StarkFiStarkFi

Vesu V2 Lending

Supply, borrow, and manage lending positions on Vesu pools

Overview

Vesu provides V2 lending pools on Starknet. StarkFi integrates with Vesu through the Starkzap SDK's wallet.lending() API, which handles all on-chain interactions — supply, withdraw, borrow, repay, close, and position monitoring.

Network-aware: All Vesu lending operations work on both Starknet mainnet and Sepolia testnet. Token addresses resolve dynamically based on the configured network.

How StarkFi Uses Vesu

FeatureSDK IntegrationStarkFi Command
Browse Poolswallet.lending().getMarkets()lend-pools
Supplywallet.lending().deposit()lend-supply
Withdrawwallet.lending().withdraw()lend-withdraw
Borrowwallet.lending().borrow()lend-borrow
Repaywallet.lending().repay()lend-repay
Close Positionwallet.tx().lendRepay()lend-close
Check Positionwallet.lending().getPositions()lend-status
Health Checkwallet.lending().getHealth()lend-monitor

Supported Pools

Pools are discovered dynamically via the SDK — no hardcoded list. Run starkfi lend-pools to see all live pools with APY/APR rates.

Tip: Use starkfi lend-pools <name> to filter by name and see detailed asset info.

Health Factor

StarkFi reports a risk-adjusted health factor, where 1.0 is the liquidation point:

healthFactor = collateralValueUSD × maxLtv / debtValueUSD

maxLtv is the pair's maximum loan-to-value ratio (max_ltv in the pool's pair_config). Vesu V2 liquidates a position as soon as collateral × max_ltv < debt, so the health factor drops below 1.0 exactly when liquidation becomes possible. Collateral and debt values are the pool's own oracle valuations, read through the Starkzap SDK. For example, with a max LTV of 0.8, a position with $1,200 of collateral and $1,000 of debt has a health factor of 0.96 and can already be liquidated.

lend-status, lend-monitor, lend-auto and the matching MCP tools all use this definition, and show the pair's max LTV next to the health factor.

Changed in v0.8.0. v0.7.2 and earlier report collateralValueUSD / debtValueUSD without the max LTV, so their health factor reads higher than the risk-adjusted value (1.25 instead of 1.0 at a max LTV of 0.8) and their risk alerts fire late. On those versions, multiply the reported value by the pair's max LTV.

Risk levels:

Risk LevelHealth FactorMeaning
SAFE> 1.3Position is healthy
WARNING1.1 – 1.3Monitor closely
DANGER1.05 – 1.1Close to liquidation
CRITICAL≤ 1.05Liquidation imminent; below 1.0 it can happen now

Important: Monitor your health factor regularly with starkfi lend-status. Below 1.0, your position can be liquidated.

Technical Details

SettingValue
SDK Modulestarkzap — wallet.lending() via VesuLendingProvider
Pool DiscoveryDynamic via getMarkets()
Amount ParsingAmount.parse() / Amount.fromRaw() with token decimals
Dust Limit~$10 minimum for borrow positions (collateral and debt)

Architecture

commands/lending.ts → services/vesu/lending.ts → StarkZap wallet.lending() API
                      services/vesu/pools.ts   → StarkZap wallet.lending().getMarkets()
                      services/vesu/monitor.ts → StarkZap wallet.lending().getPositions()
                      services/vesu/health.ts  → Shared risk classification

The VesuLendingProvider is registered during wallet initialization in services/starkzap/client.ts.

Error Handling

ErrorCauseResolution
LENDING_FAILEDOn-chain operation failedCheck token allowance, balance, and health factor
POOL_NOT_FOUNDInvalid pool name or addressRun lend-pools to see available pools

See Also

Edit on GitHub

Last updated on

On this page