Skip to main content
lifi.zap moves a token into or out of a protocol position, such as an ERC-4626 vault, an Aave market, a staking token or a wrapper. It consumes the resource on amountIn and produces a resource of the resourceOut token on amountOut, on the same chain. The op runs exactly one routing edge: a catalog entry that turns one token into another through one protocol action, for example USDC → aEthUSDC through an Aave v3 deposit. It handles every edge type (enter-position, exit-position, wrap, unwrap, mint, burn). The routing catalog lists every edge.

Ports

Config

Rules

  • One edge, no swap. If no edge goes from amountIn’s token to resourceOut, the compile fails with no_route_error. Chain a lifi.swap to the edge’s input token first, or let sdk.route plan up to two hops, with a swap only as the first hop (see Deposit with a server-planned route).
  • No output floor. No edge encodes a minimum output. Attach a slippage guard to amountOut.
  • Deposit limits. Some protocols cap a deposit or withdrawal, for example an ERC-4626 vault’s maxDeposit. The routing catalog reports the caps as the edge’s inAmountMin and inAmountMax, in the input token’s base units. An amount outside them fails the compile’s simulation.
  • recipient depends on the edge. Most edges keep the output in the execution proxy, and binding the optional recipient input is an error. Edges marked recipient: "required" in the routing catalog, such as IPOR vault deposits, mint the output straight to recipient. On these, add recipient: builder.context.sender (or another address handle) to bind.

Example

Deposit 1,000 USDC into Aave v3 (aEthUSDC) on Ethereum mainnet:
Full runnable recipe: Swap and deposit.

Errors