Source Code
Latest 25 from a total of 814 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Fill Swap | 424619933 | 47 hrs ago | IN | 0 ETH | 0.00000789 | ||||
| Fill Swap | 424540364 | 2 days ago | IN | 0 ETH | 0.00001038 | ||||
| Fill Swap | 423533260 | 5 days ago | IN | 0 ETH | 0.00000985 | ||||
| Fill Swap | 423370122 | 5 days ago | IN | 0 ETH | 0.00001046 | ||||
| Fill Swap | 423369610 | 5 days ago | IN | 0 ETH | 0.00000886 | ||||
| Fill Swap | 423210240 | 6 days ago | IN | 0 ETH | 0.00000711 | ||||
| Fill Swap | 423192721 | 6 days ago | IN | 0 ETH | 0.00000766 | ||||
| Fill Swap | 422844195 | 7 days ago | IN | 0 ETH | 0.00000768 | ||||
| Fill Swap | 422637028 | 7 days ago | IN | 0 ETH | 0.00000756 | ||||
| Fill Swap | 422635403 | 7 days ago | IN | 0 ETH | 0.00000758 | ||||
| Fill Swap | 422297691 | 8 days ago | IN | 0 ETH | 0.00000714 | ||||
| Fill Swap | 422296248 | 8 days ago | IN | 0 ETH | 0.00000774 | ||||
| Fill Swap | 422147034 | 9 days ago | IN | 0 ETH | 0.00000925 | ||||
| Fill Swap | 421862696 | 9 days ago | IN | 0 ETH | 0.00000758 | ||||
| Fill Swap | 421860918 | 9 days ago | IN | 0 ETH | 0.00000758 | ||||
| Fill Swap | 421479115 | 11 days ago | IN | 0 ETH | 0.00000712 | ||||
| Fill Swap | 421477406 | 11 days ago | IN | 0 ETH | 0.0000091 | ||||
| Fill Swap | 421138023 | 12 days ago | IN | 0 ETH | 0.00000756 | ||||
| Fill Swap | 420894266 | 12 days ago | IN | 0 ETH | 0.00001611 | ||||
| Fill Swap | 420795016 | 13 days ago | IN | 0 ETH | 0.00000708 | ||||
| Fill Swap | 420793159 | 13 days ago | IN | 0 ETH | 0.00000766 | ||||
| Fill Swap | 420438133 | 14 days ago | IN | 0 ETH | 0.0000094 | ||||
| Fill Swap | 420437078 | 14 days ago | IN | 0 ETH | 0.00000758 | ||||
| Fill Swap | 419062533 | 18 days ago | IN | 0 ETH | 0.00000378 | ||||
| Fill Swap | 419061277 | 18 days ago | IN | 0 ETH | 0.00000383 |
Latest 25 internal transactions (View All)
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 424619933 | 47 hrs ago | 0.00000265 ETH | ||||
| 424619933 | 47 hrs ago | 0.00000265 ETH | ||||
| 424540364 | 2 days ago | 0.00003679 ETH | ||||
| 424540364 | 2 days ago | 0.00003679 ETH | ||||
| 423370122 | 5 days ago | 0.0009993 ETH | ||||
| 423370122 | 5 days ago | 0.0009993 ETH | ||||
| 414424926 | 31 days ago | 0.00003395 ETH | ||||
| 414424926 | 31 days ago | 0.00003395 ETH | ||||
| 413985658 | 32 days ago | 0.00840641 ETH | ||||
| 413985658 | 32 days ago | 0.00840641 ETH | ||||
| 413850869 | 33 days ago | 0.00006747 ETH | ||||
| 413850869 | 33 days ago | 0.00006747 ETH | ||||
| 412810002 | 36 days ago | 0.00095456 ETH | ||||
| 412810002 | 36 days ago | 0.00095456 ETH | ||||
| 410792745 | 41 days ago | 0.02091694 ETH | ||||
| 410792745 | 41 days ago | 0.02091694 ETH | ||||
| 409827651 | 44 days ago | 0.00276638 ETH | ||||
| 409827651 | 44 days ago | 0.00276638 ETH | ||||
| 406204131 | 55 days ago | 0.0003572 ETH | ||||
| 406204131 | 55 days ago | 0.0003572 ETH | ||||
| 402936059 | 64 days ago | 0.00001718 ETH | ||||
| 402936059 | 64 days ago | 0.00001718 ETH | ||||
| 401935329 | 67 days ago | 0.00001783 ETH | ||||
| 401935329 | 67 days ago | 0.00001783 ETH | ||||
| 401388028 | 69 days ago | 0.00306506 ETH |
Cross-Chain Transactions
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x11111116...C857ba980 in Base Mainnet The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
OrderRouter
Compiler Version
v0.8.28+commit.7893614a
Optimization Enabled:
Yes with 600 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is set to the address provided by the deployer. This can
* later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) 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 `amount` 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 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @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);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 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 {
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
// solhint-disable-next-line max-line-length
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
/**
* @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).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}// 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;
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IEIP712} from "./IEIP712.sol";
/// @title AllowanceTransfer
/// @notice Handles ERC20 token permissions through signature based allowance setting and ERC20 token transfers by checking allowed amounts
/// @dev Requires user's token approval on the Permit2 contract
interface IAllowanceTransfer is IEIP712 {
/// @notice Thrown when an allowance on a token has expired.
/// @param deadline The timestamp at which the allowed amount is no longer valid
error AllowanceExpired(uint256 deadline);
/// @notice Thrown when an allowance on a token has been depleted.
/// @param amount The maximum amount allowed
error InsufficientAllowance(uint256 amount);
/// @notice Thrown when too many nonces are invalidated.
error ExcessiveInvalidation();
/// @notice Emits an event when the owner successfully invalidates an ordered nonce.
event NonceInvalidation(
address indexed owner, address indexed token, address indexed spender, uint48 newNonce, uint48 oldNonce
);
/// @notice Emits an event when the owner successfully sets permissions on a token for the spender.
event Approval(
address indexed owner, address indexed token, address indexed spender, uint160 amount, uint48 expiration
);
/// @notice Emits an event when the owner successfully sets permissions using a permit signature on a token for the spender.
event Permit(
address indexed owner,
address indexed token,
address indexed spender,
uint160 amount,
uint48 expiration,
uint48 nonce
);
/// @notice Emits an event when the owner sets the allowance back to 0 with the lockdown function.
event Lockdown(address indexed owner, address token, address spender);
/// @notice The permit data for a token
struct PermitDetails {
// ERC20 token address
address token;
// the maximum amount allowed to spend
uint160 amount;
// timestamp at which a spender's token allowances become invalid
uint48 expiration;
// an incrementing value indexed per owner,token,and spender for each signature
uint48 nonce;
}
/// @notice The permit message signed for a single token allowance
struct PermitSingle {
// the permit data for a single token alownce
PermitDetails details;
// address permissioned on the allowed tokens
address spender;
// deadline on the permit signature
uint256 sigDeadline;
}
/// @notice The permit message signed for multiple token allowances
struct PermitBatch {
// the permit data for multiple token allowances
PermitDetails[] details;
// address permissioned on the allowed tokens
address spender;
// deadline on the permit signature
uint256 sigDeadline;
}
/// @notice The saved permissions
/// @dev This info is saved per owner, per token, per spender and all signed over in the permit message
/// @dev Setting amount to type(uint160).max sets an unlimited approval
struct PackedAllowance {
// amount allowed
uint160 amount;
// permission expiry
uint48 expiration;
// an incrementing value indexed per owner,token,and spender for each signature
uint48 nonce;
}
/// @notice A token spender pair.
struct TokenSpenderPair {
// the token the spender is approved
address token;
// the spender address
address spender;
}
/// @notice Details for a token transfer.
struct AllowanceTransferDetails {
// the owner of the token
address from;
// the recipient of the token
address to;
// the amount of the token
uint160 amount;
// the token to be transferred
address token;
}
/// @notice A mapping from owner address to token address to spender address to PackedAllowance struct, which contains details and conditions of the approval.
/// @notice The mapping is indexed in the above order see: allowance[ownerAddress][tokenAddress][spenderAddress]
/// @dev The packed slot holds the allowed amount, expiration at which the allowed amount is no longer valid, and current nonce thats updated on any signature based approvals.
function allowance(address user, address token, address spender)
external
view
returns (uint160 amount, uint48 expiration, uint48 nonce);
/// @notice Approves the spender to use up to amount of the specified token up until the expiration
/// @param token The token to approve
/// @param spender The spender address to approve
/// @param amount The approved amount of the token
/// @param expiration The timestamp at which the approval is no longer valid
/// @dev The packed allowance also holds a nonce, which will stay unchanged in approve
/// @dev Setting amount to type(uint160).max sets an unlimited approval
function approve(address token, address spender, uint160 amount, uint48 expiration) external;
/// @notice Permit a spender to a given amount of the owners token via the owner's EIP-712 signature
/// @dev May fail if the owner's nonce was invalidated in-flight by invalidateNonce
/// @param owner The owner of the tokens being approved
/// @param permitSingle Data signed over by the owner specifying the terms of approval
/// @param signature The owner's signature over the permit data
function permit(address owner, PermitSingle memory permitSingle, bytes calldata signature) external;
/// @notice Permit a spender to the signed amounts of the owners tokens via the owner's EIP-712 signature
/// @dev May fail if the owner's nonce was invalidated in-flight by invalidateNonce
/// @param owner The owner of the tokens being approved
/// @param permitBatch Data signed over by the owner specifying the terms of approval
/// @param signature The owner's signature over the permit data
function permit(address owner, PermitBatch memory permitBatch, bytes calldata signature) external;
/// @notice Transfer approved tokens from one address to another
/// @param from The address to transfer from
/// @param to The address of the recipient
/// @param amount The amount of the token to transfer
/// @param token The token address to transfer
/// @dev Requires the from address to have approved at least the desired amount
/// of tokens to msg.sender.
function transferFrom(address from, address to, uint160 amount, address token) external;
/// @notice Transfer approved tokens in a batch
/// @param transferDetails Array of owners, recipients, amounts, and tokens for the transfers
/// @dev Requires the from addresses to have approved at least the desired amount
/// of tokens to msg.sender.
function transferFrom(AllowanceTransferDetails[] calldata transferDetails) external;
/// @notice Enables performing a "lockdown" of the sender's Permit2 identity
/// by batch revoking approvals
/// @param approvals Array of approvals to revoke.
function lockdown(TokenSpenderPair[] calldata approvals) external;
/// @notice Invalidate nonces for a given (token, spender) pair
/// @param token The token to invalidate nonces for
/// @param spender The spender to invalidate nonces for
/// @param newNonce The new nonce to set. Invalidates all nonces less than it.
/// @dev Can't invalidate more than 2**16 nonces per transaction.
function invalidateNonces(address token, address spender, uint48 newNonce) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IEIP712 {
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
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
/// @return magicValue The bytes4 magic value 0x1626ba7e
function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {ISignatureTransfer} from "./ISignatureTransfer.sol";
import {IAllowanceTransfer} from "./IAllowanceTransfer.sol";
/// @notice Permit2 handles signature-based transfers in SignatureTransfer and allowance-based transfers in AllowanceTransfer.
/// @dev Users must approve Permit2 before calling any of the transfer functions.
interface IPermit2 is ISignatureTransfer, IAllowanceTransfer {
// IPermit2 unifies the two interfaces so users have maximal flexibility with their approval.
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IEIP712} from "./IEIP712.sol";
/// @title SignatureTransfer
/// @notice Handles ERC20 token transfers through signature based actions
/// @dev Requires user's token approval on the Permit2 contract
interface ISignatureTransfer is IEIP712 {
/// @notice Thrown when the requested amount for a transfer is larger than the permissioned amount
/// @param maxAmount The maximum amount a spender can request to transfer
error InvalidAmount(uint256 maxAmount);
/// @notice Thrown when the number of tokens permissioned to a spender does not match the number of tokens being transferred
/// @dev If the spender does not need to transfer the number of tokens permitted, the spender can request amount 0 to be transferred
error LengthMismatch();
/// @notice Emits an event when the owner successfully invalidates an unordered nonce.
event UnorderedNonceInvalidation(address indexed owner, uint256 word, uint256 mask);
/// @notice The token and amount details for a transfer signed in the permit transfer signature
struct TokenPermissions {
// ERC20 token address
address token;
// the maximum amount that can be spent
uint256 amount;
}
/// @notice The signed permit message for a single token transfer
struct PermitTransferFrom {
TokenPermissions permitted;
// a unique value for every token owner's signature to prevent signature replays
uint256 nonce;
// deadline on the permit signature
uint256 deadline;
}
/// @notice Specifies the recipient address and amount for batched transfers.
/// @dev Recipients and amounts correspond to the index of the signed token permissions array.
/// @dev Reverts if the requested amount is greater than the permitted signed amount.
struct SignatureTransferDetails {
// recipient address
address to;
// spender requested amount
uint256 requestedAmount;
}
/// @notice Used to reconstruct the signed permit message for multiple token transfers
/// @dev Do not need to pass in spender address as it is required that it is msg.sender
/// @dev Note that a user still signs over a spender address
struct PermitBatchTransferFrom {
// the tokens and corresponding amounts permitted for a transfer
TokenPermissions[] permitted;
// a unique value for every token owner's signature to prevent signature replays
uint256 nonce;
// deadline on the permit signature
uint256 deadline;
}
/// @notice A map from token owner address and a caller specified word index to a bitmap. Used to set bits in the bitmap to prevent against signature replay protection
/// @dev Uses unordered nonces so that permit messages do not need to be spent in a certain order
/// @dev The mapping is indexed first by the token owner, then by an index specified in the nonce
/// @dev It returns a uint256 bitmap
/// @dev The index, or wordPosition is capped at type(uint248).max
function nonceBitmap(address, uint256) external view returns (uint256);
/// @notice Transfers a token using a signed permit message
/// @dev Reverts if the requested amount is greater than the permitted signed amount
/// @param permit The permit data signed over by the owner
/// @param owner The owner of the tokens to transfer
/// @param transferDetails The spender's requested transfer details for the permitted token
/// @param signature The signature to verify
function permitTransferFrom(
PermitTransferFrom memory permit,
SignatureTransferDetails calldata transferDetails,
address owner,
bytes calldata signature
) external;
/// @notice Transfers a token using a signed permit message
/// @notice Includes extra data provided by the caller to verify signature over
/// @dev The witness type string must follow EIP712 ordering of nested structs and must include the TokenPermissions type definition
/// @dev Reverts if the requested amount is greater than the permitted signed amount
/// @param permit The permit data signed over by the owner
/// @param owner The owner of the tokens to transfer
/// @param transferDetails The spender's requested transfer details for the permitted token
/// @param witness Extra data to include when checking the user signature
/// @param witnessTypeString The EIP-712 type definition for remaining string stub of the typehash
/// @param signature The signature to verify
function permitWitnessTransferFrom(
PermitTransferFrom memory permit,
SignatureTransferDetails calldata transferDetails,
address owner,
bytes32 witness,
string calldata witnessTypeString,
bytes calldata signature
) external;
/// @notice Transfers multiple tokens using a signed permit message
/// @param permit The permit data signed over by the owner
/// @param owner The owner of the tokens to transfer
/// @param transferDetails Specifies the recipient and requested amount for the token transfer
/// @param signature The signature to verify
function permitTransferFrom(
PermitBatchTransferFrom memory permit,
SignatureTransferDetails[] calldata transferDetails,
address owner,
bytes calldata signature
) external;
/// @notice Transfers multiple tokens using a signed permit message
/// @dev The witness type string must follow EIP712 ordering of nested structs and must include the TokenPermissions type definition
/// @notice Includes extra data provided by the caller to verify signature over
/// @param permit The permit data signed over by the owner
/// @param owner The owner of the tokens to transfer
/// @param transferDetails Specifies the recipient and requested amount for the token transfer
/// @param witness Extra data to include when checking the user signature
/// @param witnessTypeString The EIP-712 type definition for remaining string stub of the typehash
/// @param signature The signature to verify
function permitWitnessTransferFrom(
PermitBatchTransferFrom memory permit,
SignatureTransferDetails[] calldata transferDetails,
address owner,
bytes32 witness,
string calldata witnessTypeString,
bytes calldata signature
) external;
/// @notice Invalidates the bits specified in mask for the bitmap at the word position
/// @dev The wordPos is maxed at type(uint248).max
/// @param wordPos A number to index the nonceBitmap at
/// @param mask A bitmap masked against msg.sender's current bitmap at the word position
function invalidateUnorderedNonces(uint256 wordPos, uint256 mask) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
/**
* @title CustomInstructions
* @dev Library containing constants for custom instructions used by OrderRouter
*/
library CustomInstructions {
// Instruction for sweeping tokens from the router to the sender
bytes8 internal constant SWEEP = bytes8(uint64(0x01));
bytes8 internal constant APPROVE = bytes8(uint64(0x02));
bytes8 internal constant WRAP = bytes8(uint64(0x03));
bytes8 internal constant UNWRAP_TO = bytes8(uint64(0x04));
// Instruction for pulling bond asset
bytes8 internal constant BOND_ORDER = bytes8(uint64(0x05));
// Instruction for OpenOcean integration
bytes8 internal constant OPENOCEAN = bytes8(uint64(0x06));
// Instruction for Uniswap integration
bytes8 internal constant UNISWAP = bytes8(uint64(0x07));
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
interface IEIP712Types {
/**
* @dev Struct for direction parameters of an order.
* @param srcAsset The source asset being offered.
* @param dstAsset The destination asset desired
* @param srcLzc The chain ID of the source chain..
* @param dstLzc The chain ID of the destination chain.
*/
struct OrderParameters {
address srcAsset;
bytes32 dstAsset;
uint32 srcLzc;
uint32 dstLzc;
uint256 srcQuantity;
uint256 dstQuantity;
}
/**
* @dev Struct for expiration parameters of an order.
* @param timestamp The timestamp when the order was created.
* @param challengeOffset The offset for the challenge window start.
* @param challengeWindow The duration of the challenge window in seconds.
*/
struct OrderExpiration {
uint32 timestamp;
uint16 challengeOffset;
uint16 challengeWindow;
}
/**
* @dev Struct representing an order.
* @param sender The address of the order creator.
* @param parameters The direction parameters of the order.
* @param expiration The expiration parameters of the order.
* @param target The target address for the order.
* @param filler Gives the specified address permissons to fill this order at some later time
*/
struct SignedOrder {
address sender;
OrderParameters parameters;
OrderExpiration expiration;
bytes32 target;
address filler;
bytes8[] customInstructions;
bytes[] customDatas; // Optional data needed to perform custom instructions
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import "./interfaces/IEIP712Types.sol";
contract OrderHash is IEIP712Types {
// leaf structs
bytes32 public constant _ORDER_PARAMETERS_TYPEHASH =
keccak256(
"OrderParameters(address srcAsset,bytes32 dstAsset,uint32 srcLzc,uint32 dstLzc,uint256 srcQuantity,uint256 dstQuantity)"
);
bytes32 public constant _ORDER_EXPIRATION_TYPEHASH =
keccak256(
"OrderExpiration(uint32 timestamp,uint16 challengeOffset,uint16 challengeWindow)"
);
// canonical ordering!! --> https://eips.ethereum.org/EIPS/eip-712 <--
bytes32 public constant _SIGNED_ORDER_TYPEHASH =
keccak256(
"SignedOrder(address sender,OrderParameters parameters,OrderExpiration expiration,bytes32 target,address filler,bytes8[] customInstructions,bytes[] customDatas)"
"OrderExpiration(uint32 timestamp,uint16 challengeOffset,uint16 challengeWindow)"
"OrderParameters(address srcAsset,bytes32 dstAsset,uint32 srcLzc,uint32 dstLzc,uint256 srcQuantity,uint256 dstQuantity)"
);
// canonical ordering!! --> https://eips.ethereum.org/EIPS/eip-712 <--
string public constant _SIGNED_ORDER_WITNESS_TYPE_STRING = "SignedOrder witness)OrderExpiration(uint32 timestamp,uint16 challengeOffset,uint16 challengeWindow)OrderParameters(address srcAsset,bytes32 dstAsset,uint32 srcLzc,uint32 dstLzc,uint256 srcQuantity,uint256 dstQuantity)SignedOrder(address sender,OrderParameters parameters,OrderExpiration expiration,bytes32 target,address filler,bytes8[] customInstructions,bytes[] customDatas)TokenPermissions(address token,uint256 amount)";
function _hashOrderParameters(
OrderParameters calldata p
) internal pure returns (bytes32) {
return
keccak256(
abi.encode(
_ORDER_PARAMETERS_TYPEHASH,
p.srcAsset,
p.dstAsset,
p.srcLzc,
p.dstLzc,
p.srcQuantity,
p.dstQuantity
)
);
}
function _hashOrderExpiration(
OrderExpiration calldata e
) internal pure returns (bytes32) {
return
keccak256(
abi.encode(
_ORDER_EXPIRATION_TYPEHASH,
e.timestamp,
e.challengeOffset,
e.challengeWindow
)
);
}
/**
* Hashes a `bytes8[]` according to EIP-712.
* Each element is padded to 32 bytes before concatenation.
*/
function _hashCustomInstructions(
bytes8[] calldata instructions
) internal pure returns (bytes32) {
uint256 len = instructions.length;
bytes memory buf = new bytes(len * 32);
for (uint256 i; i < len; ++i) {
bytes8 inst = instructions[i];
assembly {
mstore(add(add(buf, 32), mul(i, 32)), inst)
}
}
return keccak256(buf);
}
/**
* Hashes a `bytes[]` array according to EIP-712.
* For dynamic members you must first hash each item, then hash the
* concatenation of those 32-byte hashes.
*/
function _hashCustomDatas(
bytes[] calldata datas
) internal pure returns (bytes32) {
uint256 len = datas.length;
bytes32[] memory inner = new bytes32[](len);
for (uint256 i; i < len; ++i) {
inner[i] = keccak256(datas[i]); // hash each bytes element
}
return keccak256(abi.encodePacked(inner));
}
function hashSignedOrder(
SignedOrder calldata order
) internal pure returns (bytes32) {
return
keccak256(
abi.encode(
_SIGNED_ORDER_TYPEHASH,
order.sender,
_hashOrderParameters(order.parameters),
_hashOrderExpiration(order.expiration),
order.target,
order.filler,
_hashCustomInstructions(order.customInstructions),
_hashCustomDatas(order.customDatas)
)
);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
/*
████████╗██████╗ ██╗███████╗████████╗███████╗██████╗ ██████╗
╚══██╔══╝██╔══██╗██║██╔════╝╚══██╔══╝██╔════╝██╔══██╗██╔═══██╗
██║ ██████╔╝██║███████╗ ██║ █████╗ ██████╔╝██║ ██║
██║ ██╔══██╗██║╚════██║ ██║ ██╔══╝ ██╔══██╗██║ ██║
██║ ██║ ██║██║███████║ ██║ ███████╗██║ ██║╚██████╔╝
╚═╝ ╚═╝ ╚═╝╚═╝╚══════╝ ╚═╝ ╚══════╝╚═╝ ╚═╝ ╚═════╝
********* app.tristero.com *********
*/
import "./interfaces/IEIP712Types.sol";
import "./OrderHash.sol";
import "./PermitTransfers.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "./CustomInstructions.sol";
contract OrderRouter is OrderHash, PermitTransfers, ReentrancyGuard, Ownable {
uint32 public immutable srcLzc;
uint private constant BASIS_POINTS = 10000;
constructor(address permit2, uint32 _srcLzc) PermitTransfers(permit2) Ownable(msg.sender) {
srcLzc = _srcLzc;
}
error InvalidSrcLzc();
error InvalidDstLzc();
error OrderExpired();
error ProhibitedFiller();
error InvalidCustomInstructions(uint256 index);
error InvalidCustomData(uint256 index);
error CustomInstructionFailed(uint256 index, bytes reason);
error InstructionLenMismatch();
event SwapFilled(address indexed sender, bytes32 indexed witness);
struct SigPayload {
bytes signature;
uint256 nonce;
}
function enforceFiller() private view {
require(msg.sender == 0x23fD579fB1169c595BC8814910d1be78c0b7e56d || msg.sender == 0x9f863DfdB5DF33FE5f87601b8D2f23C816d5fDE8, ProhibitedFiller());
}
function fillSwap(
SignedOrder calldata order,
SigPayload calldata payload
) public nonReentrant {
// Chain control
require(order.parameters.dstLzc == srcLzc, InvalidDstLzc());
require(order.parameters.srcLzc == srcLzc, InvalidSrcLzc());
// Time control
// NOTE: We pass the expiration timestamp of the order to the permit transfer function
// as deadline, therefore the permit deadline must be equal to expiration timestamp,
// otherwise signature verification will fail.
require(order.expiration.timestamp >= block.timestamp, OrderExpired());
// For security reasons, we must reconstruct witness from Order data on-chain.
bytes32 witness = hashSignedOrder(order);
enforceFiller();
// Create permit parameters
// srcToMaker amount of takerOrder.direction.srcAsset from taker to this contract
PermitParams memory permitParams = PermitParams({
token: order.parameters.srcAsset,
signedAmount: order.parameters.srcQuantity,
transferAmount: order.parameters.srcQuantity,
nonce: payload.nonce,
deadline: order.expiration.timestamp,
sender: order.sender,
to: address(this),
signature: payload.signature
});
// Pull tokens from sender
transferFromWithPermit(
permitParams,
_SIGNED_ORDER_WITNESS_TYPE_STRING,
witness
);
// We now pulled all funds from sender, proceed to process the order based on
// custom instructions
_execute_custom_instructions(order.customInstructions, order.customDatas);
// Clean up
address srcAsset = order.parameters.srcAsset;
address dstAsset = bytes32ToAddress(order.parameters.dstAsset);
address target = bytes32ToAddress(order.target);
// Handle source asset cleanup (ETH or ERC20)
if (srcAsset != address(0)) {
uint256 srcBalance = IERC20(srcAsset).balanceOf(address(this));
if (srcBalance > 0) {
transferTo(srcAsset, order.sender, srcBalance);
}
} else {
// ETH cleanup
uint256 ethBalance = address(this).balance;
if (ethBalance > 0) {
transferTo(address(0), order.sender, ethBalance);
}
}
// Handle destination asset cleanup (ETH or ERC20)
if (dstAsset != address(0)) {
uint256 dstBalance = IERC20(dstAsset).balanceOf(address(this));
if (dstBalance > 0) {
transferTo(dstAsset, target, dstBalance);
}
} else {
// ETH cleanup
uint256 ethBalance = address(this).balance;
if (ethBalance > 0) {
transferTo(address(0), target, ethBalance);
}
}
emit SwapFilled(order.sender, witness);
}
function _execute_custom_instructions(bytes8[] calldata customInstructions, bytes[] calldata customDatas) internal {
/* ---------- sanity checks -------------------------------------------- */
uint256 n = customInstructions.length;
require(n == customDatas.length, InstructionLenMismatch());
for (uint256 i; i < n; ++i) {
bytes8 instr = customInstructions[i];
bytes calldata d = customDatas[i];
if (instr == CustomInstructions.OPENOCEAN) {
_execOpenOcean(d, i);
} else if (instr == CustomInstructions.UNISWAP) {
_execUniswap(d, i); // placeholder for future impl.
} else if (instr == CustomInstructions.APPROVE) {
_execApprove(d, i);
} else if (instr == CustomInstructions.WRAP) {
_execWrap(d, i);
} else if (instr == CustomInstructions.UNWRAP_TO) {
_execUnwrapTo(d, i);
} else if (instr == bytes8(0)) {
/* no-op slot: skip */
} else {
revert InvalidCustomInstructions(i);
}
}
}
function _execOpenOcean(bytes calldata data, uint256 index) private {
/* format = {20-byte target}{calldata...} */
require(data.length >= 24, InvalidCustomData(index));
address target = address(bytes20(data));
bytes calldata payload = data[20:];
(bool ok, bytes memory ret) = target.call(payload);
if (!ok) revert CustomInstructionFailed(index, ret);
}
function _execUniswap(bytes calldata data, uint256 index) private pure {
/* fill once you integrate UniRouter, or leave reverting for now */
revert CustomInstructionFailed(index, "Uniswap");
}
/**
* @notice Approves tokens for a spender
* @dev Format of data: {20-byte token}{20-byte spender}{32-byte amount}
*/
function _execApprove(bytes calldata data, uint256 index) private {
require(data.length >= 72, InvalidCustomData(index)); // 20 + 20 + 32 = 72 bytes minimum
address token = address(bytes20(data[:20]));
address spender = address(bytes20(data[20:40]));
uint256 amount = abi.decode(data[40:72], (uint256));
// Execute the approval
bool success = IERC20(token).approve(spender, amount);
if (!success) revert CustomInstructionFailed(index, "Approval failed");
}
/**
* @notice Wraps ETH to WETH
* @dev Format of data: {20-byte WETH address}{32-byte amount}
* @dev Requires the contract to have ETH
*/
function _execWrap(bytes calldata data, uint256 index) private {
require(data.length >= 52, InvalidCustomData(index)); // 20 + 32 = 52 bytes minimum
address weth = address(bytes20(data[:20]));
uint256 amount = abi.decode(data[20:52], (uint256));
// Execute the wrap by calling deposit() on WETH
// WETH9 interface: function deposit() external payable;
(bool success, bytes memory returnData) = weth.call{value: amount}(abi.encodeWithSignature("deposit()"));
if (!success) revert CustomInstructionFailed(index, returnData);
}
/**
* @notice Unwraps WETH to ETH and sends to a specific address
* @dev Format of data: {20-byte WETH address}{20-byte recipient}
*/
function _execUnwrapTo(bytes calldata data, uint256 index) private {
require(data.length >= 40, InvalidCustomData(index)); // 20 + 20 = 40 bytes minimum
address weth = address(bytes20(data[:20]));
address recipient = address(bytes20(data[20:40]));
// Get the entire WETH balance of this contract
uint256 amount = IERC20(weth).balanceOf(address(this));
// First withdraw ETH from WETH
// WETH9 interface: function withdraw(uint) external;
(bool withdrawSuccess, bytes memory withdrawData) = weth.call(
abi.encodeWithSignature("withdraw(uint256)", amount)
);
if (!withdrawSuccess) revert CustomInstructionFailed(index, withdrawData);
// Then send the ETH to recipient
(bool sendSuccess,) = recipient.call{value: amount}("");
if (!sendSuccess) revert CustomInstructionFailed(index, "ETH transfer failed");
}
// Helper function
function bytes32ToAddress(
bytes32 _bytes
) internal pure returns (address addr) {
addr = address(uint160(uint256(_bytes)));
}
// Helper function
function addressToBytes32(address _addr) internal pure returns (bytes32) {
return bytes32(uint256(uint160(_addr)));
}
/**
* @notice Allows the contract to receive ETH
* @dev Required for WETH unwrapping operations
*/
receive() external payable {}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import "@permit2/interfaces/IPermit2.sol";
import "@permit2/interfaces/ISignatureTransfer.sol";
import "@permit2/interfaces/IERC1271.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract PermitTransfers {
IPermit2 public immutable PERMIT2;
error InvalidPermit2Address();
constructor(address permit2) {
require(permit2 != address(0), InvalidPermit2Address());
PERMIT2 = IPermit2(permit2);
}
/// @dev Reverts when the inner Permit2 call fails.
/// `reason` is the 4-byte error selector returned by Permit2
/// (`bytes4(0)` if no data was returned).
/// For example if Permit2 reverts with InvalidSignature(),
/// then `reason` will be bytes4(keccak256("InvalidSignature()"))
error TransferFailure(bytes4 reason);
struct PermitParams {
address token;
uint256 nonce;
uint256 deadline;
address sender; // owner who signed the permit
address to;
uint256 signedAmount; // Amount in the permit
uint256 transferAmount; // Amount to transfer (can be less than signedAmount)
bytes signature;
}
/**
* @notice Inbound transfer using Permit2 + witness
*/
function transferFromWithPermit(
PermitParams memory p,
string memory witnessTypeString,
bytes32 witness
) internal {
ISignatureTransfer.PermitTransferFrom memory permit = ISignatureTransfer.PermitTransferFrom({
permitted: ISignatureTransfer.TokenPermissions({
token: p.token,
amount: p.signedAmount
}),
nonce: p.nonce,
deadline: p.deadline
});
ISignatureTransfer.SignatureTransferDetails memory details = ISignatureTransfer.SignatureTransferDetails({
to: p.to,
requestedAmount: p.transferAmount
});
bytes memory data = abi.encodeWithSignature(
"permitWitnessTransferFrom(((address,uint256),uint256,uint256),(address,uint256),address,bytes32,string,bytes)",
permit,
details,
p.sender,
witness,
witnessTypeString,
p.signature
);
(bool ok, bytes memory ret) = address(PERMIT2).call(data);
if (!ok) {
// Default selector = 0x00000000 when no revert data
bytes4 selector = 0x00000000;
if (ret.length >= 4) {
// load first 32 bytes, then keep the high-order 4
assembly {
selector := mload(add(ret, 32))
}
}
revert TransferFailure(selector);
}
}
/**
* @notice Outbound transfer
* @dev Handles both ERC20 tokens and ETH (when tkn is address(0))
* @param tkn Token address (address(0) for ETH)
* @param to Recipient address
* @param amount Amount to transfer
*/
function transferTo(address tkn, address to, uint amount) internal {
if (amount == 0) return;
if (tkn == address(0)) {
// Handle ETH transfer
(bool success, ) = to.call{value: amount}("");
require(success, "ETH transfer failed");
} else {
// Handle ERC20 transfer
SafeERC20.safeTransfer(IERC20(tkn), to, amount);
}
}
}{
"optimizer": {
"enabled": true,
"runs": 600
},
"evmVersion": "paris",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"metadata": {
"useLiteralContent": true
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"permit2","type":"address"},{"internalType":"uint32","name":"_srcLzc","type":"uint32"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"bytes","name":"reason","type":"bytes"}],"name":"CustomInstructionFailed","type":"error"},{"inputs":[],"name":"InstructionLenMismatch","type":"error"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"InvalidCustomData","type":"error"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"InvalidCustomInstructions","type":"error"},{"inputs":[],"name":"InvalidDstLzc","type":"error"},{"inputs":[],"name":"InvalidPermit2Address","type":"error"},{"inputs":[],"name":"InvalidSrcLzc","type":"error"},{"inputs":[],"name":"OrderExpired","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ProhibitedFiller","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"bytes4","name":"reason","type":"bytes4"}],"name":"TransferFailure","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"bytes32","name":"witness","type":"bytes32"}],"name":"SwapFilled","type":"event"},{"inputs":[],"name":"PERMIT2","outputs":[{"internalType":"contract IPermit2","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_ORDER_EXPIRATION_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_ORDER_PARAMETERS_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_SIGNED_ORDER_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_SIGNED_ORDER_WITNESS_TYPE_STRING","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"sender","type":"address"},{"components":[{"internalType":"address","name":"srcAsset","type":"address"},{"internalType":"bytes32","name":"dstAsset","type":"bytes32"},{"internalType":"uint32","name":"srcLzc","type":"uint32"},{"internalType":"uint32","name":"dstLzc","type":"uint32"},{"internalType":"uint256","name":"srcQuantity","type":"uint256"},{"internalType":"uint256","name":"dstQuantity","type":"uint256"}],"internalType":"struct IEIP712Types.OrderParameters","name":"parameters","type":"tuple"},{"components":[{"internalType":"uint32","name":"timestamp","type":"uint32"},{"internalType":"uint16","name":"challengeOffset","type":"uint16"},{"internalType":"uint16","name":"challengeWindow","type":"uint16"}],"internalType":"struct IEIP712Types.OrderExpiration","name":"expiration","type":"tuple"},{"internalType":"bytes32","name":"target","type":"bytes32"},{"internalType":"address","name":"filler","type":"address"},{"internalType":"bytes8[]","name":"customInstructions","type":"bytes8[]"},{"internalType":"bytes[]","name":"customDatas","type":"bytes[]"}],"internalType":"struct IEIP712Types.SignedOrder","name":"order","type":"tuple"},{"components":[{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"internalType":"struct OrderRouter.SigPayload","name":"payload","type":"tuple"}],"name":"fillSwap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"srcLzc","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
0x60c060405234801561001057600080fd5b5060405161204d38038061204d83398101604081905261002f916100fc565b33826001600160a01b038116610058576040516359106c8960e01b815260040160405180910390fd5b6001600160a01b039081166080526001600055811661009157604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b61009a816100aa565b5063ffffffff1660a0525061014b565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000806040838503121561010f57600080fd5b82516001600160a01b038116811461012657600080fd5b602084015190925063ffffffff8116811461014057600080fd5b809150509250929050565b60805160a051611ec8610185600039600081816101ef015281816102bf015261031a01526000818161014e01526109df0152611ec86000f3fe6080604052600436106100b55760003560e01c8063964e93d211610069578063cedb6a171161004e578063cedb6a1714610226578063df94b2cd1461025a578063f2fde38b1461027c57600080fd5b8063964e93d2146101bd578063b77bcbf6146101dd57600080fd5b80636afdd8501161009a5780636afdd8501461013c578063715018a6146101885780638da5cb5b1461019f57600080fd5b80630663f739146100c1578063491df7961461010857600080fd5b366100bc57005b600080fd5b3480156100cd57600080fd5b506100f57f09b1a1bb4cc16023559d74e2ef3baf1e7655278389aa191f93c2d0ce7a228f9781565b6040519081526020015b60405180910390f35b34801561011457600080fd5b506100f57f08c5c06d705aab195c64aebf22ef7673b006faea02f9cefb82682c50404d2d5481565b34801561014857600080fd5b506101707f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100ff565b34801561019457600080fd5b5061019d61029c565b005b3480156101ab57600080fd5b506001546001600160a01b0316610170565b3480156101c957600080fd5b5061019d6101d836600461183b565b6102b0565b3480156101e957600080fd5b506102117f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff90911681526020016100ff565b34801561023257600080fd5b506100f57f0a22d08807493225d7fba8130c820642109e440bcc009aedb37f6d9fa2a90b6d81565b34801561026657600080fd5b5061026f6106a6565b6040516100ff9190611901565b34801561028857600080fd5b5061019d610297366004611914565b6106c5565b6102a4610708565b6102ae6000610735565b565b6102b8610794565b63ffffffff7f0000000000000000000000000000000000000000000000000000000000000000166102ef60a084016080850161193d565b63ffffffff161461031357604051632b7b5ea760e11b815260040160405180910390fd5b63ffffffff7f00000000000000000000000000000000000000000000000000000000000000001661034a608084016060850161193d565b63ffffffff161461036e57604051636c8d8b3d60e01b815260040160405180910390fd5b42610380610100840160e0850161193d565b63ffffffff1610156103a5576040516362b439dd60e11b815260040160405180910390fd5b60006103b0836107be565b90506103ba6108b5565b604080516101008101825260009181906103d990870160208801611914565b6001600160a01b0316815260208581013590820152604001610402610100870160e0880161193d565b63ffffffff16815260209081019061041c90870187611914565b6001600160a01b0316815230602082015260a086013560408201819052606082015260800161044b8580611963565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050915250604080516101e081019091526101a68082529192506104ab91839190611ced602083013984610907565b6104cf6104bc6101808601866119b1565b6104ca6101a08801886119b1565b610ab1565b60006104e16040860160208701611914565b905060408501356101408601356001600160a01b0383161561058d576040516370a0823160e01b81523060048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa158015610544573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061056891906119fb565b90508015610587576105878461058160208b018b611914565b83610cc0565b506105a8565b4780156105a6576105a6600061058160208b018b611914565b505b6001600160a01b0382161561063b576040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa1580156105fe573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061062291906119fb565b9050801561063557610635838383610cc0565b50610650565b47801561064e5761064e60008383610cc0565b505b8461065e6020890189611914565b6001600160a01b03167fffd4fcf4dc488f8b6780a471c88ecf0f88cb54e115b3295ce393d38b603ef63c60405160405180910390a350505050506106a26001600055565b5050565b604051806101e001604052806101a68152602001611ced6101a6913981565b6106cd610708565b6001600160a01b0381166106fc57604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b61070581610735565b50565b6001546001600160a01b031633146102ae5760405163118cdaa760e01b81523360048201526024016106f3565b600180546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6002600054036107b757604051633ee5aeb560e01b815260040160405180910390fd5b6002600055565b60007f0a22d08807493225d7fba8130c820642109e440bcc009aedb37f6d9fa2a90b6d6107ee6020840184611914565b6107fa84602001610d64565b6108068560e001610e13565b61014086013561081e61018088016101608901611914565b61083461082f6101808a018a6119b1565b610e97565b61084a6108456101a08b018b6119b1565b610f44565b6040805160208101999099526001600160a01b03978816908901526060880195909552608087019390935260a086019190915290921660c084015260e0830191909152610100820152610120015b604051602081830303815290604052805190602001209050919050565b7323fd579fb1169c595bc8814910d1be78c0b7e56d3314806108ea5750739f863dfdb5df33fe5f87601b8d2f23c816d5fde833145b6102ae5760405163773f27df60e11b815260040160405180910390fd5b60006040518060600160405280604051806040016040528087600001516001600160a01b031681526020018760a00151815250815260200185602001518152602001856040015181525090506000604051806040016040528086608001516001600160a01b031681526020018660c00151815250905060008282876060015186888a60e001516040516024016109a296959493929190611a14565b60408051601f198184030181529181526020820180516001600160e01b03166309be14ff60e11b1790525190915060009081906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690610a0b908590611ab4565b6000604051808303816000865af19150503d8060008114610a48576040519150601f19603f3d011682016040523d82523d6000602084013e610a4d565b606091505b509150915081610aa7578051600090600411610a6a575060208101515b604051630427c7ef60e21b81527fffffffff00000000000000000000000000000000000000000000000000000000821660048201526024016106f3565b5050505050505050565b82818114610aeb576040517fffbfdfb900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b81811015610cb8576000868683818110610b0a57610b0a611ad0565b9050602002016020810190610b1f9190611ae6565b9050366000868685818110610b3657610b36611ad0565b9050602002810190610b489190611963565b90925090507ffffffffffffffffa0000000000000000000000000000000000000000000000006001600160c01b0319841601610b8e57610b89828286611029565b610caa565b7ffffffffffffffff90000000000000000000000000000000000000000000000006001600160c01b0319841601610bca57610b898282866110fb565b7ffffffffffffffffe0000000000000000000000000000000000000000000000006001600160c01b0319841601610c0657610b89828286611137565b7ffffffffffffffffd0000000000000000000000000000000000000000000000006001600160c01b0319841601610c4257610b89828286611291565b7ffffffffffffffffc0000000000000000000000000000000000000000000000006001600160c01b0319841601610c7e57610b898282866113a3565b6001600160c01b0319831615610caa5760405163952d055b60e01b8152600481018590526024016106f3565b505050806001019050610aee565b505050505050565b80600003610ccd57505050565b6001600160a01b038316610d54576000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610d28576040519150601f19603f3d011682016040523d82523d6000602084013e610d2d565b606091505b5050905080610d4e5760405162461bcd60e51b81526004016106f390611b10565b50505050565b610d5f8383836115b4565b505050565b60007f08c5c06d705aab195c64aebf22ef7673b006faea02f9cefb82682c50404d2d54610d946020840184611914565b6020840135610da9606086016040870161193d565b610db9608087016060880161193d565b86608001358760a0013560405160200161089897969594939291909687526001600160a01b03959095166020870152604086019390935263ffffffff918216606086015216608084015260a083015260c082015260e00190565b60007f09b1a1bb4cc16023559d74e2ef3baf1e7655278389aa191f93c2d0ce7a228f97610e43602084018461193d565b610e536040850160208601611b43565b610e636060860160408701611b43565b60408051602081019590955263ffffffff9093169284019290925261ffff908116606084015216608082015260a001610898565b60008181610ea6826020611b67565b67ffffffffffffffff811115610ebe57610ebe611b8c565b6040519080825280601f01601f191660200182016040528015610ee8576020820181803683370190505b50905060005b82811015610f31576000868683818110610f0a57610f0a611ad0565b9050602002016020810190610f1f9190611ae6565b60208381028501015250600101610eee565b5080516020909101209150505b92915050565b600081818167ffffffffffffffff811115610f6157610f61611b8c565b604051908082528060200260200182016040528015610f8a578160200160208202803683370190505b50905060005b82811015610ff757858582818110610faa57610faa611ad0565b9050602002810190610fbc9190611963565b604051610fca929190611ba2565b6040518091039020828281518110610fe457610fe4611ad0565b6020908102919091010152600101610f90565b50806040516020016110099190611bb2565b604051602081830303815290604052805190602001209250505092915050565b80601883101561104f576040516314ba797960e11b81526004016106f391815260200190565b50600061105c8385611be8565b60601c90503660006110718560148189611c35565b91509150600080846001600160a01b03168484604051611092929190611ba2565b6000604051808303816000865af19150503d80600081146110cf576040519150601f19603f3d011682016040523d82523d6000602084013e6110d4565b606091505b509150915081610aa757858160405163121ec1d760e31b81526004016106f3929190611c5f565b8060405163121ec1d760e31b81526004016106f3918152604060208201819052600790820152660556e69737761760cc1b606082015260800190565b80604883101561115d576040516314ba797960e11b81526004016106f391815260200190565b50600061116d6014828587611c35565b61117691611be8565b60601c9050600061118b602860148688611c35565b61119491611be8565b60601c905060006111a9604860288789611c35565b8101906111b69190611c78565b60405163095ea7b360e01b81526001600160a01b0384811660048301526024820183905291925060009185169063095ea7b3906044016020604051808303816000875af115801561120b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061122f9190611c91565b905080611288578460405163121ec1d760e31b81526004016106f3918152604060208201819052600f908201527f417070726f76616c206661696c65640000000000000000000000000000000000606082015260800190565b50505050505050565b8060348310156112b7576040516314ba797960e11b81526004016106f391815260200190565b5060006112c76014828587611c35565b6112d091611be8565b60601c905060006112e5603460148688611c35565b8101906112f29190611c78565b60408051600481526024810182526020810180516001600160e01b0316630d0e30db60e41b179052905191925060009182916001600160a01b03861691859161133a91611ab4565b60006040518083038185875af1925050503d8060008114611377576040519150601f19603f3d011682016040523d82523d6000602084013e61137c565b606091505b50915091508161128857848160405163121ec1d760e31b81526004016106f3929190611c5f565b8060288310156113c9576040516314ba797960e11b81526004016106f391815260200190565b5060006113d96014828587611c35565b6113e291611be8565b60601c905060006113f7602860148688611c35565b61140091611be8565b6040516370a0823160e01b815230600482015260609190911c91506000906001600160a01b038416906370a0823190602401602060405180830381865afa15801561144f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061147391906119fb565b9050600080846001600160a01b03168360405160240161149591815260200190565b60408051601f198184030181529181526020820180516001600160e01b0316632e1a7d4d60e01b179052516114ca9190611ab4565b6000604051808303816000865af19150503d8060008114611507576040519150601f19603f3d011682016040523d82523d6000602084013e61150c565b606091505b50915091508161153357858160405163121ec1d760e31b81526004016106f3929190611c5f565b6000846001600160a01b03168460405160006040518083038185875af1925050503d8060008114611580576040519150601f19603f3d011682016040523d82523d6000602084013e611585565b606091505b50509050806115a9578660405163121ec1d760e31b81526004016106f39190611cb3565b505050505050505050565b604080516001600160a01b03848116602483015260448083018590528351808403909101815260649092018352602080830180516001600160e01b031663a9059cbb60e01b17905283518085019094528084527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656490840152610d5f928692916000916116449185169084906116c1565b805190915015610d5f57808060200190518101906116629190611c91565b610d5f5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016106f3565b60606116d084846000856116da565b90505b9392505050565b60608247101561173b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016106f3565b843b6117895760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016106f3565b600080866001600160a01b031685876040516117a59190611ab4565b60006040518083038185875af1925050503d80600081146117e2576040519150601f19603f3d011682016040523d82523d6000602084013e6117e7565b606091505b50915091506117f7828286611802565b979650505050505050565b606083156118115750816116d3565b8251156118215782518084602001fd5b8160405162461bcd60e51b81526004016106f39190611901565b6000806040838503121561184e57600080fd5b823567ffffffffffffffff81111561186557600080fd5b83016101c0818603121561187857600080fd5b9150602083013567ffffffffffffffff81111561189457600080fd5b8301604081860312156118a657600080fd5b809150509250929050565b60005b838110156118cc5781810151838201526020016118b4565b50506000910152565b600081518084526118ed8160208601602086016118b1565b601f01601f19169290920160200192915050565b6020815260006116d360208301846118d5565b60006020828403121561192657600080fd5b81356001600160a01b03811681146116d357600080fd5b60006020828403121561194f57600080fd5b813563ffffffff811681146116d357600080fd5b6000808335601e1984360301811261197a57600080fd5b83018035915067ffffffffffffffff82111561199557600080fd5b6020019150368190038213156119aa57600080fd5b9250929050565b6000808335601e198436030181126119c857600080fd5b83018035915067ffffffffffffffff8211156119e357600080fd5b6020019150600581901b36038213156119aa57600080fd5b600060208284031215611a0d57600080fd5b5051919050565b611a3281885180516001600160a01b03168252602090810151910152565b6020870151604082015260408701516060820152611a66608082018780516001600160a01b03168252602090810151910152565b6001600160a01b03851660c08201528360e08201526101406101008201526000611a946101408301856118d5565b828103610120840152611aa781856118d5565b9998505050505050505050565b60008251611ac68184602087016118b1565b9190910192915050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215611af857600080fd5b81356001600160c01b0319811681146116d357600080fd5b602081526000610f3e602083016013815272115512081d1c985b9cd9995c8819985a5b1959606a1b602082015260400190565b600060208284031215611b5557600080fd5b813561ffff811681146116d357600080fd5b8082028115828204841417610f3e57634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b8183823760009101908152919050565b8151600090829060208501835b82811015611bdd578151845260209384019390910190600101611bbf565b509195945050505050565b80356bffffffffffffffffffffffff198116906014841015611c2e576bffffffffffffffffffffffff196bffffffffffffffffffffffff198560140360031b1b82161691505b5092915050565b60008085851115611c4557600080fd5b83861115611c5257600080fd5b5050820193919092039150565b8281526040602082015260006116d060408301846118d5565b600060208284031215611c8a57600080fd5b5035919050565b600060208284031215611ca357600080fd5b815180151581146116d357600080fd5b8181526040602082015260006116d3604083016013815272115512081d1c985b9cd9995c8819985a5b1959606a1b60208201526040019056fe5369676e65644f72646572207769746e657373294f7264657245787069726174696f6e2875696e7433322074696d657374616d702c75696e743136206368616c6c656e67654f66667365742c75696e743136206368616c6c656e676557696e646f77294f72646572506172616d657465727328616464726573732073726341737365742c627974657333322064737441737365742c75696e743332207372634c7a632c75696e743332206473744c7a632c75696e74323536207372635175616e746974792c75696e74323536206473745175616e74697479295369676e65644f7264657228616464726573732073656e6465722c4f72646572506172616d657465727320706172616d65746572732c4f7264657245787069726174696f6e2065787069726174696f6e2c62797465733332207461726765742c616464726573732066696c6c65722c6279746573385b5d20637573746f6d496e737472756374696f6e732c62797465735b5d20637573746f6d446174617329546f6b656e5065726d697373696f6e73286164647265737320746f6b656e2c75696e7432353620616d6f756e7429a26469706673582212207ee7e3763b15d71df3ae9932317ed51c0d7476095b74c93406e050858ae826fc64736f6c634300081c0033000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba3000000000000000000000000000000000000000000000000000000000000759e
Deployed Bytecode
0x6080604052600436106100b55760003560e01c8063964e93d211610069578063cedb6a171161004e578063cedb6a1714610226578063df94b2cd1461025a578063f2fde38b1461027c57600080fd5b8063964e93d2146101bd578063b77bcbf6146101dd57600080fd5b80636afdd8501161009a5780636afdd8501461013c578063715018a6146101885780638da5cb5b1461019f57600080fd5b80630663f739146100c1578063491df7961461010857600080fd5b366100bc57005b600080fd5b3480156100cd57600080fd5b506100f57f09b1a1bb4cc16023559d74e2ef3baf1e7655278389aa191f93c2d0ce7a228f9781565b6040519081526020015b60405180910390f35b34801561011457600080fd5b506100f57f08c5c06d705aab195c64aebf22ef7673b006faea02f9cefb82682c50404d2d5481565b34801561014857600080fd5b506101707f000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba381565b6040516001600160a01b0390911681526020016100ff565b34801561019457600080fd5b5061019d61029c565b005b3480156101ab57600080fd5b506001546001600160a01b0316610170565b3480156101c957600080fd5b5061019d6101d836600461183b565b6102b0565b3480156101e957600080fd5b506102117f000000000000000000000000000000000000000000000000000000000000759e81565b60405163ffffffff90911681526020016100ff565b34801561023257600080fd5b506100f57f0a22d08807493225d7fba8130c820642109e440bcc009aedb37f6d9fa2a90b6d81565b34801561026657600080fd5b5061026f6106a6565b6040516100ff9190611901565b34801561028857600080fd5b5061019d610297366004611914565b6106c5565b6102a4610708565b6102ae6000610735565b565b6102b8610794565b63ffffffff7f000000000000000000000000000000000000000000000000000000000000759e166102ef60a084016080850161193d565b63ffffffff161461031357604051632b7b5ea760e11b815260040160405180910390fd5b63ffffffff7f000000000000000000000000000000000000000000000000000000000000759e1661034a608084016060850161193d565b63ffffffff161461036e57604051636c8d8b3d60e01b815260040160405180910390fd5b42610380610100840160e0850161193d565b63ffffffff1610156103a5576040516362b439dd60e11b815260040160405180910390fd5b60006103b0836107be565b90506103ba6108b5565b604080516101008101825260009181906103d990870160208801611914565b6001600160a01b0316815260208581013590820152604001610402610100870160e0880161193d565b63ffffffff16815260209081019061041c90870187611914565b6001600160a01b0316815230602082015260a086013560408201819052606082015260800161044b8580611963565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050915250604080516101e081019091526101a68082529192506104ab91839190611ced602083013984610907565b6104cf6104bc6101808601866119b1565b6104ca6101a08801886119b1565b610ab1565b60006104e16040860160208701611914565b905060408501356101408601356001600160a01b0383161561058d576040516370a0823160e01b81523060048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa158015610544573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061056891906119fb565b90508015610587576105878461058160208b018b611914565b83610cc0565b506105a8565b4780156105a6576105a6600061058160208b018b611914565b505b6001600160a01b0382161561063b576040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa1580156105fe573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061062291906119fb565b9050801561063557610635838383610cc0565b50610650565b47801561064e5761064e60008383610cc0565b505b8461065e6020890189611914565b6001600160a01b03167fffd4fcf4dc488f8b6780a471c88ecf0f88cb54e115b3295ce393d38b603ef63c60405160405180910390a350505050506106a26001600055565b5050565b604051806101e001604052806101a68152602001611ced6101a6913981565b6106cd610708565b6001600160a01b0381166106fc57604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b61070581610735565b50565b6001546001600160a01b031633146102ae5760405163118cdaa760e01b81523360048201526024016106f3565b600180546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6002600054036107b757604051633ee5aeb560e01b815260040160405180910390fd5b6002600055565b60007f0a22d08807493225d7fba8130c820642109e440bcc009aedb37f6d9fa2a90b6d6107ee6020840184611914565b6107fa84602001610d64565b6108068560e001610e13565b61014086013561081e61018088016101608901611914565b61083461082f6101808a018a6119b1565b610e97565b61084a6108456101a08b018b6119b1565b610f44565b6040805160208101999099526001600160a01b03978816908901526060880195909552608087019390935260a086019190915290921660c084015260e0830191909152610100820152610120015b604051602081830303815290604052805190602001209050919050565b7323fd579fb1169c595bc8814910d1be78c0b7e56d3314806108ea5750739f863dfdb5df33fe5f87601b8d2f23c816d5fde833145b6102ae5760405163773f27df60e11b815260040160405180910390fd5b60006040518060600160405280604051806040016040528087600001516001600160a01b031681526020018760a00151815250815260200185602001518152602001856040015181525090506000604051806040016040528086608001516001600160a01b031681526020018660c00151815250905060008282876060015186888a60e001516040516024016109a296959493929190611a14565b60408051601f198184030181529181526020820180516001600160e01b03166309be14ff60e11b1790525190915060009081906001600160a01b037f000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba31690610a0b908590611ab4565b6000604051808303816000865af19150503d8060008114610a48576040519150601f19603f3d011682016040523d82523d6000602084013e610a4d565b606091505b509150915081610aa7578051600090600411610a6a575060208101515b604051630427c7ef60e21b81527fffffffff00000000000000000000000000000000000000000000000000000000821660048201526024016106f3565b5050505050505050565b82818114610aeb576040517fffbfdfb900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b81811015610cb8576000868683818110610b0a57610b0a611ad0565b9050602002016020810190610b1f9190611ae6565b9050366000868685818110610b3657610b36611ad0565b9050602002810190610b489190611963565b90925090507ffffffffffffffffa0000000000000000000000000000000000000000000000006001600160c01b0319841601610b8e57610b89828286611029565b610caa565b7ffffffffffffffff90000000000000000000000000000000000000000000000006001600160c01b0319841601610bca57610b898282866110fb565b7ffffffffffffffffe0000000000000000000000000000000000000000000000006001600160c01b0319841601610c0657610b89828286611137565b7ffffffffffffffffd0000000000000000000000000000000000000000000000006001600160c01b0319841601610c4257610b89828286611291565b7ffffffffffffffffc0000000000000000000000000000000000000000000000006001600160c01b0319841601610c7e57610b898282866113a3565b6001600160c01b0319831615610caa5760405163952d055b60e01b8152600481018590526024016106f3565b505050806001019050610aee565b505050505050565b80600003610ccd57505050565b6001600160a01b038316610d54576000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610d28576040519150601f19603f3d011682016040523d82523d6000602084013e610d2d565b606091505b5050905080610d4e5760405162461bcd60e51b81526004016106f390611b10565b50505050565b610d5f8383836115b4565b505050565b60007f08c5c06d705aab195c64aebf22ef7673b006faea02f9cefb82682c50404d2d54610d946020840184611914565b6020840135610da9606086016040870161193d565b610db9608087016060880161193d565b86608001358760a0013560405160200161089897969594939291909687526001600160a01b03959095166020870152604086019390935263ffffffff918216606086015216608084015260a083015260c082015260e00190565b60007f09b1a1bb4cc16023559d74e2ef3baf1e7655278389aa191f93c2d0ce7a228f97610e43602084018461193d565b610e536040850160208601611b43565b610e636060860160408701611b43565b60408051602081019590955263ffffffff9093169284019290925261ffff908116606084015216608082015260a001610898565b60008181610ea6826020611b67565b67ffffffffffffffff811115610ebe57610ebe611b8c565b6040519080825280601f01601f191660200182016040528015610ee8576020820181803683370190505b50905060005b82811015610f31576000868683818110610f0a57610f0a611ad0565b9050602002016020810190610f1f9190611ae6565b60208381028501015250600101610eee565b5080516020909101209150505b92915050565b600081818167ffffffffffffffff811115610f6157610f61611b8c565b604051908082528060200260200182016040528015610f8a578160200160208202803683370190505b50905060005b82811015610ff757858582818110610faa57610faa611ad0565b9050602002810190610fbc9190611963565b604051610fca929190611ba2565b6040518091039020828281518110610fe457610fe4611ad0565b6020908102919091010152600101610f90565b50806040516020016110099190611bb2565b604051602081830303815290604052805190602001209250505092915050565b80601883101561104f576040516314ba797960e11b81526004016106f391815260200190565b50600061105c8385611be8565b60601c90503660006110718560148189611c35565b91509150600080846001600160a01b03168484604051611092929190611ba2565b6000604051808303816000865af19150503d80600081146110cf576040519150601f19603f3d011682016040523d82523d6000602084013e6110d4565b606091505b509150915081610aa757858160405163121ec1d760e31b81526004016106f3929190611c5f565b8060405163121ec1d760e31b81526004016106f3918152604060208201819052600790820152660556e69737761760cc1b606082015260800190565b80604883101561115d576040516314ba797960e11b81526004016106f391815260200190565b50600061116d6014828587611c35565b61117691611be8565b60601c9050600061118b602860148688611c35565b61119491611be8565b60601c905060006111a9604860288789611c35565b8101906111b69190611c78565b60405163095ea7b360e01b81526001600160a01b0384811660048301526024820183905291925060009185169063095ea7b3906044016020604051808303816000875af115801561120b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061122f9190611c91565b905080611288578460405163121ec1d760e31b81526004016106f3918152604060208201819052600f908201527f417070726f76616c206661696c65640000000000000000000000000000000000606082015260800190565b50505050505050565b8060348310156112b7576040516314ba797960e11b81526004016106f391815260200190565b5060006112c76014828587611c35565b6112d091611be8565b60601c905060006112e5603460148688611c35565b8101906112f29190611c78565b60408051600481526024810182526020810180516001600160e01b0316630d0e30db60e41b179052905191925060009182916001600160a01b03861691859161133a91611ab4565b60006040518083038185875af1925050503d8060008114611377576040519150601f19603f3d011682016040523d82523d6000602084013e61137c565b606091505b50915091508161128857848160405163121ec1d760e31b81526004016106f3929190611c5f565b8060288310156113c9576040516314ba797960e11b81526004016106f391815260200190565b5060006113d96014828587611c35565b6113e291611be8565b60601c905060006113f7602860148688611c35565b61140091611be8565b6040516370a0823160e01b815230600482015260609190911c91506000906001600160a01b038416906370a0823190602401602060405180830381865afa15801561144f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061147391906119fb565b9050600080846001600160a01b03168360405160240161149591815260200190565b60408051601f198184030181529181526020820180516001600160e01b0316632e1a7d4d60e01b179052516114ca9190611ab4565b6000604051808303816000865af19150503d8060008114611507576040519150601f19603f3d011682016040523d82523d6000602084013e61150c565b606091505b50915091508161153357858160405163121ec1d760e31b81526004016106f3929190611c5f565b6000846001600160a01b03168460405160006040518083038185875af1925050503d8060008114611580576040519150601f19603f3d011682016040523d82523d6000602084013e611585565b606091505b50509050806115a9578660405163121ec1d760e31b81526004016106f39190611cb3565b505050505050505050565b604080516001600160a01b03848116602483015260448083018590528351808403909101815260649092018352602080830180516001600160e01b031663a9059cbb60e01b17905283518085019094528084527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656490840152610d5f928692916000916116449185169084906116c1565b805190915015610d5f57808060200190518101906116629190611c91565b610d5f5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016106f3565b60606116d084846000856116da565b90505b9392505050565b60608247101561173b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016106f3565b843b6117895760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016106f3565b600080866001600160a01b031685876040516117a59190611ab4565b60006040518083038185875af1925050503d80600081146117e2576040519150601f19603f3d011682016040523d82523d6000602084013e6117e7565b606091505b50915091506117f7828286611802565b979650505050505050565b606083156118115750816116d3565b8251156118215782518084602001fd5b8160405162461bcd60e51b81526004016106f39190611901565b6000806040838503121561184e57600080fd5b823567ffffffffffffffff81111561186557600080fd5b83016101c0818603121561187857600080fd5b9150602083013567ffffffffffffffff81111561189457600080fd5b8301604081860312156118a657600080fd5b809150509250929050565b60005b838110156118cc5781810151838201526020016118b4565b50506000910152565b600081518084526118ed8160208601602086016118b1565b601f01601f19169290920160200192915050565b6020815260006116d360208301846118d5565b60006020828403121561192657600080fd5b81356001600160a01b03811681146116d357600080fd5b60006020828403121561194f57600080fd5b813563ffffffff811681146116d357600080fd5b6000808335601e1984360301811261197a57600080fd5b83018035915067ffffffffffffffff82111561199557600080fd5b6020019150368190038213156119aa57600080fd5b9250929050565b6000808335601e198436030181126119c857600080fd5b83018035915067ffffffffffffffff8211156119e357600080fd5b6020019150600581901b36038213156119aa57600080fd5b600060208284031215611a0d57600080fd5b5051919050565b611a3281885180516001600160a01b03168252602090810151910152565b6020870151604082015260408701516060820152611a66608082018780516001600160a01b03168252602090810151910152565b6001600160a01b03851660c08201528360e08201526101406101008201526000611a946101408301856118d5565b828103610120840152611aa781856118d5565b9998505050505050505050565b60008251611ac68184602087016118b1565b9190910192915050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215611af857600080fd5b81356001600160c01b0319811681146116d357600080fd5b602081526000610f3e602083016013815272115512081d1c985b9cd9995c8819985a5b1959606a1b602082015260400190565b600060208284031215611b5557600080fd5b813561ffff811681146116d357600080fd5b8082028115828204841417610f3e57634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b8183823760009101908152919050565b8151600090829060208501835b82811015611bdd578151845260209384019390910190600101611bbf565b509195945050505050565b80356bffffffffffffffffffffffff198116906014841015611c2e576bffffffffffffffffffffffff196bffffffffffffffffffffffff198560140360031b1b82161691505b5092915050565b60008085851115611c4557600080fd5b83861115611c5257600080fd5b5050820193919092039150565b8281526040602082015260006116d060408301846118d5565b600060208284031215611c8a57600080fd5b5035919050565b600060208284031215611ca357600080fd5b815180151581146116d357600080fd5b8181526040602082015260006116d3604083016013815272115512081d1c985b9cd9995c8819985a5b1959606a1b60208201526040019056fe5369676e65644f72646572207769746e657373294f7264657245787069726174696f6e2875696e7433322074696d657374616d702c75696e743136206368616c6c656e67654f66667365742c75696e743136206368616c6c656e676557696e646f77294f72646572506172616d657465727328616464726573732073726341737365742c627974657333322064737441737365742c75696e743332207372634c7a632c75696e743332206473744c7a632c75696e74323536207372635175616e746974792c75696e74323536206473745175616e74697479295369676e65644f7264657228616464726573732073656e6465722c4f72646572506172616d657465727320706172616d65746572732c4f7264657245787069726174696f6e2065787069726174696f6e2c62797465733332207461726765742c616464726573732066696c6c65722c6279746573385b5d20637573746f6d496e737472756374696f6e732c62797465735b5d20637573746f6d446174617329546f6b656e5065726d697373696f6e73286164647265737320746f6b656e2c75696e7432353620616d6f756e7429a26469706673582212207ee7e3763b15d71df3ae9932317ed51c0d7476095b74c93406e050858ae826fc64736f6c634300081c0033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.