StarkFiStarkFi

Lending Commands

Supply, borrow, repay, and manage Vesu V2 lending positions

Prerequisite: All lending commands require an active authenticated session. Run starkfi auth login first.

Typical Flows

Earn Yield (Supply)

1. starkfi lend-pools prime   →  Check pools and APY rates
2. starkfi lend-supply 100 -p Prime -t USDC  →  Supply tokens
3. starkfi lend-status  →  Verify position (auto-scans all pools)

Leverage (Borrow)

1. starkfi lend-pools  →  Find pools and supported pairs
2. starkfi lend-borrow -p Prime ...  →  Deposit collateral + borrow
3. starkfi lend-status  →  Overview of all positions
3b. starkfi lend-status -p Prime --collateral-token ETH --borrow-token USDC  →  Detailed Health Factor
4. starkfi lend-repay 500 -p Prime -t USDC ...  →  Repay when ready
5. starkfi lend-close -p Prime ...  →  Or close everything atomically

lend-pools

Lists all available Vesu V2 lending pools.

starkfi lend-pools [name]
starkfi lend-pools --json

Shows pool name, protocol version, available assets (with APY/APR), and pair count. Optionally filter by name (partial match — shows detailed asset info).

Examples:

starkfi lend-pools
starkfi lend-pools prime
starkfi lend-pools re7 --json

lend-supply

Supplies assets into a lending pool to earn yield.

starkfi lend-supply <amount> -p <pool> -t <token>

Flags:

FlagDescription
-p, --pool <name>Pool name (e.g., Prime) or contract address
-t, --token <symbol>Token symbol to supply (e.g., USDC, ETH)
--simulateEstimate fees without executing
--jsonOutput raw JSON

Examples:

starkfi lend-supply 100 -p Prime -t USDC
starkfi lend-supply 0.5 -p "Genesis: Re7 Labs" -t ETH --simulate

Note: There is no minimum amount for supply operations.


lend-withdraw

Withdraws supplied assets from a pool.

starkfi lend-withdraw <amount> -p <pool> -t <token>

Flags:

FlagDescription
-p, --pool <name>Pool name or contract address
-t, --token <symbol>Token symbol to withdraw
--simulateEstimate fees without executing
--jsonOutput raw JSON

Example:

starkfi lend-withdraw 50 -p Prime -t USDC

lend-borrow

Borrows assets against your collateral. Atomically deposits collateral and borrows the debt asset in a single transaction.

starkfi lend-borrow -p <pool> --collateral-amount <n> --collateral-token <symbol> --borrow-amount <n> --borrow-token <symbol>

Flags:

FlagDescription
-p, --pool <name>Pool name or contract address
--collateral-amount <n>Amount of collateral to deposit
--collateral-token <symbol>Collateral token symbol (e.g., ETH, STRK)
--borrow-amount <n>Amount to borrow
--borrow-token <symbol>Token to borrow (e.g., USDC, USDT)
--use-suppliedUse previously supplied earn positions as collateral
--simulateEstimate fees without executing
--jsonOutput raw JSON

Example:

starkfi lend-borrow -p Prime --collateral-amount 0.5 --collateral-token ETH --borrow-amount 500 --borrow-token USDC

Important: Monitor your Health Factor after borrowing with lend-status.


lend-repay

Repays borrowed debt.

starkfi lend-repay <amount> -p <pool> -t <token> --collateral-token <symbol>

Flags:

FlagDescription
-p, --pool <name>Pool name or contract address
-t, --token <symbol>Token to repay (e.g., USDC)
--collateral-token <symbol>Collateral token of the position (e.g., ETH)
--simulateEstimate fees without executing
--jsonOutput raw JSON

Example:

starkfi lend-repay 500 -p Prime -t USDC --collateral-token ETH

lend-close

Closes an entire lending position atomically — repays all debt and withdraws all collateral in one transaction.

The amounts come from the position's exact on-chain base units. Interest keeps accruing between the read and execution, so the repayment approval and the requested withdrawal are 1% above the amounts read. Vesu V2 caps a repayment at the outstanding debt and a withdrawal at the position's collateral, and transfers only those amounts, so the extra 1% is never charged; at most that much token allowance to the pool remains afterwards.

Known issue in v0.7.2 and earlier: lend-close (and the close_position MCP tool) fails with Invalid unit amount for any position with debt. Fixed in v0.8.0.

starkfi lend-close -p <pool> --collateral-token <symbol> --borrow-token <symbol>

Flags:

FlagDescription
-p, --pool <name>Pool name or contract address
--collateral-token <symbol>Collateral token symbol (e.g., ETH)
--borrow-token <symbol>Borrowed token symbol (e.g., USDC)
--simulateEstimate fees without executing
--jsonOutput raw JSON

Example:

starkfi lend-close -p Prime --collateral-token ETH --borrow-token USDC

lend-status

Checks your lending positions. Run without arguments to auto-scan all pools, or specify a pool for detailed position info.

# Auto-scan all pools (no arguments needed)
starkfi lend-status

# Specific pool + token
starkfi lend-status -p <pool> --collateral-token <symbol> [--borrow-token <symbol>]

Flags:

FlagDescriptionRequired
-p, --pool <name>Pool name or contract addressNo
--collateral-token <symbol>Token supplied to the pool (e.g., ETH)No*
--borrow-token <symbol>Borrow token (required to see debt position + HF)No
--jsonOutput raw JSONNo

* Required when -p is specified. Omit both -p and --collateral-token to auto-scan.

Examples:

starkfi lend-status                                          # Scan all pools
starkfi lend-status -p Prime --collateral-token ETH          # Supply position
starkfi lend-status -p Prime --collateral-token ETH --borrow-token USDC  # With HF

Shows supplied yield balance, collateral and debt amounts, the pair's max LTV, health factor, and risk level. The health factor is collateral value × max LTV / debt value, so below 1.0 Vesu can liquidate the position (see Health Factor).

Risk LevelHealth Factor
SAFE> 1.3
WARNING1.1 – 1.3
DANGER1.05 – 1.1
CRITICAL≤ 1.05

lend-monitor

Monitors lending positions and alerts on low health factors. Run without --pool to scan all pools, or specify a pool for a single position check.

# Scan all pools
starkfi lend-monitor

# Specific position
starkfi lend-monitor -p <pool> --collateral-token <symbol> --borrow-token <symbol>

Flags:

FlagDescriptionRequired
-p, --pool <name>Pool name or contract addressNo
--collateral-token <symbol>Collateral token symbol (required with --pool)No*
--borrow-token <symbol>Debt token symbol (required with --pool)No*
--warning-threshold <n>Custom warning threshold (default: 1.3)No
--jsonOutput raw JSONNo

* Required when -p is specified.

Risk Levels:

Risk LevelHealth FactorAlert
SAFE> 1.3No
WARNING1.1 – 1.3⚠️ Attention
DANGER1.05 – 1.1🔴 Repay/add
CRITICAL≤ 1.05🚨 Liquidation

Shows collateral amount, debt amount, the pair's max LTV, health factor (collateral value × max LTV / debt value; below 1.0 the position can be liquidated), risk level, and actionable recommendations for each position.

Examples:

starkfi lend-monitor
starkfi lend-monitor -p Prime --collateral-token ETH --borrow-token USDC
starkfi lend-monitor --warning-threshold 1.5 --json

lend-auto

Automatically adjusts a lending position to improve the health factor. Supports three strategies.

starkfi lend-auto -p <pool> --collateral-token <symbol> --borrow-token <symbol>

Flags:

FlagDescriptionRequired
-p, --pool <name>Pool name or contract addressYes
--collateral-token <symbol>Collateral token symbolYes
--borrow-token <symbol>Debt token symbolYes
--strategy <type>repay, add-collateral, or auto (default)No
--target-hf <number>Target health factor (default: 1.3)No
--simulatePreview without executingNo

Strategies:

StrategyAction
repayRepay part of the debt to improve HF
add-collateralAdd more collateral to improve HF
auto (default)Automatically pick the best option based on balances

Shows the action taken, amount, previous and estimated new health factor, and transaction hash.

The amount is sized from the position's own token amounts and USD values (the pool's oracle prices), so it is correct for tokens of any decimals. Health factor here is the same risk-adjusted value as everywhere else: collateral value × the pair's max LTV / debt value, where 1.0 is the liquidation point. Before sending anything, lend-auto asks the lending provider for a projected post-action health factor and a preflight simulation. It refuses to execute (and --simulate reports an error) if the simulation fails, if no projection is available, or if the projected health factor does not reach --target-hf or does not improve on the current one.

Examples:

starkfi lend-auto -p Prime --collateral-token ETH --borrow-token USDC
starkfi lend-auto -p Prime --collateral-token ETH --borrow-token USDC --strategy repay
starkfi lend-auto -p Prime --collateral-token ETH --borrow-token USDC --simulate

Tip: Use lend-monitor first to identify positions that need rebalancing, then use lend-auto to fix them.


MCP equivalent: Lending Tools — list_lending_pools, supply_assets, borrow_assets, repay_debt, close_position, monitor_lending_position, auto_rebalance_lending

Edit on GitHub

Last updated on

On this page