StarkFiStarkFi

Lending Tools

10 tools for Vesu V2 lending operations — supply, borrow, repay, withdraw, close, monitor, auto-rebalance, quote health

Prerequisite: All lending tools require an active authenticated session. Call get_auth_status first to verify.

Supply (earn yield)

1. list_lending_pools    →  Find pools and check APY rates
2. supply_assets         →  Deposit tokens into a pool
3. get_lending_position  →  Verify position

Borrow (leverage)

1. list_lending_pools            →  Find pools and supported pairs
2. borrow_assets                 →  Deposit collateral + borrow in one call
3. get_lending_position          →  Monitor Health Factor
4. monitor_lending_position      →  Ongoing health monitoring with alerts
5. auto_rebalance_lending        →  Auto-fix when HF drops
6. repay_debt                    →  Repay when ready
7. close_position                →  Or close everything atomically

list_lending_pools

List available Vesu V2 lending pools with live APY/APR data, supported assets, and pairs.

ParamTypeRequiredDescription
namestringNoFilter pools by name (partial match). Omit to list all.

This is a read-only tool.


get_lending_position

Get the user's position in a lending pool — collateral value, debt value, Health Factor, and risk level.

ParamTypeRequiredDescription
poolstringYesPool name (e.g., Prime, Re7) or contract address
collateral_tokenstringYesCollateral token symbol (e.g., ETH, STRK)
borrow_tokenstringNoBorrow token symbol (e.g., USDC). Optional for supply-only positions.

This is a read-only tool. Use it to monitor Health Factor before and after operations.

Health Factor Guide:

  • Above 1.3 — Safe
  • 1.1 – 1.3 — Warning (monitor closely)
  • 1.05 – 1.1 — Danger (liquidation risk)
  • ≤ 1.05 — Critical (imminent liquidation)

supply_assets

Supply tokens into a Vesu V2 pool to earn interest.

ParamTypeRequiredDescription
poolstringYesPool name (e.g., Prime, Re7) or contract address
amountstringYesAmount to supply (e.g., 100, 0.5)
tokenstringYesToken symbol to supply (e.g., STRK, ETH, USDC)

Note: There is no minimum amount for supply operations.


withdraw_assets

Withdraw previously supplied tokens from a pool.

ParamTypeRequiredDescription
poolstringYesPool name or contract address
amountstringYesAmount to withdraw
tokenstringYesToken symbol to withdraw

borrow_assets

Borrow tokens by supplying collateral. Atomically deposits collateral and borrows the debt asset in a single transaction.

ParamTypeRequiredDescription
poolstringYesPool name or contract address
collateral_amountstringYesCollateral amount to deposit
collateral_tokenstringYesCollateral token symbol (e.g., ETH, STRK)
borrow_amountstringYesAmount to borrow
borrow_tokenstringYesToken to borrow (e.g., USDC, USDT)
use_suppliedbooleanNoSet true to use previously supplied earn position as collateral

Important: Monitor your Health Factor after borrowing. Use get_lending_position or monitor_lending_position to check.


repay_debt

Repay borrowed tokens on an existing lending position.

ParamTypeRequiredDescription
poolstringYesPool name or contract address
amountstringYesAmount to repay
tokenstringYesToken to repay (e.g., USDC, USDT)
collateral_tokenstringYesCollateral token of the position — needed to identify which position to repay

close_position

Atomically close an active lending position. Repays all outstanding debt and withdraws all collateral in a single transaction.

ParamTypeRequiredDescription
poolstringYesPool name or contract address
collateral_tokenstringYesCollateral token symbol (e.g., STRK, ETH)
debt_tokenstringYesBorrowed token symbol (e.g., USDC, USDT)

Note: This tool handles the full close flow atomically — repay debt + withdraw collateral in one transaction.


monitor_lending_position

Monitor health factors across lending positions with 4-level risk classification and actionable alerts. Scan all pools or check a specific position.

ParamTypeRequiredDescription
poolstringNoPool name or address. Omit to scan all pools.
collateral_tokenstringNoCollateral token (required with pool)
borrow_tokenstringNoDebt token (required with pool)
warning_thresholdnumberNoCustom warning threshold (default: 1.3)

This is a read-only tool — safe to call without user confirmation.

Returns for each position:

  • Health factor value
  • Risk level (SAFE, WARNING, DANGER, CRITICAL)
  • Alert message (if risk is elevated)
  • Recommendation (repay amount or collateral to add)

auto_rebalance_lending

Automatically adjust a lending position to improve its health factor. Chooses the best strategy (repay debt or add collateral) based on wallet balances.

ParamTypeRequiredDescription
poolstringYesPool name or contract address
collateral_tokenstringYesCollateral token symbol
borrow_tokenstringYesDebt token symbol
strategystringNorepay, add-collateral, or auto (default)
target_health_factornumberNoTarget health factor (default: 1.3)
simulatebooleanNoSet true to preview without executing

Important: This is a transactional tool. Always confirm with the user and use simulate: true first to preview the action.

Returns: action taken, amount, token, previous HF, estimated new HF, and transaction hash.


lending_quote_health

Simulate the impact of a lending action on the position's Health Factor without executing. Useful for previewing how a borrow, repay, deposit, or withdrawal would change the health factor before committing.

ParamTypeRequiredDescription
poolstringYesPool name or contract address
collateral_tokenstringYesCollateral token symbol
debt_tokenstringYesDebt token symbol
actionstringYesAction to simulate: borrow, repay, deposit, withdraw
amountstringYesAmount for the action

This is a read-only tool — safe to call without user confirmation.

Returns: current health factor, projected health factor, and risk change indicator (IMPROVING, DECLINING, STABLE).


CLI equivalent: Lending Commands

Edit on GitHub

Last updated on

On this page