Skip to main content

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.
This is experimental pilot software. See Disclaimers for details.

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

FunctionParametersDescription
__constructoradmin: AddressInitializes the deployer with an admin address stored in persistent storage.
FunctionParametersReturnsAuth
deploywasm_hash: BytesN<32>, salt: BytesN<32>, constructor_args: Vec<Val>Address (deployed contract)Admin
How it works:
  1. Requires admin authentication (require_auth)
  2. Validates constructor arguments length (max 20 args)
  3. Calls env.deployer().with_address(current_contract, salt).deploy_v2(wasm_hash, constructor_args)
  4. Returns the address of the newly deployed contract

Deployment Flow

1

Install WASM

The contract bytecode (WASM) is first installed on the Stellar network, producing a wasm_hash.
2

Call Deploy

The admin calls deploy() with the WASM hash, a unique salt for address derivation, and the constructor arguments for the new contract.
3

Contract Created

The Deployer creates a new contract instance. The deployed address is deterministic based on the deployer address and salt.
The salt parameter makes each deployment address unique. Using the same WASM hash with a different salt produces a different contract address.