Return the admin address.
fn get_admin(env: soroban_sdk::Env) -> soroban_sdk::Address
Return a page of registered vault addresses.
offset – Starting index (0-based).limit – Maximum number of entries to return (capped at 50).fn get_vaults(
env: soroban_sdk::Env,
offset: u32,
limit: u32,
) -> soroban_sdk::Vec
Complete a two-step admin transfer. Pending admin only.
The address previously set via [set_pending_admin] must authorize
this call. On success, that address becomes the new admin.
FactoryError::NoPendingAdmin] if no transfer is in progress.fn accept_admin(env: soroban_sdk::Env, caller: soroban_sdk::Address)
Register an already-deployed vault and perform the anti-inflation seed deposit.
The admin must:
__constructor).seed_amount of base_asset from their account to this factory.The factory will:
seed_amount of base_asset from caller into the vault directly.vault.seed_deposit(seed_amount) to mint seed shares to the burn address.After this call, total_supply > 0 which eliminates the first-depositor
inflation attack.
FactoryError::NotAdmin]FactoryError::VaultAlreadyRegistered]FactoryError::InvalidSeedAmount]fn create_vault(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
vault: soroban_sdk::Address,
manager: soroban_sdk::Address,
base_asset: soroban_sdk::Address,
seed_amount: i128,
)
Remove a vault from the registry. Admin only.
The vault contract itself is not destroyed; it is only de-listed.
FactoryError::NotAdmin]FactoryError::VaultNotFound]fn remove_vault(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
vault: soroban_sdk::Address,
)
Bump the persistent TTL for vault registry entries in index range [start, end).
This function is permissionless: any account may call it to pay for TTL renewal, preventing registry entries from expiring silently.
start – First index to touch (inclusive).end – One-past-last index to touch (exclusive).If start >= end or start >= vault_count the call is a no-op.
end is clamped to vault_count so callers can safely pass u32::MAX.
fn touch_vaults(env: soroban_sdk::Env, start: u32, end: u32)
Return true if vault is registered.
fn is_registered(env: soroban_sdk::Env, vault: soroban_sdk::Address) -> bool
Initialize the factory. Runs atomically at deployment via CreateContract.
admin – Registry admin address.asset_handler – The AssetHandler contract that holds per-asset oracles.
Pass None to initialize without a handler (can be set later).fn __constructor(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
asset_handler: Option,
)
Register a newly deployed vault. Admin only.
The vault must already be initialized before registration.
This function verifies vault.get_manager() and ensures the provided
manager matches on-chain state.
caller – Must equal the admin.vault – Address of the initialized vault contract.manager – Manager address (informational; stored in the event only).FactoryError::NotAdmin]FactoryError::VaultAlreadyRegistered]FactoryError::ManagerMismatch]fn register_vault(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
vault: soroban_sdk::Address,
manager: soroban_sdk::Address,
)
Return the total number of registered vaults.
fn get_vault_count(env: soroban_sdk::Env) -> u32
Return the AssetHandler contract address.
fn get_asset_handler(env: soroban_sdk::Env) -> Option
Return the admin-assigned manager for a registered vault.
FactoryError::VaultManagerNotFound] if the vault is not tracked.fn get_vault_manager(
env: soroban_sdk::Env,
vault: soroban_sdk::Address,
) -> soroban_sdk::Address
Set or update the AssetHandler reference. Admin only.
fn set_asset_handler(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
asset_handler: soroban_sdk::Address,
)
Begin a two-step admin transfer. Current admin only.
Records new_admin as the pending admin; the transfer is not complete
until new_admin calls [accept_admin]. This prevents accidental
lock-out if a wrong address is supplied.
FactoryError::NotAdmin]fn set_pending_admin(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
new_admin: soroban_sdk::Address,
)
Assign or reassign the manager for a registered vault.
The admin is the only party that can change vault managers. This
function updates the factory's VaultManager record and also calls
vault.set_manager(new_manager) so the vault's own state stays in sync.
FactoryError::NotAdmin]FactoryError::VaultNotFound]fn set_vault_manager(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
vault: soroban_sdk::Address,
new_manager: soroban_sdk::Address,
)
Return true if asset is in the protocol-authorized asset list.
fn is_authorized_asset(env: soroban_sdk::Env, asset: soroban_sdk::Address) -> bool
Return true if guard is in the protocol-authorized guard list.
fn is_authorized_guard(env: soroban_sdk::Env, guard: soroban_sdk::Address) -> bool
Add an asset to the protocol-wide authorized asset list.
The asset must already be registered in the AssetHandler (with its price oracle) before it can be authorized here. The AssetHandler is the single source of truth for per-asset oracles.
FactoryError::NotAdmin]FactoryError::AssetAlreadyAuthorized]FactoryError::AssetHandlerNotSet] if no AssetHandler is configuredfn add_authorized_asset(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
asset: soroban_sdk::Address,
)
Add a strategy guard contract to the protocol-wide authorized guard list.
FactoryError::NotAdmin]FactoryError::GuardAlreadyAuthorized]fn add_authorized_guard(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
guard: soroban_sdk::Address,
)
Return the full list of protocol-authorized assets.
fn get_authorized_assets(
env: soroban_sdk::Env,
) -> soroban_sdk::Vec
Return the full list of protocol-authorized guard contracts.
fn get_authorized_guards(
env: soroban_sdk::Env,
) -> soroban_sdk::Vec
Remove an asset from the protocol-wide authorized asset list.
FactoryError::NotAdmin]FactoryError::AssetNotAuthorized]fn remove_authorized_asset(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
asset: soroban_sdk::Address,
)
Remove a strategy guard contract from the authorized guard list.
FactoryError::NotAdmin]FactoryError::GuardNotAuthorized]fn remove_authorized_guard(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
guard: soroban_sdk::Address,
)
Verify a vault is initialized and register it. Admin only.
Unlike [register_vault], this function calls vault.get_manager() to
confirm the vault contract exists and is properly initialized before
adding it to the registry. The manager address from the vault itself is
used in the registration event, removing the need for the caller to supply
it separately and preventing spoofed manager information.
FactoryError::NotAdmin]FactoryError::VaultAlreadyRegistered]vault.get_manager() fails — i.e. the vault is
not initialized or the address is not a vault contract.fn verify_and_register_vault(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
vault: soroban_sdk::Address,
)