Contract 4d2fe0da6d50c0f6fd85bebacbd44a1dcca43aad1721cb7826cf5407581d21d7

← Back to Index 📥 Download WASM

Meta

rssdkver 23.1.0#7456be9d91fe1f4cb070fc2732bac78244ce6c3f
rsver 1.93.0-nightly

Instances

  • CDR33OXA5JRG4QTWDLIK5YQNBNZB3MB2X4KNKMGAIF2YEY3J6U3B25J2

Interface

Mint shares by depositing assets into the vault and Blend

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

Redeem shares from the vault by withdrawing from Blend

fn redeem(
    env: soroban_sdk::Env,
    shares: i128,
    receiver: soroban_sdk::Address,
    owner: soroban_sdk::Address,
    operator: soroban_sdk::Address,
) -> i128
fn symbol(env: soroban_sdk::Env) -> soroban_sdk::String
fn approve(
    env: soroban_sdk::Env,
    owner: soroban_sdk::Address,
    spender: soroban_sdk::Address,
    amount: i128,
    live_until_ledger: u32,
)
fn balance(env: soroban_sdk::Env, account: soroban_sdk::Address) -> i128

Deposit assets into the vault and supply to Blend

fn deposit(
    env: soroban_sdk::Env,
    assets: i128,
    receiver: soroban_sdk::Address,
    from: soroban_sdk::Address,
    operator: soroban_sdk::Address,
) -> i128

Compound BLND rewards into USDC and re-deposit

This function performs three steps:

  1. Claims BLND tokens from Blend pool
  2. Swaps BLND for USDC on Comet DEX
  3. Deposits USDC back into Blend pool

Returns the amount of USDC deposited back into the pool

fn compound(env: soroban_sdk::Env) -> i128
fn decimals(env: soroban_sdk::Env) -> u32
fn max_mint(env: soroban_sdk::Env, receiver: soroban_sdk::Address) -> i128
fn transfer(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    to: soroban_sdk::Address,
    amount: i128,
)

Withdraw assets from the vault by redeeming from Blend

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

Initialize the vault

This function can only be called once. Subsequent calls will panic.

Arguments

  • asset - The underlying asset address (USDC)
  • decimals_offset - The decimal offset for share token
  • blend_pool - The Blend pool contract address
  • usdc_reserve_index - The reserve index for USDC in the Blend pool
  • blnd_token - The BLND token address for claiming rewards
  • blnd_reserve_index - The reserve index for BLND in the Blend pool
  • comet_pool - The Comet pool contract address for BLND-USDC swaps
fn initialize(
    env: soroban_sdk::Env,
    asset: soroban_sdk::Address,
    decimals_offset: u32,
    blend_pool: soroban_sdk::Address,
    usdc_reserve_index: u32,
    blnd_token: soroban_sdk::Address,
    blnd_reserve_index: u32,
    comet_pool: soroban_sdk::Address,
)
fn max_redeem(env: soroban_sdk::Env, owner: soroban_sdk::Address) -> i128
fn max_deposit(env: soroban_sdk::Env, receiver: soroban_sdk::Address) -> i128
fn query_asset(env: soroban_sdk::Env) -> soroban_sdk::Address
fn max_withdraw(env: soroban_sdk::Env, owner: soroban_sdk::Address) -> i128
fn preview_mint(env: soroban_sdk::Env, shares: i128) -> i128

Override total_assets to query the actual balance in Blend pool

fn total_assets(env: soroban_sdk::Env) -> i128
fn total_supply(env: soroban_sdk::Env) -> i128
fn transfer_from(
    env: soroban_sdk::Env,
    spender: soroban_sdk::Address,
    from: soroban_sdk::Address,
    to: soroban_sdk::Address,
    amount: i128,
)

Check if the contract has been initialized

fn is_initialized(env: soroban_sdk::Env) -> bool
fn preview_redeem(env: soroban_sdk::Env, shares: i128) -> i128
fn preview_deposit(env: soroban_sdk::Env, assets: i128) -> i128
fn preview_withdraw(env: soroban_sdk::Env, assets: i128) -> i128
fn convert_to_assets(env: soroban_sdk::Env, shares: i128) -> i128
fn convert_to_shares(env: soroban_sdk::Env, assets: i128) -> i128

Get a snapshot of all depositors and their current token balances

Returns a Map of Address -> Balance (in vault share tokens)

This function is useful for calculating points for future token distributions or incentive programs based on vault participation.

Note: This function has scalability limits and works best with a moderate number of depositors. For very large user bases, alternative tracking mechanisms should be considered.

fn get_depositors_snapshot(
    env: soroban_sdk::Env,
) -> soroban_sdk::Map

Imports

WebAssembly Text (WAT) ▶