Skip to main content

GPv2VaultRelayer API

The GPv2VaultRelayer contract serves as an intermediary between CoW Protocol’s settlement system and Balancer Vault, facilitating fund transfers and swap execution with protocol fees.

State Variables

Access Control

All external functions are restricted to the creator (settlement contract) through the onlyCreator modifier.

Functions

transferFromAccounts

Moves sell token amounts from user accounts to the settlement contract.
Supports three balance types:

batchSwapWithFee

Executes multi-step swaps through Balancer pools and simultaneously collects protocol fees.
Parameters: Returns: int256[] - Token deltas indicating amounts sent and received. The function handles both sell orders (GIVEN_IN) and buy orders (GIVEN_OUT) swap kinds.

Security

  • Access restricted exclusively to the creator through onlyCreator
  • Unauthorized calls revert with "GPv2: not creator"
  • Immutable state prevents tampering
  • Users never interact with this contract directly
Last modified on March 4, 2026