Documentation Index
Fetch the complete documentation index at: https://cowswap-mintlify-seo-audit-1777280932.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
ISwapGuard
TheISwapGuard interface enables CoW Protocol to restrict order settlements through ComposableCoW by implementing a verification mechanism.
Core Function
The interface requires a singleverify() function that evaluates whether an order meets security criteria before settlement. This function receives:
| Parameter | Type | Description |
|---|---|---|
order | GPv2Order.Data | The CoW Protocol order data |
ctx | bytes32 | Context identifier (either bytes32(0) for merkle trees or a hash for cabinet lookups) |
params | ConditionalOrderParams | Programmatic order parameters |
offchainInput | bytes | Optional off-chain verification input |
Implementation Examples
ReceiverLock
Restricts orders to self-transfers only, preventing fund redirection by ensuring the receiver is set toaddress(0).
TokenWhitelistGuard
Maintains an approved token list, validating both the sell and buy tokens against this whitelist.AmountLimitGuard
Enforces maximum trade sizes by checking the sell amount against a configured limit.Key Requirements
- Implementations should inherit from
BaseSwapGuardfor proper ERC-165 interface support - Verification logic must remain stateless, deterministic, and gas-efficient since it executes during order validation