Skip to main content

BaseConditionalOrder

BaseConditionalOrder is an abstract contract serving as the foundational layer for creating custom programmatic order types in CoW Protocol. It implements IConditionalOrderGenerator and handles verification workflows, enabling developers to focus on order generation logic.

Core Implementation Requirements

Developers must implement the getTradeableOrder function, which generates discrete CoW Protocol orders based on conditional parameters. This function receives: The function must return a valid GPv2Order.Data struct.

Error Handling

The contract specifies distinct error types for watchtower optimization:

Key Features

  • Automatic hash verification through the verify function, which compares generated order hashes against provided hashes
  • ERC-165 interface detection via supportsInterface

Best Practices

  • Validate input data early
  • Use precise timing signals rather than generic errors
  • Store dynamic state via the cabinet mechanism
  • Ensure unique order hashes (typically through distinct validTo values)
  • Handle all edge cases including pre-start and post-expiration states
Last modified on March 12, 2026