// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.8.0 <0.9.0; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; // See https://github.com/curvefi/curve-burners/blob/main/contracts/burners/CowSwapBurner.vy#L44:L56 struct GPv2Order { IERC20 sellToken; IERC20 buyToken; address receiver; uint256 sellAmount; uint256 buyAmount; uint32 validTo; bytes32 appData; uint256 feeAmount; bytes32 kind; bool partiallyFillable; bytes32 sellTokenBalance; bytes32 buyTokenBalance; } /** * @notice Conditional Order Interface - verify a Cow order. * @author CoW Protocol Developers + mfw78 */ interface ICowConditionalOrder { /** * @notice This struct is used to uniquely identify a conditional order for an owner. * @dev H(handler || salt || staticData) **MUST** be unique for an owner. * @param handler The contract implementing the conditional order logic * @param salt Allows for multiple conditional orders of the same type and data (currently unused) * @param staticData Data available to ALL discrete orders created by the conditional order */ struct ConditionalOrderParams { ICowConditionalOrder handler; bytes32 salt; bytes staticData; } /** * @notice This error is returned by the `getTradeableOrder` function if the order conditions are not met. * @param reason Text explaining the reason the order is invalid */ error OrderNotValid(string reason); // Errors specific to polling (interpreted by the off-chain Watchtower). /** * @notice Polling should be retried at the next block. * @param reason Text description of the reason it should be retried */ error PollTryNextBlock(string reason); /** * @notice Polling should be retried at a specific block number. * @param blockNumber The block number when polling should resume * @param reason Text description of the reason it should be retried */ error PollTryAtBlock(uint256 blockNumber, string reason); /** * @notice Polling should be retried at a specific epoch (unix timestamp). * @param timestamp The unix timestamp when polling should resume * @param reason Text description of the reason it should be retried */ error PollTryAtEpoch(uint256 timestamp, string reason); /** * @notice The conditional order should not be polled again (i.e., deleted). * @param reason Text description of the reason it should be deleted */ error PollNever(string reason); /** * @notice Verify that a given discrete order is valid. * @dev Used in combination with `isValidSafeSignature` to verify that the order is signed by the Safe. * **MUST** revert if any order conditions are not met. The `order` parameter is ignored / not validated by the * `ICowConditionalOrderGenerator` implementation. This parameter is included to allow more granular control over * the order verification logic, and to allow a watchtower / user to propose a discrete order without it being * generated by on-chain logic. See https://docs.cow.fi/cow-protocol/reference/contracts/periphery/composable-cow. * * @param owner The owner of the order (usually a contract) * @param sender The `msg.sender` calling `isValidSignature` * @param _hash `EIP712` order digest * @param domainSeparator `EIP712` domain separator * @param ctx See docs.cow.fi/cow-protocol/reference/contracts/periphery/composable-cow#execution-context * @param staticInput Conditional order type-specific data known at time of creation for all discrete orders * @param offchainInput Type-specific data NOT known at time of creation for a specific discrete order (or zero) * @param order The proposed discrete order's `GPv2Order` data struct */ function verify( address owner, address sender, bytes32 _hash, bytes32 domainSeparator, bytes32 ctx, bytes calldata staticInput, bytes calldata offchainInput, GPv2Order calldata order ) external view; }