Contract 86fc7eb21eb92ebaa5857b6a0396bd790b222c82a35b7297cc17df61a6b082a8

← Back to Index 📥 Download WASM

Meta

rssdkver 22.0.8#f46e9e0610213bbb72285566f9dd960ff96d03d8
rsver 1.88.0

Instances

  • CBMJ4WMU72KEYVIIRLFV2XRVXO67PXV2LFFBBD3QHPZ27JZTWYXTRJUP

Interface

Initialize the contract

Arguments

  • admin - The admin address
  • pool - The blend pool address the vault will deposit into
  • asset - The asset address of the reserve the vault will support
  • rate_type - The rate type the vault will use
  • 0 = take rate (admin earns a percentage of the vault's earnings)
  • 1 = capped rate (vault earns at most the APR cap, with any additional returns going to the admin)
  • 2 = fixed rate (vault always earns the fixed rate, with the admin either supplementing or earning the difference)
  • rate - The rate value, with 7 decimals (e.g. 1000000 for 10%)
  • signer- The signer address if the vault is permissioned, None otherwise

Panics

  • InvalidFeeRate - If the value is not within 0 and 1_000_0000
  • InvalidFeeRateType - If the rate type is not 0, 1, or 2
fn __constructor(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    pool: soroban_sdk::Address,
    asset: soroban_sdk::Address,
    rate_type: u32,
    rate: u32,
    signer: Option,
)

Fetch a user's position in shares

Arguments

  • user - The address of the user

Returns

  • i128 - The user's position in shares, or the user has no shares
fn get_shares(env: soroban_sdk::Env, user: soroban_sdk::Address) -> i128

Fetch a user's position in bTokens

Arguments

  • user - The address of the user

Returns

  • i128 - The user's position in bTokens, or 0 if they have no bTokens
fn get_b_tokens(env: soroban_sdk::Env, user: soroban_sdk::Address) -> i128

Fetch a user's position in underlying tokens

Arguments

  • user - The address of the user

Returns

  • i128 - The user's position in underlying tokens, or 0 if they have no shares
fn get_underlying_tokens(env: soroban_sdk::Env, user: soroban_sdk::Address) -> i128

Fetch a user's rewards for a specific token. Does not update the user's rewards.

If the current claimable rewards is needed, it is recommended to simulate a claim call to get the current claimable rewards.

Arguments

  • user - The address of the user
  • token - The address of the reward token

Returns

  • Option<UserRewards> - The user's rewards for the token, or None
fn get_rewards(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
    token: soroban_sdk::Address,
) -> Option

Fetch the admin balance in underlying tokens

Returns

  • i128 - The admin's accrued fees in underlying tokens, or 0 if the reserve does not exist
fn get_underlying_admin_balance(env: soroban_sdk::Env) -> i128

Get the vault's blend pool it deposits into and the asset it supports.

Returns

  • (Address, Address) - (The blend pool address, the asset address)
fn get_config(env: soroban_sdk::Env) -> (soroban_sdk::Address, soroban_sdk::Address)

Get the vault data

Returns

  • VaultData - The vault data
fn get_vault(env: soroban_sdk::Env) -> VaultData

Get the vault's fee configuration

Returns

  • Fee - The fee configuration for the vault
fn get_fee(env: soroban_sdk::Env) -> Fee

Get the vault's admin

Returns

  • Address - The admin address for the vault
fn get_admin(env: soroban_sdk::Env) -> soroban_sdk::Address

Get the vault's signer

Returns

  • Option<Address> - The signer address for the vault, or None if no signer is set
fn get_signer(env: soroban_sdk::Env) -> Option

Get the current reward token for the fee vault

Returns

  • Option<Address> - The address of the reward token, or None if no reward token is set
fn get_reward_token(env: soroban_sdk::Env) -> Option

Get the reward data for a specific token

Arguments

  • token - The address of the reward token

Returns

  • Option<RewardData> - The reward data for the token, or None if no data exists
fn get_reward_data(
    env: soroban_sdk::Env,
    token: soroban_sdk::Address,
) -> Option

NOT INTENDED FOR CONTRACT USE

Get the vault summary, which includes the pool, asset, admin, signer, fee, vault data, rewards, and estimated APR for vault suppliers. Intended for use by dApps looking to fetch display data.

Returns

  • VaultSummary - The summary of the vault
fn get_vault_summary(env: soroban_sdk::Env) -> VaultSummary

ADMIN ONLY Sets the Fee mode for the fee vault

Arguments

  • e - The environment object
  • rate_type - The rate type the vault will use
  • 0 = take rate (admin earns a percentage of the vault's earnings)
  • 1 = capped rate (vault earns at most the APR cap, with any additional returns going to the admin)
  • 2 = fixed rate (vault always earns the fixed rate, with the admin either supplementing or earning the difference)
  • rate - The rate value, with 7 decimals (e.g. 1000000 for 10%)

Panics

  • InvalidFeeRate - If the value is not within 0 and 1_000_0000
  • InvalidFeeRateType - If the rate type is not 0, 1, or 2
fn set_fee(env: soroban_sdk::Env, rate_type: u32, rate: u32)

ADMIN ONLY Sets the admin address for the fee vault. Requires a signature from both the current admin and the new admin address.

Arguments

  • e - The environment object
  • admin - The new admin address to set
fn set_admin(env: soroban_sdk::Env, admin: soroban_sdk::Address)

ADMIN ONLY Sets the signer for the fee vault. This address is required to sign all user deposits into the fee vault. Requires a signature from both the current admin and the new signer address.

Passing None as the signer will remove the signer requirement for deposits.

Arguments

  • signer - The new signer address to set
fn set_signer(env: soroban_sdk::Env, signer: Option)

ADMIN ONLY Claims emissions for the given reserves from the pool. This is a passthrough function that invokes the pool's "claim" function as the contract. More details can be found here: https://github.com/blend-capital/blend-contracts/blob/v1.0.0/pool/src/contract.rs#L192

Arguments

  • reserve_token_ids - The ids of the reserves to claiming emissions for
  • to - The address to send the emissions to

Returns

  • i128 - The amount of blnd tokens claimed
fn claim_emissions(
    env: soroban_sdk::Env,
    reserve_token_ids: soroban_sdk::Vec,
    to: soroban_sdk::Address,
) -> i128

ADMIN ONLY Deposit tokens into the vault's admin balance

Arguments

  • amount - The amount of tokens to deposit

Returns

  • i128 - The number of b_tokens minted

Panics

  • InvalidAmount - If the amount is less than or equal to 0
  • InvalidBTokensMinted - If the amount of bTokens minted is less than or equal to 0
  • BalanceError - If the user does not have enough tokens
fn admin_deposit(env: soroban_sdk::Env, amount: i128) -> i128

ADMIN ONLY Withdraw tokens from the vault's admin balance

Arguments

  • amount - The amount of underlying tokens to withdraw

Returns

  • i128 - The number of b_tokens burnt

Panics

  • InvalidAmount - If the amount is less than or equal to 0
  • BalanceError - If the user does not have enough shares to withdraw the amount
  • InvalidBTokensBurnt - If the amount of bTokens burnt is less than or equal to 0
fn admin_withdraw(env: soroban_sdk::Env, amount: i128) -> i128

ADMIN ONLY Sets rewards to be distributed to the fee vault depositors. The full reward_amount will be transferred to the vault to be distributed to the users until the expiration timestamp.

Arguments

  • token - The address of the reward token
  • reward_amount - The amount of rewards to distribute
  • expiration - The timestamp when the rewards expire

Panics

  • InvalidRewardConfig - If the reward token cannot be changed, or if a valid reward period cannot be started
  • BalanceError - If the admin does not have enough tokens to set the rewards
fn set_rewards(
    env: soroban_sdk::Env,
    token: soroban_sdk::Address,
    reward_amount: i128,
    expiration: u64,
)

Deposits tokens into the fee vault for a specific reserve. Requires the signer to sign the transaction if the signer is set.

Arguments

  • user - The address of the user making the deposit
  • amount - The amount of tokens to deposit

Returns

  • i128 - The number of shares minted for the user

Panics

  • InvalidAmount - If the amount is less than or equal to 0
  • InvalidBTokensMinted - If the amount of bTokens minted is less than or equal to 0
  • InvalidSharesMinted - If the amount of shares minted is less than or equal to 0
  • BalanceError - If the user does not have enough tokens
fn deposit(env: soroban_sdk::Env, user: soroban_sdk::Address, amount: i128) -> i128

Withdraws tokens from the fee vault for a specific reserve. If the input amount is greater than the user's underlying balance, the user's full balance will be withdrawn.

Arguments

  • user - The address of the user making the withdrawal
  • amount - The amount of tokens to withdraw

Returns

  • i128 - The number of shares burnt

Panics

  • InvalidAmount - If the amount is less than or equal to 0
  • InvalidBTokensBurnt - If the amount of bTokens burnt is less than or equal to 0
  • InsufficientReserves - If the pool doesn't have enough reserves to complete the withdrawal
fn withdraw(env: soroban_sdk::Env, user: soroban_sdk::Address, amount: i128) -> i128

Claims rewards for the user from the fee vault.

Arguments

  • user - The address of the user claiming rewards
  • reward_token - The address of the reward token to claim
  • to - The address to send the claimed rewards to

Returns

  • i128 - The amount of rewards claimed

Panics

  • NoRewardsConfigured - If no rewards are configured for the token
fn claim_rewards(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
    reward_token: soroban_sdk::Address,
    to: soroban_sdk::Address,
) -> i128

Imports

WebAssembly Text (WAT) ▶