Contract 372e2e6c213396ddf1780f23ece3619e5129f14616183fd11b997c196bd8c7cf

← Back to Index 📥 Download WASM

Meta

cliver 26.0.0#60f7458e7ecffddf2f2d91dc6d0d2db4fab03ecc
home_domain rgstry.xyz
rssdk_spec_shaking 2
rssdkver 26.1.0#175aa41306f383057a8cdfc84b68d931664fc34e
rsver 1.97.0
source_repo github:stellar-registry/oz-combined-wasms

Interface

Mints a specific amount of vault shares to the receiver by depositing the required amount of underlying assets, returning the amount of assets deposited.

Arguments

  • e - Access to the Soroban environment.
  • shares - The amount of vault shares to mint.
  • receiver - The address that will receive the minted vault shares.
  • from - The address that will provide the underlying assets.
  • operator - The address performing the mint operation.

Errors

  • [crate::vault::VaultTokenError::VaultExceededMaxMint] - When attempting to mint more shares than the maximum allowed for the receiver.
  • [crate::vault::VaultTokenError::VaultInvalidSharesAmount] - When shares < 0.
  • [crate::vault::VaultTokenError::MathOverflow] - When mathematical operations result in overflow.

Events

  • topics - ["deposit", operator: Address, from: Address, receiver: Address]
  • data - [assets: i128, shares: i128]

Security Warning

⚠️ SECURITY RISK: This function has NO AUTHORIZATION CONTROLS ⚠️

Authorization

fn mint(
    env: soroban_sdk::Env,
    shares: i128,
    receiver: soroban_sdk::Address,
    from: soroban_sdk::Address,
    operator: soroban_sdk::Address,
) -> i128

Returns the name for this token.

Arguments

  • e - Access to Soroban environment.
fn name(env: soroban_sdk::Env) -> soroban_sdk::String

Redeems a specific amount of vault shares for underlying assets, returning the amount of underlying assets received.

Arguments

  • e - Access to the Soroban environment.
  • shares - The amount of vault shares to redeem.
  • receiver - The address that will receive the underlying assets.
  • owner - The address that owns the vault shares to be burned.
  • operator - The address performing the redemption operation.

Errors

  • [crate::vault::VaultTokenError::VaultExceededMaxRedeem] - When attempting to redeem more shares than the maximum allowed for the owner.
  • [crate::vault::VaultTokenError::VaultInvalidSharesAmount] - When shares < 0.
  • [crate::vault::VaultTokenError::MathOverflow] - When mathematical operations result in overflow.

Events

  • topics - ["withdraw", operator: Address, receiver: Address, owner: Address]
  • data - [assets: i128, shares: i128]

Security Warning

⚠️ SECURITY RISK: This function has NO AUTHORIZATION CONTROLS ⚠️

Authorization for the operator must be ha

fn redeem(
    env: soroban_sdk::Env,
    shares: i128,
    receiver: soroban_sdk::Address,
    owner: soroban_sdk::Address,
    operator: soroban_sdk::Address,
) -> i128

Returns the symbol for this token.

Arguments

  • e - Access to Soroban environment.
fn symbol(env: soroban_sdk::Env) -> soroban_sdk::String

Sets the amount of tokens a spender is allowed to spend on behalf of an owner. Overrides any existing allowance set between spender and owner.

Arguments

  • e - Access to Soroban environment.
  • owner - The address holding the tokens.
  • spender - The address authorized to spend the tokens.
  • amount - The amount of tokens made available to spender.
  • live_until_ledger - The ledger number at which the allowance expires.

Errors

  • [FungibleTokenError::InvalidLiveUntilLedger] - Occurs when attempting to set live_until_ledger that is less than the current ledger number and greater than 0.
  • [FungibleTokenError::LessThanZero] - Occurs when amount < 0.

Events

  • topics - ["approve", from: Address, spender: Address]
  • data - [amount: i128, live_until_ledger: u32]
fn approve(
    env: soroban_sdk::Env,
    owner: soroban_sdk::Address,
    spender: soroban_sdk::Address,
    amount: i128,
    live_until_ledger: u32,
)

Returns the amount of tokens held by account.

Arguments

  • e - Access to the Soroban environment.
  • account - The address for which the balance is being queried.
fn balance(env: soroban_sdk::Env, account: soroban_sdk::Address) -> i128

Deposits underlying assets into the vault and mints vault shares to the receiver, returning the amount of vault shares minted.

Arguments

  • e - Access to the Soroban environment.
  • assets - The amount of underlying assets to deposit.
  • receiver - The address that will receive the minted vault shares.
  • from - The address that will provide the underlying assets.
  • operator - The address performing the deposit operation.

Errors

  • [crate::vault::VaultTokenError::VaultExceededMaxDeposit] - When attempting to deposit more assets than the maximum allowed for the receiver.
  • [crate::vault::VaultTokenError::VaultInvalidAssetsAmount] - When assets < 0.
  • [crate::vault::VaultTokenError::MathOverflow] - When mathematical operations result in overflow.

Events

  • topics - ["deposit", operator: Address, from: Address, receiver: Address]
  • data - [assets: i128, shares: i128]

Security Warning

⚠️ SECURITY RISK: This function has NO AUTHORIZATION CONTROLS ⚠️

Authorization for the op

fn deposit(
    env: soroban_sdk::Env,
    assets: i128,
    receiver: soroban_sdk::Address,
    from: soroban_sdk::Address,
    operator: soroban_sdk::Address,
) -> i128
fn upgrade(
    env: soroban_sdk::Env,
    new_wasm_hash: soroban_sdk::BytesN<32>,
    operator: soroban_sdk::Address,
)
fn decimals(env: soroban_sdk::Env) -> u32

Returns the maximum amount of vault shares that can be minted for the given receiver address (currently i128::MAX).

Arguments

  • e - Access to the Soroban environment.
  • receiver - The address that would receive the vault shares.
fn max_mint(env: soroban_sdk::Env, receiver: soroban_sdk::Address) -> i128

Transfers amount of tokens from from to to.

Arguments

  • e - Access to Soroban environment.
  • from - The address holding the tokens.
  • to - The address receiving the transferred tokens.
  • amount - The amount of tokens to be transferred.

Errors

  • [FungibleTokenError::InsufficientBalance] - When attempting to transfer more tokens than from current balance.
  • [FungibleTokenError::LessThanZero] - When amount < 0.

Events

  • topics - ["transfer", from: Address, to: Address]
  • data - [to_muxed_id: Option<u64>, amount: i128]
fn transfer(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    to: soroban_sdk::MuxedAddress,
    amount: i128,
)

Withdraws a specific amount of underlying assets from the vault by burning the required amount of vault shares from the owner, returning the amount of vault shares burned.

Arguments

  • e - Access to the Soroban environment.
  • assets - The amount of underlying assets to withdraw.
  • receiver - The address that will receive the underlying assets.
  • owner - The address that owns the vault shares to be burned.
  • operator - The address performing the withdrawal operation.

Errors

  • [crate::vault::VaultTokenError::VaultExceededMaxWithdraw] - When attempting to withdraw more assets than the maximum allowed for the owner.

Events

  • topics - ["withdraw", operator: Address, receiver: Address, owner: Address]
  • data - [assets: i128, shares: i128]

Security Warning

⚠️ SECURITY RISK: This function has NO AUTHORIZATION CONTROLS ⚠️

Authorization for the operator must be handled at a higher level.

fn withdraw(
    env: soroban_sdk::Env,
    assets: i128,
    receiver: soroban_sdk::Address,
    owner: soroban_sdk::Address,
    operator: soroban_sdk::Address,
) -> i128

Returns the amount of tokens a spender is allowed to spend on behalf of an owner.

Arguments

  • e - Access to Soroban environment.
  • owner - The address holding the tokens.
  • spender - The address authorized to spend the tokens.
fn allowance(
    env: soroban_sdk::Env,
    owner: soroban_sdk::Address,
    spender: soroban_sdk::Address,
) -> i128

Returns Some(Address) if ownership is set, or None if ownership has been renounced.

Arguments

  • e - Access to the Soroban environment.
fn get_owner(env: soroban_sdk::Env) -> Option

Returns the maximum amount of vault shares that can be redeemed by the given owner (equal to their vault share balance).

Arguments

  • e - Access to the Soroban environment.
  • owner - The address that owns the vault shares.
fn max_redeem(env: soroban_sdk::Env, owner: soroban_sdk::Address) -> i128

Returns the maximum amount of underlying assets that can be deposited for the given receiver address (currently i128::MAX).

Arguments

  • e - Access to the Soroban environment.
  • receiver - The address that would receive the vault shares.
fn max_deposit(env: soroban_sdk::Env, receiver: soroban_sdk::Address) -> i128

Returns the address of the underlying asset that the vault manages.

Arguments

  • e - Access to the Soroban environment.

Errors

  • [crate::vault::VaultTokenError::VaultAssetAddressNotSet] - When the vault's underlying asset address has not been initialized.
fn query_asset(env: soroban_sdk::Env) -> soroban_sdk::Address

Returns the maximum amount of underlying assets that can be withdrawn by the given owner, limited by their vault share balance.

Arguments

  • e - Access to the Soroban environment.
  • owner - The address that owns the vault shares.

Errors

  • [crate::vault::VaultTokenError::VaultInvalidSharesAmount] - When shares < 0.
  • [crate::vault::VaultTokenError::MathOverflow] - When mathematical operations result in overflow.
fn max_withdraw(env: soroban_sdk::Env, owner: soroban_sdk::Address) -> i128

Simulates and returns the amount of underlying assets required to mint a given amount of vault shares (rounded up).

Arguments

  • e - Access to the Soroban environment.
  • shares - The amount of vault shares to simulate minting.

Errors

  • [crate::vault::VaultTokenError::VaultInvalidSharesAmount] - When shares < 0.
  • [crate::vault::VaultTokenError::MathOverflow] - When mathematical operations result in overflow.
fn preview_mint(env: soroban_sdk::Env, shares: i128) -> i128

Returns the total amount of underlying assets held by the vault.

This represents the vault's balance of the underlying asset, which determines the conversion rate between shares and assets.

Arguments

  • e - Access to the Soroban environment.

Errors

  • [crate::vault::VaultTokenError::VaultAssetAddressNotSet] - When the vault's underlying asset address has not been initialized.
fn total_assets(env: soroban_sdk::Env) -> i128

Returns the total amount of tokens in circulation.

Arguments

  • e - Access to the Soroban environment.
fn total_supply(env: soroban_sdk::Env) -> i128
fn __constructor(
    env: soroban_sdk::Env,
    name: soroban_sdk::String,
    symbol: soroban_sdk::String,
    asset: soroban_sdk::Address,
    decimals_offset: u32,
    owner: soroban_sdk::Address,
)

Transfers amount of tokens from from to to using the allowance mechanism. amount is then deducted from spender allowance.

Arguments

  • e - Access to Soroban environment.
  • spender - The address authorizing the transfer, and having its allowance consumed during the transfer.
  • from - The address holding the tokens which will be transferred.
  • to - The address receiving the transferred tokens.
  • amount - The amount of tokens to be transferred.

Errors

  • [FungibleTokenError::InsufficientBalance] - When attempting to transfer more tokens than from current balance.
  • [FungibleTokenError::LessThanZero] - When amount < 0.
  • [FungibleTokenError::InsufficientAllowance] - When attempting to transfer more tokens than spender current allowance.

Events

  • topics - ["transfer", from: Address, to: Address]
  • data - [amount: i128]
fn transfer_from(
    env: soroban_sdk::Env,
    spender: soroban_sdk::Address,
    from: soroban_sdk::Address,
    to: soroban_sdk::Address,
    amount: i128,
)

Simulates and returns the amount of underlying assets that would be received for redeeming a given amount of vault shares (rounded down).

Arguments

  • e - Access to the Soroban environment.
  • shares - The amount of vault shares to simulate redeeming.

Errors

  • [crate::vault::VaultTokenError::VaultInvalidSharesAmount] - When shares < 0.
  • [crate::vault::VaultTokenError::MathOverflow] - When mathematical operations result in overflow.
fn preview_redeem(env: soroban_sdk::Env, shares: i128) -> i128

Simulates and returns the amount of vault shares that would be minted for a given deposit of underlying assets (rounded down).

Arguments

  • e - Access to the Soroban environment.
  • assets - The amount of underlying assets to simulate depositing.

Errors

  • [crate::vault::VaultTokenError::VaultInvalidAssetsAmount] - When assets < 0.
  • [crate::vault::VaultTokenError::MathOverflow] - When mathematical operations result in overflow.
fn preview_deposit(env: soroban_sdk::Env, assets: i128) -> i128

Accepts a pending ownership transfer.

Arguments

  • e - Access to the Soroban environment.

Errors

  • [crate::role_transfer::RoleTransferError::NoPendingTransfer] - If there is no pending transfer to accept.

Events

  • topics - ["ownership_transfer_completed"]
  • data - [new_owner: Address]
fn accept_ownership(env: soroban_sdk::Env)

Simulates and returns the amount of vault shares that would be burned to withdraw a given amount of underlying assets (rounded up).

Arguments

  • e - Access to the Soroban environment.
  • assets - The amount of underlying assets to simulate withdrawing.

Errors

  • [crate::vault::VaultTokenError::VaultInvalidAssetsAmount] - When assets < 0.
  • [crate::vault::VaultTokenError::MathOverflow] - When mathematical operations result in overflow.
fn preview_withdraw(env: soroban_sdk::Env, assets: i128) -> i128

Converts an amount of vault shares to the equivalent amount of underlying assets (rounded down).

Arguments

  • e - Access to the Soroban environment.
  • shares - The amount of vault shares to convert.

Errors

  • [crate::vault::VaultTokenError::VaultInvalidSharesAmount] - When shares < 0.
  • [crate::vault::VaultTokenError::MathOverflow] - When mathematical operations result in overflow.
fn convert_to_assets(env: soroban_sdk::Env, shares: i128) -> i128

Converts an amount of underlying assets to the equivalent amount of vault shares (rounded down).

Arguments

  • e - Access to the Soroban environment.
  • assets - The amount of underlying assets to convert.

Errors

  • [crate::vault::VaultTokenError::VaultInvalidAssetsAmount] - When assets < 0.
  • [crate::vault::VaultTokenError::MathOverflow] - When mathematical operations result in overflow.
fn convert_to_shares(env: soroban_sdk::Env, assets: i128) -> i128

Renounces ownership of the contract.

Permanently removes the owner, disabling all functions gated by #[only_owner].

Arguments

  • e - Access to the Soroban environment.

Errors

  • [OwnableError::TransferInProgress] - If there is a pending ownership transfer.
  • [OwnableError::OwnerNotSet] - If the owner is not set.

Notes

  • Authorization for the current owner is required.
fn renounce_ownership(env: soroban_sdk::Env)

Initiates a 2-step ownership transfer to a new address.

Requires authorization from the current owner. The new owner must later call accept_ownership() to complete the transfer.

Arguments

  • e - Access to the Soroban environment.
  • new_owner - The proposed new owner.
  • live_until_ledger - Ledger number until which the new owner can accept. A value of 0 cancels any pending transfer.

Errors

  • [OwnableError::OwnerNotSet] - If the owner is not set.
  • [crate::role_transfer::RoleTransferError::NoPendingTransfer] - If trying to cancel a transfer that doesn't exist.
  • [crate::role_transfer::RoleTransferError::InvalidLiveUntilLedger] - If the specified ledger is in the past.
  • [crate::role_transfer::RoleTransferError::InvalidPendingAccount] - If the specified pending account is not the same as the provided new address.

Notes

  • Authorization for the current owner is required.
fn transfer_ownership(
    env: soroban_sdk::Env,
    new_owner: soroban_sdk::Address,
    live_until_ledger: u32,
)

Imports

WebAssembly Text (WAT) ▶