| Pool | Asset | Address |
|---|---|---|
| LendingPoolXLM | Stellar Lumens (XLM) | CBA4E4ZMXUKCDTNT7LDKSO3LGNGKHRCE4GUVPSRCAKU3TKAONUY7SVOB |
| LendingPoolUSDC | USD Coin (USDC) | CABLEI2ZPCWLO2FQRHJJYR7JW75BCCPN2ZIV5BX7CHPXZT4CZVTGUOBU |
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:
| Parameter | Type | Description |
|---|---|---|
lender | Address | The depositor’s wallet address |
amount_wad | U256 | Deposit amount in WAD (10¹⁸ = 1 token) |
- 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
| Key | Type | Description |
|---|---|---|
BorrowsWAD | U256 | Total outstanding debt (stored, not live) |
TotalBorrowSharesWAD | U256 | Sum of all borrow shares |
UserBorrowSharesWAD(Address) | U256 | Per-account borrow shares |
LastUpdatedTime | u64 | Timestamp of last update_state() call |
TotalTokensMintedWAD(Symbol) | U256 | Cumulative vTokens minted |
TotalTokensBurntWAD(Symbol) | U256 | Cumulative vTokens burned |
VTokenContractAddress(Symbol) | Address | vToken contract address |
Pool Configuration
| Parameter | Description |
|---|---|
origination_fee | Per-borrow fee rate in WAD (testnet: 10^16 = 1%) |
RateModel | Address of the RateModel contract |
AccountManager | Address of the AccountManager (only authorized caller for lend_to/collect_from) |
Treasury | Destination for origination fees |
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

