Verified contractExactMIT
CowOrderLane
Address0x9ecd0b2d84861c6b3fa82774ca89d9bc66120eaf
- Balance
0 ETH
- Transactions
0
- Compiler
solc 0.8.28
- Same code
2 more contracts
Details
- Compiler
- solc 0.8.28+commit.7893614a
- Language
- solidity
- Optimization
- Yes, 5 runs
- EVM version
- prague
- License
- MIT
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,455,291
- Creation transaction
- 0xdc86edaf9c…0a71095a13
13 files
- node_modules/@shift-defi/cow-protocol-adapter/src/CowOrderLane.solmain3.7 KB
- lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/interfaces/IERC1271.sol653 B
- lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/interfaces/IERC1363.sol4.45 KB
- lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/interfaces/IERC165.sol192 B
- lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/interfaces/IERC20.sol181 B
- lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol2.78 KB
- lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol9.39 KB
- lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/utils/ReentrancyGuard.sol3.38 KB
- lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol870 B
- node_modules/@shift-defi/cow-protocol-adapter/src/interfaces/ICowOrderLane.sol4.19 KB
- node_modules/@shift-defi/cow-protocol-adapter/src/interfaces/ICowProtocolAdapter.sol22.23 KB
- node_modules/@shift-defi/cow-protocol-adapter/src/interfaces/IGPv2Settlement.sol2.04 KB
- node_modules/@shift-defi/cow-protocol-adapter/src/interfaces/IOwnerImmutable.sol894 B
node_modules/@shift-defi/cow-protocol-adapter/src/CowOrderLane.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import {ICowOrderLane} from "./interfaces/ICowOrderLane.sol";
import {ICowProtocolAdapter} from "./interfaces/ICowProtocolAdapter.sol";
import {IGPv2Settlement} from "./interfaces/IGPv2Settlement.sol";
/// @title CowOrderLane
/// @notice The address an adapter's order names as its owner, so that the order holds a sell
/// token allowance row of its own.
/// @dev Deployed once per adapter as an implementation, then cloned per lane. A clone
/// `delegatecall`s this code, so every clone reads the immutables baked into this
/// contract's bytecode while `address(this)` is the clone's own address.
///
/// The reentrancy guard's slot belongs to the clone and reads as unentered at any value but
/// the entered one, so a clone is guarded from its first call without running a constructor.
contract CowOrderLane is ICowOrderLane, ReentrancyGuard {
using SafeERC20 for IERC20;
address internal immutable ADAPTER;
address internal immutable RECIPIENT;
IGPv2Settlement internal immutable SETTLEMENT;
address internal immutable VAULT_RELAYER;
/// @dev Restricts a function to the adapter.
modifier onlyAdapter() {
_checkAdapter();
_;
}
/// @dev Every counterparty is fixed here rather than passed per call.
/// @param _adapter The adapter the lane obeys.
/// @param _recipient The only address the lane can send value to, the adapter's owner.
/// @param _settlement The settlement contract the lane cancels orders at.
/// @param _vaultRelayer The address the lane grants token allowances to.
constructor(address _adapter, address _recipient, address _settlement, address _vaultRelayer) {
ADAPTER = _adapter;
RECIPIENT = _recipient;
SETTLEMENT = IGPv2Settlement(_settlement);
VAULT_RELAYER = _vaultRelayer;
}
/// @inheritdoc ICowOrderLane
function approveRelayer(address token, uint256 amount) external onlyAdapter nonReentrant {
IERC20(token).forceApprove(VAULT_RELAYER, amount);
}
/// @inheritdoc ICowOrderLane
function invalidateOrder(bytes calldata orderUid) external onlyAdapter nonReentrant {
SETTLEMENT.invalidateOrder(orderUid);
}
/// @inheritdoc ICowOrderLane
function drain(address token) external onlyAdapter nonReentrant returns (uint256) {
uint256 amount = IERC20(token).balanceOf(address(this));
if (amount != 0) {
IERC20(token).safeTransfer(RECIPIENT, amount);
}
return amount;
}
/// @inheritdoc ICowOrderLane
function isValidSignature(bytes32 orderDigest, bytes calldata) external view returns (bytes4) {
return ICowProtocolAdapter(ADAPTER).isValidSignatureForLane(address(this), orderDigest);
}
/// @inheritdoc ICowOrderLane
function adapter() external view returns (address) {
return ADAPTER;
}
/// @inheritdoc ICowOrderLane
function recipient() external view returns (address) {
return RECIPIENT;
}
/// @inheritdoc ICowOrderLane
function settlement() external view returns (address) {
return address(SETTLEMENT);
}
/// @inheritdoc ICowOrderLane
function vaultRelayer() external view returns (address) {
return VAULT_RELAYER;
}
function _checkAdapter() internal view {
require(msg.sender == ADAPTER, NotAdapter(msg.sender));
}
}
lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/interfaces/IERC1271.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1271.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC-1271 standard signature validation method for
* contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].
*/
interface IERC1271 {
/**
* @dev Should return whether the signature provided is valid for the provided data
* @param hash Hash of the data to be signed
* @param signature Signature byte array associated with _data
*/
function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);
}
lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/interfaces/IERC1363.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363.sol)
pragma solidity ^0.8.20;
import {IERC20} from "./IERC20.sol";
import {IERC165} from "./IERC165.sol";
/**
* @title IERC1363
* @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
*
* Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
* after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
*/
interface IERC1363 is IERC20, IERC165 {
/*
* Note: the ERC-165 identifier for this interface is 0xb0202a11.
* 0xb0202a11 ===
* bytes4(keccak256('transferAndCall(address,uint256)')) ^
* bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
* bytes4(keccak256('approveAndCall(address,uint256)')) ^
* bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
*/
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferAndCall(address to, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @param data Additional data with no specified format, sent in call to `to`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param from The address which you want to send tokens from.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferFromAndCall(address from, address to, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param from The address which you want to send tokens from.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @param data Additional data with no specified format, sent in call to `to`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function approveAndCall(address spender, uint256 value) external returns (bool);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
* @param data Additional data with no specified format, sent in call to `spender`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}
lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/interfaces/IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "../utils/introspection/IERC165.sol";
lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/interfaces/IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../token/ERC20/IERC20.sol";
lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC-20 standard as defined in the ERC.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}
lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.2.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC-20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
/**
* @dev An operation with an ERC-20 token failed.
*/
error SafeERC20FailedOperation(address token);
/**
* @dev Indicates a failed `decreaseAllowance` request.
*/
error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*
* IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
* smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
* this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
* that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
forceApprove(token, spender, oldAllowance + value);
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
* value, non-reverting calls are assumed to be successful.
*
* IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
* smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
* this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
* that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
unchecked {
uint256 currentAllowance = token.allowance(address(this), spender);
if (currentAllowance < requestedDecrease) {
revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
}
forceApprove(token, spender, currentAllowance - requestedDecrease);
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*
* NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
* only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
* set here.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
* code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* Reverts if the returned value is other than `true`.
*/
function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
if (to.code.length == 0) {
safeTransfer(token, to, value);
} else if (!token.transferAndCall(to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
* has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* Reverts if the returned value is other than `true`.
*/
function transferFromAndCallRelaxed(
IERC1363 token,
address from,
address to,
uint256 value,
bytes memory data
) internal {
if (to.code.length == 0) {
safeTransferFrom(token, from, to, value);
} else if (!token.transferFromAndCall(from, to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
* code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
* Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
* once without retrying, and relies on the returned value to be true.
*
* Reverts if the returned value is other than `true`.
*/
function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
if (to.code.length == 0) {
forceApprove(token, to, value);
} else if (!token.approveAndCall(to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturnBool} that reverts if call fails to meet the requirements.
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
uint256 returnSize;
uint256 returnValue;
assembly ("memory-safe") {
let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
// bubble errors
if iszero(success) {
let ptr := mload(0x40)
returndatacopy(ptr, 0, returndatasize())
revert(ptr, returndatasize())
}
returnSize := returndatasize()
returnValue := mload(0)
}
if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silently catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
bool success;
uint256 returnSize;
uint256 returnValue;
assembly ("memory-safe") {
success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
returnSize := returndatasize()
returnValue := mload(0)
}
return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);
}
}
lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/utils/ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/ReentrancyGuard.sol)
pragma solidity ^0.8.20;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If EIP-1153 (transient storage) is available on the chain you're deploying at,
* consider using {ReentrancyGuardTransient} instead.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant NOT_ENTERED = 1;
uint256 private constant ENTERED = 2;
uint256 private _status;
/**
* @dev Unauthorized reentrant call.
*/
error ReentrancyGuardReentrantCall();
constructor() {
_status = NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be NOT_ENTERED
if (_status == ENTERED) {
revert ReentrancyGuardReentrantCall();
}
// Any calls to nonReentrant after this point will fail
_status = ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == ENTERED;
}
}
lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC-165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[ERC].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
node_modules/@shift-defi/cow-protocol-adapter/src/interfaces/ICowOrderLane.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;
import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";
/// @title ICowOrderLane
/// @notice Interface for a lane: the address an adapter's order names as its owner, so that the
/// order holds a sell token allowance row of its own.
/// @dev CoW Protocol binds four roles to an order's owner — it holds the sell tokens, grants the
/// vault relayer its allowance, answers the ERC-1271 check, and is the only caller
/// settlement's `invalidateOrder` accepts. Orders naming different lanes share no allowance
/// row.
///
/// A lane holds no state and knows nothing about the order it carries. Its adapter, that
/// adapter's owner, the settlement contract and the vault relayer are fixed in the
/// implementation it delegates to, so no caller supplies any of them.
interface ICowOrderLane is IERC1271 {
/// @notice Thrown when any address other than the adapter calls the lane.
/// @param caller The rejected caller.
error NotAdapter(address caller);
/// @notice Grants the vault relayer an allowance over the lane's balance of a token.
/// @dev An absolute set rather than an increase; a lane carries at most one pending order
/// per token. Uses `forceApprove`, so a token that refuses to move a non-zero allowance
/// directly to another non-zero value is handled.
/// @param token The token to grant the allowance over.
/// @param amount The allowance to leave in place.
function approveRelayer(address token, uint256 amount) external;
/// @notice Cancels an order this lane owns, so no trade against it can settle.
/// @dev Settlement accepts the call only from the address encoded in `orderUid`.
/// @param orderUid The order's unique identifier.
function invalidateOrder(bytes calldata orderUid) external;
/// @notice Sends the lane's whole balance of a token to the adapter's owner.
/// @dev The destination is fixed in the implementation, so the caller does not choose it.
/// @param token The token to send.
/// @return amount The amount sent, which is zero where the lane held none.
function drain(address token) external returns (uint256 amount);
/// @notice Whether the adapter endorses the order carried by an EIP-712 digest under this
/// lane, the ERC-1271 check settlement makes before filling an order the lane owns.
/// @dev Delegates the judgement to the adapter, which holds the order records. The adapter
/// endorses the digest only where its record is pending and names this lane.
/// @param orderDigest The order's EIP-712 digest, the value settlement presents for
/// verification.
/// @param signature Ignored; present because ERC-1271 fixes this signature.
/// @return magicValue `IERC1271.isValidSignature.selector` where the adapter endorses the
/// order, zero otherwise.
function isValidSignature(bytes32 orderDigest, bytes calldata signature)
external
view
override
returns (bytes4 magicValue);
/// @notice The adapter this lane belongs to, and its only permitted caller.
/// @dev Fixed in the implementation, which each adapter deploys for itself.
/// @return The adapter address.
function adapter() external view returns (address);
/// @notice The only address the lane can send value to.
/// @dev The adapter's immutable owner, fixed in the implementation alongside {adapter}.
/// @return The recipient address.
function recipient() external view returns (address);
/// @notice The CoW Protocol settlement contract the lane cancels orders at.
/// @dev Fixed in the implementation. The same contract the adapter places orders against.
/// @return The settlement contract address.
function settlement() external view returns (address);
/// @notice The address the lane grants token allowances to.
/// @dev Fixed in the implementation. The spender half of the lane's allowance rows.
/// @return The vault relayer address.
function vaultRelayer() external view returns (address);
}
node_modules/@shift-defi/cow-protocol-adapter/src/interfaces/ICowProtocolAdapter.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;
import {IOwnerImmutable} from "./IOwnerImmutable.sol";
/// @title ICowProtocolAdapter
/// @notice Interface for the CoW Protocol adapter. The owner is the contract the adapter
/// instance is bound to; see {IOwnerImmutable} for the access-control surface.
interface ICowProtocolAdapter is IOwnerImmutable {
/// @notice The stage of an order's life the adapter has recorded.
/// @dev `None` is the zero value. `Filled` and `Cancelled` are terminal, and a record is
/// never deleted, so a digest in either state can never be placed again.
enum OrderStatus {
None,
Pending,
Filled,
Cancelled
}
/// @notice What the adapter establishes about whether a pending order has filled.
/// @dev Every pending order has one of these verdicts. Settlement's fill record decides it
/// where that record is conclusive, the lane's relayer allowance otherwise.
/// @param Unfilled No sell tokens have been pulled for the order.
/// @param Filled The order has been filled and its bought tokens delivered to the owner.
/// @param Invalidated Settlement holds the cancellation marker for the order.
enum FillVerdict {
Unfilled,
Filled,
Invalidated
}
/// @notice The caller-supplied part of an order.
/// @dev The remaining fields are fixed by the adapter: `kind` is sell, `receiver` is the
/// owner, `partiallyFillable` is false, `feeAmount` is zero, and both balance fields
/// are plain ERC-20.
/// @param sellToken The token to sell.
/// @param buyToken The token to buy.
/// @param sellAmount The exact amount of `sellToken` to sell.
/// @param buyAmount The least `buyToken` the order accepts for it.
/// @param validTo The unix timestamp after which the order is no longer fillable.
/// @param appData The hash of the order's off-chain metadata.
struct OrderParams {
address sellToken;
address buyToken;
uint256 sellAmount;
uint256 buyAmount;
uint32 validTo;
bytes32 appData;
}
/// @notice The adapter's record of an order it placed.
/// @dev Keyed by the order's EIP-712 digest and kept after the order resolves.
/// @param sellToken The token the order sells.
/// @param validTo The unix timestamp after which the order is no longer fillable.
/// @param status The stage of the order's life.
/// @param lane The index of the lane that owns the order and holds its sell tokens.
/// @param sellAmount The exact amount of `sellToken` the order sells.
/// @param buyAmount The least buy token the order accepts for it.
struct OrderRecord {
address sellToken;
uint32 validTo;
OrderStatus status;
uint8 lane;
uint256 sellAmount;
uint256 buyAmount;
}
/// @notice Emitted once at construction, when the adapter is bound to a settlement contract.
/// @param settlement The CoW Protocol settlement contract the adapter is bound to.
/// @param vaultRelayer The relayer that settlement reported, read at construction.
/// @param domainSeparator The EIP-712 domain separator that settlement reported, read at
/// construction.
event SettlementSet(address indexed settlement, address indexed vaultRelayer, bytes32 domainSeparator);
/// @notice Emitted when an order is placed and its sell tokens are committed to it.
/// @param orderDigest The order's EIP-712 digest, the key it is recorded under.
/// @param sellToken The token the order sells.
/// @param buyToken The token the order buys.
/// @param sellAmount The exact amount of `sellToken` the order sells.
/// @param buyAmount The least `buyToken` the order accepts for it.
/// @param validTo The unix timestamp after which the order is no longer fillable.
/// @param lane The address of the lane that owns the order and holds its sell tokens.
/// @param uid The identifier settlement records fills of the order under.
event OrderPlaced(
bytes32 indexed orderDigest,
address indexed sellToken,
address indexed buyToken,
uint256 sellAmount,
uint256 buyAmount,
uint32 validTo,
address lane,
bytes uid
);
/// @notice Emitted when an order needs a lane index that has never been used.
/// @param index The lane's index.
/// @param lane The lane's address.
event LaneDeployed(uint256 indexed index, address indexed lane);
/// @notice Emitted when a filled order is resolved and its commitment released.
/// @param orderDigest The order's EIP-712 digest.
/// @param sellToken The token the order sold.
/// @param sellAmount The commitment released, which is what the order sold.
/// @param filled The sell amount settlement records the order as filled for, zero where the
/// fill was established from the lane's allowance instead.
/// @param returned The amount drained from the lane to the owner.
event OrderResolved(
bytes32 indexed orderDigest, address indexed sellToken, uint256 sellAmount, uint256 filled, uint256 returned
);
/// @notice Emitted when an order is cancelled and its sell tokens returned.
/// @param orderDigest The order's EIP-712 digest.
/// @param sellToken The token the order sold.
/// @param returned The amount drained from the lane to the owner.
event OrderCancelled(bytes32 indexed orderDigest, address indexed sellToken, uint256 returned);
/// @notice Emitted when a token balance held by the adapter is returned to the owner.
/// @param token The token that was swept.
/// @param amount The amount transferred to the owner.
event TokensSwept(address indexed token, uint256 amount);
/// @notice Emitted when a token balance held by a lane is returned to the owner.
/// @param laneIndex The lane that was swept.
/// @param token The token that was swept.
/// @param amount The amount transferred to the owner.
event LaneSwept(uint256 indexed laneIndex, address indexed token, uint256 amount);
/// @notice Thrown when the zero address is supplied as the settlement contract.
error ZeroSettlement();
/// @notice Thrown when the settlement contract reports the zero address as its relayer.
error ZeroVaultRelayer();
/// @notice Thrown when the settlement contract reports a zero EIP-712 domain separator.
error ZeroDomainSeparator();
/// @notice Thrown when a sweep is attempted for a token no balance is held of.
error NothingToSweep();
/// @notice Thrown when an order names the zero address as its sell token.
error ZeroSellToken();
/// @notice Thrown when an order names the zero address as its buy token.
error ZeroBuyToken();
/// @notice Thrown when an order sells and buys the same token.
error IdenticalTokens();
/// @notice Thrown when an order sells nothing.
error ZeroSellAmount();
/// @notice Thrown when an order buys nothing.
error ZeroBuyAmount();
/// @notice Thrown when an order carries no expiry.
error ZeroValidTo();
/// @notice Thrown when an order is placed with an expiry that has already passed.
/// @param validTo The order's expiry.
/// @param timestamp The block timestamp it was compared against.
error ValidToInPast(uint32 validTo, uint256 timestamp);
/// @notice Thrown when an order's sell token delivered less than was pulled.
/// @dev Measured as the lane's balance change across the pull, so a token taking a fee on
/// transfer is rejected.
/// @param requested The amount the adapter pulled.
/// @param received The balance change it measured.
error SellTokenShortfall(uint256 requested, uint256 received);
/// @notice Thrown when an order is placed under a digest this adapter has already used.
/// @dev A digest is spent for the adapter's lifetime, whether its order is pending or has
/// since resolved. Vary any order field to place another order.
/// @param orderDigest The digest already recorded.
error OrderDigestUsed(bytes32 orderDigest);
/// @notice Thrown when every lane is already carrying a pending order on the sell token.
/// @dev A sell token has 256 lanes. Resolve or cancel an order on the token to free one.
/// @param sellToken The token whose lanes are exhausted.
error NoFreeLane(address sellToken);
/// @notice Thrown when a cancellation names an order the adapter establishes has filled.
/// @dev Resolve it instead. `filled` is zero where the fill was established from the lane's
/// allowance rather than from settlement's record.
/// @param orderDigest The digest named.
/// @param filled The amount settlement records the order as filled for.
error OrderFilled(bytes32 orderDigest, uint256 filled);
/// @notice Thrown when a resolution names an order the adapter cannot establish has filled.
/// @dev Cancel it instead.
/// @param orderDigest The digest named.
/// @param verdict What the adapter establishes about the order.
error OrderNotFilled(bytes32 orderDigest, FillVerdict verdict);
/// @notice Thrown when an order the adapter placed is still pending.
/// @dev Read {fillVerdict} for each of {pendingOrderDigests} to see which orders are
/// outstanding.
/// @param pendingOrders How many orders are still pending.
error OrdersStillPending(uint256 pendingOrders);
/// @notice Thrown when a call names a digest the adapter holds no order under.
/// @param orderDigest The digest supplied.
error OrderUnknown(bytes32 orderDigest);
/// @notice Thrown when a call names a digest that carries no pending order.
/// @dev Covers a digest never placed and one whose order has already resolved or been
/// cancelled.
/// @param orderDigest The digest named.
error OrderNotPending(bytes32 orderDigest);
/// @notice Thrown when a call names an index at or above the number of lanes deployed.
/// @param index The index asked for.
/// @param deployed How many lanes exist.
error LaneIndexOutOfRange(uint256 index, uint256 deployed);
/// @notice Thrown when a lane sweep names a lane that is carrying a pending order on the
/// token.
/// @param laneIndex The lane named.
/// @param token The token named.
error LaneOccupied(uint256 laneIndex, address token);
/// @notice Thrown when a lane index at or above the lane count is supplied.
/// @dev Distinct from {LaneIndexOutOfRange}, which is about lanes not yet deployed: such an
/// index names no lane at any point in the adapter's life.
/// @param index The index supplied.
/// @param laneCount How many lanes a sell token has.
error LaneIndexTooLarge(uint256 index, uint256 laneCount);
/// @notice Places an order, pulling its sell tokens from the owner and granting the vault
/// relayer the allowance settlement needs to collect them.
/// @dev The order is assigned the lowest-numbered lane carrying no pending order on
/// `params.sellToken`, deploying that lane where its index has never been used. The
/// lane, not the adapter, owns the order: it holds the sell tokens, grants the
/// allowance and is the address encoded in the identifier {OrderPlaced} carries.
///
/// Reverts with {NoFreeLane} where the token has all 256 lanes occupied, and with
/// {SellTokenShortfall} where the lane's balance grows by less than `params.sellAmount`.
/// Any excess delivered is left on the lane and reaches the owner when the order
/// resolves.
/// @param params The caller-supplied part of the order.
/// @return orderDigest The order's EIP-712 digest, the key {resolveOrder}, {cancelOrder} and
/// {orderRecord} take it by. The identifier settlement records fills under is carried
/// by {OrderPlaced}.
function placeOrder(OrderParams calldata params) external returns (bytes32 orderDigest);
/// @notice Resolves one filled order, releasing its commitment and draining its lane to the
/// owner.
/// @dev Reverts with {OrderNotFilled} unless {fillVerdict} establishes the order as filled;
/// clearing one that has not is {cancelOrder}'s job. The incremental counterpart of
/// {requireNoPendingOrders}, for a pending set too large to resolve in one transaction.
///
/// No tokens move on the order's account: the fill delivered the bought tokens to the
/// owner and collected the sell amount. The drain carries home a placement overshoot or
/// a donation, and nothing where neither happened.
/// @param orderDigest The EIP-712 digest of the order to resolve.
function resolveOrder(bytes32 orderDigest) external;
/// @notice Resolves every filled order the adapter has placed, and reverts unless none is left
/// pending.
/// @dev The gate on a consumer's own state machine. Succeeds only where no order remains
/// pending, and reverts with {OrdersStillPending} otherwise, undoing the resolutions it
/// made. Resolves each filled order by the same steps {resolveOrder} takes for one, so
/// nothing has to be resolved individually first.
function requireNoPendingOrders() external;
/// @notice Cancels a pending order, retracting it at settlement and returning its sell
/// tokens to the owner.
/// @dev Invalidates the order at settlement through its lane, drops the lane's relayer
/// allowance to zero and drains it to the owner. Nothing else takes an order out of the
/// pending set on expiry: an expired order stays pending until this is called.
///
/// Reverts with {OrderFilled} for an order established as filled, which is
/// {resolveOrder}'s to take. A solver may fill the order between the decision to cancel
/// and this call, in which case it reverts.
/// @param orderDigest The EIP-712 digest of the order to cancel.
function cancelOrder(bytes32 orderDigest) external;
/// @notice Returns a token balance held by the adapter itself to the owner.
/// @dev The destination is the immutable owner. The whole balance is returned: an order's
/// sell tokens are held by its lane, so anything the adapter holds arrived unsolicited.
/// Reverts with {NothingToSweep} where the balance is zero.
/// @param token The token to return.
function sweep(address token) external;
/// @notice Returns a token balance held by one of the adapter's lanes to the owner.
/// @dev For balances that arrived at a lane outside an order; a lane's own order sends its
/// leftovers home when it resolves. Reverts with {LaneOccupied} where the lane carries
/// a pending order on `token`, and with {NothingToSweep} where the balance is zero. A
/// lane carrying an order on another token is sweepable for this one.
/// @param laneIndex The lane to sweep.
/// @param token The token to return.
function sweepLane(uint256 laneIndex, address token) external;
/// @notice Whether the adapter endorses the order carried by an EIP-712 digest under a given
/// lane, the judgement behind the ERC-1271 check settlement makes on that lane.
/// @dev Returns the magic value only where the digest carries a pending order whose record
/// names `lane`, so a digest never placed, one already resolved, one cancelled, and one
/// pending under a different lane all return zero.
///
/// A pending order is endorsed for as long as its record stays pending, `validTo`
/// included: settlement rejects an expired order itself.
/// @param lane The lane being asked, which settlement takes from the order's identifier.
/// @param orderDigest The order's EIP-712 digest.
/// @return magicValue `IERC1271.isValidSignature.selector` where the adapter endorses the
/// order under that lane, zero otherwise.
function isValidSignatureForLane(address lane, bytes32 orderDigest) external view returns (bytes4 magicValue);
/// @notice The unique identifier settlement would record fills of an order under, were it
/// placed on a given lane.
/// @dev Derived from the order's EIP-712 digest, the lane's address and `validTo`. Read
/// {nextLane} for the index an order not yet placed would be given, or
/// {orderRecord}`.lane` for one already placed. Reverts with {LaneIndexTooLarge} where
/// `laneIndex` names no lane.
/// @param params The caller-supplied part of the order.
/// @param laneIndex The index of the lane owning the order, below the lane count.
/// @return The order's 56-byte unique identifier.
function orderUid(OrderParams calldata params, uint256 laneIndex) external view returns (bytes memory);
/// @notice The unique identifier settlement records fills of a placed order under.
/// @dev Packed from the digest and the lane and `validTo` its record carries, so it answers
/// for an order in any state the adapter has recorded, pending or not. Reverts with
/// {OrderUnknown} where no order was ever placed under `orderDigest`.
/// @param orderDigest The order's EIP-712 digest, as returned by {placeOrder}.
/// @return The order's 56-byte unique identifier.
function orderUidOf(bytes32 orderDigest) external view returns (bytes memory);
/// @notice The lane the next order selling a token would be placed on.
/// @dev The lowest-numbered lane carrying no pending order on `sellToken`. Reverts with
/// {NoFreeLane} where the token has none. The answer holds until the next {placeOrder}
/// on that token.
/// @param sellToken The token the order would sell.
/// @return lane The lane's address.
/// @return index The lane's index.
function nextLane(address sellToken) external view returns (address lane, uint256 index);
/// @notice The address of the lane at an index, whether or not it has been deployed yet.
/// @dev A lane's address is a function of its index and this adapter alone. Reverts with
/// {LaneIndexTooLarge} at or above the lane count.
/// @param index The lane's index, below the lane count.
/// @return The lane's address.
function laneAt(uint256 index) external view returns (address);
/// @notice Which lanes are carrying a pending order on a token.
/// @dev A bit field: bit `i` is set where lane `i` carries a pending order selling `token`.
/// A lane may carry orders on several tokens at once.
/// @param token The sell token to report on.
/// @return The bit field of occupied lanes.
function laneOccupancy(address token) external view returns (uint256);
/// @notice How many lanes have been deployed.
/// @dev Rises only in {placeOrder}, and only for an index never used before; freeing a lane
/// never lowers it. Deployed lanes are the indices `0` to this count minus one.
/// @return The number of lanes deployed.
function deployedLaneCount() external view returns (uint256);
/// @notice The implementation every lane delegates its behaviour to.
/// @dev Deployed by this adapter at construction and bound to it. Lanes are minimal proxies
/// to it.
/// @return The lane implementation address.
function laneImplementation() external view returns (address);
/// @notice The order recorded under a digest.
/// @dev A `status` of `None` means the digest was never placed. The record is retained after
/// the order resolves.
/// @param orderDigest The order's EIP-712 digest.
/// @return The order record, or a zeroed struct if the digest was never placed.
function orderRecord(bytes32 orderDigest) external view returns (OrderRecord memory);
/// @notice What the adapter establishes about whether a pending order has filled.
/// @dev Reverts with {OrderNotPending} for a digest that carries no pending order. The
/// judgement does not depend on `block.timestamp`.
/// @param orderDigest The order's EIP-712 digest.
/// @return verdict What the adapter establishes.
/// @return filled The amount settlement records the order as filled for, which is zero where
/// the verdict came from the lane's allowance instead.
function fillVerdict(bytes32 orderDigest) external view returns (FillVerdict verdict, uint256 filled);
/// @notice How many orders the adapter has placed and not resolved.
/// @dev The size of the set {pendingOrderDigests} returns.
/// @return The number of pending orders.
function pendingOrderCount() external view returns (uint256);
/// @notice The digests of every order the adapter has placed and not resolved.
/// @dev A digest joins the set at {placeOrder} and leaves it when the order resolves or is
/// cancelled; the record itself is kept either way. Order within the set is not stable.
/// @return The pending order digests.
function pendingOrderDigests() external view returns (bytes32[] memory);
/// @notice The CoW Protocol settlement contract this adapter places orders against.
/// @dev Immutable — set once at construction, never reassigned.
/// @return The settlement contract address.
function settlement() external view returns (address);
/// @notice The address token allowances are granted to for settlement to pull sell tokens.
/// @dev Read from {settlement} at construction and fixed thereafter.
/// @return The vault relayer address.
function vaultRelayer() external view returns (address);
/// @notice The EIP-712 domain separator orders placed by this adapter are signed against.
/// @dev Read from {settlement} at construction and fixed thereafter.
/// @return The domain separator.
function domainSeparator() external view returns (bytes32);
}
node_modules/@shift-defi/cow-protocol-adapter/src/interfaces/IGPv2Settlement.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;
/// @title IGPv2Settlement
/// @notice The subset of CoW Protocol's `GPv2Settlement` that this adapter calls.
/// @dev Declared locally rather than imported: CoW's contracts target solc 0.7.6 and do not
/// compile under this repository's pragma. Signatures mirror the deployed contract.
interface IGPv2Settlement {
/// @notice Cancels an order on-chain, so no trade against it can settle.
/// @dev Writes `type(uint256).max` over the order's fill record. Callable only by the address
/// encoded in `orderUid`, and unconditional — it overwrites whatever the record held,
/// including a fill, so fill status must be read before calling it.
/// @param orderUid The order's unique identifier.
function invalidateOrder(bytes calldata orderUid) external;
/// @notice The cumulative amount an order has been filled for.
/// @dev In units of the order's exact side: the sell amount for a sell order, the buy amount
/// for a buy order. `type(uint256).max` means the order was cancelled. The record is
/// only meaningful while the order is valid — settlement lets a solver clear it once the
/// order has expired, after which a filled, a cancelled and an untouched order all read
/// zero.
/// @param orderUid The order's unique identifier.
/// @return The amount filled.
function filledAmount(bytes calldata orderUid) external view returns (uint256);
/// @notice The contract that pulls sell tokens from an order's owner during settlement.
/// @dev Token allowances are granted to this address, not to the settlement contract.
/// @return The vault relayer address.
function vaultRelayer() external view returns (address);
/// @notice The EIP-712 domain separator orders are signed against.
/// @dev Binds a signature to this settlement contract and chain.
/// @return The domain separator.
function domainSeparator() external view returns (bytes32);
}
node_modules/@shift-defi/cow-protocol-adapter/src/interfaces/IOwnerImmutable.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;
/// @title IOwnerImmutable
/// @notice Interface for single-owner access control whose owner is fixed at construction.
interface IOwnerImmutable {
/// @notice Emitted once at construction, when the owner is set.
/// @param owner The address the contract is permanently bound to.
event OwnerSet(address indexed owner);
/// @notice Thrown when the address supplied as parameter is the zero address.
error ZeroAddress();
/// @notice Thrown when a caller other than the owner calls an owner-only function.
/// @param caller The rejected caller.
error NotOwner(address caller);
/// @notice The address this contract is permanently bound to.
/// @dev Immutable — set once at construction, never reassigned.
/// @return The owner address.
function owner() external view returns (address);
}
Compiler settingsShow
{
"viaIR": false,
"metadata": {
"appendCBOR": true,
"bytecodeHash": "ipfs",
"useLiteralContent": false
},
"libraries": {},
"optimizer": {
"runs": 5,
"enabled": true
},
"evmVersion": "prague",
"remappings": [
"@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/",
"@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
"@shift-defi/cow-protocol-adapter/=node_modules/@shift-defi/cow-protocol-adapter/",
"lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/:erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/erc4626-tests/",
"lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/:forge-std/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/forge-std/src/",
"lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/:halmos-cheatcodes/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"lib/openzeppelin-contracts-upgradeable/:erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
"lib/openzeppelin-contracts-upgradeable/:forge-std/=lib/openzeppelin-contracts-upgradeable/lib/forge-std/src/",
"lib/openzeppelin-contracts-upgradeable/:halmos-cheatcodes/=lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/",
"lib/openzeppelin-foundry-upgrades/:forge-std/=lib/openzeppelin-foundry-upgrades/lib/forge-std/src/",
"erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
"forge-std/=lib/forge-std/src/",
"halmos-cheatcodes/=lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/",
"openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
"openzeppelin-contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/",
"openzeppelin-foundry-upgrades/=lib/openzeppelin-foundry-upgrades/src/"
]
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.