Contract 3e7a2f545e6447ddf0f6b3b338e0dce313a3f07cfb74e053d8ddebf751165176

← Back to Index 📥 Download WASM

Meta

rssdkver 22.0.6#0c47dcfa187069d241f11fb082730f667b55e802
rsver 1.83.0

Instances

  • CAVP2QLPIG7FQNHI57KXF7KS6NIAAUQKHZZDM3AGVADE64WHFBC5YURX
  • CAXVEXXRY74LIE6UNDOTOXO5INGQTYNYZPGCVNYESBGKNK2WKYXQTZKA
  • CCTFV3QLISICFWCHIX45VBJSG2XCVIKSEWEOWZEEBYH5FH5EDS2SMJDT
  • CD5KZOBS77QUGDTCPJARUT5BBCFELOV6XBIXD3DNB4AXJSHYJBSRVXFO
  • CDP7JYD65XOU2QQBGNMPOZV366WQTMB37UYPBCDKSMPBE7IKHXAAS5NA

Interface

fn __constructor(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    defindex_receiver: soroban_sdk::Address,
    defindex_fee: u32,
    vault_wasm_hash: soroban_sdk::BytesN<32>,
)

Creates a new DeFindex Vault with the specified parameters.

Arguments

  • e - The environment in which the contract is running.
  • roles - A Map containing role identifiers (u32) and their corresponding Address assignments. Example roles include the manager and fee receiver.
  • vault_fee - The fee rate in basis points (1 basis point = 0.01%) allocated to the fee receiver.
  • assets - A vector of AssetStrategySet structs defining the strategies and assets managed by the vault.
  • salt - A unique BytesN<32> value used to ensure that each deployed vault has a unique address.
  • soroswap_router - The Address of the Soroswap router, which facilitates swaps within the vault.
  • name_symbol - A Map containing the vault's name and symbol metadata (e.g., "name" -> "MyVault", "symbol" -> "MVLT").
  • upgradable - A boolean flag indicating whether the deployed vault contract should support upgrades.

Returns

  • Result<Address, FactoryError> - Returns the address of the newly created vault if su
fn create_defindex_vault(
    env: soroban_sdk::Env,
    roles: soroban_sdk::Map,
    vault_fee: u32,
    assets: soroban_sdk::Vec,
    salt: soroban_sdk::BytesN<32>,
    soroswap_router: soroban_sdk::Address,
    name_symbol: soroban_sdk::Map,
    upgradable: bool,
) -> Result

Creates a new DeFindex Vault with specified parameters and performs an initial deposit to set asset ratios.

Arguments

  • e - The environment in which the contract is running.
  • caller - The address of the caller, who must authenticate and provide the initial deposit.
  • roles - A Map containing role identifiers (u32) and their corresponding Address assignments. Example roles include the manager and fee receiver.
  • vault_fee - The fee rate in basis points (1 basis point = 0.01%) allocated to the fee receiver.
  • assets - A vector of AssetStrategySet structs defining the strategies and assets managed by the vault.
  • salt - A unique BytesN<32> value used to ensure that each deployed vault has a unique address.
  • soroswap_router - The Address of the Soroswap router, which facilitates swaps within the vault.
  • name_symbol - A Map containing the vault's name and symbol metadata (e.g., "name" -> "MyVault", "symbol" -> "MVLT").
  • upgradable - A boolean flag indicating whether the deplo
fn create_defindex_vault_deposit(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    roles: soroban_sdk::Map,
    vault_fee: u32,
    assets: soroban_sdk::Vec,
    salt: soroban_sdk::BytesN<32>,
    soroswap_router: soroban_sdk::Address,
    name_symbol: soroban_sdk::Map,
    upgradable: bool,
    amounts: soroban_sdk::Vec,
) -> Result

Sets a new admin address.

Arguments

  • e - The environment in which the contract is running.
  • new_admin - The new administrator's address.

Returns

  • Result<(), FactoryError> - Returns Ok(()) if successful, or an error if not authorized.
fn set_new_admin(
    env: soroban_sdk::Env,
    new_admin: soroban_sdk::Address,
) -> Result<(), FactoryError>

Updates the default receiver address for the DeFindex portion of fees.

Arguments

  • e - The environment in which the contract is running.
  • new_fee_receiver - The address of the new fee receiver.

Returns

  • Result<(), FactoryError> - Returns Ok(()) if successful, or an error if not authorized.
fn set_defindex_receiver(
    env: soroban_sdk::Env,
    new_fee_receiver: soroban_sdk::Address,
) -> Result<(), FactoryError>

Updates the default fee rate for new vaults.

Arguments

  • e - The environment in which the contract is running.
  • new_fee_rate - The new annual fee rate in basis points.

Returns

  • Result<(), FactoryError> - Returns Ok(()) if successful, or an error if not authorized.
fn set_defindex_fee(
    env: soroban_sdk::Env,
    defindex_fee: u32,
) -> Result<(), FactoryError>
fn set_vault_wasm_hash(
    env: soroban_sdk::Env,
    new_vault_wasm_hash: soroban_sdk::BytesN<32>,
) -> Result<(), FactoryError>

Retrieves the current admin's address.

Arguments

  • e - The environment in which the contract is running.

Returns

  • Result<Address, FactoryError> - Returns the admin's address or an error if not found.
fn admin(env: soroban_sdk::Env) -> Result

Retrieves the current DeFindex receiver's address.

Arguments

  • e - The environment in which the contract is running.

Returns

  • Result<Address, FactoryError> - Returns the DeFindex receiver's address or an error if not found.
fn defindex_receiver(
    env: soroban_sdk::Env,
) -> Result

Retrieves the total number of deployed DeFindex vaults.

Arguments

  • e - The environment in which the contract is running.

Returns

  • Result<u32, FactoryError> - Returns the total number of deployed vaults or an error if retrieval fails.
fn total_vaults(env: soroban_sdk::Env) -> Result

Retrieves a specific vault address by its index.

Arguments

  • e - The environment in which the contract is running.
  • index - The index of the vault to retrieve (0-based).

Returns

  • Result<Address, FactoryError> - Returns the vault address at the specified index or an error if not found.
fn get_vault_by_index(
    env: soroban_sdk::Env,
    index: u32,
) -> Result

Retrieves the current fee rate.

Arguments

  • e - The environment in which the contract is running.

Returns

  • Result<u32, FactoryError> - Returns the fee rate in basis points or an error if not found.
fn defindex_fee(env: soroban_sdk::Env) -> Result

Retrieves the WASM hash of the vault contract.

Arguments

  • e - The environment in which the contract is running.

Returns

  • Result<BytesN<32>, FactoryError> - Returns the 32-byte WASM hash of the vault contract or an error if the contract is not properly initialized.

Behavior

  1. Ensures the contract is initialized by calling check_initialized(&e).
  2. Extends the instance's time-to-live (TTL) by invoking extend_instance_ttl(&e).
  3. Retrieves and returns the vault WASM hash by calling get_vault_wasm_hash(&e).
fn vault_wasm_hash(
    env: soroban_sdk::Env,
) -> Result, FactoryError>

Imports

WebAssembly Text (WAT) ▶