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
| Feature | SDK Integration | StarkFi Command |
|---|---|---|
| Browse Pools | wallet.lending().getMarkets() | lend-pools |
| Supply | wallet.lending().deposit() | lend-supply |
| Withdraw | wallet.lending().withdraw() | lend-withdraw |
| Borrow | wallet.lending().borrow() | lend-borrow |
| Repay | wallet.lending().repay() | lend-repay |
| Close Position | wallet.tx().lendRepay() | lend-close |
| Check Position | wallet.lending().getPositions() | lend-status |
| Health Check | wallet.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 / debtValueUSDmaxLtv 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 / debtValueUSDwithout 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 Level | Health Factor | Meaning |
|---|---|---|
| SAFE | > 1.3 | Position is healthy |
| WARNING | 1.1 – 1.3 | Monitor closely |
| DANGER | 1.05 – 1.1 | Close to liquidation |
| CRITICAL | ≤ 1.05 | Liquidation 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
| Setting | Value |
|---|---|
| SDK Module | starkzap — wallet.lending() via VesuLendingProvider |
| Pool Discovery | Dynamic via getMarkets() |
| Amount Parsing | Amount.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 classificationThe VesuLendingProvider is registered during wallet initialization in services/starkzap/client.ts.
Error Handling
| Error | Cause | Resolution |
|---|---|---|
LENDING_FAILED | On-chain operation failed | Check token allowance, balance, and health factor |
POOL_NOT_FOUND | Invalid pool name or address | Run lend-pools to see available pools |
See Also
- Lending Commands — Full CLI reference for all lending operations
- Lending Tools — MCP tool equivalents for AI agents
- Error Handling — Full error code reference
Last updated on