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.
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.Result<Address, FactoryError> - Returns the address of the newly created vault if sufn 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.
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 deplofn 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.
e - The environment in which the contract is running.new_admin - The new administrator's address.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.
e - The environment in which the contract is running.new_fee_receiver - The address of the new fee receiver.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.
e - The environment in which the contract is running.new_fee_rate - The new annual fee rate in basis points.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.
e - The environment in which the contract is running.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.
e - The environment in which the contract is running.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.
e - The environment in which the contract is running.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.
e - The environment in which the contract is running.index - The index of the vault to retrieve (0-based).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.
e - The environment in which the contract is running.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.
e - The environment in which the contract is running.Result<BytesN<32>, FactoryError> - Returns the 32-byte WASM hash of the vault contract
or an error if the contract is not properly initialized.check_initialized(&e).extend_instance_ttl(&e).get_vault_wasm_hash(&e).fn vault_wasm_hash(
env: soroban_sdk::Env,
) -> Result, FactoryError>