Initialize the contract
admin - The admin addresspool - The blend pool address the vault will deposit intoasset - The asset address of the reserve the vault will supportrate_type - The rate type the vault will userate - The rate value, with 7 decimals (e.g. 1000000 for 10%)signer- The signer address if the vault is permissioned, None otherwiseInvalidFeeRate - If the value is not within 0 and 1_000_0000InvalidFeeRateType - If the rate type is not 0, 1, or 2fn __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
user - The address of the useri128 - The user's position in shares, or the user has no sharesfn get_shares(env: soroban_sdk::Env, user: soroban_sdk::Address) -> i128
Fetch a user's position in bTokens
user - The address of the useri128 - The user's position in bTokens, or 0 if they have no bTokensfn get_b_tokens(env: soroban_sdk::Env, user: soroban_sdk::Address) -> i128
Fetch a user's position in underlying tokens
user - The address of the useri128 - The user's position in underlying tokens, or 0 if they have no sharesfn 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.
user - The address of the usertoken - The address of the reward tokenOption<UserRewards> - The user's rewards for the token, or Nonefn get_rewards(
env: soroban_sdk::Env,
user: soroban_sdk::Address,
token: soroban_sdk::Address,
) -> Option
Fetch the admin balance in underlying tokens
i128 - The admin's accrued fees in underlying tokens, or 0 if the reserve does not existfn get_underlying_admin_balance(env: soroban_sdk::Env) -> i128
Get the vault's blend pool it deposits into and the asset it supports.
(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
VaultData - The vault datafn get_vault(env: soroban_sdk::Env) -> VaultData
Get the vault's fee configuration
Fee - The fee configuration for the vaultfn get_fee(env: soroban_sdk::Env) -> Fee
Get the vault's admin
Address - The admin address for the vaultfn get_admin(env: soroban_sdk::Env) -> soroban_sdk::Address
Get the vault's signer
Option<Address> - The signer address for the vault, or None if no signer is setfn get_signer(env: soroban_sdk::Env) -> Option
Get the current reward token for the fee vault
Option<Address> - The address of the reward token, or None if no reward token is setfn get_reward_token(env: soroban_sdk::Env) -> Option
Get the reward data for a specific token
token - The address of the reward tokenOption<RewardData> - The reward data for the token, or None if no data existsfn 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.
VaultSummary - The summary of the vaultfn get_vault_summary(env: soroban_sdk::Env) -> VaultSummary
ADMIN ONLY Sets the Fee mode for the fee vault
e - The environment objectrate_type - The rate type the vault will userate - The rate value, with 7 decimals (e.g. 1000000 for 10%)InvalidFeeRate - If the value is not within 0 and 1_000_0000InvalidFeeRateType - If the rate type is not 0, 1, or 2fn 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.
e - The environment objectadmin - The new admin address to setfn 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.
signer - The new signer address to setfn 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
reserve_token_ids - The ids of the reserves to claiming emissions forto - The address to send the emissions toi128 - The amount of blnd tokens claimedfn 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
amount - The amount of tokens to depositi128 - The number of b_tokens mintedInvalidAmount - If the amount is less than or equal to 0InvalidBTokensMinted - If the amount of bTokens minted is less than or equal to 0BalanceError - If the user does not have enough tokensfn admin_deposit(env: soroban_sdk::Env, amount: i128) -> i128
ADMIN ONLY Withdraw tokens from the vault's admin balance
amount - The amount of underlying tokens to withdrawi128 - The number of b_tokens burntInvalidAmount - If the amount is less than or equal to 0BalanceError - If the user does not have enough shares to withdraw the amountInvalidBTokensBurnt - If the amount of bTokens burnt is less than or equal to 0fn 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.
token - The address of the reward tokenreward_amount - The amount of rewards to distributeexpiration - The timestamp when the rewards expireInvalidRewardConfig - If the reward token cannot be changed, or if a valid reward period cannot be startedBalanceError - If the admin does not have enough tokens to set the rewardsfn set_rewards(
env: soroban_sdk::Env,
token: soroban_sdk::Address,
reward_amount: i128,
expiration: u64,
)
ADMIN ONLY Upgrades the contract to use new WASM bytecode. This allows the contract to be updated with new functionality while preserving its state and address.
new_wasm_hash - The hash of the new WASM bytecode to upgrade tofn upgrade_contract(env: soroban_sdk::Env, new_wasm_hash: soroban_sdk::BytesN<32>)
Deposits tokens into the fee vault for a specific reserve. Requires the signer to sign the transaction if the signer is set.
user - The address of the user making the depositamount - The amount of tokens to depositi128 - The number of shares minted for the userInvalidAmount - If the amount is less than or equal to 0InvalidBTokensMinted - If the amount of bTokens minted is less than or equal to 0InvalidSharesMinted - If the amount of shares minted is less than or equal to 0BalanceError - If the user does not have enough tokensfn 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. Requires the signer to sign the transaction if the signer is set.
user - The address of the user making the withdrawalamount - The amount of tokens to withdrawi128 - The number of shares burntInvalidAmount - If the amount is less than or equal to 0InvalidBTokensBurnt - If the amount of bTokens burnt is less than or equal to 0InsufficientReserves - If the pool doesn't have enough reserves to complete the withdrawalfn withdraw(env: soroban_sdk::Env, user: soroban_sdk::Address, amount: i128) -> i128
Claims rewards for the user from the fee vault.
user - The address of the user claiming rewardsreward_token - The address of the reward token to claimto - The address to send the claimed rewards toi128 - The amount of rewards claimedNoRewardsConfigured - If no rewards are configured for the tokenfn claim_rewards(
env: soroban_sdk::Env,
user: soroban_sdk::Address,
reward_token: soroban_sdk::Address,
to: soroban_sdk::Address,
) -> i128