All three pools share the same interface — only the underlying asset differs.
Liquidity Provider Functions
deposit_xlm / deposit_usdc
amount_wad of the pool’s native asset from lender, mints vTokens proportional to the LP’s share of the pool.
Authorization: lender.require_auth()
Parameters:
What happens:
- Calls
update_state()to accrue pending interest - Computes vToken amount:
floor(amount × vtoken_supply / total_assets) - Transfers native asset from lender to pool
- Mints vTokens to lender
redeem_vxlm / redeem_vusdc
tokens_to_redeem vTokens and transfers the underlying asset back to the lender.
Authorization: lender.require_auth()
What happens:
- Calls
update_state()to accrue pending interest - Computes underlying:
floor(vtoken_amount × total_assets / vtoken_supply) - Burns vTokens from lender
- Transfers underlying asset to lender
Borrow Functions (AccountManager Only)
These functions are restricted to the registered AccountManager. Direct calls from other addresses will panic.lend_to
smart_account. Called by AccountManager after RiskEngine approval.
Authorization: AccountManager.require_auth()
What happens:
update_state()— accrue interest- Convert
amount_wadto borrow shares and add toUserBorrowSharesWAD(smart_account) - Deduct origination fee:
fee = floor(amount × origination_fee_rate / WAD)→ send to treasury - Transfer
amount_wadworth of assets tosmart_account
true on success
collect_from
smart_account. Called by AccountManager during repay or liquidation.
Authorization: AccountManager.require_auth()
What happens:
update_state()— accrue interest- Convert
amount_wadto borrow shares and subtract fromUserBorrowSharesWAD(smart_account) - Decrease
BorrowsWADbyamount_wad
true on success
State & Query Functions
update_state
get_borrow_balance
trader, including accrued interest.
get_total_liquidity_in_pool
get_borrows
total_assets
liquidity + borrows — the pool’s theoretical total, including outstanding debt.
get_rate_factor
(now - last_updated) × rate_per_sec in WAD — the accrual factor since the last state update.
Conversion Functions
convert_xlm_to_vtoken
amount of the underlying asset would mint at current exchange rate.
convert_vtoken_to_xlm
vtoken_amount vTokens would redeem to at current exchange rate.
convert_asset_borrow_shares
convert_borrow_shares_asset
Pool Storage
Pool Configuration
Error Codes
Related
- vTokens — the fungible tokens minted by lending pools
- Rate Model — the interest rate curve
- Math Reference — vToken exchange rate and borrow share formulas
- Integrate Lending — end-to-end guide for supply/withdraw integration

