Contract 9c650c9f45931e980a7a3c729d59fc8d2a000f04bb96dc2e9783a74e91bcbdd4

← Back to Index 📥 Download WASM

Meta

cliver 26.0.0#60f7458e7ecffddf2f2d91dc6d0d2db4fab03ecc
rssdkver 22.0.11#34f7f53ae31e0fd02aab436a9872e79fa671ca02
rsver 1.94.1

Instances

  • CACKI4OIMKKKE4KWO73ZZA772POWEADE6H75S3GPPEALU2SK3SQRGZK4

Interface

Return the admin address.

fn get_admin(env: soroban_sdk::Env) -> soroban_sdk::Address

Return a page of registered vault addresses.

Arguments

  • 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.

Errors

  • [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:

  1. Deploy and initialize the vault externally (via __constructor).
  2. Approve seed_amount of base_asset from their account to this factory.
  3. Call this function.

The factory will:

  1. Verify the vault is not already registered.
  2. Pull seed_amount of base_asset from caller into the vault directly.
  3. Call vault.seed_deposit(seed_amount) to mint seed shares to the burn address.
  4. Register the vault and record its manager.

After this call, total_supply > 0 which eliminates the first-depositor inflation attack.

Errors

  • [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.

Errors

  • [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.

Arguments

  • 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.

Arguments

  • 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.

Arguments

  • caller – Must equal the admin.
  • vault – Address of the initialized vault contract.
  • manager – Manager address (informational; stored in the event only).

Errors

  • [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.

Errors

  • [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.

Errors

  • [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.

Errors

  • [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.

Errors

  • [FactoryError::NotAdmin]
  • [FactoryError::AssetAlreadyAuthorized]
  • [FactoryError::AssetHandlerNotSet] if no AssetHandler is configured
  • Panics if asset is not registered in AssetHandler
fn 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.

Errors

  • [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.

Errors

  • [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.

Errors

  • [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.

Errors

  • [FactoryError::NotAdmin]
  • [FactoryError::VaultAlreadyRegistered]
  • Panics (propagated) if 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,
)

Imports

WebAssembly Text (WAT) ▶