Skip to main content

Supply

Resolve the exact asset’s pool with lendingPoolAddress(assetType). The app-local ContractService.deposit(walletAddress, amount, assetType) accepts a human-unit number, constructs WAD arguments, prepares/signs/submits, and returns a success result or error. For precise external integrations, build amounts from strings/bigint directly. At the contract boundary call deposit(lender, amount_wad). The lender authorizes the call and underlying transfer. This is a wallet-to-pool flow; no SmartAccount is required.

Redeem

Read the receipt balance and its own decimals. Convert the desired receipt quantity to WAD and call redeem_vtokens(lender, tokens_to_redeem_wad). The app-local ContractService.withdraw passes receipt quantities, despite the generic parameter name amount. Redemption can partially fill because the pool limits a single payout to 50% of total assets and available cash. Read withdraw_event.asset_amount, vtoken_amount, and the refreshed balance. Do not show the requested quantity as the completed payout.

Pool data

Use get_total_liquidity_in_pool, get_borrows, total_assets, and conversion getters to distinguish available cash from outstanding debt and receipt value. Read the current rate model and fee. Borrowers are subject to the pool’s 95% utilization cap. See Lending Pools for signatures and Math Reference for scaling.

Source reference

  • mercury-stellar-backend/lib/stellar-utils.ts
  • mercury-stellar-backend/hooks/use-earn.ts
  • Protocol_V1_Soroban_testnet/contracts/lending-pool/src/pool.rs