Deployer Contract
The Deployer contract provides a factory pattern for deploying new contract instances on the Stellar network. It is used to deploy new vault contracts and other infrastructure components with controlled access.Purpose
The Deployer provides admin-gated contract deployment, ensuring that only authorized parties can deploy new contract instances. This prevents unauthorized vault creation and ensures all deployed contracts follow the correct initialization pattern.Function Reference
Constructor
Constructor
| Function | Parameters | Description |
|---|---|---|
__constructor | admin: Address | Initializes the deployer with an admin address stored in persistent storage. |
Deploy
Deploy
| Function | Parameters | Returns | Auth |
|---|---|---|---|
deploy | wasm_hash: BytesN<32>, salt: BytesN<32>, constructor_args: Vec<Val> | Address (deployed contract) | Admin |
- Requires admin authentication (
require_auth) - Validates constructor arguments length (max 20 args)
- Calls
env.deployer().with_address(current_contract, salt).deploy_v2(wasm_hash, constructor_args) - Returns the address of the newly deployed contract
Deployment Flow
Install WASM
The contract bytecode (WASM) is first installed on the Stellar network, producing a
wasm_hash.Call Deploy
The admin calls
deploy() with the WASM hash, a unique salt for address derivation, and the constructor arguments for the new contract.The
salt parameter makes each deployment address unique. Using the same WASM hash with a different salt produces a different contract address.
