Skip to main content
lifi.zap is one of many ops the Composer supports. It has a dedicated page here because it’s worth explaining in depth — for the complete, live list of every op, see the Op Catalog.
lifi.zap is the entry point for any position registered as a compose routing edge: ERC-4626 vaults, Aave-style lending markets, Pendle, Yearn, and more. It consumes an input resource and produces an output resource matching resourceOut, internally composing a swap (if needed) with the protocol-specific enter-position edge. Unlike lifi.swap, the aggregator does not guarantee a minimum output on the zap output port — always attach a slippage guard on amountOut. See the routing edges catalog for protocols and tokens currently supported.

Example

Zap USDC into Aave v3 aEthUSDC on Ethereum mainnet:
builder.lifi.zap('zap', {
  bind: { amountIn: builder.inputs.amountIn },
  config: {
    resourceOut: resources.erc20(A_ETH_USDC, 1),
  },
  guards: [guards.slippage({ port: 'amountOut', bps: 100 })],
});
Full runnable recipe: Swap and Deposit.