Skip to main content
Post-hooks let you chain actions after a swap settles — stake received tokens, bridge them to another chain, or deposit into a vault. This tutorial shows complete worked examples for each pattern.
Post-hooks that need to act on received tokens must use CoW Shed. Without it, the tokens land in your wallet but the post-hook executes in the HooksTrampoline contract, which can’t access your wallet.

How Post-Hooks Work

Example 1: Swap → Stake (Lido stETH)

Swap USDC for WETH, then stake the WETH into Lido to receive stETH.

Example 2: Swap → Bridge (Across Protocol)

Swap tokens on Ethereum, then bridge the received tokens to Arbitrum via Across.
CoW Swap also supports native cross-chain swaps through the UI, which handles bridging automatically without custom hooks.

Example 3: Swap → Vault Deposit (ERC-4626)

Swap tokens and deposit into an ERC-4626 yield vault:

Key Considerations

Gas Limits

Amount Handling

Post-hooks execute with a fixed amount — the exact callData you sign. If the swap returns more tokens than expected (surplus), the extra tokens remain in the CoW Shed proxy. To handle variable amounts, you can:
  • Use the full balance in the CoW Shed proxy (if the protocol supports type(uint256).max)
  • Set the post-hook amount to the order’s buyAmount (guaranteed minimum)

Failure Modes

If a post-hook fails, the entire settlement transaction reverts — your swap doesn’t execute either. Ensure:
  • Sufficient gas limits for each hook operation
  • Correct token approvals in the hook chain
  • The target protocol accepts the deposit/stake/bridge at the time of execution

Next Steps

Last modified on March 12, 2026