CELO Price: $0.332149 (+4.07%)
Gas: 52.5 GWei

Contract

0x77f3e71ef71E66937c84D4FDd935504B44646f70

Overview

CELO Balance

Celo Chain LogoCelo Chain LogoCelo Chain Logo0 CELO

CELO Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Permit Multicall335124682025-04-23 13:00:261 hr ago1745413226IN
0x77f3e71e...B44646f70
0 CELO0.0066918325.66753333
Permit Multicall335120742025-04-23 12:53:521 hr ago1745412832IN
0x77f3e71e...B44646f70
0 CELO0.0081422925.00106666
Permit Multicall335099082025-04-23 12:17:461 hr ago1745410666IN
0x77f3e71e...B44646f70
0 CELO0.0065606225.16774002
Permit Multicall335094362025-04-23 12:09:542 hrs ago1745410194IN
0x77f3e71e...B44646f70
0 CELO0.0070779325.16767999
Permit Multicall335087202025-04-23 11:57:582 hrs ago1745409478IN
0x77f3e71e...B44646f70
0 CELO0.0068126725.00108666
Permit Multicall335075122025-04-23 11:37:502 hrs ago1745408270IN
0x77f3e71e...B44646f70
0 CELO0.0078596730.14836154
Permit Multicall335042362025-04-23 10:43:143 hrs ago1745404994IN
0x77f3e71e...B44646f70
0 CELO0.0064150725.33428669
Permit Multicall335039032025-04-23 10:37:413 hrs ago1745404661IN
0x77f3e71e...B44646f70
0 CELO0.0066909425.66767999
Permit Multicall335023182025-04-23 10:11:164 hrs ago1745403076IN
0x77f3e71e...B44646f70
0 CELO0.0068633125.51191841
Permit Multicall335019062025-04-23 10:04:244 hrs ago1745402664IN
0x77f3e71e...B44646f70
0 CELO0.0063037225.74010723
Permit Multicall335006052025-04-23 9:42:434 hrs ago1745401363IN
0x77f3e71e...B44646f70
0 CELO0.006304425.00109999
Permit Multicall334998272025-04-23 9:29:454 hrs ago1745400585IN
0x77f3e71e...B44646f70
0 CELO0.008152125.00109999
Permit Multicall334989242025-04-23 9:14:424 hrs ago1745399682IN
0x77f3e71e...B44646f70
0 CELO0.0061230425.00109999
Permit Multicall334979032025-04-23 8:57:415 hrs ago1745398661IN
0x77f3e71e...B44646f70
0 CELO0.0070827125.50619417
Permit Multicall334902332025-04-23 6:49:517 hrs ago1745390991IN
0x77f3e71e...B44646f70
0 CELO0.0066899925.00109999
Permit Multicall334902132025-04-23 6:49:317 hrs ago1745390971IN
0x77f3e71e...B44646f70
0 CELO0.0061196425.08442999
Permit Multicall334884212025-04-23 6:19:397 hrs ago1745389179IN
0x77f3e71e...B44646f70
0 CELO0.0069423525.00101333
Permit Multicall334827982025-04-23 4:45:569 hrs ago1745383556IN
0x77f3e71e...B44646f70
0 CELO0.0065180625.00100667
Permit Multicall334756262025-04-23 2:46:2411 hrs ago1745376384IN
0x77f3e71e...B44646f70
0 CELO0.0066652125.00100666
Permit Multicall334715872025-04-23 1:39:0512 hrs ago1745372345IN
0x77f3e71e...B44646f70
0 CELO0.0058930325.00100666
Permit Multicall334700462025-04-23 1:13:2412 hrs ago1745370804IN
0x77f3e71e...B44646f70
0 CELO0.0065346625.00099999
Permit Multicall334644362025-04-22 23:39:5414 hrs ago1745365194IN
0x77f3e71e...B44646f70
0 CELO0.0075355929.99132866
Permit Multicall334604172025-04-22 22:32:5515 hrs ago1745361175IN
0x77f3e71e...B44646f70
0 CELO0.006245325.50406026
Permit Multicall334571142025-04-22 21:37:5216 hrs ago1745357872IN
0x77f3e71e...B44646f70
0 CELO0.0072853427.94402393
Permit Multicall334545122025-04-22 20:54:3017 hrs ago1745355270IN
0x77f3e71e...B44646f70
0 CELO0.0066392525.34753999
VIEW ADVANCED FILTER

Latest 25 internal transactions (View All)

Parent Transaction Hash Block From To
335124682025-04-23 13:00:261 hr ago1745413226
0x77f3e71e...B44646f70
0.25380005 CELO
335124682025-04-23 13:00:261 hr ago1745413226
0x77f3e71e...B44646f70
0.25380005 CELO
335120742025-04-23 12:53:521 hr ago1745412832
0x77f3e71e...B44646f70
52.44968853 CELO
335120742025-04-23 12:53:521 hr ago1745412832
0x77f3e71e...B44646f70
52.44968853 CELO
335099082025-04-23 12:17:461 hr ago1745410666
0x77f3e71e...B44646f70
0.19540051 CELO
335099082025-04-23 12:17:461 hr ago1745410666
0x77f3e71e...B44646f70
0.19540051 CELO
335075122025-04-23 11:37:502 hrs ago1745408270
0x77f3e71e...B44646f70
0.60857655 CELO
335075122025-04-23 11:37:502 hrs ago1745408270
0x77f3e71e...B44646f70
0.60857655 CELO
335039032025-04-23 10:37:413 hrs ago1745404661
0x77f3e71e...B44646f70
0.15271122 CELO
335039032025-04-23 10:37:413 hrs ago1745404661
0x77f3e71e...B44646f70
0.15271122 CELO
335023182025-04-23 10:11:164 hrs ago1745403076
0x77f3e71e...B44646f70
0.14665808 CELO
335023182025-04-23 10:11:164 hrs ago1745403076
0x77f3e71e...B44646f70
0.14665808 CELO
335006052025-04-23 9:42:434 hrs ago1745401363
0x77f3e71e...B44646f70
3.21986679 CELO
335006052025-04-23 9:42:434 hrs ago1745401363
0x77f3e71e...B44646f70
3.21986679 CELO
334979032025-04-23 8:57:415 hrs ago1745398661
0x77f3e71e...B44646f70
65.90337643 CELO
334979032025-04-23 8:57:415 hrs ago1745398661
0x77f3e71e...B44646f70
65.90337643 CELO
334903752025-04-23 6:52:137 hrs ago1745391133
0x77f3e71e...B44646f70
1.25320154 CELO
334903752025-04-23 6:52:137 hrs ago1745391133
0x77f3e71e...B44646f70
1.25320154 CELO
334902132025-04-23 6:49:317 hrs ago1745390971
0x77f3e71e...B44646f70
1.0726379 CELO
334902132025-04-23 6:49:317 hrs ago1745390971
0x77f3e71e...B44646f70
1.0726379 CELO
334884212025-04-23 6:19:397 hrs ago1745389179
0x77f3e71e...B44646f70
0.524707 CELO
334884212025-04-23 6:19:397 hrs ago1745389179
0x77f3e71e...B44646f70
0.524707 CELO
334827982025-04-23 4:45:569 hrs ago1745383556
0x77f3e71e...B44646f70
0.36486022 CELO
334827982025-04-23 4:45:569 hrs ago1745383556
0x77f3e71e...B44646f70
0.36486022 CELO
334802342025-04-23 4:03:1210 hrs ago1745380992
0x77f3e71e...B44646f70
1.52124277 CELO
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ERC20Router

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 13 : ERC20Router__Paris.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import {IERC20} from "openzeppelin-contracts-v4.9.3/contracts/token/ERC20/IERC20.sol";
import {IERC721} from "openzeppelin-contracts-v4.9.3/contracts/token/ERC721/IERC721.sol";
import {IERC1155} from "openzeppelin-contracts-v4.9.3/contracts/token/ERC1155/IERC1155.sol";
import {SafeERC20} from "openzeppelin-contracts-v4.9.3/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 {MulticallerInternal} from "./utils/MulticallerInternal.sol";

struct RelayerWitness {
    address relayer;
}

contract ERC20Router is MulticallerInternal {
    using SafeERC20 for IERC20;

    // --- Errors --- //

    /// @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;

    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) {
        // Set the address of the Permit2 contract
        PERMIT2 = IPermit2(permit2);
    }

    receive() external payable {}

    /// @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();
        }

        // Set the recipient in storage
        _setRecipient(refundTo);

        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 = _aggregate(targets, datas, values, refundTo);

        // Clear the recipient in storage
        _clearRecipient();

        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
    ///         This function is called `delegatecallMulticall` to not break integrations with the previous router
    /// @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();
        }

        for (uint256 i = 0; i < targets.length; i++) {
            // Revert if the call fails
            if (targets[i] == ZORA_REWARDS_V1) {
                revert InvalidTarget(ZORA_REWARDS_V1);
            }
        }

        // Set the recipient in storage
        _setRecipient(refundTo);

        // Perform the multicall
        bytes[] memory data = _aggregate(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
    /// @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));
        }

        uint256 recipientStorageSlot = RECIPIENT_STORAGE_SLOT;

        // Set the recipient in storage
        uint256 recipientValue = uint256(uint160(recipient));

        assembly {
            sstore(recipientStorageSlot, recipientValue)
        }
    }

    /// @notice Internal function to get the recipient address for ERC721 or ERC1155 mint
    function _getRecipient() internal view returns (address) {
        uint256 recipientStorageSlot = RECIPIENT_STORAGE_SLOT;
        uint256 value;

        assembly {
            value := sload(recipientStorageSlot)
        }

        // Get the recipient from storage
        return address(uint160(value));
    }

    /// @notice Internal function to clear the recipient address for ERC721 or ERC1155 mint
    function _clearRecipient() internal {
        uint256 recipientStorageSlot = RECIPIENT_STORAGE_SLOT;

        // Return if recipient hasn't been set
        if (_getRecipient() == address(0)) {
            return;
        }

        // Clear the recipient in storage
        assembly {
            sstore(recipientStorageSlot, 0)
        }
    }

    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;
    }
}

File 2 of 13 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @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 amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 amount) external returns (bool);
}

File 3 of 13 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

import "../../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 caller.
     *
     * 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);
}

File 4 of 13 : IERC1155.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155 is IERC165 {
    /**
     * @dev Emitted when `value` tokens of token 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 amount 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 `amount` tokens of token type `id` from `from` to `to`.
     *
     * 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 `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 amount, bytes calldata data) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` 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 amounts,
        bytes calldata data
    ) external;
}

File 5 of 13 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    /**
     * @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.encodeWithSelector(token.transfer.selector, 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.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(IERC20 token, address spender, uint256 value) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    /**
     * @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);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @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.encodeWithSelector(token.approve.selector, spender, value);

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
    }

    /**
     * @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.isContract(address(token));
    }
}

File 6 of 13 : IAllowanceTransfer.sol
// 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;
}

File 7 of 13 : ISignatureTransfer.sol
// 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;
}

File 8 of 13 : IPermit2.sol
// 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.
}

File 9 of 13 : MulticallerInternal.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

/**
 * @title Multicaller
 * @author vectorized.eth
 * @notice Contract that allows for efficient aggregation
 *         of multiple calls in a single transaction.
 */
contract MulticallerInternal {
    // =============================================================
    //                            ERRORS
    // =============================================================

    /**
     * @dev The lengths of the input arrays are not the same.
     */
    error ArrayLengthsMismatch();

    // =============================================================
    //                    AGGREGATION OPERATIONS
    // =============================================================

    /**
     * @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
    ) internal returns (bytes[] memory) {
        assembly {
            if iszero(
                and(
                    eq(targets.length, data.length),
                    eq(data.length, values.length)
                )
            ) {
                // Store the function selector of `ArrayLengthsMismatch()`.
                mstore(returndatasize(), 0x3b800a46)
                // Revert with (offset, size).
                revert(0x1c, 0x04)
            }

            let resultsSize := 0x40

            if data.length {
                let results := 0x40
                // Left shift by 5 is equivalent to multiplying by 0x20.
                data.length := shl(5, data.length)
                // Copy the offsets from calldata into memory.
                calldatacopy(results, data.offset, data.length)
                // Offset into `results`.
                let resultsOffset := data.length
                // Pointer to the end of `results`.
                let end := add(results, data.length)
                // For deriving the calldata offsets from the `results` pointer.
                let valuesOffsetDiff := sub(values.offset, results)
                let targetsOffsetDiff := sub(targets.offset, results)

                for {

                } 1 {

                } {
                    // The offset of the current bytes in the calldata.
                    let o := add(data.offset, mload(results))
                    let memPtr := add(resultsOffset, 0x40)
                    // Copy the current bytes from calldata to the memory.
                    calldatacopy(
                        memPtr,
                        add(o, 0x20), // The offset of the current bytes' bytes.
                        calldataload(o) // The length of the current bytes.
                    )
                    if iszero(
                        call(
                            gas(), // Remaining gas.
                            calldataload(add(targetsOffsetDiff, results)), // Address to call.
                            calldataload(add(valuesOffsetDiff, results)), // ETH to send.
                            memPtr, // Start of input calldata in memory.
                            calldataload(o), // Size of input calldata.
                            0x00, // We will use returndatacopy instead.
                            0x00 // We will use returndatacopy instead.
                        )
                    ) {
                        // Bubble up the revert if the call reverts.
                        returndatacopy(0x00, 0x00, returndatasize())
                        revert(0x00, returndatasize())
                    }
                    // Append the current `resultsOffset` into `results`.
                    mstore(results, resultsOffset)
                    // Append the returndatasize, and the returndata.
                    mstore(memPtr, returndatasize())
                    returndatacopy(add(memPtr, 0x20), 0x00, returndatasize())
                    // Advance the `resultsOffset` by `returndatasize() + 0x20`,
                    // rounded up to the next multiple of 0x20.
                    resultsOffset := and(
                        add(add(resultsOffset, returndatasize()), 0x3f),
                        not(0x1f)
                    )
                    // Advance the `results` pointer.
                    results := add(results, 0x20)
                    if eq(results, end) {
                        break
                    }
                }
                resultsSize := add(resultsOffset, 0x40)
            }

            if refundTo {
                // Force transfers all the remaining ETH in the contract to `refundTo`,
                // with a gas stipend of 100000, which should be enough for most use cases.
                // If sending via a regular call fails, force sends the ETH by
                // creating a temporary contract which uses `SELFDESTRUCT` to force send the ETH.
                if selfbalance() {
                    // If `refundTo` is `address(1)`, replace it with the `msg.sender`.
                    refundTo := xor(
                        refundTo,
                        mul(eq(refundTo, 1), xor(refundTo, caller()))
                    )
                    // Transfer the ETH and check if it succeeded or not.
                    if iszero(
                        call(
                            100000,
                            refundTo,
                            selfbalance(),
                            codesize(),
                            0x00,
                            codesize(),
                            0x00
                        )
                    ) {
                        mstore(0x00, refundTo) // Store the address in scratch space.
                        mstore8(0x0b, 0x73) // Opcode `PUSH20`.
                        mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
                        // We can directly use `SELFDESTRUCT` in the contract creation.
                        // Compatible with `SENDALL`: https://eips.ethereum.org/EIPS/eip-4758
                        if iszero(create(selfbalance(), 0x0b, 0x16)) {
                            // Coerce gas estimation to provide enough gas for the `create` above.
                            revert(codesize(), codesize())
                        }
                    }
                }
            }

            mstore(0x00, 0x20) // Store the memory offset of the `results`.
            mstore(0x20, targets.length) // Store `targets.length` into `results`.
            // Direct return.
            return(0x00, resultsSize)
        }
    }

    /**
     * @dev Decompresses the calldata and performs a delegatecall
     *      with the decompressed calldata to itself.
     *
     *      Accompanying JavaScript library to compress the calldata:
     *      https://github.com/vectorized/solady/blob/main/js/solady.js
     *      (See: `LibZip.cdCompress`)
     */
    fallback() external payable {
        assembly {
            // If the calldata starts with the bitwise negation of
            // `bytes4(keccak256("aggregate(address[],bytes[],uint256[],address)"))`.
            let s := calldataload(returndatasize())
            if eq(shr(224, s), 0x66e0daa0) {
                mstore(returndatasize(), not(s))
                let o := 4
                for {
                    let i := o
                } lt(i, calldatasize()) {

                } {
                    let c := byte(returndatasize(), calldataload(i))
                    i := add(i, 1)
                    if iszero(c) {
                        let d := byte(returndatasize(), calldataload(i))
                        i := add(i, 1)
                        // Fill with either 0xff or 0x00.
                        mstore(o, not(returndatasize()))
                        if iszero(gt(d, 0x7f)) {
                            codecopy(o, codesize(), add(d, 1))
                        }
                        o := add(o, add(and(d, 0x7f), 1))
                        continue
                    }
                    mstore8(o, c)
                    o := add(o, 1)
                }
                let success := delegatecall(
                    gas(),
                    address(),
                    0x00,
                    o,
                    0x00,
                    0x00
                )
                returndatacopy(0x00, 0x00, returndatasize())
                if iszero(success) {
                    revert(0x00, returndatasize())
                }
                return(0x00, returndatasize())
            }
            revert(returndatasize(), returndatasize())
        }
    }
}

File 10 of 13 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @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);
}

File 11 of 13 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @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.
 */
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].
     */
    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);
}

File 12 of 13 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://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.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) 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(errorMessage);
        }
    }
}

File 13 of 13 : IEIP712.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IEIP712 {
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

Settings
{
  "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-v4.9.3/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-v4.9.3/=lib/openzeppelin-contracts-v4.9.3/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "openzeppelin/=lib/openzeppelin-contracts-v4.9.3/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": "paris",
  "viaIR": true,
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"permit2","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ArrayLengthsMismatch","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":"NoRecipientSet","type":"error"},{"stateMutability":"payable","type":"fallback"},{"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":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"refundTo","type":"address"}],"name":"cleanupERC20","outputs":[],"stateMutability":"nonpayable","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":[{"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"},{"stateMutability":"payable","type":"receive"}]

Contract Creation Code

60a03461009057601f61132e38819003918201601f19168301916001600160401b038311848410176100955780849260209460405283398101031261009057516001600160a01b03811690819003610090577fde8722880b5dd233e72245d89ecf1926d842675ee7337f75a172abc8abc5ba8860005560805260405161128290816100ac823960805181610a900152f35b600080fd5b634e487b7160e01b600052604160045260246000fdfe6080806040526004361015610017575b50366111c657005b6000803560e01c918263150b7a02146100a157505080633806a3cf1461009c5780633dad0c9c1461009757806366b9ca7b146100925780636e305f801461008d578063bc197c8114610088578063c99a0d65146100835763f23a6e611461007e573861000f565b610893565b610858565b6107b1565b610690565b6105e6565b6103e8565b6103b8565b3461018c578060031936011261018c576100bc600435610190565b6100c7602435610190565b6064356001600160401b038111610188576100e69036906004016101c2565b835454909190610106906001600160a01b03165b6001600160a01b031690565b916001600160a01b0383161561017957333b1561017557635c46a7ef60e11b8452607f199261013a92906044359030610f7a565b018183335af1801561017057610161575b604051630a85bd0160e11b8152602090f35b0390f35b61016b6080604052565b61014b565b610b86565b8480fd5b63f36675c360e01b8452600484fd5b8280fd5b5080fd5b6001600160a01b038116036101a157565b600080fd5b600435906101b382610190565b565b60a435906101b382610190565b9181601f840112156101a1578235916001600160401b0383116101a157602083818601950101116101a157565b60009103126101a157565b634e487b7160e01b600052604160045260246000fd5b606081019081106001600160401b0382111761022b57604052565b6101fa565b604081019081106001600160401b0382111761022b57604052565b6001600160401b03811161022b57604052565b608081019081106001600160401b0382111761022b57604052565b90601f801991011681019081106001600160401b0382111761022b57604052565b604051906101b382610230565b6001600160401b03811161022b57601f01601f191660200190565b6040519060a082018281106001600160401b0382111761022b576040526064825263756e742960e01b6080837f52656c617965725769746e657373207769746e6573732952656c61796572576960208201527f746e65737328616464726573732072656c6179657229546f6b656e5065726d6960408201527f7373696f6e73286164647265737320746f6b656e2c75696e7432353620616d6f60608201520152565b919082519283825260005b848110610390575050826000602080949584010152601f8019910116010190565b60208183018101518483018201520161036f565b9060206103b5928181520190610364565b90565b346101a15760003660031901126101a15761015d6103d46102c2565b604051918291602083526020830190610364565b346101a15760403660031901126101a15760043561040581610190565b6024359061041282610190565b6040516370a0823160e01b81523060048201526001600160a01b039190911691602082602481865afa9182156101705760009261045d575b508161045257005b61045b92610b92565b005b90916020823d821161048b575b8161047760209383610279565b81010312610488575051903861044a565b80fd5b3d915061046a565b6001600160401b03811161022b5760051b60200190565b90916060828403126101a15760408051906104c482610210565b819380356001600160401b0381116101a157810186601f820112156101a1578035906104ef82610493565b906104fc85519283610279565b828252602092838084019160061b830101918a83116101a1578401905b8282106105385750505084528181013590840152810135910152909150565b86828c03126101a157848791825161054f81610230565b843561055a81610190565b81528285013583820152815201910190610519565b9181601f840112156101a1578235916001600160401b0383116101a1576020808501948460051b0101116101a157565b81601f820112156101a1578035906105b6826102a7565b926105c46040519485610279565b828452602083830101116101a157816000926020809301838601378301015290565b60e03660031901126101a1576105fa6101a6565b6001600160401b036024358181116101a15761061a9036906004016104aa565b6044358281116101a15761063290369060040161056f565b6064929192358481116101a15761064d90369060040161056f565b916084358681116101a15761066690369060040161056f565b9590946106716101b5565b9760c4359081116101a15761068a90369060040161059f565b98610981565b60803660031901126101a15760046001600160401b0381358181116101a1576106bc903690840161056f565b916024358181116101a1576106d4903690860161056f565b916044359081116101a1576106ec903690870161056f565b949093606435966106fc88610190565b8483148015906107a7575b6107985760005b83811061072557505061072087610f11565b6110b8565b737777777f279eba3d3ad8f4e708545291a6fdba8b6107506100fa61074b848888610b67565b610b7c565b146107635761075e90610b2c565b61070e565b60405163d08525e960e01b8152737777777f279eba3d3ad8f4e708545291a6fdba8b81840190815281906020010390fd5b0390fd5b604051631dc0052360e11b8152fd5b5086851415610707565b346101a15760a03660031901126101a1576107cd600435610190565b6107d8602435610190565b6001600160401b036044358181116101a1576107f890369060040161056f565b6064929192358281116101a15761081390369060040161056f565b6084949194359384116101a15761015d9461083561083d9536906004016101c2565b94909361100b565b6040516001600160e01b031990911681529081906020820190565b346101a15760003660031901126101a15760206040517f4910260415865c6d3ecf96968c7d912a0d533a72c3479ab1e1df0f4eb86fb0088152f35b346101a15760a03660031901126101a1576108af600435610190565b6108ba602435610190565b6084356001600160401b0381116101a1576108d99036906004016101c2565b600054549091906108f2906001600160a01b03166100fa565b906001600160a01b0382161561096f57333b156101a1576000916109336040519485938493637921219560e11b855260643590604435903060048801610fb4565b038183335af1801561017057610956575b60405163f23a6e6160e01b8152602090f35b806109636109699261024b565b806101ef565b38610944565b60405163f36675c360e01b8152600490fd5b909192939495969798868514801590610b22575b610b10576109a28a610f11565b80516109b1575b5050506110b8565b959198949097936040979397519760209889810190610a1781610a093385919091602060408201937f4910260415865c6d3ecf96968c7d912a0d533a72c3479ab1e1df0f4eb86fb008835260018060a01b0316910152565b03601f198101835282610279565b519020610a258c5151610d7f565b9b60005b81518051821015610a775790610a6c8f82908f80610a4a84610a7298610de0565b510151610a5561029a565b30815291820152610a668383610de0565b52610de0565b50610b2c565b610a29565b505093979b909498919599509991959960018060a01b037f00000000000000000000000000000000000000000000000000000000000000001691610ab96102c2565b94833b156101a157610ae7600096928793604051998a988997889663fe8ec1a760e01b885260048801610e47565b03925af1801561017057610afd575b80806109a9565b80610963610b0a9261024b565b38610af6565b604051631dc0052360e11b8152600490fd5b5088871415610995565b6000198114610b3b5760010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b9190811015610b775760051b0190565b610b51565b356103b581610190565b6040513d6000823e3d90fd5b60405163a9059cbb60e01b60208083019182526001600160a01b0394851660248401526044808401969096529482526101b39493610c42936000918291610bd88661025e565b169260405194610be786610230565b8786527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656488870152519082855af13d15610c6f573d91610c26836102a7565b92610c346040519485610279565b83523d60008785013e610cee565b8051918215928315610c57575b505050610c8f565b610c679350820181019101610c77565b388080610c4f565b606091610cee565b908160209103126101a1575180151581036101a15790565b15610c9657565b60405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608490fd5b91929015610d505750815115610d02575090565b3b15610d0b5790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b825190915015610d635750805190602001fd5b60405162461bcd60e51b815290819061079490600483016103a4565b90610d8982610493565b604090610d9882519182610279565b8381528093610da9601f1991610493565b0191600090815b848110610dbe575050505050565b6020908251610dcc81610230565b848152828581830152828701015201610db0565b8051821015610b775760209160051b010190565b90815180825260208080930193019160005b828110610e14575050505090565b9091929382604082610e3b60019489516020809160018060a01b0381511684520151910152565b01950193929101610e06565b9491969593909660c08652610120860197805190606060c08901528151809a5261014088019960208093019060005b818110610ee6575050506103b59899610ed896959493836040848c60e0610ec698610eb498015191015201516101008c01528a8303908b0152610df4565b6001600160a01b039094166040880152565b60608601528482036080860152610364565b9160a0818403910152610364565b825180516001600160a01b03168e52602090810151908e01526040909c019b91840191600101610e76565b6001600160a01b031680158015610f4f575b610f4c57308114610f345760005455565b604051630bc2c5df60e11b8152306004820152602490fd5b50565b5060018114610f23565b908060209392818452848401376000828201840152601f01601f1916010190565b6001600160a01b039081166084521660a45260c452608060e452610104829052610124919081908337600081830152601f01601f19160190565b91926103b596949160a094600180871b038092168552166020840152604083015260608201528160808201520191610f59565b81835290916001600160fb1b0383116101a15760209260051b809284830137010190565b949192909260018060a01b03600054541692831561096f57333b156101a157600095611079611088946110656040519a8b998a99631759616b60e11b8b523060048c015260248b015260a060448b015260a48a0191610fe7565b9060031995868984030160648a0152610fe7565b92858403016084860152610f59565b038183335af18015610170576110a5575b5063bc197c8160e01b90565b806109636110b29261024b565b38611099565b959390949295606093871487871416156111b957869360409761112f575b5050505050806110ee575b5060206000526020526000f35b47156110e15733811860018214021860003881804785620186a0f16110e1576000526073600b5360ff6020536016600b47f01561112b57386110e1565b3838fd5b8794919395979160051b9384878737848601945b835188019087810182359081602080950182376000808093838a8c603f19918291010135908c8b0101355af1156111b0578287523d90523d908583013e603f601f19913d0101169301968986891461119d57509692611143565b97505050509150500192388080806110d6565b503d81803e3d90fd5b633b800a463d526004601cfd5b3d356366e0daa08160e01c146111da573d3dfd5b193d5260043d815b36811061120357600080808581305af43d82803e156111ff573d90f35b3d90fd5b8035821a92600180920193801561122057815301905b90916111e2565b503d19815283820193607f90353d1a81811115611241575b16010190611219565b83810138843961123856fea2646970667358221220f3ff45c1aaee6fbebd64e258fffdb959dd7b47844ed65e6fe7f21f9fc88fe5db64736f6c63430008130033000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba3

Deployed Bytecode

0x6080806040526004361015610017575b50366111c657005b6000803560e01c918263150b7a02146100a157505080633806a3cf1461009c5780633dad0c9c1461009757806366b9ca7b146100925780636e305f801461008d578063bc197c8114610088578063c99a0d65146100835763f23a6e611461007e573861000f565b610893565b610858565b6107b1565b610690565b6105e6565b6103e8565b6103b8565b3461018c578060031936011261018c576100bc600435610190565b6100c7602435610190565b6064356001600160401b038111610188576100e69036906004016101c2565b835454909190610106906001600160a01b03165b6001600160a01b031690565b916001600160a01b0383161561017957333b1561017557635c46a7ef60e11b8452607f199261013a92906044359030610f7a565b018183335af1801561017057610161575b604051630a85bd0160e11b8152602090f35b0390f35b61016b6080604052565b61014b565b610b86565b8480fd5b63f36675c360e01b8452600484fd5b8280fd5b5080fd5b6001600160a01b038116036101a157565b600080fd5b600435906101b382610190565b565b60a435906101b382610190565b9181601f840112156101a1578235916001600160401b0383116101a157602083818601950101116101a157565b60009103126101a157565b634e487b7160e01b600052604160045260246000fd5b606081019081106001600160401b0382111761022b57604052565b6101fa565b604081019081106001600160401b0382111761022b57604052565b6001600160401b03811161022b57604052565b608081019081106001600160401b0382111761022b57604052565b90601f801991011681019081106001600160401b0382111761022b57604052565b604051906101b382610230565b6001600160401b03811161022b57601f01601f191660200190565b6040519060a082018281106001600160401b0382111761022b576040526064825263756e742960e01b6080837f52656c617965725769746e657373207769746e6573732952656c61796572576960208201527f746e65737328616464726573732072656c6179657229546f6b656e5065726d6960408201527f7373696f6e73286164647265737320746f6b656e2c75696e7432353620616d6f60608201520152565b919082519283825260005b848110610390575050826000602080949584010152601f8019910116010190565b60208183018101518483018201520161036f565b9060206103b5928181520190610364565b90565b346101a15760003660031901126101a15761015d6103d46102c2565b604051918291602083526020830190610364565b346101a15760403660031901126101a15760043561040581610190565b6024359061041282610190565b6040516370a0823160e01b81523060048201526001600160a01b039190911691602082602481865afa9182156101705760009261045d575b508161045257005b61045b92610b92565b005b90916020823d821161048b575b8161047760209383610279565b81010312610488575051903861044a565b80fd5b3d915061046a565b6001600160401b03811161022b5760051b60200190565b90916060828403126101a15760408051906104c482610210565b819380356001600160401b0381116101a157810186601f820112156101a1578035906104ef82610493565b906104fc85519283610279565b828252602092838084019160061b830101918a83116101a1578401905b8282106105385750505084528181013590840152810135910152909150565b86828c03126101a157848791825161054f81610230565b843561055a81610190565b81528285013583820152815201910190610519565b9181601f840112156101a1578235916001600160401b0383116101a1576020808501948460051b0101116101a157565b81601f820112156101a1578035906105b6826102a7565b926105c46040519485610279565b828452602083830101116101a157816000926020809301838601378301015290565b60e03660031901126101a1576105fa6101a6565b6001600160401b036024358181116101a15761061a9036906004016104aa565b6044358281116101a15761063290369060040161056f565b6064929192358481116101a15761064d90369060040161056f565b916084358681116101a15761066690369060040161056f565b9590946106716101b5565b9760c4359081116101a15761068a90369060040161059f565b98610981565b60803660031901126101a15760046001600160401b0381358181116101a1576106bc903690840161056f565b916024358181116101a1576106d4903690860161056f565b916044359081116101a1576106ec903690870161056f565b949093606435966106fc88610190565b8483148015906107a7575b6107985760005b83811061072557505061072087610f11565b6110b8565b737777777f279eba3d3ad8f4e708545291a6fdba8b6107506100fa61074b848888610b67565b610b7c565b146107635761075e90610b2c565b61070e565b60405163d08525e960e01b8152737777777f279eba3d3ad8f4e708545291a6fdba8b81840190815281906020010390fd5b0390fd5b604051631dc0052360e11b8152fd5b5086851415610707565b346101a15760a03660031901126101a1576107cd600435610190565b6107d8602435610190565b6001600160401b036044358181116101a1576107f890369060040161056f565b6064929192358281116101a15761081390369060040161056f565b6084949194359384116101a15761015d9461083561083d9536906004016101c2565b94909361100b565b6040516001600160e01b031990911681529081906020820190565b346101a15760003660031901126101a15760206040517f4910260415865c6d3ecf96968c7d912a0d533a72c3479ab1e1df0f4eb86fb0088152f35b346101a15760a03660031901126101a1576108af600435610190565b6108ba602435610190565b6084356001600160401b0381116101a1576108d99036906004016101c2565b600054549091906108f2906001600160a01b03166100fa565b906001600160a01b0382161561096f57333b156101a1576000916109336040519485938493637921219560e11b855260643590604435903060048801610fb4565b038183335af1801561017057610956575b60405163f23a6e6160e01b8152602090f35b806109636109699261024b565b806101ef565b38610944565b60405163f36675c360e01b8152600490fd5b909192939495969798868514801590610b22575b610b10576109a28a610f11565b80516109b1575b5050506110b8565b959198949097936040979397519760209889810190610a1781610a093385919091602060408201937f4910260415865c6d3ecf96968c7d912a0d533a72c3479ab1e1df0f4eb86fb008835260018060a01b0316910152565b03601f198101835282610279565b519020610a258c5151610d7f565b9b60005b81518051821015610a775790610a6c8f82908f80610a4a84610a7298610de0565b510151610a5561029a565b30815291820152610a668383610de0565b52610de0565b50610b2c565b610a29565b505093979b909498919599509991959960018060a01b037f000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba31691610ab96102c2565b94833b156101a157610ae7600096928793604051998a988997889663fe8ec1a760e01b885260048801610e47565b03925af1801561017057610afd575b80806109a9565b80610963610b0a9261024b565b38610af6565b604051631dc0052360e11b8152600490fd5b5088871415610995565b6000198114610b3b5760010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b9190811015610b775760051b0190565b610b51565b356103b581610190565b6040513d6000823e3d90fd5b60405163a9059cbb60e01b60208083019182526001600160a01b0394851660248401526044808401969096529482526101b39493610c42936000918291610bd88661025e565b169260405194610be786610230565b8786527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656488870152519082855af13d15610c6f573d91610c26836102a7565b92610c346040519485610279565b83523d60008785013e610cee565b8051918215928315610c57575b505050610c8f565b610c679350820181019101610c77565b388080610c4f565b606091610cee565b908160209103126101a1575180151581036101a15790565b15610c9657565b60405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608490fd5b91929015610d505750815115610d02575090565b3b15610d0b5790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b825190915015610d635750805190602001fd5b60405162461bcd60e51b815290819061079490600483016103a4565b90610d8982610493565b604090610d9882519182610279565b8381528093610da9601f1991610493565b0191600090815b848110610dbe575050505050565b6020908251610dcc81610230565b848152828581830152828701015201610db0565b8051821015610b775760209160051b010190565b90815180825260208080930193019160005b828110610e14575050505090565b9091929382604082610e3b60019489516020809160018060a01b0381511684520151910152565b01950193929101610e06565b9491969593909660c08652610120860197805190606060c08901528151809a5261014088019960208093019060005b818110610ee6575050506103b59899610ed896959493836040848c60e0610ec698610eb498015191015201516101008c01528a8303908b0152610df4565b6001600160a01b039094166040880152565b60608601528482036080860152610364565b9160a0818403910152610364565b825180516001600160a01b03168e52602090810151908e01526040909c019b91840191600101610e76565b6001600160a01b031680158015610f4f575b610f4c57308114610f345760005455565b604051630bc2c5df60e11b8152306004820152602490fd5b50565b5060018114610f23565b908060209392818452848401376000828201840152601f01601f1916010190565b6001600160a01b039081166084521660a45260c452608060e452610104829052610124919081908337600081830152601f01601f19160190565b91926103b596949160a094600180871b038092168552166020840152604083015260608201528160808201520191610f59565b81835290916001600160fb1b0383116101a15760209260051b809284830137010190565b949192909260018060a01b03600054541692831561096f57333b156101a157600095611079611088946110656040519a8b998a99631759616b60e11b8b523060048c015260248b015260a060448b015260a48a0191610fe7565b9060031995868984030160648a0152610fe7565b92858403016084860152610f59565b038183335af18015610170576110a5575b5063bc197c8160e01b90565b806109636110b29261024b565b38611099565b959390949295606093871487871416156111b957869360409761112f575b5050505050806110ee575b5060206000526020526000f35b47156110e15733811860018214021860003881804785620186a0f16110e1576000526073600b5360ff6020536016600b47f01561112b57386110e1565b3838fd5b8794919395979160051b9384878737848601945b835188019087810182359081602080950182376000808093838a8c603f19918291010135908c8b0101355af1156111b0578287523d90523d908583013e603f601f19913d0101169301968986891461119d57509692611143565b97505050509150500192388080806110d6565b503d81803e3d90fd5b633b800a463d526004601cfd5b3d356366e0daa08160e01c146111da573d3dfd5b193d5260043d815b36811061120357600080808581305af43d82803e156111ff573d90f35b3d90fd5b8035821a92600180920193801561122057815301905b90916111e2565b503d19815283820193607f90353d1a81811115611241575b16010190611219565b83810138843961123856fea2646970667358221220f3ff45c1aaee6fbebd64e258fffdb959dd7b47844ed65e6fe7f21f9fc88fe5db64736f6c63430008130033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba3

-----Decoded View---------------
Arg [0] : permit2 (address): 0x000000000022D473030F116dDEE9F6B43aC78BA3

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba3


Block Transaction Gas Used Reward
view all blocks validated

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
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.