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:
The function returns a boolean indicating approval.
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