Core Guides

Earn

Vault discovery, inspection, recommendations, portfolio reads, and deposit execution.

View source on GitHub

Earn

The Earn commands wrap the LI.FI Earn API. They let you discover yield-bearing vaults across protocols and chains, inspect their details, get recommendations, view portfolio positions, and execute on-chain deposits.

Read commands (no wallet needed):

Write commands (require LIFI_WALLET_PRIVATE_KEY + LIFI_RPC_<CHAIN>):


lifi vaults

List and filter depositable yield vaults.

bash
lifi vaults [flags]

Flags

FlagDefaultDescription
--chain <name|id>$LIFI_DEFAULT_FROM_CHAINFilter by chain. Accepts chain name, key, or numeric ID.
--asset <symbol|address>Filter by underlying asset symbol (e.g. USDC) or token address.
--protocol <name>Filter by protocol name (e.g. morpho-v1, pendle).
--sort apy|apy30d|tvl|nameapySort field.
--order asc|descdescSort direction.
--min-tvl-usd <amount>Minimum TVL filter in USD (e.g. 1000000 for $1M+).
--min-apy <percent>Minimum APY filter (e.g. 10 for 10%+).
--transactional-onlyfalseOnly show vaults that support on-chain deposits via Composer.
--limit <n>25Maximum number of results.
--jsonOutput as JSON.

Required secrets

None — this command only calls the read-only Earn API.

Examples

bash
# Top 10 USDC vaults on Base by APY
lifi vaults --chain base --asset USDC --transactional-only --sort apy --limit 10

# All morpho-v1 vaults on Ethereum with $1M+ TVL
lifi vaults --chain ethereum --protocol morpho-v1 --min-tvl-usd 1000000

# Vaults with 15%+ APY, sorted by TVL descending
lifi vaults --min-apy 15 --sort tvl

# JSON output for scripting
lifi vaults --chain base --asset USDC --json | jq '.[].analytics.apy.total'

lifi inspect

Print full details for a single vault — APY breakdown, TVL, protocol info, supported deposit/redeem packs, and data freshness.

bash
lifi inspect <vault> [--json]

<vault> can be:

  • A vault address (0xabc...)
  • A vault slug (e.g. csusdc-morpho-v1)
  • A vault name (e.g. CSUSDC)

Required secrets

None.

Examples

bash
lifi inspect 0x9b5e92fd7c2ef79fddd33c6c7a3c3e5abb...
lifi inspect csusdc-morpho-v1
lifi inspect CSUSDC --json

lifi recommend

Rank vaults for a target asset and chain using a scoring strategy.

bash
lifi recommend [flags]

Flags

FlagDefaultDescription
--asset <symbol|address>Target asset to earn yield on.
--from-chain <name|id>Source chain (used to filter vaults when --to-chain is not set).
--to-chain <name|id>--from-chainChain where the vault should be.
--strategy highest-apy|safest|balancedbalancedScoring strategy. See below.
--min-tvl-usd <amount>TVL floor filter.
--limit <n>5Maximum results.
--jsonJSON output.

Scoring strategies

StrategyDescription
highest-apyRanked purely by total APY. Favours high-yield vaults regardless of size.
safestWeighted towards TVL (log scale) plus base APY only. Ignores volatile reward APY.
balancedAPY + log-TVL weight (default). Balances yield and protocol maturity.

Required secrets

None.

Examples

bash
# Best USDC vault on Base by balanced score
lifi recommend --asset USDC --from-chain base

# Safest USDC vault with $500k+ TVL
lifi recommend --asset USDC --from-chain ethereum --strategy safest --min-tvl-usd 500000

# Highest-APY vault, any chain
lifi recommend --asset USDC --strategy highest-apy --limit 3 --json

lifi portfolio

Show current Earn positions for a wallet address.

bash
lifi portfolio <address> [flags]

Flags

FlagDescription
--chain <name|id>Filter by chain.
--protocol <name>Filter by protocol.
--asset <symbol|address>Filter by asset.
--jsonJSON output.

Required secrets

None — pass any wallet address as an argument.

Examples

bash
lifi portfolio 0xYourWallet
lifi portfolio 0xYourWallet --chain base
lifi portfolio 0xYourWallet --protocol morpho-v1 --json

lifi deposit

Execute a full Earn deposit using the Composer routing API. The flow is:

  1. Fetch a routing quote from the Composer API
  2. Run a preflight check (simulation, allowance check, balance check)
  3. Prompt for confirmation (skipped with --yes or --dry-run)
  4. Submit the ERC-20 approval if needed
  5. Broadcast the deposit transaction
  6. Optionally wait for confirmation and verify the portfolio position
bash
lifi deposit --vault <address> --from-chain <chain> --from-token <token> --amount <amount> [flags]

Flags

FlagDefaultDescription
--vault <address>requiredTarget vault address.
--from-chain <name|id>$LIFI_DEFAULT_FROM_CHAINSource chain.
--from-token <symbol|address>requiredToken to deposit.
--amount <human>requiredAmount in human-readable units (e.g. 100 for 100 USDC).
--to-chain <name|id>vault's chainDestination chain (for cross-chain deposits).
--from-address <address>derived from keyOverride source wallet address.
--to-address <address>same as fromOverride destination wallet address.
--slippage-bps <n>$LIFI_DEFAULT_SLIPPAGE_BPSSlippage tolerance in basis points.
--approve auto|always|neverautoApproval mode. auto submits if needed, never aborts if needed.
--approval-amount exact|infiniteexactApproval sizing. exact approves only the required amount.
--gas-policy auto|quote|rpcautoGas pricing. auto picks the safer of the quote and RPC estimates.
--waitfalseWait for on-chain source transaction confirmation.
--verify-positionfalsePoll portfolio after confirmation to verify position appeared.
--wait-timeout <duration>5mMaximum time to wait for confirmation.
--portfolio-timeout <duration>1mMaximum time to poll for portfolio update.
--dry-runfalsePreflight only — never broadcasts. Safe to use at any time.
--simulatetrueRPC-simulate the transaction before broadcast.
--skip-simulatefalseBypass simulation (e.g. when the chain doesn't support eth_call simulation).
--yesfalseSkip the confirmation prompt.
--jsonJSON output for all stages.

Required secrets

SecretPurpose
LIFI_WALLET_PRIVATE_KEYSigns the deposit (and approval if needed) transaction
LIFI_RPC_<CHAIN>On-chain RPC for the source chain

Examples

bash
# Preflight only (safe, no broadcast)
lifi deposit \
  --vault 0xVault \
  --from-chain base \
  --from-token USDC \
  --amount 100 \
  --dry-run

# Standard deposit — waits for confirmation, then checks portfolio
lifi deposit \
  --vault 0xVault \
  --from-chain base \
  --from-token USDC \
  --amount 100 \
  --wait \
  --verify-position

# Cross-chain deposit: USDC on Optimism → vault on Base
lifi deposit \
  --vault 0xVault \
  --from-chain opt \
  --from-token USDC \
  --to-chain base \
  --amount 50 \
  --wait

# Automation-friendly (no prompts, JSON output)
lifi deposit \
  --vault 0xVault \
  --from-chain base \
  --from-token USDC \
  --amount 100 \
  --yes \
  --wait \
  --verify-position \
  --json

Preflight output

Before any broadcast, lifi deposit prints an Execution Plan table that shows:

FieldDescription
walletThe signing wallet address
source chainChain the tokens come from
source tokenToken being deposited
source amountAmount in human-readable units
vaultTarget vault address
expected receivedEstimated vault tokens received
approval addressSpender address for the ERC-20 approval
approval neededWhether an approval transaction is required
approval amountApproval amount that will be submitted
gas policyGas pricing strategy in effect
token balanceCurrent token balance in the wallet
native balanceCurrent native token balance (for gas)
estimated gas costEstimated gas cost in USD

Use --dry-run to see this output without broadcasting.