More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 63,677 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Permit Multicall | 65575354 | 46 secs ago | IN | 0 POL | 0.01038139 | ||||
Permit Multicall | 65575282 | 3 mins ago | IN | 0 POL | 0.00836127 | ||||
Delegatecall Mul... | 65575201 | 6 mins ago | IN | 3 POL | 0.0048273 | ||||
Permit Multicall | 65575057 | 11 mins ago | IN | 0 POL | 0.01191957 | ||||
Permit Multicall | 65574979 | 14 mins ago | IN | 0 POL | 0.00786647 | ||||
Delegatecall Mul... | 65574700 | 24 mins ago | IN | 2 POL | 0.00596549 | ||||
Permit Multicall | 65574665 | 25 mins ago | IN | 0 POL | 0.00917405 | ||||
Delegatecall Mul... | 65574571 | 29 mins ago | IN | 0.43213251 POL | 0.00491962 | ||||
Delegatecall Mul... | 65574528 | 30 mins ago | IN | 9.69910862 POL | 0.00868639 | ||||
Permit Multicall | 65574511 | 31 mins ago | IN | 0 POL | 0.01827581 | ||||
Delegatecall Mul... | 65574497 | 31 mins ago | IN | 3 POL | 0.00450584 | ||||
Delegatecall Mul... | 65574497 | 31 mins ago | IN | 40.67887545 POL | 0.00712815 | ||||
Permit Multicall | 65574480 | 32 mins ago | IN | 0 POL | 0.00855113 | ||||
Permit Multicall | 65574464 | 32 mins ago | IN | 0 POL | 0.00819958 | ||||
Permit Multicall | 65574460 | 32 mins ago | IN | 0 POL | 0.00814652 | ||||
Permit Multicall | 65574444 | 33 mins ago | IN | 0 POL | 0.00765611 | ||||
Permit Multicall | 65574409 | 34 mins ago | IN | 0 POL | 0.00847874 | ||||
Permit Multicall | 65574349 | 36 mins ago | IN | 0 POL | 0.00842437 | ||||
Delegatecall Mul... | 65574332 | 37 mins ago | IN | 0.2 POL | 0.00573196 | ||||
Permit Multicall | 65574321 | 37 mins ago | IN | 0 POL | 0.00821971 | ||||
Delegatecall Mul... | 65574238 | 40 mins ago | IN | 36.33674596 POL | 0.00645752 | ||||
Permit Multicall | 65574163 | 43 mins ago | IN | 0 POL | 0.0088182 | ||||
Delegatecall Mul... | 65574072 | 46 mins ago | IN | 0.6 POL | 0.00450578 | ||||
Delegatecall Mul... | 65574070 | 46 mins ago | IN | 17.1581635 POL | 0.00464609 | ||||
Delegatecall Mul... | 65573965 | 50 mins ago | IN | 1.13012767 POL | 0.00569934 |
Latest 25 internal transactions (View All)
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
65575354 | 46 secs ago | 2.44506304 POL | ||||
65575354 | 46 secs ago | 2.44506304 POL | ||||
65575282 | 3 mins ago | 1.15749204 POL | ||||
65575282 | 3 mins ago | 1.15749204 POL | ||||
65575201 | 6 mins ago | 3 POL | ||||
65575102 | 9 mins ago | 83.40659606 POL | ||||
65575102 | 9 mins ago | 83.40659606 POL | ||||
65575057 | 11 mins ago | 0.97848932 POL | ||||
65575057 | 11 mins ago | 0.97848932 POL | ||||
65574979 | 14 mins ago | 0.54002035 POL | ||||
65574979 | 14 mins ago | 0.54002035 POL | ||||
65574700 | 24 mins ago | 2 POL | ||||
65574665 | 25 mins ago | 0.98690944 POL | ||||
65574665 | 25 mins ago | 0.98690944 POL | ||||
65574571 | 29 mins ago | 0.43213251 POL | ||||
65574528 | 30 mins ago | 9.69910862 POL | ||||
65574511 | 31 mins ago | 4.57389833 POL | ||||
65574511 | 31 mins ago | 4.57389833 POL | ||||
65574497 | 31 mins ago | 3 POL | ||||
65574497 | 31 mins ago | 40.67887545 POL | ||||
65574480 | 32 mins ago | 1.19275763 POL | ||||
65574480 | 32 mins ago | 1.19275763 POL | ||||
65574464 | 32 mins ago | 24.88759262 POL | ||||
65574464 | 32 mins ago | 24.88759262 POL | ||||
65574460 | 32 mins ago | 0.76994109 POL |
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Source Code Verified (Exact Match)
Contract Name:
ERC20Router
Compiler Version
v0.8.25+commit.b61c2a91
Optimization Enabled:
Yes with 200 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.25; import {Ownable} from "solady/src/auth/Ownable.sol"; import {Tstorish} from "tstorish/src/Tstorish.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import {IERC1155} from "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {IAllowanceTransfer} from "permit2-relay/src/interfaces/IAllowanceTransfer.sol"; import {ISignatureTransfer} from "permit2-relay/src/interfaces/ISignatureTransfer.sol"; import {IPermit2} from "permit2-relay/src/interfaces/IPermit2.sol"; import {RelayerWitness} from "./types/lib/RelayStructs.sol"; import {IMulticaller} from "./types/interfaces/IMulticaller.sol"; contract ERC20Router is Ownable, Tstorish { using SafeERC20 for IERC20; // --- Errors --- // /// @notice Revert if array lengths do not match error ArrayLengthsMismatch(); /// @notice Revert if this contract is set as the recipient error InvalidRecipient(address recipient); /// @notice Revert if the target is invalid error InvalidTarget(address target); /// @notice Revert if the native transfer failed error NativeTransferFailed(); /// @notice Revert if no recipient is set error NoRecipientSet(); uint256 RECIPIENT_STORAGE_SLOT = uint256(keccak256("ERC20Router.recipient")); address constant ZORA_REWARDS_V1 = 0x7777777F279eba3d3Ad8F4E708545291A6fDBA8B; IPermit2 private immutable PERMIT2; address private immutable MULTICALLER; string public constant _RELAYER_WITNESS_TYPE_STRING = "RelayerWitness witness)RelayerWitness(address relayer)TokenPermissions(address token,uint256 amount)"; bytes32 public constant _EIP_712_RELAYER_WITNESS_TYPE_HASH = keccak256("RelayerWitness(address relayer)"); constructor(address permit2, address multicaller, address owner) Tstorish() { // Set the address of the Permit2 contract PERMIT2 = IPermit2(permit2); // Set the address of the multicaller contract MULTICALLER = multicaller; // Set the owner that can withdraw funds stuck in the contract _initializeOwner(owner); } receive() external payable {} function withdraw() external onlyOwner { _send(msg.sender, address(this).balance); } /// @notice Pull user ERC20 tokens through a signed batch permit /// and perform an arbitrary multicall. Pass in an empty /// permitSignature to only perform the multicall. /// @dev msg.value will persist across all calls in the multicall /// @param user The address of the user /// @param permit The permit details /// @param targets The addresses of the contracts to call /// @param datas The calldata for each call /// @param values The value to send with each call /// @param refundTo The address to refund any leftover ETH to /// @param permitSignature The signature for the permit function permitMulticall( address user, ISignatureTransfer.PermitBatchTransferFrom memory permit, address[] calldata targets, bytes[] calldata datas, uint256[] calldata values, address refundTo, bytes memory permitSignature ) external payable returns (bytes memory) { // Revert if array lengths do not match if (targets.length != datas.length || datas.length != values.length) { revert ArrayLengthsMismatch(); } if (permitSignature.length != 0) { // Use permit to transfer tokens from user to router _handlePermitBatch(user, permit, permitSignature); } // Perform the multicall and send leftover to refundTo bytes memory data = _delegatecallMulticall( targets, datas, values, refundTo ); return data; } /// @notice Call the Multicaller with a delegatecall to set the ERC20Router as the /// sender of the calls to the targets. /// @dev If a multicall is expecting to mint ERC721s or ERC1155s, the recipient must be explicitly set /// All calls to ERC721s and ERC1155s in the multicall will have the same recipient set in refundTo /// If refundTo is address(this), be sure to transfer tokens out of the router as part of the multicall /// @param targets The addresses of the contracts to call /// @param datas The calldata for each call /// @param values The value to send with each call /// @param refundTo The address to send any leftover ETH and set as recipient of ERC721/ERC1155 mints function delegatecallMulticall( address[] calldata targets, bytes[] calldata datas, uint256[] calldata values, address refundTo ) external payable returns (bytes memory) { // Revert if array lengths do not match if (targets.length != datas.length || datas.length != values.length) { revert ArrayLengthsMismatch(); } // Set the recipient in storage _setRecipient(refundTo); // Perform the multicall bytes memory data = _delegatecallMulticall( targets, datas, values, refundTo ); // Clear the recipient in storage _clearRecipient(); return data; } /// @notice Send leftover ERC20 tokens to the refundTo address /// @dev Should be included in the multicall if the router is expecting to receive tokens /// @param token The address of the ERC20 token /// @param refundTo The address to refund the tokens to function cleanupERC20(address token, address refundTo) external { // Check the router's balance for the token uint256 balance = IERC20(token).balanceOf(address(this)); // Transfer the token to the refundTo address if (balance > 0) { IERC20(token).safeTransfer(refundTo, balance); } } /// @notice Internal function to handle a permit batch transfer /// @param user The address of the user /// @param permit The permit details /// @param permitSignature The signature for the permit function _handlePermitBatch( address user, ISignatureTransfer.PermitBatchTransferFrom memory permit, bytes memory permitSignature ) internal { // Create the witness that should be signed over bytes32 witness = keccak256( abi.encode(_EIP_712_RELAYER_WITNESS_TYPE_HASH, msg.sender) ); // Create the SignatureTransferDetails array ISignatureTransfer.SignatureTransferDetails[] memory signatureTransferDetails = new ISignatureTransfer.SignatureTransferDetails[]( permit.permitted.length ); for (uint256 i = 0; i < permit.permitted.length; i++) { uint256 amount = permit.permitted[i].amount; signatureTransferDetails[i] = ISignatureTransfer .SignatureTransferDetails({ to: address(this), requestedAmount: amount }); } // Use the SignatureTransferDetails and permit signature to transfer tokens to the router PERMIT2.permitWitnessTransferFrom( permit, signatureTransferDetails, // When using a permit signature, cannot deposit on behalf of someone else other than `user` user, witness, _RELAYER_WITNESS_TYPE_STRING, permitSignature ); } /// @notice Internal function to set the recipient address for ERC721 or ERC1155 mint /// @dev If the chain does not support tstore, recipient will be saved in storage /// @param recipient The address of the recipient function _setRecipient(address recipient) internal { // Return early if the recipient is address(0) or address(1), which are special cases for the multicaller // If a multicall is expecting to mint ERC721s or ERC1155s, the recipient must be explicitly set if (recipient == address(0) || recipient == address(1)) { return; } // For safety, revert if the recipient is this contract // Tokens should either be minted directly to recipient, or transferred to recipient through the onReceived hooks if (recipient == address(this)) { revert InvalidRecipient(address(this)); } // Set the recipient in storage _setTstorish(RECIPIENT_STORAGE_SLOT, uint256(uint160(recipient))); } /// @notice Internal function to get the recipient address for ERC721 or ERC1155 mint function _getRecipient() internal view returns (address) { // Get the recipient from storage return address(uint160(_getTstorish(RECIPIENT_STORAGE_SLOT))); } /// @notice Internal function to clear the recipient address for ERC721 or ERC1155 mint function _clearRecipient() internal { // Return if recipient hasn't been set if (_getRecipient() == address(0)) { return; } // Clear the recipient in storage _clearTstorish(RECIPIENT_STORAGE_SLOT); } /// @notice Internal function to delegatecall the Multicaller contract /// @param targets The addresses of the contracts to call /// @param datas The calldata for each call /// @param values The value to send with each call /// @param refundTo The address to send any leftover ETH and set as recipient of ERC721/ERC1155 mints function _delegatecallMulticall( address[] calldata targets, bytes[] calldata datas, uint256[] calldata values, address refundTo ) internal returns (bytes memory) { for (uint256 i = 0; i < targets.length; i++) { // Revert if the call fails if (targets[i] == ZORA_REWARDS_V1) { revert InvalidTarget(ZORA_REWARDS_V1); } } // Perform the multicall and refund to the user (bool success, bytes memory data) = MULTICALLER.delegatecall( abi.encodeWithSignature( "aggregate(address[],bytes[],uint256[],address)", targets, datas, values, refundTo ) ); if (!success) { assembly { let returnDataSize := mload(data) revert(add(data, 32), returnDataSize) } } return data; } function _send(address to, uint256 value) internal { bool success; assembly { // Save gas by avoiding copying the return data to memory. // Provide at most 100k gas to the internal call, which is // more than enough to cover common use-cases of logic for // receiving native tokens (eg. SCW payable fallbacks). success := call(100000, to, value, 0, 0, 0, 0) } if (!success) { revert NativeTransferFailed(); } } function onERC721Received( address /*_operator*/, address /*_from*/, uint256 _tokenId, bytes calldata _data ) external returns (bytes4) { // Get the recipient from storage address recipient = _getRecipient(); // Revert if no recipient is set // Note this means transferring NFTs to this contract via `safeTransferFrom` will revert, // unless the transfer is part of a multicall that sets the recipient in storage if (recipient == address(0)) { revert NoRecipientSet(); } // Transfer the NFT to the recipient IERC721(msg.sender).safeTransferFrom(address(this), recipient, _tokenId, _data); return this.onERC721Received.selector; } function onERC1155Received( address /*_operator*/, address /*_from*/, uint256 _id, uint256 _value, bytes calldata _data ) external returns (bytes4) { // Get the recipient from storage address recipient = _getRecipient(); // Revert if no recipient is set // Note this means transferring NFTs to this contract via `safeTransferFrom` will revert, // unless the transfer is part of a multicall that sets the recipient in storage if (recipient == address(0)) { revert NoRecipientSet(); } // Transfer the tokens to the recipient IERC1155(msg.sender).safeTransferFrom(address(this), recipient, _id, _value, _data); return this.onERC1155Received.selector; } function onERC1155BatchReceived( address /*_operator*/, address /*_from*/, uint256[] calldata _ids, uint256[] calldata _values, bytes calldata _data ) external returns (bytes4) { // Get the recipient from storage address recipient = _getRecipient(); // Revert if no recipient is set // Note this means transferring NFTs to this contract via `safeTransferFrom` will revert, // unless the transfer is part of a multicall that sets the recipient in storage if (recipient == address(0)) { revert NoRecipientSet(); } // Transfer the tokens to the recipient IERC1155(msg.sender).safeBatchTransferFrom(address(this), recipient, _ids, _values, _data); return this.onERC1155BatchReceived.selector; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Simple single owner authorization mixin. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol) /// /// @dev Note: /// This implementation does NOT auto-initialize the owner to `msg.sender`. /// You MUST call the `_initializeOwner` in the constructor / initializer. /// /// While the ownable portion follows /// [EIP-173](https://eips.ethereum.org/EIPS/eip-173) for compatibility, /// the nomenclature for the 2-step ownership handover may be unique to this codebase. abstract contract Ownable { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The caller is not authorized to call the function. error Unauthorized(); /// @dev The `newOwner` cannot be the zero address. error NewOwnerIsZeroAddress(); /// @dev The `pendingOwner` does not have a valid handover request. error NoHandoverRequest(); /// @dev Cannot double-initialize. error AlreadyInitialized(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* EVENTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The ownership is transferred from `oldOwner` to `newOwner`. /// This event is intentionally kept the same as OpenZeppelin's Ownable to be /// compatible with indexers and [EIP-173](https://eips.ethereum.org/EIPS/eip-173), /// despite it not being as lightweight as a single argument event. event OwnershipTransferred(address indexed oldOwner, address indexed newOwner); /// @dev An ownership handover to `pendingOwner` has been requested. event OwnershipHandoverRequested(address indexed pendingOwner); /// @dev The ownership handover to `pendingOwner` has been canceled. event OwnershipHandoverCanceled(address indexed pendingOwner); /// @dev `keccak256(bytes("OwnershipTransferred(address,address)"))`. uint256 private constant _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE = 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0; /// @dev `keccak256(bytes("OwnershipHandoverRequested(address)"))`. uint256 private constant _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE = 0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d; /// @dev `keccak256(bytes("OwnershipHandoverCanceled(address)"))`. uint256 private constant _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE = 0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* STORAGE */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The owner slot is given by: /// `bytes32(~uint256(uint32(bytes4(keccak256("_OWNER_SLOT_NOT")))))`. /// It is intentionally chosen to be a high value /// to avoid collision with lower slots. /// The choice of manual storage layout is to enable compatibility /// with both regular and upgradeable contracts. bytes32 internal constant _OWNER_SLOT = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927; /// The ownership handover slot of `newOwner` is given by: /// ``` /// mstore(0x00, or(shl(96, user), _HANDOVER_SLOT_SEED)) /// let handoverSlot := keccak256(0x00, 0x20) /// ``` /// It stores the expiry timestamp of the two-step ownership handover. uint256 private constant _HANDOVER_SLOT_SEED = 0x389a75e1; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Override to return true to make `_initializeOwner` prevent double-initialization. function _guardInitializeOwner() internal pure virtual returns (bool guard) {} /// @dev Initializes the owner directly without authorization guard. /// This function must be called upon initialization, /// regardless of whether the contract is upgradeable or not. /// This is to enable generalization to both regular and upgradeable contracts, /// and to save gas in case the initial owner is not the caller. /// For performance reasons, this function will not check if there /// is an existing owner. function _initializeOwner(address newOwner) internal virtual { if (_guardInitializeOwner()) { /// @solidity memory-safe-assembly assembly { let ownerSlot := _OWNER_SLOT if sload(ownerSlot) { mstore(0x00, 0x0dc149f0) // `AlreadyInitialized()`. revert(0x1c, 0x04) } // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Store the new value. sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner)))) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner) } } else { /// @solidity memory-safe-assembly assembly { // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Store the new value. sstore(_OWNER_SLOT, newOwner) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner) } } } /// @dev Sets the owner directly without authorization guard. function _setOwner(address newOwner) internal virtual { if (_guardInitializeOwner()) { /// @solidity memory-safe-assembly assembly { let ownerSlot := _OWNER_SLOT // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner) // Store the new value. sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner)))) } } else { /// @solidity memory-safe-assembly assembly { let ownerSlot := _OWNER_SLOT // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner) // Store the new value. sstore(ownerSlot, newOwner) } } } /// @dev Throws if the sender is not the owner. function _checkOwner() internal view virtual { /// @solidity memory-safe-assembly assembly { // If the caller is not the stored owner, revert. if iszero(eq(caller(), sload(_OWNER_SLOT))) { mstore(0x00, 0x82b42900) // `Unauthorized()`. revert(0x1c, 0x04) } } } /// @dev Returns how long a two-step ownership handover is valid for in seconds. /// Override to return a different value if needed. /// Made internal to conserve bytecode. Wrap it in a public function if needed. function _ownershipHandoverValidFor() internal view virtual returns (uint64) { return 48 * 3600; } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PUBLIC UPDATE FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Allows the owner to transfer the ownership to `newOwner`. function transferOwnership(address newOwner) public payable virtual onlyOwner { /// @solidity memory-safe-assembly assembly { if iszero(shl(96, newOwner)) { mstore(0x00, 0x7448fbae) // `NewOwnerIsZeroAddress()`. revert(0x1c, 0x04) } } _setOwner(newOwner); } /// @dev Allows the owner to renounce their ownership. function renounceOwnership() public payable virtual onlyOwner { _setOwner(address(0)); } /// @dev Request a two-step ownership handover to the caller. /// The request will automatically expire in 48 hours (172800 seconds) by default. function requestOwnershipHandover() public payable virtual { unchecked { uint256 expires = block.timestamp + _ownershipHandoverValidFor(); /// @solidity memory-safe-assembly assembly { // Compute and set the handover slot to `expires`. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, caller()) sstore(keccak256(0x0c, 0x20), expires) // Emit the {OwnershipHandoverRequested} event. log2(0, 0, _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE, caller()) } } } /// @dev Cancels the two-step ownership handover to the caller, if any. function cancelOwnershipHandover() public payable virtual { /// @solidity memory-safe-assembly assembly { // Compute and set the handover slot to 0. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, caller()) sstore(keccak256(0x0c, 0x20), 0) // Emit the {OwnershipHandoverCanceled} event. log2(0, 0, _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE, caller()) } } /// @dev Allows the owner to complete the two-step ownership handover to `pendingOwner`. /// Reverts if there is no existing ownership handover requested by `pendingOwner`. function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner { /// @solidity memory-safe-assembly assembly { // Compute and set the handover slot to 0. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, pendingOwner) let handoverSlot := keccak256(0x0c, 0x20) // If the handover does not exist, or has expired. if gt(timestamp(), sload(handoverSlot)) { mstore(0x00, 0x6f5e8818) // `NoHandoverRequest()`. revert(0x1c, 0x04) } // Set the handover slot to 0. sstore(handoverSlot, 0) } _setOwner(pendingOwner); } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PUBLIC READ FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the owner of the contract. function owner() public view virtual returns (address result) { /// @solidity memory-safe-assembly assembly { result := sload(_OWNER_SLOT) } } /// @dev Returns the expiry timestamp for the two-step ownership handover to `pendingOwner`. function ownershipHandoverExpiresAt(address pendingOwner) public view virtual returns (uint256 result) { /// @solidity memory-safe-assembly assembly { // Compute the handover slot. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, pendingOwner) // Load the handover slot. result := sload(keccak256(0x0c, 0x20)) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* MODIFIERS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Marks a function as only callable by the owner. modifier onlyOwner() virtual { _checkOwner(); _; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.24; contract Tstorish { // Declare a storage variable indicating if TSTORE support has been // activated post-deployment. bool private _tstoreSupport; /* * ------------------------------------------------------------------------+ * Opcode | Mnemonic | Stack | Memory | * ------------------------------------------------------------------------| * 60 0x02 | PUSH1 0x02 | 0x02 | | * 60 0x1e | PUSH1 0x1e | 0x1e 0x02 | | * 61 0x3d5c | PUSH2 0x3d5c | 0x3d5c 0x1e 0x02 | | * 3d | RETURNDATASIZE | 0 0x3d5c 0x1e 0x02 | | * | * :: store deployed bytecode in memory: (3d) RETURNDATASIZE (5c) TLOAD :: | * 52 | MSTORE | 0x1e 0x02 | [0..0x20): 0x3d5c | * f3 | RETURN | | [0..0x20): 0x3d5c | * ------------------------------------------------------------------------+ */ uint256 constant _TLOAD_TEST_PAYLOAD = 0x6002_601e_613d5c_3d_52_f3; uint256 constant _TLOAD_TEST_PAYLOAD_LENGTH = 0x0a; uint256 constant _TLOAD_TEST_PAYLOAD_OFFSET = 0x16; // Declare an immutable variable to store the tstore test contract address. address private immutable _tloadTestContract; // Declare an immutable variable to store the initial TSTORE support status. bool private immutable _tstoreInitialSupport; // Declare an immutable function type variable for the _setTstorish function // based on chain support for tstore at time of deployment. function(uint256,uint256) internal immutable _setTstorish; // Declare an immutable function type variable for the _getTstorish function // based on chain support for tstore at time of deployment. function(uint256) view returns (uint256) internal immutable _getTstorish; // Declare an immutable function type variable for the _clearTstorish function // based on chain support for tstore at time of deployment. function(uint256) internal immutable _clearTstorish; // Declare a few custom revert error types. error TStoreAlreadyActivated(); error TStoreNotSupported(); error TloadTestContractDeploymentFailed(); error OnlyDirectCalls(); /** * @dev Determine TSTORE availability during deployment. This involves * attempting to deploy a contract that utilizes TLOAD as part of the * contract construction bytecode, and configuring initial support for * using TSTORE in place of SSTORE based on the result. */ constructor() { // Deploy the contract testing TLOAD support and store the address. address tloadTestContract = _prepareTloadTest(); // Ensure the deployment was successful. if (tloadTestContract == address(0)) { revert TloadTestContractDeploymentFailed(); } // Determine if TSTORE is supported. bool tstoreInitialSupport = _testTload(tloadTestContract); if (tstoreInitialSupport) { // If TSTORE is supported, set functions to their versions that use // tstore/tload directly without support checks. _setTstorish = _setTstore; _getTstorish = _getTstore; _clearTstorish = _clearTstore; } else { // If TSTORE is not supported, set functions to their versions that // fallback to sstore/sload until _tstoreSupport is true. _setTstorish = _setTstorishWithSstoreFallback; _getTstorish = _getTstorishWithSloadFallback; _clearTstorish = _clearTstorishWithSstoreFallback; } _tstoreInitialSupport = tstoreInitialSupport; // Set the address of the deployed TLOAD test contract as an immutable. _tloadTestContract = tloadTestContract; } /** * @dev External function to activate TSTORE usage. Does not need to be * called if TSTORE is supported from deployment, and only needs to be * called once. Reverts if TSTORE has already been activated or if the * opcode is not available. Note that this must be called directly from * an externally-owned account to avoid potential reentrancy issues. */ function __activateTstore() external { // Ensure this function is triggered from an externally-owned account. if (msg.sender != tx.origin) { revert OnlyDirectCalls(); } // Determine if TSTORE can potentially be activated. if (_tstoreInitialSupport || _tstoreSupport) { revert TStoreAlreadyActivated(); } // Determine if TSTORE can be activated and revert if not. if (!_testTload(_tloadTestContract)) { revert TStoreNotSupported(); } // Mark TSTORE as activated. _tstoreSupport = true; } /** * @dev Private function to set a TSTORISH value. Assigned to _setTstorish * internal function variable at construction if chain has tstore support. * * @param storageSlot The slot to write the TSTORISH value to. * @param value The value to write to the given storage slot. */ function _setTstore(uint256 storageSlot, uint256 value) private { assembly { tstore(storageSlot, value) } } /** * @dev Private function to set a TSTORISH value with sstore fallback. * Assigned to _setTstorish internal function variable at construction * if chain does not have tstore support. * * @param storageSlot The slot to write the TSTORISH value to. * @param value The value to write to the given storage slot. */ function _setTstorishWithSstoreFallback(uint256 storageSlot, uint256 value) private { if (_tstoreSupport) { assembly { tstore(storageSlot, value) } } else { assembly { sstore(storageSlot, value) } } } /** * @dev Private function to read a TSTORISH value. Assigned to _getTstorish * internal function variable at construction if chain has tstore support. * * @param storageSlot The slot to read the TSTORISH value from. * * @return value The TSTORISH value at the given storage slot. */ function _getTstore( uint256 storageSlot ) private view returns (uint256 value) { assembly { value := tload(storageSlot) } } /** * @dev Private function to read a TSTORISH value with sload fallback. * Assigned to _getTstorish internal function variable at construction * if chain does not have tstore support. * * @param storageSlot The slot to read the TSTORISH value from. * * @return value The TSTORISH value at the given storage slot. */ function _getTstorishWithSloadFallback( uint256 storageSlot ) private view returns (uint256 value) { if (_tstoreSupport) { assembly { value := tload(storageSlot) } } else { assembly { value := sload(storageSlot) } } } /** * @dev Private function to clear a TSTORISH value. Assigned to _clearTstorish internal * function variable at construction if chain has tstore support. * * @param storageSlot The slot to clear the TSTORISH value for. */ function _clearTstore(uint256 storageSlot) private { assembly { tstore(storageSlot, 0) } } /** * @dev Private function to clear a TSTORISH value with sstore fallback. * Assigned to _clearTstorish internal function variable at construction * if chain does not have tstore support. * * @param storageSlot The slot to clear the TSTORISH value for. */ function _clearTstorishWithSstoreFallback(uint256 storageSlot) private { if (_tstoreSupport) { assembly { tstore(storageSlot, 0) } } else { assembly { sstore(storageSlot, 0) } } } /** * @dev Private function to deploy a test contract that utilizes TLOAD as * part of its fallback logic. */ function _prepareTloadTest() private returns (address contractAddress) { // Utilize assembly to deploy a contract testing TLOAD support. assembly { // Write the contract deployment code payload to scratch space. mstore(0, _TLOAD_TEST_PAYLOAD) // Deploy the contract. contractAddress := create( 0, _TLOAD_TEST_PAYLOAD_OFFSET, _TLOAD_TEST_PAYLOAD_LENGTH ) } } /** * @dev Private view function to determine if TSTORE/TLOAD are supported by * the current EVM implementation by attempting to call the test * contract, which utilizes TLOAD as part of its fallback logic. */ function _testTload( address tloadTestContract ) private view returns (bool ok) { // Call the test contract, which will perform a TLOAD test. If the call // does not revert, then TLOAD/TSTORE is supported. Do not forward all // available gas, as all forwarded gas will be consumed on revert. (ok, ) = tloadTestContract.staticcall{ gas: gasleft() / 10 }(""); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.20; import {IERC165} from "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon * a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or * {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon * a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 tokenId) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the address zero. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (token/ERC1155/IERC1155.sol) pragma solidity ^0.8.20; import {IERC165} from "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC1155 compliant contract, as defined in the * https://eips.ethereum.org/EIPS/eip-1155[EIP]. */ interface IERC1155 is IERC165 { /** * @dev Emitted when `value` amount of tokens of type `id` are transferred from `from` to `to` by `operator`. */ event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); /** * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all * transfers. */ event TransferBatch( address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values ); /** * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to * `approved`. */ event ApprovalForAll(address indexed account, address indexed operator, bool approved); /** * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. * * If an {URI} event was emitted for `id`, the standard * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value * returned by {IERC1155MetadataURI-uri}. */ event URI(string value, uint256 indexed id); /** * @dev Returns the value of tokens of token type `id` owned by `account`. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) external view returns (uint256); /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch( address[] calldata accounts, uint256[] calldata ids ) external view returns (uint256[] memory); /** * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the caller. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. * * See {setApprovalForAll}. */ function isApprovedForAll(address account, address operator) external view returns (bool); /** * @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`. * * WARNING: This function can potentially allow a reentrancy attack when transferring tokens * to an untrusted contract, when invoking {onERC1155Received} on the receiver. * Ensure to follow the checks-effects-interactions pattern and consider employing * reentrancy guards when interacting with untrusted contracts. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}. * - `from` must have a balance of tokens of type `id` of at least `value` amount. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. * * WARNING: This function can potentially allow a reentrancy attack when transferring tokens * to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver. * Ensure to follow the checks-effects-interactions pattern and consider employing * reentrancy guards when interacting with untrusted contracts. * * Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments. * * Requirements: * * - `ids` and `values` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; import {IERC20Permit} from "../extensions/IERC20Permit.sol"; import {Address} from "../../../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; /** * @dev An operation with an ERC20 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. */ 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. */ 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. */ 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 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); if (returndata.length != 0 && !abi.decode(returndata, (bool))) { 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 silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // 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 cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0; } }
// 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; 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.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.23; enum OrderStatus { NotInitiated, Initiated, Settled__FulfilledPrimary, Settled__FulfilledSecondary, Settled__Refund, Cancelled } enum Verdict { FulfilledPrimary, FulfilledSecondary, Refund } /// @notice A struct representing an input or output token transfer. These transfers must take place /// on their respective chains in order for validators to sign the order. /// @param token The address of the token to transfer /// @param from The from address /// @param to The to address /// @param amount The amount to transfer /// @param chainId The chainId of the transfer struct TokenTransfer { address token; // address(0) for native, erc20 otherwise address from; address to; uint256 amount; uint256 chainId; // chainId of 0 means escrow balance should be transferred between `from` and `to` } /// @notice A call to be executed as part of the order. If a call is representing a "pre-hook", the output /// of the call will be bridged to the destination chain. If a call is representing a "post-hook", /// the output of the call will be sent to the user. /// @param to The address of the contract to call /// @param isPreHook If true, the call is a "pre-hook". If false, the call is a "post-hook" /// @param value The value to send with the call /// @param data The data to send with the call struct Route { address to; uint256 value; uint256 chainId; bytes data; } /// @notice An order that can be sequenced and settled by the protocol /// To complete the order lifecycle, the order must be signed by the user, relayer, validator, and oracle /// @param user The address of the user /// @param relayer The address of the relayer /// @param validator The address of the validator /// @param collateralAmount The amount of collateral to lock as part of the order /// @param expiration The order expiration timestamp. If a validator determines that input tokens haven't been transferred by expiration, /// it can cancel the order. /// @param intentCommit A hash of the order's input and output TokenTransfer[], or the order's "intent". Any internal Relay ETH fees to other /// parties in the order lifecylce should be specified in the output array. Note that the order of the encoded inputs will affect /// the intentCommit hash. The intentCommit is meant to be revealed in the call to `settleOrder`. /// @param primaryCommit A hash of the order's origin and destination Route[]. This route should satisfy the hashed intentCommit. /// The routeCommit is meant to be verified offchain between the relayer and the validator. /// @param hookCommit A hash of the order's pre and post hooks, if necessary. Note that the pre hook will be executed with the user's input tokens /// on the origin chain, and the post hook will be executed with the user's output tokens on the destination chain struct Order { address user; address relayer; address validator; uint256 nonce; uint256 collateralAmount; uint256 inputDeadline; uint256 primaryDeadline; uint256 secondaryDeadline; bytes32 intentCommit; bytes32 primaryCommit; bytes32 secondaryCommit; } /// @notice Collateral balances (user or relayer) /// @param totalBalance The total balance of the account /// @param outstandingBalance The balance locked in initiated but unsettled orders /// @param relayEthBalance Surplus ETH from fees that can be used to pay for fees or gas struct Balances { uint256 totalBalance; uint256 outstandingBalance; uint256 relayEthBalance; } struct RelayerWitness { address relayer; } struct EscrowBalance { uint256 timelock; uint256 lockedBalance; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /** * @title IMulticaller * @notice Interface for the Multicaller contract. */ interface IMulticaller { /** * @dev Aggregates multiple calls in a single transaction. * @param targets An array of addresses to call. * @param data An array of calldata to forward to the targets. * @param values How much ETH to forward to each target. * @param refundTo The address to transfer any remaining ETH in the contract after the calls. * If `address(0)`, remaining ETH will NOT be refunded. * If `address(1)`, remaining ETH will be refunded to `msg.sender`. * If anything else, remaining ETH will be refunded to `refundTo`. * @return An array of the returndata from each call. */ function aggregate( address[] calldata targets, bytes[] calldata data, uint256[] calldata values, address refundTo ) external payable returns (bytes[] memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * 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[EIP 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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. * * CAUTION: See Security Considerations above. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol) pragma solidity ^0.8.20; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error AddressInsufficientBalance(address account); /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedInnerCall(); /** * @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://consensys.net/diligence/blog/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.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert AddressInsufficientBalance(address(this)); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert FailedInnerCall(); } } /** * @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 or custom error, it is bubbled * up by this function (like regular Solidity function calls). However, if * the call reverted with no returned reason, this function reverts with a * {FailedInnerCall} error. * * 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. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0); } /** * @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`. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { if (address(this).balance < value) { revert AddressInsufficientBalance(address(this)); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an * unsuccessful call. */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata ) internal view returns (bytes memory) { if (!success) { _revert(returndata); } else { // only check if target is a contract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (returndata.length == 0 && target.code.length == 0) { revert AddressEmptyCode(target); } return returndata; } } /** * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the * revert reason or with a default {FailedInnerCall} error. */ function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) { if (!success) { _revert(returndata); } else { return returndata; } } /** * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}. */ function _revert(bytes memory returndata) private pure { // 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 /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert FailedInnerCall(); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IEIP712 { function DOMAIN_SEPARATOR() external view returns (bytes32); }
{ "remappings": [ "@openzeppelin/=lib/openzeppelin-contracts/contracts/", "account-abstraction/=lib/account-abstraction/contracts/", "solady/=lib/solady/", "smart-wallet/=lib/smart-wallet/", "magic-spend/=lib/magic-spend/", "multicaller/=lib/Multicaller/", "v2-core/=lib/v2-core/", "v2-periphery/=lib/v2-periphery/", "tstorish/=lib/tstorish/", "permit2-relay/=lib/permit2-relay/", "solmate/=lib/solmate/", "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "@openzeppelin/contracts/security/=lib/magic-spend/lib/openzeppelin-contracts/contracts/utils/", "FreshCryptoLib/=lib/smart-wallet/lib/FreshCryptoLib/solidity/src/", "Multicaller/=lib/Multicaller/src/", "ds-test/=lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "forge-gas-snapshot/=lib/permit2-relay/lib/forge-gas-snapshot/src/", "forge-std/=lib/forge-std/src/", "fuzzlib/=lib/magic-spend/lib/fuzzlib/src/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "p256-verifier/=lib/smart-wallet/lib/p256-verifier/", "safe-singleton-deployer-sol/=lib/smart-wallet/lib/safe-singleton-deployer-sol/", "webauthn-sol/=lib/smart-wallet/lib/webauthn-sol/src/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "cancun", "viaIR": true, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"permit2","type":"address"},{"internalType":"address","name":"multicaller","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"AlreadyInitialized","type":"error"},{"inputs":[],"name":"ArrayLengthsMismatch","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"}],"name":"InvalidRecipient","type":"error"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"InvalidTarget","type":"error"},{"inputs":[],"name":"NativeTransferFailed","type":"error"},{"inputs":[],"name":"NewOwnerIsZeroAddress","type":"error"},{"inputs":[],"name":"NoHandoverRequest","type":"error"},{"inputs":[],"name":"NoRecipientSet","type":"error"},{"inputs":[],"name":"OnlyDirectCalls","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"TStoreAlreadyActivated","type":"error"},{"inputs":[],"name":"TStoreNotSupported","type":"error"},{"inputs":[],"name":"TloadTestContractDeploymentFailed","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"OwnershipHandoverCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"OwnershipHandoverRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"_EIP_712_RELAYER_WITNESS_TYPE_HASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_RELAYER_WITNESS_TYPE_STRING","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"__activateTstore","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"cancelOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"refundTo","type":"address"}],"name":"cleanupERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"pendingOwner","type":"address"}],"name":"completeOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address[]","name":"targets","type":"address[]"},{"internalType":"bytes[]","name":"datas","type":"bytes[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"address","name":"refundTo","type":"address"}],"name":"delegatecallMulticall","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"_ids","type":"uint256[]"},{"internalType":"uint256[]","name":"_values","type":"uint256[]"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"uint256","name":"_value","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"result","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pendingOwner","type":"address"}],"name":"ownershipHandoverExpiresAt","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"components":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct ISignatureTransfer.TokenPermissions[]","name":"permitted","type":"tuple[]"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct ISignatureTransfer.PermitBatchTransferFrom","name":"permit","type":"tuple"},{"internalType":"address[]","name":"targets","type":"address[]"},{"internalType":"bytes[]","name":"datas","type":"bytes[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"address","name":"refundTo","type":"address"},{"internalType":"bytes","name":"permitSignature","type":"bytes"}],"name":"permitMulticall","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"requestOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
610160604052346100a75761181a6060813803918261001d816100bf565b9384928339810103126100a75780610037610056926100e9565b906100506040610049602084016100e9565b92016100e9565b916100fd565b6040516115f0908161022a823960805181610909015260a051816108d7015260c0518161142f015260e05181610f14015261010051816114b101526101205181610d7c0152610140518161136f0152f35b5f80fd5b634e487b7160e01b5f52604160045260245ffd5b6040519190601f01601f191682016001600160401b038111838210176100e457604052565b6100ab565b51906001600160a01b03821682036100a757565b9190696002601e613d5c3d52f35f52600a60165ff0926001600160a01b03908185161561019c5784610131610185966101e7565b801561018757600160c052600360e0526005610100525b60a0526080526101777fde8722880b5dd233e72245d89ecf1926d842675ee7337f75a172abc8abc5ba88600155565b1661012052610140526101ae565b565b600260c052600460e052600661010052610148565b604051632aea588760e01b8152600490fd5b6001600160a01b0316638b78c6d8198190555f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a3565b5f80808093600a5a04fa3d15610226573d6001600160401b0381116100e457610219601f8201601f19166020016100bf565b9081525f60203d92013e90565b9056fe6080604052600436101561001a575b3615610018575f80fd5b005b5f3560e01c8063150b7a021461012957806325692962146101245780633806a3cf1461011f5780633ccfd60b1461011a5780633dad0c9c1461011557806354d1f13d1461011057806366b9ca7b1461010b5780636e305f8014610106578063715018a6146101015780637423eb3c146100fc5780638da5cb5b146100f7578063bc197c81146100f2578063c99a0d65146100ed578063f04e283e146100e8578063f23a6e61146100e3578063f2fde38b146100de5763fee81cf40361000e57610be8565b610ba9565b610ae4565b610a93565b610a59565b6109b2565b610986565b6108be565b61087a565b6107c4565b610707565b61055e565b6104b8565b61047c565b61044d565b610278565b61018c565b6001600160a01b0381160361013f57565b5f80fd5b600435906101508261012e565b565b60a435906101508261012e565b9181601f8401121561013f578235916001600160401b03831161013f576020838186019501011161013f57565b3461013f57608036600319011261013f576101a860043561012e565b6101b360243561012e565b6064356001600160401b03811161013f576101d290369060040161015f565b906101db610f0f565b906001600160a01b0382161561025c57333b1561013f575f916102176040519485938493635c46a7ef60e11b8552604435903060048701610c3e565b038183335af180156102575761023e575b604051630a85bd0160e11b8152602090f35b0390f35b8061024b610251926102d5565b8061026e565b5f610228565b610c6f565b60405163f36675c360e01b8152600490fd5b5f91031261013f57565b5f36600319011261013f5763389a75e1600c52335f526202a30042016020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a2005b634e487b7160e01b5f52604160045260245ffd5b6001600160401b0381116102e857604052565b6102c1565b606081019081106001600160401b038211176102e857604052565b604081019081106001600160401b038211176102e857604052565b608081019081106001600160401b038211176102e857604052565b90601f801991011681019081106001600160401b038211176102e857604052565b6040519061015082610308565b6001600160401b0381116102e857601f01601f191660200190565b6040519060a082018281106001600160401b038211176102e8576040526064825263756e742960e01b6080837f52656c617965725769746e657373207769746e6573732952656c61796572576960208201527f746e65737328616464726573732072656c6179657229546f6b656e5065726d6960408201527f7373696f6e73286164647265737320746f6b656e2c75696e7432353620616d6f60608201520152565b805180835260209291819084018484015e5f828201840152601f01601f1916010190565b3461013f575f36600319011261013f5761023a610468610387565b604051918291602083526020830190610429565b3461013f575f36600319011261013f57610494610f67565b5f8080804733620186a0f1156104a657005b604051633d2cec6f60e21b8152600490fd5b3461013f57604036600319011261013f576004356104d58161012e565b602435906104e28261012e565b6040516370a0823160e01b81523060048201526001600160a01b039190911691602082602481865afa918215610257575f9261052a575b508161052157005b61001892610f83565b9091506020813d602011610556575b816105466020938361033e565b8101031261013f5751905f610519565b3d9150610539565b5f36600319011261013f5763389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2005b6001600160401b0381116102e85760051b60200190565b909160608284031261013f5760408051906105d3826102ed565b819380356001600160401b03811161013f57810186601f8201121561013f578035602091610600826105a2565b9161060d8651938461033e565b808352838084019160061b830101918a831161013f578401905b8282106106465750505084528181013590840152810135910152909150565b86828c031261013f57848791825161065d81610308565b84356106688161012e565b81528285013583820152815201910190610627565b9181601f8401121561013f578235916001600160401b03831161013f576020808501948460051b01011161013f57565b81601f8201121561013f578035906106c48261036c565b926106d2604051948561033e565b8284526020838301011161013f57815f926020809301838601378301015290565b906020610704928181520190610429565b90565b60e036600319011261013f5761071b610143565b6001600160401b0360243581811161013f5761073b9036906004016105b9565b9160443582811161013f5761075490369060040161067d565b60643584811161013f5761076c90369060040161067d565b60849291923586811161013f5761078790369060040161067d565b939092610792610152565b9560c43598891161013f5761023a996107b26107b89a36906004016106ad565b98610c7a565b604051918291826106f3565b608036600319011261013f576001600160401b0360043581811161013f576107f090369060040161067d565b9160243581811161013f5761080990369060040161067d565b909160443590811161013f5761082390369060040161067d565b91606435936108318561012e565b818714801590610870575b61085e5761023a96610856966108518761140d565b61132b565b6107b8611496565b604051631dc0052360e11b8152600490fd5b508382141561083c565b5f36600319011261013f5761088d610f67565b5f638b78c6d8198181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a355005b3461013f575f36600319011261013f57323303610974577f00000000000000000000000000000000000000000000000000000000000000008015610969575b6109575761093161092d7f000000000000000000000000000000000000000000000000000000000000000061152d565b1590565b61094557610018600160ff195f5416175f55565b6040516370a4078f60e01b8152600490fd5b604051630f45b98b60e41b8152600490fd5b505f5460ff166108fd565b60405163096650c560e21b8152600490fd5b3461013f575f36600319011261013f57638b78c6d819546040516001600160a01b039091168152602090f35b3461013f5760a036600319011261013f576109ce60043561012e565b6109d960243561012e565b6001600160401b0360443581811161013f576109f990369060040161067d565b60649291923582811161013f57610a1490369060040161067d565b60849491943593841161013f5761023a94610a36610a3e95369060040161015f565b949093610e2b565b6040516001600160e01b031990911681529081906020820190565b3461013f575f36600319011261013f5760206040517f4910260415865c6d3ecf96968c7d912a0d533a72c3479ab1e1df0f4eb86fb0088152f35b602036600319011261013f57600435610aab8161012e565b610ab3610f67565b63389a75e1600c52805f526020600c209081544211610ad7575f61001892556114f5565b636f5e88185f526004601cfd5b3461013f5760a036600319011261013f57610b0060043561012e565b610b0b60243561012e565b6084356001600160401b03811161013f57610b2a90369060040161015f565b90610b33610f0f565b906001600160a01b0382161561025c57333b1561013f575f91610b736040519485938493637921219560e11b855260643590604435903060048801610edc565b038183335af1801561025757610b96575b60405163f23a6e6160e01b8152602090f35b8061024b610ba3926102d5565b5f610b84565b602036600319011261013f57600435610bc18161012e565b610bc9610f67565b8060601b15610bdb57610018906114f5565b637448fbae5f526004601cfd5b3461013f57602036600319011261013f57600435610c058161012e565b63389a75e1600c525f52602080600c2054604051908152f35b908060209392818452848401375f828201840152601f01601f1916010190565b6001600160a01b03918216815291166020820152604081019190915260806060820181905261070493910191610c1e565b6040513d5f823e3d90fd5b90999899858414801590610dfd575b61085e578a51610ca1575b505061070497985061132b565b96929793604099969295919951986020996020810190610d0881610cfa3385919091602060408201937f4910260415865c6d3ecf96968c7d912a0d533a72c3479ab1e1df0f4eb86fb008835260018060a01b0316910152565b03601f19810183528261033e565b51902096610d178a5151611033565b9c5f5b8b518051821015610d6457908f818f9182610d5d93610d3b846001986110a5565b510151610d4661035f565b30815291820152610d5783836110a5565b526110a5565b5001610d1a565b505093979b92969a5093979b90949860018060a01b037f00000000000000000000000000000000000000000000000000000000000000001693610da5610387565b853b1561013f5760405163fe8ec1a760e01b81529d8e958695610dcb9560048801611110565b03815a5f948591f19788156102575761070498610dea575b8998610c94565b8061024b610df7926102d5565b5f610de3565b5087861415610c89565b81835290916001600160fb1b03831161013f5760209260051b809284830137010190565b94909290916001600160a01b03610e40610f0f565b1692831561025c57333b1561013f575f95610e9d610eac94610e896040519a8b998a99631759616b60e11b8b523060048c015260248b015260a060448b015260a48a0191610e07565b9060031995868984030160648a0152610e07565b92858403016084860152610c1e565b038183335af1801561025757610ec9575b5063bc197c8160e01b90565b8061024b610ed6926102d5565b5f610ebd565b919261070496949160a094600180871b038092168552166020840152604083015260608201528160808201520191610c1e565b6001547f000000000000000000000000000000000000000000000000000000000000000080600414610f50576003036115a6575c5b6001600160a01b031690565b505f5460ff1615610f61575c610f44565b54610f44565b638b78c6d819543303610f7657565b6382b429005f526004601cfd5b915f8091610fd69360405195602087019263a9059cbb60e01b845260018060a01b038093166024890152604488015260448752610fbf87610323565b1694519082865af1610fcf6112fc565b9083611543565b805190811515918261100f575b5050610fec5750565b604051635274afe760e01b81526001600160a01b03919091166004820152602490fd5b819250906020918101031261013f576020015180159081150361013f575f80610fe3565b9061103d826105a2565b60409061104d604051918261033e565b838152809361105e601f19916105a2565b01915f5b83811061106f5750505050565b602090825161107d81610308565b5f8152825f81830152828601015201611062565b634e487b7160e01b5f52603260045260245ffd5b80518210156110b95760209160051b010190565b611091565b9081518082526020808093019301915f5b8281106110dd575050505090565b909192938260408261110460019489516020809160018060a01b0381511684520151910152565b019501939291016110cf565b9491969593909660c086526101208601978051606060c08901528051809a526101408801996020809201915f5b8281106111ae575050505061117c61070498996111a096959493604084602061118e96015160e08d015201516101008b015289820360208b01526110be565b6001600160a01b039094166040880152565b60608601528482036080860152610429565b9160a0818403910152610429565b835180516001600160a01b03168e52602090810151908e01526040909c019b9281019260010161113d565b91908110156110b95760051b0190565b356107048161012e565b97969593909492918060808a0160808b525260a0890195905f5b8181106112cd575050506020888603818a015281865280860195818360051b82010196845f925b85841061126e57505050505050508260609261125b928861015097960360408a0152610e07565b6001600160a01b03909216940193909352565b90919293949598601f198282030184528935601e198436030181121561013f5783018681019190356001600160401b03811161013f57803603831361013f576112bc88928392600195610c1e565b9b0194019401929594939190611234565b909192939660019084356112e08161012e565b60a083901b83900316815260209081019895940192910161120d565b3d15611326573d9061130d8261036c565b9161131b604051938461033e565b82523d5f602084013e565b606090565b95929491949390935f5b8581106113a957505f9694919361136b93889795610cfa93604051978896602088019a63991f255f60e01b8c52602489016111f3565b51907f00000000000000000000000000000000000000000000000000000000000000005af46113986112fc565b90156113a15790565b602081519101fd5b737777777f279eba3d3ad8f4e708545291a6fdba8b6113d4610f446113cf848a8d6111d9565b6111e9565b146113e157600101611335565b60405163d08525e960e01b8152737777777f279eba3d3ad8f4e708545291a6fdba8b6004820152602490fd5b6001600160a01b03168015801561148c575b61148957308114611471576001547f000000000000000000000000000000000000000000000000000000000000000080600214611460576001036115a6575d565b505f5460ff161561146e575d565b55565b604051630bc2c5df60e11b8152306004820152602490fd5b50565b506001811461141f565b6001600160a01b036114a6610f0f565b1615610150576001547f0000000000000000000000000000000000000000000000000000000000000000806006146114e4576005036115a6575f905d565b505f9060ff825416821461146e575d565b60018060a01b0316638b78c6d8198181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a355565b5f80808093600a5a04fa61153f6112fc565b5090565b9061156a575080511561155857805190602001fd5b604051630a12f52160e11b8152600490fd5b8151158061159d575b61157b575090565b604051639996b31560e01b81526001600160a01b039091166004820152602490fd5b50803b15611573565b634e487b7160e01b5f52605160045260245ffdfea26469706673582212207bf9c133090554a1de9ee1cebedde6e2e7868181fbec31459ba2521f5a235e4764736f6c63430008190033000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba30000000000000000000000000000000000002bdbf1bf3279983603ec279cc6df000000000000000000000000f70da97812cb96acdf810712aa562db8dfa3dbef
Deployed Bytecode
0x6080604052600436101561001a575b3615610018575f80fd5b005b5f3560e01c8063150b7a021461012957806325692962146101245780633806a3cf1461011f5780633ccfd60b1461011a5780633dad0c9c1461011557806354d1f13d1461011057806366b9ca7b1461010b5780636e305f8014610106578063715018a6146101015780637423eb3c146100fc5780638da5cb5b146100f7578063bc197c81146100f2578063c99a0d65146100ed578063f04e283e146100e8578063f23a6e61146100e3578063f2fde38b146100de5763fee81cf40361000e57610be8565b610ba9565b610ae4565b610a93565b610a59565b6109b2565b610986565b6108be565b61087a565b6107c4565b610707565b61055e565b6104b8565b61047c565b61044d565b610278565b61018c565b6001600160a01b0381160361013f57565b5f80fd5b600435906101508261012e565b565b60a435906101508261012e565b9181601f8401121561013f578235916001600160401b03831161013f576020838186019501011161013f57565b3461013f57608036600319011261013f576101a860043561012e565b6101b360243561012e565b6064356001600160401b03811161013f576101d290369060040161015f565b906101db610f0f565b906001600160a01b0382161561025c57333b1561013f575f916102176040519485938493635c46a7ef60e11b8552604435903060048701610c3e565b038183335af180156102575761023e575b604051630a85bd0160e11b8152602090f35b0390f35b8061024b610251926102d5565b8061026e565b5f610228565b610c6f565b60405163f36675c360e01b8152600490fd5b5f91031261013f57565b5f36600319011261013f5763389a75e1600c52335f526202a30042016020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a2005b634e487b7160e01b5f52604160045260245ffd5b6001600160401b0381116102e857604052565b6102c1565b606081019081106001600160401b038211176102e857604052565b604081019081106001600160401b038211176102e857604052565b608081019081106001600160401b038211176102e857604052565b90601f801991011681019081106001600160401b038211176102e857604052565b6040519061015082610308565b6001600160401b0381116102e857601f01601f191660200190565b6040519060a082018281106001600160401b038211176102e8576040526064825263756e742960e01b6080837f52656c617965725769746e657373207769746e6573732952656c61796572576960208201527f746e65737328616464726573732072656c6179657229546f6b656e5065726d6960408201527f7373696f6e73286164647265737320746f6b656e2c75696e7432353620616d6f60608201520152565b805180835260209291819084018484015e5f828201840152601f01601f1916010190565b3461013f575f36600319011261013f5761023a610468610387565b604051918291602083526020830190610429565b3461013f575f36600319011261013f57610494610f67565b5f8080804733620186a0f1156104a657005b604051633d2cec6f60e21b8152600490fd5b3461013f57604036600319011261013f576004356104d58161012e565b602435906104e28261012e565b6040516370a0823160e01b81523060048201526001600160a01b039190911691602082602481865afa918215610257575f9261052a575b508161052157005b61001892610f83565b9091506020813d602011610556575b816105466020938361033e565b8101031261013f5751905f610519565b3d9150610539565b5f36600319011261013f5763389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2005b6001600160401b0381116102e85760051b60200190565b909160608284031261013f5760408051906105d3826102ed565b819380356001600160401b03811161013f57810186601f8201121561013f578035602091610600826105a2565b9161060d8651938461033e565b808352838084019160061b830101918a831161013f578401905b8282106106465750505084528181013590840152810135910152909150565b86828c031261013f57848791825161065d81610308565b84356106688161012e565b81528285013583820152815201910190610627565b9181601f8401121561013f578235916001600160401b03831161013f576020808501948460051b01011161013f57565b81601f8201121561013f578035906106c48261036c565b926106d2604051948561033e565b8284526020838301011161013f57815f926020809301838601378301015290565b906020610704928181520190610429565b90565b60e036600319011261013f5761071b610143565b6001600160401b0360243581811161013f5761073b9036906004016105b9565b9160443582811161013f5761075490369060040161067d565b60643584811161013f5761076c90369060040161067d565b60849291923586811161013f5761078790369060040161067d565b939092610792610152565b9560c43598891161013f5761023a996107b26107b89a36906004016106ad565b98610c7a565b604051918291826106f3565b608036600319011261013f576001600160401b0360043581811161013f576107f090369060040161067d565b9160243581811161013f5761080990369060040161067d565b909160443590811161013f5761082390369060040161067d565b91606435936108318561012e565b818714801590610870575b61085e5761023a96610856966108518761140d565b61132b565b6107b8611496565b604051631dc0052360e11b8152600490fd5b508382141561083c565b5f36600319011261013f5761088d610f67565b5f638b78c6d8198181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a355005b3461013f575f36600319011261013f57323303610974577f00000000000000000000000000000000000000000000000000000000000000018015610969575b6109575761093161092d7f00000000000000000000000075c272be306cb9fe9938d4ab3ed9a78cc7c2248d61152d565b1590565b61094557610018600160ff195f5416175f55565b6040516370a4078f60e01b8152600490fd5b604051630f45b98b60e41b8152600490fd5b505f5460ff166108fd565b60405163096650c560e21b8152600490fd5b3461013f575f36600319011261013f57638b78c6d819546040516001600160a01b039091168152602090f35b3461013f5760a036600319011261013f576109ce60043561012e565b6109d960243561012e565b6001600160401b0360443581811161013f576109f990369060040161067d565b60649291923582811161013f57610a1490369060040161067d565b60849491943593841161013f5761023a94610a36610a3e95369060040161015f565b949093610e2b565b6040516001600160e01b031990911681529081906020820190565b3461013f575f36600319011261013f5760206040517f4910260415865c6d3ecf96968c7d912a0d533a72c3479ab1e1df0f4eb86fb0088152f35b602036600319011261013f57600435610aab8161012e565b610ab3610f67565b63389a75e1600c52805f526020600c209081544211610ad7575f61001892556114f5565b636f5e88185f526004601cfd5b3461013f5760a036600319011261013f57610b0060043561012e565b610b0b60243561012e565b6084356001600160401b03811161013f57610b2a90369060040161015f565b90610b33610f0f565b906001600160a01b0382161561025c57333b1561013f575f91610b736040519485938493637921219560e11b855260643590604435903060048801610edc565b038183335af1801561025757610b96575b60405163f23a6e6160e01b8152602090f35b8061024b610ba3926102d5565b5f610b84565b602036600319011261013f57600435610bc18161012e565b610bc9610f67565b8060601b15610bdb57610018906114f5565b637448fbae5f526004601cfd5b3461013f57602036600319011261013f57600435610c058161012e565b63389a75e1600c525f52602080600c2054604051908152f35b908060209392818452848401375f828201840152601f01601f1916010190565b6001600160a01b03918216815291166020820152604081019190915260806060820181905261070493910191610c1e565b6040513d5f823e3d90fd5b90999899858414801590610dfd575b61085e578a51610ca1575b505061070497985061132b565b96929793604099969295919951986020996020810190610d0881610cfa3385919091602060408201937f4910260415865c6d3ecf96968c7d912a0d533a72c3479ab1e1df0f4eb86fb008835260018060a01b0316910152565b03601f19810183528261033e565b51902096610d178a5151611033565b9c5f5b8b518051821015610d6457908f818f9182610d5d93610d3b846001986110a5565b510151610d4661035f565b30815291820152610d5783836110a5565b526110a5565b5001610d1a565b505093979b92969a5093979b90949860018060a01b037f000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba31693610da5610387565b853b1561013f5760405163fe8ec1a760e01b81529d8e958695610dcb9560048801611110565b03815a5f948591f19788156102575761070498610dea575b8998610c94565b8061024b610df7926102d5565b5f610de3565b5087861415610c89565b81835290916001600160fb1b03831161013f5760209260051b809284830137010190565b94909290916001600160a01b03610e40610f0f565b1692831561025c57333b1561013f575f95610e9d610eac94610e896040519a8b998a99631759616b60e11b8b523060048c015260248b015260a060448b015260a48a0191610e07565b9060031995868984030160648a0152610e07565b92858403016084860152610c1e565b038183335af1801561025757610ec9575b5063bc197c8160e01b90565b8061024b610ed6926102d5565b5f610ebd565b919261070496949160a094600180871b038092168552166020840152604083015260608201528160808201520191610c1e565b6001547f000000000000000000000000000000000000000000000000000000000000000380600414610f50576003036115a6575c5b6001600160a01b031690565b505f5460ff1615610f61575c610f44565b54610f44565b638b78c6d819543303610f7657565b6382b429005f526004601cfd5b915f8091610fd69360405195602087019263a9059cbb60e01b845260018060a01b038093166024890152604488015260448752610fbf87610323565b1694519082865af1610fcf6112fc565b9083611543565b805190811515918261100f575b5050610fec5750565b604051635274afe760e01b81526001600160a01b03919091166004820152602490fd5b819250906020918101031261013f576020015180159081150361013f575f80610fe3565b9061103d826105a2565b60409061104d604051918261033e565b838152809361105e601f19916105a2565b01915f5b83811061106f5750505050565b602090825161107d81610308565b5f8152825f81830152828601015201611062565b634e487b7160e01b5f52603260045260245ffd5b80518210156110b95760209160051b010190565b611091565b9081518082526020808093019301915f5b8281106110dd575050505090565b909192938260408261110460019489516020809160018060a01b0381511684520151910152565b019501939291016110cf565b9491969593909660c086526101208601978051606060c08901528051809a526101408801996020809201915f5b8281106111ae575050505061117c61070498996111a096959493604084602061118e96015160e08d015201516101008b015289820360208b01526110be565b6001600160a01b039094166040880152565b60608601528482036080860152610429565b9160a0818403910152610429565b835180516001600160a01b03168e52602090810151908e01526040909c019b9281019260010161113d565b91908110156110b95760051b0190565b356107048161012e565b97969593909492918060808a0160808b525260a0890195905f5b8181106112cd575050506020888603818a015281865280860195818360051b82010196845f925b85841061126e57505050505050508260609261125b928861015097960360408a0152610e07565b6001600160a01b03909216940193909352565b90919293949598601f198282030184528935601e198436030181121561013f5783018681019190356001600160401b03811161013f57803603831361013f576112bc88928392600195610c1e565b9b0194019401929594939190611234565b909192939660019084356112e08161012e565b60a083901b83900316815260209081019895940192910161120d565b3d15611326573d9061130d8261036c565b9161131b604051938461033e565b82523d5f602084013e565b606090565b95929491949390935f5b8581106113a957505f9694919361136b93889795610cfa93604051978896602088019a63991f255f60e01b8c52602489016111f3565b51907f0000000000000000000000000000000000002bdbf1bf3279983603ec279cc6df5af46113986112fc565b90156113a15790565b602081519101fd5b737777777f279eba3d3ad8f4e708545291a6fdba8b6113d4610f446113cf848a8d6111d9565b6111e9565b146113e157600101611335565b60405163d08525e960e01b8152737777777f279eba3d3ad8f4e708545291a6fdba8b6004820152602490fd5b6001600160a01b03168015801561148c575b61148957308114611471576001547f000000000000000000000000000000000000000000000000000000000000000180600214611460576001036115a6575d565b505f5460ff161561146e575d565b55565b604051630bc2c5df60e11b8152306004820152602490fd5b50565b506001811461141f565b6001600160a01b036114a6610f0f565b1615610150576001547f0000000000000000000000000000000000000000000000000000000000000005806006146114e4576005036115a6575f905d565b505f9060ff825416821461146e575d565b60018060a01b0316638b78c6d8198181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a355565b5f80808093600a5a04fa61153f6112fc565b5090565b9061156a575080511561155857805190602001fd5b604051630a12f52160e11b8152600490fd5b8151158061159d575b61157b575090565b604051639996b31560e01b81526001600160a01b039091166004820152602490fd5b50803b15611573565b634e487b7160e01b5f52605160045260245ffdfea26469706673582212207bf9c133090554a1de9ee1cebedde6e2e7868181fbec31459ba2521f5a235e4764736f6c63430008190033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba30000000000000000000000000000000000002bdbf1bf3279983603ec279cc6df000000000000000000000000f70da97812cb96acdf810712aa562db8dfa3dbef
-----Decoded View---------------
Arg [0] : permit2 (address): 0x000000000022D473030F116dDEE9F6B43aC78BA3
Arg [1] : multicaller (address): 0x0000000000002Bdbf1Bf3279983603Ec279CC6dF
Arg [2] : owner (address): 0xf70da97812CB96acDF810712Aa562db8dfA3dbEF
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba3
Arg [1] : 0000000000000000000000000000000000002bdbf1bf3279983603ec279cc6df
Arg [2] : 000000000000000000000000f70da97812cb96acdf810712aa562db8dfa3dbef
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.