NotASettlement
Definition
Description
This error is thrown when a caller attempts to execute hooks through the trampoline without being the authorized settlement contract. The mechanism enforces that exclusively the CoW Protocol settlement contract can execute hooks, functioning as a critical security control.When It’s Thrown
The error activates through theonlySettlement modifier when:
msg.senderdoes not match thesettlementaddress stored in the contract- Any external caller (other than the settlement contract) attempts to call
execute()
Code Location
Example Scenarios
Successful Call (No Error)Catching the Error
Error Selector
How to Handle
Prevention
Design Pattern
Debugging
1
Verify caller
Check that the caller is the settlement contract address using events or debuggers to inspect
msg.sender.2
Check trampoline configuration
Verify the trampoline was deployed with the correct settlement address.
3
Review integration flow
Ensure your integration follows the correct pattern: order -> settlement -> trampoline -> hook target.
Testing
Related Errors
Out of Gas
While not a custom error, hooks may fail due to insufficient gas:Unlike
NotASettlement, out-of-gas errors are not caught. The entire transaction will revert if any hook’s gas limit cannot be satisfied.Hook Target Reverts
Hook target reverts do not cause
NotASettlement or block the settlement. They simply result in the hook not executing its logic.Related
- HooksTrampoline Contract — Contract API reference
- Hook Struct — Hook structure specification
- Usage Guide — Implementation guide