Skip to main content
Generalized wrappers are under active development and the API may change. The flagship implementation is the Euler/EVC integration.
Generalized wrappers are smart contracts that solvers call instead of the settlement contract directly. A wrapper executes custom logic before and/or after the settlement, enabling use cases that are impossible with CoW Hooks alone — such as leveraged positions, flash loans, and programmatic order execution for all wallet types.

How wrappers work

When a settlement uses wrappers, the solver does not call settle() on the settlement contract. Instead, the solver calls wrappedSettle() on the first wrapper in the chain. The execution flow is nested:
  1. The solver calls wrappedSettle(settleData, chainedWrapperData) on the outermost wrapper.
  2. The wrapper runs its pre-settlement logic.
  3. The wrapper calls _next(), which either chains to the next wrapper or calls the settlement contract.
  4. After settlement returns, the wrapper runs its post-settlement logic.
When multiple wrappers are chained, execution nests like function calls:
Solver → Wrapper1(pre) → Wrapper2(pre) → Settlement → Wrapper2(post) → Wrapper1(post)
This nesting means each wrapper has full control over the execution context both before and after the inner call completes.

How wrappers are specified

Wrappers are specified in the order’s appData via a wrappers array. Each entry contains a target (the wrapper contract address) and an optional data field for wrapper-specific parameters. This is distinct from hooks, which are specified per-order in the metadata.hooks field.

Authentication and security

Only allowlisted wrapper contracts can call the settlement contract. Allowlisting is governed by CoW DAO through the GPv2AllowlistAuthenticator. Before a wrapper can be added to the allowlist, it must be audited by a well-known security provider. Wrapper implementations should treat all parameters as untrusted. Because wrappers are nested, a wrapper further down the chain could modify the settlement data before it reaches the settlement contract. Defensive design is required.

Gas overhead

An empty wrapper (one that performs no custom logic) adds approximately 22,272 gas (~11.4% overhead) on a single Uniswap V3 trade. Real-world wrappers will add more depending on the complexity of their pre- and post-settlement logic.

How wrappers differ from hooks

HooksWrappers
ScopePer-order; run alongside a specific orderPer-settlement; can inspect and modify the entire settlement
Executed byThe settlement contractThe solver, before calling settlement
ApprovalNo DAO approval requiredMust be allowlisted by CoW DAO
Entry pointSettlement contract’s settle()Wrapper’s wrappedSettle()
Hooks are lightweight per-order actions. Wrappers replace the settlement entry point entirely and are suited for use cases that need to wrap the entire settlement execution.

Use cases

  • Leveraged positions: The flagship use case. The Euler/EVC integration uses wrappers to open, modify, and close leveraged positions atomically as part of a CoW Protocol settlement.
  • Flash loan integration: Wrappers can take flash loans before settlement and repay them after, providing capital efficiency for solvers.
  • Programmatic order execution: Wrappers enable programmatic order patterns for all wallet types, not just smart contract wallets.

Implementation

The abstract CowWrapper contract that wrapper implementations extend lives in the Euler integration contracts repository. Wrapper developers inherit from this base contract and implement their custom pre- and post-settlement logic.
Last modified on March 12, 2026