supply_asset
Supply an ERC-20 token as collateral to the lending pool.
Parameters
asset(string): ERC-20 token symbol or address (e.g.USDC,WETH)amount(string): Amount to supply in human-readable units (e.g.100)wallet_address(string): User's wallet address
Steps
- Call
GET /api/v1/tokens?symbol={asset}to resolve the token contract address and decimals - Convert
amountto token units:amount_raw = amount * 10^decimals - Call
GET /api/v1/allowance?token={token_address}&owner={wallet_address}&spender=POOLto check existing approval - If
allowance < amount_raw, callPOST /api/v1/approvewith body{ token: token_address, amount: amount_raw, owner: wallet_address }The response contains{ to, data, value }. Execute the approval transaction:await walletClient.sendTransaction({ to: resp.to, data: resp.data, value: resp.value }) - Call
POST /api/v1/supplywith body{ token: token_address, amount: amount_raw, wallet: wallet_address }The response contains{ to, data, value }. Execute the supply transaction:await walletClient.sendTransaction({ to: resp.to, data: resp.data, value: resp.value }) - Return a confirmation with the supplied amount and the resulting health factor
borrow_asset
Borrow an asset against the user's supplied collateral.
Parameters
asset(string): ERC-20 token symbol or address to borrowamount(string): Amount to borrow in human-readable unitswallet_address(string): User's wallet address
Steps
- Call
GET /api/v1/tokens?symbol={asset}to resolve token details - Call
GET /api/v1/borrow-capacity?wallet={wallet_address}and verify there is sufficient collateral to cover the requested borrow amount - Call
POST /api/v1/borrowwith body{ token: token_address, amount: amount_raw, wallet: wallet_address }The response contains{ to, data, value }. Execute the borrow transaction:await walletClient.sendTransaction({ to: resp.to, data: resp.data, value: resp.value }) - Return the borrowed amount and the updated health factor
get_position
Returns the user's current lending position. This is a read-only call — no transaction is executed.
Parameters
wallet_address(string): User's wallet address
Steps
- Call
GET /api/v1/position?wallet={wallet_address} - Return
{ supply_balance, borrow_balance, health_factor, available_to_borrow }