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 toresourceOut, the compile fails withno_route_error. Chain alifi.swapto the edge’s input token first, or letsdk.routeplan 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
slippageguard toamountOut. - 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’sinAmountMinandinAmountMax, in the input token’s base units. An amount outside them fails the compile’s simulation. recipientdepends on the edge. Most edges keep the output in the execution proxy, and binding the optionalrecipientinput is an error. Edges markedrecipient: "required"in the routing catalog, such as IPOR vault deposits, mint the output straight torecipient. On these, addrecipient: builder.context.sender(or another address handle) tobind.
Example
Deposit 1,000 USDC into Aave v3 (aEthUSDC) on Ethereum mainnet:Errors
Related
lifi.swap: swap to the edge’s input token first.- Routing catalog: every edge a zap can run.
- Swap and deposit and Deposit with a server-planned route: full recipes.

