For the complete documentation index, see llms.txt. This page is also available as markdown.

ZeroDev Earn

Deposit into DeFi vaults from any chain with a single transaction.

Beta

ZeroDev Earn is an experimental product offered in beta. It supports your integration with third-party protocols. ZeroDev does not provide these protocols or the services they offer, does not custody assets, and does not execute or control transactions; any transactions are solely between you (or your end users) and the applicable third-party protocol. Any APY, rewards, or other amounts are provided by such protocols, not ZeroDev, and all data is supplied by third parties for informational purposes only. Use involves significant risk, including smart contract failures, market volatility, illiquidity, lockup, and loss of principal. ZeroDev is not liable for any losses arising from use of the product or the third-party protocols it surfaces. You are responsible for ensuring your end users understand these risks and for any disclosures required by applicable law. Do your own independent research and proceed at your own risk.

@zerodev/earn turns an intent like "deposit this USDC into a vault on another chain" into a quote: a Smart Routing Address (SRA) to fund, plus the ready-to-sign source-chain calls. The user signs on the source chain. A relayer bridges when necessary and runs the deposit on the destination chain.

The SDK does not hold keys or submit transactions. Your application requests a quote, sends the returned calls with its wallet client, and tracks the SRA until the deposit completes.

const quote = await earn.morpho.deposit({
  owner: account.address,
  amount: "100",
  token: TOKENS.USDC,
  srcChainId: 8453, // Base
  into: vault,      // Vault on Arbitrum
});

Deposit lifecycle

  1. Your application selects a vault and requests a quote.
  2. The server validates the vault, reads its current deposit capacity, and creates an SRA containing the destination actions.
  3. The owner submits the source-chain calls returned in quote.transaction or quote.userOp.
  4. The relayer bridges the funds when the source and destination chains differ, then executes the vault deposit.
  5. Your application tracks the SRA with earn.watchStatus or earn.getStatus.

Same-chain deposits use the same flow without the bridge step.

Supported operations

OperationMethodsNotes
Deposit into Aave V3earn.aave.depositSupplies an Aave reserve
Deposit into Morpho, Fluid, or Yearnearn.morpho.deposit, earn.fluid.deposit, earn.yearn.depositinto accepts a discovered vault or raw contract address
Deposit into another ERC-4626 vaultearn.erc4626.deposit, earn.depositIntoVaultGeneric or explicitly selected protocol
Discover vaultsearn.listVaults, earn.getVaultListings come from vaults.fyi and are filtered for supported protocols and assets
Track a depositearn.watchStatus, earn.getStatusStatus is scoped to the SRA
Withdraw a vault positionearn.withdrawFromVaultSame-chain; vault must be known to vaults.fyi
Recover funds from an SRAearn.getWithdrawCallsRequires the SRA owner to sign

See Supported protocols and vaults for protocol-specific methods, accepted targets, chains, tokens, and constraints.

Start integrating

On this page