Supply and redeem
deposit(lender, amount_wad) authenticates the lender, accrues interest, transfers native underlying, and mints vTokens. The first deposit uses 1:1 WAD accounting and reserves 1,000 WAD share units for minimum liquidity before native vToken conversion. Later deposits use a virtual offset of 1 WAD integer unit in both supply and assets. A zero-share accounting result is rejected.
redeem_vtokens(lender, tokens_to_redeem_wad) accepts vToken quantity in WAD, not underlying quantity or raw native receipt units. Payout is clamped to the minimum of requested value, 50% of total assets, and available liquidity. A partial redemption burns the recomputed share amount; zero available payout fails. Read the event’s asset_amount and remaining balance to determine what actually redeemed.
Borrow and repay accounting
Only AccountManager may calllend_to and collect_from. lend_to returns (is_first_borrow, net_amount_wad) on success, records gross debt with upward-rounded shares, and distributes the fee to treasury and net proceeds to the SmartAccount. New borrowing cannot exceed 95% pool utilization.
collect_from updates debt accounting; it does not itself pull tokens. AccountManager’s regular repay path separately transfers account-held underlying, while liquidation transfers from the liquidator using an allowance. Do not call the pool accounting function as a standalone repayment flow.
get_borrows includes pending interest with floor rounding. update_state persists interest with ceiling rounding. Account debt getters use these live preview borrows, not just stored principal. See Math Reference.
Pool administration
Pool pause blocks supply, redeem, and borrow, but notcollect_from. Admin transfer is two-step. Origination fee and rate-model address are configurable. Read get_origination_fee rather than assuming a fixed deployment fee. The frontend’s 0.9999 spend buffer is a rounding allowance, not the on-chain fee.
Function signatures
These signatures are copied from the reviewed Rust implementation.env is supplied by Soroban and is not a transaction argument. Result errors and panics must be handled by the caller; simulation does not guarantee later execution. Public methods include privileged and internal-contract callbacks, not just user entrypoints.
__constructor
propose_admin
accept_admin
get_admin
initialize_pool
deposit
redeem_vtokens
lend_to
collect_from
convert_asset_borrow_shares
convert_borrow_shares_asset
update_state
set_paused
is_paused
before_deposit
before_withdraw
get_user_borrow_shares
get_borrow_balance
get_total_borrow_shares
total_assets
get_borrows
get_rate_factor
get_total_liquidity_in_pool
get_last_updated_time
get_current_total_vtoken_balance
get_total_vtokens_minted
get_total_vtokens_burnt
get_lenders
is_pool_initialised
get_native_asset_address
get_asset_config
convert_asset_to_vtoken
convert_vtoken_to_asset
update_origination_fee
update_rate_model
get_origination_fee
get_treasury
get_max_utilization_wad
upgrade
Source reference
Protocol_V1_Soroban_testnet/contracts/lending-pool/src/pool.rs

