ETH Price: $2,059.37 (-1.18%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
L1ERC721Gateway

Compiler Version
v0.8.16+commit.07a7930e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 20 : L1ERC721Gateway.sol
// SPDX-License-Identifier: MIT

pragma solidity =0.8.16;

import {IERC721Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol";
import {ERC721HolderUpgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/utils/ERC721HolderUpgradeable.sol";

import {IL2ERC721Gateway} from "../../L2/gateways/IL2ERC721Gateway.sol";
import {IL1ScrollMessenger} from "../IL1ScrollMessenger.sol";
import {IL1ERC721Gateway} from "./IL1ERC721Gateway.sol";

import {IMessageDropCallback} from "../../libraries/callbacks/IMessageDropCallback.sol";
import {ScrollGatewayBase} from "../../libraries/gateway/ScrollGatewayBase.sol";

/// @title L1ERC721Gateway
/// @notice The `L1ERC721Gateway` is used to deposit ERC721 compatible NFT on layer 1 and
/// finalize withdraw the NFTs from layer 2.
/// @dev The deposited NFTs are held in this gateway. On finalizing withdraw, the corresponding
/// NFT will be transfer to the recipient directly.
///
/// This will be changed if we have more specific scenarios.
contract L1ERC721Gateway is ERC721HolderUpgradeable, ScrollGatewayBase, IL1ERC721Gateway, IMessageDropCallback {
    /**********
     * Events *
     **********/

    /// @notice Emitted when token mapping for ERC721 token is updated.
    /// @param l1Token The address of ERC721 token in layer 1.
    /// @param oldL2Token The address of the old corresponding ERC721 token in layer 2.
    /// @param newL2Token The address of the new corresponding ERC721 token in layer 2.
    event UpdateTokenMapping(address indexed l1Token, address indexed oldL2Token, address indexed newL2Token);

    /*************
     * Variables *
     *************/

    /// @notice Mapping from l1 token address to l2 token address for ERC721 NFT.
    mapping(address => address) public tokenMapping;

    /***************
     * Constructor *
     ***************/

    /// @notice Constructor for `L2ERC721Gateway` implementation contract.
    ///
    /// @param _counterpart The address of `L2ERC721Gateway` contract in L2.
    /// @param _messenger The address of `L1ScrollMessenger` contract in L1.
    constructor(address _counterpart, address _messenger) ScrollGatewayBase(_counterpart, address(0), _messenger) {
        _disableInitializers();
    }

    /// @notice Initialize the storage of L1ERC721Gateway.
    ///
    /// @dev The parameters `_counterpart` and `_messenger` are no longer used.
    ///
    /// @param _counterpart The address of L2ERC721Gateway in L2.
    /// @param _messenger The address of L1ScrollMessenger in L1.
    function initialize(address _counterpart, address _messenger) external initializer {
        ERC721HolderUpgradeable.__ERC721Holder_init();

        ScrollGatewayBase._initialize(_counterpart, address(0), _messenger);
    }

    /*****************************
     * Public Mutating Functions *
     *****************************/

    /// @inheritdoc IL1ERC721Gateway
    function depositERC721(
        address _token,
        uint256 _tokenId,
        uint256 _gasLimit
    ) external payable override {
        _depositERC721(_token, _msgSender(), _tokenId, _gasLimit);
    }

    /// @inheritdoc IL1ERC721Gateway
    function depositERC721(
        address _token,
        address _to,
        uint256 _tokenId,
        uint256 _gasLimit
    ) external payable override {
        _depositERC721(_token, _to, _tokenId, _gasLimit);
    }

    /// @inheritdoc IL1ERC721Gateway
    function batchDepositERC721(
        address _token,
        uint256[] calldata _tokenIds,
        uint256 _gasLimit
    ) external payable override {
        _batchDepositERC721(_token, _msgSender(), _tokenIds, _gasLimit);
    }

    /// @inheritdoc IL1ERC721Gateway
    function batchDepositERC721(
        address _token,
        address _to,
        uint256[] calldata _tokenIds,
        uint256 _gasLimit
    ) external payable override {
        _batchDepositERC721(_token, _to, _tokenIds, _gasLimit);
    }

    /// @inheritdoc IL1ERC721Gateway
    function finalizeWithdrawERC721(
        address _l1Token,
        address _l2Token,
        address _from,
        address _to,
        uint256 _tokenId
    ) external virtual onlyCallByCounterpart nonReentrant {
        require(_l2Token != address(0), "token address cannot be 0");
        require(_l2Token == tokenMapping[_l1Token], "l2 token mismatch");

        IERC721Upgradeable(_l1Token).safeTransferFrom(address(this), _to, _tokenId);

        emit FinalizeWithdrawERC721(_l1Token, _l2Token, _from, _to, _tokenId);
    }

    /// @inheritdoc IL1ERC721Gateway
    function finalizeBatchWithdrawERC721(
        address _l1Token,
        address _l2Token,
        address _from,
        address _to,
        uint256[] calldata _tokenIds
    ) external virtual onlyCallByCounterpart nonReentrant {
        require(_l2Token != address(0), "token address cannot be 0");
        require(_l2Token == tokenMapping[_l1Token], "l2 token mismatch");

        for (uint256 i = 0; i < _tokenIds.length; i++) {
            IERC721Upgradeable(_l1Token).safeTransferFrom(address(this), _to, _tokenIds[i]);
        }

        emit FinalizeBatchWithdrawERC721(_l1Token, _l2Token, _from, _to, _tokenIds);
    }

    /// @inheritdoc IMessageDropCallback
    function onDropMessage(bytes calldata _message) external payable virtual onlyInDropContext nonReentrant {
        require(msg.value == 0, "nonzero msg.value");

        if (bytes4(_message[0:4]) == IL2ERC721Gateway.finalizeDepositERC721.selector) {
            (address _token, , address _receiver, , uint256 _tokenId) = abi.decode(
                _message[4:],
                (address, address, address, address, uint256)
            );
            IERC721Upgradeable(_token).safeTransferFrom(address(this), _receiver, _tokenId);

            emit RefundERC721(_token, _receiver, _tokenId);
        } else if (bytes4(_message[0:4]) == IL2ERC721Gateway.finalizeBatchDepositERC721.selector) {
            (address _token, , address _receiver, , uint256[] memory _tokenIds) = abi.decode(
                _message[4:],
                (address, address, address, address, uint256[])
            );
            for (uint256 i = 0; i < _tokenIds.length; i++) {
                IERC721Upgradeable(_token).safeTransferFrom(address(this), _receiver, _tokenIds[i]);
            }
            emit BatchRefundERC721(_token, _receiver, _tokenIds);
        } else {
            revert("invalid selector");
        }
    }

    /************************
     * Restricted Functions *
     ************************/

    /// @notice Update layer 2 to layer 2 token mapping.
    /// @param _l1Token The address of ERC721 token on layer 1.
    /// @param _l2Token The address of corresponding ERC721 token on layer 2.
    function updateTokenMapping(address _l1Token, address _l2Token) external onlyOwner {
        require(_l2Token != address(0), "token address cannot be 0");

        address _oldL2Token = tokenMapping[_l1Token];
        tokenMapping[_l1Token] = _l2Token;

        emit UpdateTokenMapping(_l1Token, _oldL2Token, _l2Token);
    }

    /**********************
     * Internal Functions *
     **********************/

    /// @dev Internal function to deposit ERC721 NFT to layer 2.
    /// @param _token The address of ERC721 NFT on layer 1.
    /// @param _to The address of recipient on layer 2.
    /// @param _tokenId The token id to deposit.
    /// @param _gasLimit Estimated gas limit required to complete the deposit on layer 2.
    function _depositERC721(
        address _token,
        address _to,
        uint256 _tokenId,
        uint256 _gasLimit
    ) internal virtual nonReentrant {
        address _l2Token = tokenMapping[_token];
        require(_l2Token != address(0), "no corresponding l2 token");

        address _sender = _msgSender();

        // 1. transfer token to this contract
        IERC721Upgradeable(_token).safeTransferFrom(_sender, address(this), _tokenId);

        // 2. Generate message passed to L2ERC721Gateway.
        bytes memory _message = abi.encodeCall(
            IL2ERC721Gateway.finalizeDepositERC721,
            (_token, _l2Token, _sender, _to, _tokenId)
        );

        // 3. Send message to L1ScrollMessenger.
        IL1ScrollMessenger(messenger).sendMessage{value: msg.value}(counterpart, 0, _message, _gasLimit, _sender);

        emit DepositERC721(_token, _l2Token, _sender, _to, _tokenId);
    }

    /// @dev Internal function to batch deposit ERC721 NFT to layer 2.
    /// @param _token The address of ERC721 NFT on layer 1.
    /// @param _to The address of recipient on layer 2.
    /// @param _tokenIds The list of token ids to deposit.
    /// @param _gasLimit Estimated gas limit required to complete the deposit on layer 2.
    function _batchDepositERC721(
        address _token,
        address _to,
        uint256[] calldata _tokenIds,
        uint256 _gasLimit
    ) internal virtual nonReentrant {
        require(_tokenIds.length > 0, "no token to deposit");

        address _l2Token = tokenMapping[_token];
        require(_l2Token != address(0), "no corresponding l2 token");

        address _sender = _msgSender();

        // 1. transfer token to this contract
        for (uint256 i = 0; i < _tokenIds.length; i++) {
            IERC721Upgradeable(_token).safeTransferFrom(_sender, address(this), _tokenIds[i]);
        }

        // 2. Generate message passed to L2ERC721Gateway.
        bytes memory _message = abi.encodeCall(
            IL2ERC721Gateway.finalizeBatchDepositERC721,
            (_token, _l2Token, _sender, _to, _tokenIds)
        );

        // 3. Send message to L1ScrollMessenger.
        IL1ScrollMessenger(messenger).sendMessage{value: msg.value}(counterpart, 0, _message, _gasLimit, _sender);

        emit BatchDepositERC721(_token, _l2Token, _sender, _to, _tokenIds);
    }
}

File 2 of 20 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init() internal onlyInitializing {
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal onlyInitializing {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 3 of 20 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

import "../../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```solidity
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 *
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
     * constructor.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 1;
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: setting the version to 255 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized != type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint8) {
        return _initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _initializing;
    }
}

File 4 of 20 : ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuardUpgradeable is Initializable {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    function __ReentrancyGuard_init() internal onlyInitializing {
        __ReentrancyGuard_init_unchained();
    }

    function __ReentrancyGuard_init_unchained() internal onlyInitializing {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;
    }

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 5 of 20 : IERC721ReceiverUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721ReceiverUpgradeable {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

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

pragma solidity ^0.8.0;

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

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721Upgradeable is IERC165Upgradeable {
    /**
     * @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 7 of 20 : ERC721HolderUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/utils/ERC721Holder.sol)

pragma solidity ^0.8.0;

import "../IERC721ReceiverUpgradeable.sol";
import "../../../proxy/utils/Initializable.sol";

/**
 * @dev Implementation of the {IERC721Receiver} interface.
 *
 * Accepts all token transfers.
 * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}.
 */
contract ERC721HolderUpgradeable is Initializable, IERC721ReceiverUpgradeable {
    function __ERC721Holder_init() internal onlyInitializing {
    }

    function __ERC721Holder_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC721Receiver-onERC721Received}.
     *
     * Always returns `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(address, address, uint256, bytes memory) public virtual override returns (bytes4) {
        return this.onERC721Received.selector;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 8 of 20 : AddressUpgradeable.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 AddressUpgradeable {
    /**
     * @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 9 of 20 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 10 of 20 : IERC165Upgradeable.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 IERC165Upgradeable {
    /**
     * @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 20 : IL1ERC721Gateway.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.16;

/// @title The interface for the ERC721 cross chain gateway on layer 1.
interface IL1ERC721Gateway {
    /**********
     * Events *
     **********/

    /// @notice Emitted when the ERC721 NFT is transfered to recipient on layer 1.
    /// @param _l1Token The address of ERC721 NFT on layer 1.
    /// @param _l2Token The address of ERC721 NFT on layer 2.
    /// @param _from The address of sender on layer 2.
    /// @param _to The address of recipient on layer 1.
    /// @param _tokenId The token id of the ERC721 NFT to withdraw from layer 2.
    event FinalizeWithdrawERC721(
        address indexed _l1Token,
        address indexed _l2Token,
        address indexed _from,
        address _to,
        uint256 _tokenId
    );

    /// @notice Emitted when the ERC721 NFT is batch transfered to recipient on layer 1.
    /// @param _l1Token The address of ERC721 NFT on layer 1.
    /// @param _l2Token The address of ERC721 NFT on layer 2.
    /// @param _from The address of sender on layer 2.
    /// @param _to The address of recipient on layer 1.
    /// @param _tokenIds The list of token ids of the ERC721 NFT to withdraw from layer 2.
    event FinalizeBatchWithdrawERC721(
        address indexed _l1Token,
        address indexed _l2Token,
        address indexed _from,
        address _to,
        uint256[] _tokenIds
    );

    /// @notice Emitted when the ERC721 NFT is deposited to gateway on layer 1.
    /// @param _l1Token The address of ERC721 NFT on layer 1.
    /// @param _l2Token The address of ERC721 NFT on layer 2.
    /// @param _from The address of sender on layer 1.
    /// @param _to The address of recipient on layer 2.
    /// @param _tokenId The token id of the ERC721 NFT to deposit on layer 1.
    event DepositERC721(
        address indexed _l1Token,
        address indexed _l2Token,
        address indexed _from,
        address _to,
        uint256 _tokenId
    );

    /// @notice Emitted when the ERC721 NFT is batch deposited to gateway on layer 1.
    /// @param _l1Token The address of ERC721 NFT on layer 1.
    /// @param _l2Token The address of ERC721 NFT on layer 2.
    /// @param _from The address of sender on layer 1.
    /// @param _to The address of recipient on layer 2.
    /// @param _tokenIds The list of token ids of the ERC721 NFT to deposit on layer 1.
    event BatchDepositERC721(
        address indexed _l1Token,
        address indexed _l2Token,
        address indexed _from,
        address _to,
        uint256[] _tokenIds
    );

    /// @notice Emitted when some ERC721 token is refunded.
    /// @param token The address of the token in L1.
    /// @param recipient The address of receiver in L1.
    /// @param tokenId The id of token refunded.
    event RefundERC721(address indexed token, address indexed recipient, uint256 tokenId);

    /// @notice Emitted when a batch of ERC721 tokens are refunded.
    /// @param token The address of the token in L1.
    /// @param recipient The address of receiver in L1.
    /// @param tokenIds The list of token ids of the ERC721 NFT refunded.
    event BatchRefundERC721(address indexed token, address indexed recipient, uint256[] tokenIds);

    /*****************************
     * Public Mutating Functions *
     *****************************/

    /// @notice Deposit some ERC721 NFT to caller's account on layer 2.
    /// @param _token The address of ERC721 NFT on layer 1.
    /// @param _tokenId The token id to deposit.
    /// @param _gasLimit Estimated gas limit required to complete the deposit on layer 2.
    function depositERC721(
        address _token,
        uint256 _tokenId,
        uint256 _gasLimit
    ) external payable;

    /// @notice Deposit some ERC721 NFT to a recipient's account on layer 2.
    /// @param _token The address of ERC721 NFT on layer 1.
    /// @param _to The address of recipient on layer 2.
    /// @param _tokenId The token id to deposit.
    /// @param _gasLimit Estimated gas limit required to complete the deposit on layer 2.
    function depositERC721(
        address _token,
        address _to,
        uint256 _tokenId,
        uint256 _gasLimit
    ) external payable;

    /// @notice Deposit a list of some ERC721 NFT to caller's account on layer 2.
    /// @param _token The address of ERC721 NFT on layer 1.
    /// @param _tokenIds The list of token ids to deposit.
    /// @param _gasLimit Estimated gas limit required to complete the deposit on layer 2.
    function batchDepositERC721(
        address _token,
        uint256[] calldata _tokenIds,
        uint256 _gasLimit
    ) external payable;

    /// @notice Deposit a list of some ERC721 NFT to a recipient's account on layer 2.
    /// @param _token The address of ERC721 NFT on layer 1.
    /// @param _to The address of recipient on layer 2.
    /// @param _tokenIds The list of token ids to deposit.
    /// @param _gasLimit Estimated gas limit required to complete the deposit on layer 2.
    function batchDepositERC721(
        address _token,
        address _to,
        uint256[] calldata _tokenIds,
        uint256 _gasLimit
    ) external payable;

    /// @notice Complete ERC721 withdraw from layer 2 to layer 1 and send NFT to recipient's account on layer 1.
    /// @dev Requirements:
    ///  - The function should only be called by L1ScrollMessenger.
    ///  - The function should also only be called by L2ERC721Gateway on layer 2.
    /// @param _l1Token The address of corresponding layer 1 token.
    /// @param _l2Token The address of corresponding layer 2 token.
    /// @param _from The address of account who withdraw the token on layer 2.
    /// @param _to The address of recipient on layer 1 to receive the token.
    /// @param _tokenId The token id to withdraw.
    function finalizeWithdrawERC721(
        address _l1Token,
        address _l2Token,
        address _from,
        address _to,
        uint256 _tokenId
    ) external;

    /// @notice Complete ERC721 batch withdraw from layer 2 to layer 1 and send NFT to recipient's account on layer 1.
    /// @dev Requirements:
    ///  - The function should only be called by L1ScrollMessenger.
    ///  - The function should also only be called by L2ERC721Gateway on layer 2.
    /// @param _l1Token The address of corresponding layer 1 token.
    /// @param _l2Token The address of corresponding layer 2 token.
    /// @param _from The address of account who withdraw the token on layer 2.
    /// @param _to The address of recipient on layer 1 to receive the token.
    /// @param _tokenIds The list of token ids to withdraw.
    function finalizeBatchWithdrawERC721(
        address _l1Token,
        address _l2Token,
        address _from,
        address _to,
        uint256[] calldata _tokenIds
    ) external;
}

File 12 of 20 : IL1ScrollMessenger.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.16;

import {IScrollMessenger} from "../libraries/IScrollMessenger.sol";

interface IL1ScrollMessenger is IScrollMessenger {
    /**********
     * Events *
     **********/

    /// @notice Emitted when the maximum number of times each message can be replayed is updated.
    /// @param oldMaxReplayTimes The old maximum number of times each message can be replayed.
    /// @param newMaxReplayTimes The new maximum number of times each message can be replayed.
    event UpdateMaxReplayTimes(uint256 oldMaxReplayTimes, uint256 newMaxReplayTimes);

    /***********
     * Structs *
     ***********/

    struct L2MessageProof {
        // The index of the batch where the message belongs to.
        uint256 batchIndex;
        // Concatenation of merkle proof for withdraw merkle trie.
        bytes merkleProof;
    }

    /*****************************
     * Public Mutating Functions *
     *****************************/

    /// @notice Relay a L2 => L1 message with message proof.
    /// @param from The address of the sender of the message.
    /// @param to The address of the recipient of the message.
    /// @param value The msg.value passed to the message call.
    /// @param nonce The nonce of the message to avoid replay attack.
    /// @param message The content of the message.
    /// @param proof The proof used to verify the correctness of the transaction.
    function relayMessageWithProof(
        address from,
        address to,
        uint256 value,
        uint256 nonce,
        bytes memory message,
        L2MessageProof memory proof
    ) external;

    /// @notice Replay an existing message.
    /// @param from The address of the sender of the message.
    /// @param to The address of the recipient of the message.
    /// @param value The msg.value passed to the message call.
    /// @param messageNonce The nonce for the message to replay.
    /// @param message The content of the message.
    /// @param newGasLimit New gas limit to be used for this message.
    /// @param refundAddress The address of account who will receive the refunded fee.
    function replayMessage(
        address from,
        address to,
        uint256 value,
        uint256 messageNonce,
        bytes memory message,
        uint32 newGasLimit,
        address refundAddress
    ) external payable;

    /// @notice Drop a skipped message.
    /// @param from The address of the sender of the message.
    /// @param to The address of the recipient of the message.
    /// @param value The msg.value passed to the message call.
    /// @param messageNonce The nonce for the message to drop.
    /// @param message The content of the message.
    function dropMessage(
        address from,
        address to,
        uint256 value,
        uint256 messageNonce,
        bytes memory message
    ) external;
}

File 13 of 20 : IL2ERC721Gateway.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.16;

/// @title The interface for the ERC721 cross chain gateway on layer 2.
interface IL2ERC721Gateway {
    /**********
     * Events *
     **********/

    /// @notice Emitted when the ERC721 NFT is transfered to recipient on layer 2.
    /// @param l1Token The address of ERC721 NFT on layer 1.
    /// @param l2Token The address of ERC721 NFT on layer 2.
    /// @param from The address of sender on layer 1.
    /// @param to The address of recipient on layer 2.
    /// @param tokenId The token id of the ERC721 NFT deposited on layer 1.
    event FinalizeDepositERC721(
        address indexed l1Token,
        address indexed l2Token,
        address indexed from,
        address to,
        uint256 tokenId
    );

    /// @notice Emitted when the ERC721 NFT is batch transfered to recipient on layer 2.
    /// @param l1Token The address of ERC721 NFT on layer 1.
    /// @param l2Token The address of ERC721 NFT on layer 2.
    /// @param from The address of sender on layer 1.
    /// @param to The address of recipient on layer 2.
    /// @param tokenIds The list of token ids of the ERC721 NFT deposited on layer 1.
    event FinalizeBatchDepositERC721(
        address indexed l1Token,
        address indexed l2Token,
        address indexed from,
        address to,
        uint256[] tokenIds
    );

    /// @notice Emitted when the ERC721 NFT is transfered to gateway on layer 2.
    /// @param l1Token The address of ERC721 NFT on layer 1.
    /// @param l2Token The address of ERC721 NFT on layer 2.
    /// @param from The address of sender on layer 2.
    /// @param to The address of recipient on layer 1.
    /// @param tokenId The token id of the ERC721 NFT to withdraw on layer 2.
    event WithdrawERC721(
        address indexed l1Token,
        address indexed l2Token,
        address indexed from,
        address to,
        uint256 tokenId
    );

    /// @notice Emitted when the ERC721 NFT is batch transfered to gateway on layer 2.
    /// @param l1Token The address of ERC721 NFT on layer 1.
    /// @param l2Token The address of ERC721 NFT on layer 2.
    /// @param from The address of sender on layer 2.
    /// @param to The address of recipient on layer 1.
    /// @param tokenIds The list of token ids of the ERC721 NFT to withdraw on layer 2.
    event BatchWithdrawERC721(
        address indexed l1Token,
        address indexed l2Token,
        address indexed from,
        address to,
        uint256[] tokenIds
    );

    /*****************************
     * Public Mutating Functions *
     *****************************/

    /// @notice Withdraw some ERC721 NFT to caller's account on layer 1.
    /// @param token The address of ERC721 NFT on layer 2.
    /// @param tokenId The token id to withdraw.
    /// @param gasLimit Unused, but included for potential forward compatibility considerations.
    function withdrawERC721(
        address token,
        uint256 tokenId,
        uint256 gasLimit
    ) external payable;

    /// @notice Withdraw some ERC721 NFT to caller's account on layer 1.
    /// @param token The address of ERC721 NFT on layer 2.
    /// @param to The address of recipient on layer 1.
    /// @param tokenId The token id to withdraw.
    /// @param gasLimit Unused, but included for potential forward compatibility considerations.
    function withdrawERC721(
        address token,
        address to,
        uint256 tokenId,
        uint256 gasLimit
    ) external payable;

    /// @notice Batch withdraw a list of ERC721 NFT to caller's account on layer 1.
    /// @param token The address of ERC721 NFT on layer 2.
    /// @param tokenIds The list of token ids to withdraw.
    /// @param gasLimit Unused, but included for potential forward compatibility considerations.
    function batchWithdrawERC721(
        address token,
        uint256[] memory tokenIds,
        uint256 gasLimit
    ) external payable;

    /// @notice Batch withdraw a list of ERC721 NFT to caller's account on layer 1.
    /// @param token The address of ERC721 NFT on layer 2.
    /// @param to The address of recipient on layer 1.
    /// @param tokenIds The list of token ids to withdraw.
    /// @param gasLimit Unused, but included for potential forward compatibility considerations.
    function batchWithdrawERC721(
        address token,
        address to,
        uint256[] memory tokenIds,
        uint256 gasLimit
    ) external payable;

    /// @notice Complete ERC721 deposit from layer 1 to layer 2 and send NFT to recipient's account on layer 2.
    /// @dev Requirements:
    ///  - The function should only be called by L2ScrollMessenger.
    ///  - The function should also only be called by L1ERC721Gateway on layer 1.
    /// @param l1Token The address of corresponding layer 1 token.
    /// @param l2Token The address of corresponding layer 2 token.
    /// @param from The address of account who withdraw the token on layer 1.
    /// @param to The address of recipient on layer 2 to receive the token.
    /// @param tokenId The token id to withdraw.
    function finalizeDepositERC721(
        address l1Token,
        address l2Token,
        address from,
        address to,
        uint256 tokenId
    ) external;

    /// @notice Complete ERC721 deposit from layer 1 to layer 2 and send NFT to recipient's account on layer 2.
    /// @dev Requirements:
    ///  - The function should only be called by L2ScrollMessenger.
    ///  - The function should also only be called by L1ERC721Gateway on layer 1.
    /// @param l1Token The address of corresponding layer 1 token.
    /// @param l2Token The address of corresponding layer 2 token.
    /// @param from The address of account who withdraw the token on layer 1.
    /// @param to The address of recipient on layer 2 to receive the token.
    /// @param tokenIds The list of token ids to withdraw.
    function finalizeBatchDepositERC721(
        address l1Token,
        address l2Token,
        address from,
        address to,
        uint256[] calldata tokenIds
    ) external;
}

File 14 of 20 : IMessageDropCallback.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.16;

interface IMessageDropCallback {
    function onDropMessage(bytes memory message) external payable;
}

File 15 of 20 : IScrollGatewayCallback.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.16;

interface IScrollGatewayCallback {
    function onScrollGatewayCallback(bytes memory data) external;
}

File 16 of 20 : ScrollConstants.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.16;

library ScrollConstants {
    /// @notice The address of default cross chain message sender.
    address internal constant DEFAULT_XDOMAIN_MESSAGE_SENDER = address(1);

    /// @notice The address for dropping message.
    /// @dev The first 20 bytes of keccak("drop")
    address internal constant DROP_XDOMAIN_MESSAGE_SENDER = 0x6f297C61B5C92eF107fFD30CD56AFFE5A273e841;
}

File 17 of 20 : IScrollGateway.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.16;

interface IScrollGateway {
    /**********
     * Errors *
     **********/

    /// @dev Thrown when the given address is `address(0)`.
    error ErrorZeroAddress();

    /// @dev Thrown when the caller is not corresponding `L1ScrollMessenger` or `L2ScrollMessenger`.
    error ErrorCallerIsNotMessenger();

    /// @dev Thrown when the cross chain sender is not the counterpart gateway contract.
    error ErrorCallerIsNotCounterpartGateway();

    /// @dev Thrown when ScrollMessenger is not dropping message.
    error ErrorNotInDropMessageContext();

    /*************************
     * Public View Functions *
     *************************/

    /// @notice The address of corresponding L1/L2 Gateway contract.
    function counterpart() external view returns (address);

    /// @notice The address of L1GatewayRouter/L2GatewayRouter contract.
    function router() external view returns (address);

    /// @notice The address of corresponding L1ScrollMessenger/L2ScrollMessenger contract.
    function messenger() external view returns (address);
}

File 18 of 20 : ScrollGatewayBase.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.16;

import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import {ReentrancyGuardUpgradeable} from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";

import {IScrollGateway} from "./IScrollGateway.sol";
import {IScrollMessenger} from "../IScrollMessenger.sol";
import {IScrollGatewayCallback} from "../callbacks/IScrollGatewayCallback.sol";
import {ScrollConstants} from "../constants/ScrollConstants.sol";
import {ITokenRateLimiter} from "../../rate-limiter/ITokenRateLimiter.sol";

/// @title ScrollGatewayBase
/// @notice The `ScrollGatewayBase` is a base contract for gateway contracts used in both in L1 and L2.
abstract contract ScrollGatewayBase is ReentrancyGuardUpgradeable, OwnableUpgradeable, IScrollGateway {
    /*************
     * Constants *
     *************/

    /// @inheritdoc IScrollGateway
    address public immutable override counterpart;

    /// @inheritdoc IScrollGateway
    address public immutable override router;

    /// @inheritdoc IScrollGateway
    address public immutable override messenger;

    /*************
     * Variables *
     *************/

    /// @dev The storage slot used as counterpart gateway contract, which is deprecated now.
    address private __counterpart;

    /// @dev The storage slot used as gateway router contract, which is deprecated now.
    address private __router;

    /// @dev The storage slot used as scroll messenger contract, which is deprecated now.
    address private __messenger;

    /// @dev The storage slot used as token rate limiter contract, which is deprecated now.
    address private __rateLimiter;

    /// @dev The storage slots for future usage.
    uint256[46] private __gap;

    /**********************
     * Function Modifiers *
     **********************/

    modifier onlyCallByCounterpart() {
        // check caller is messenger
        if (_msgSender() != messenger) {
            revert ErrorCallerIsNotMessenger();
        }

        // check cross domain caller is counterpart gateway
        if (counterpart != IScrollMessenger(messenger).xDomainMessageSender()) {
            revert ErrorCallerIsNotCounterpartGateway();
        }
        _;
    }

    modifier onlyInDropContext() {
        // check caller is messenger
        if (_msgSender() != messenger) {
            revert ErrorCallerIsNotMessenger();
        }

        // check we are dropping message in ScrollMessenger.
        if (ScrollConstants.DROP_XDOMAIN_MESSAGE_SENDER != IScrollMessenger(messenger).xDomainMessageSender()) {
            revert ErrorNotInDropMessageContext();
        }
        _;
    }

    /***************
     * Constructor *
     ***************/

    constructor(
        address _counterpart,
        address _router,
        address _messenger
    ) {
        if (_counterpart == address(0) || _messenger == address(0)) {
            revert ErrorZeroAddress();
        }

        counterpart = _counterpart;
        router = _router;
        messenger = _messenger;
    }

    function _initialize(
        address,
        address,
        address
    ) internal {
        ReentrancyGuardUpgradeable.__ReentrancyGuard_init();
        OwnableUpgradeable.__Ownable_init();
    }

    /**********************
     * Internal Functions *
     **********************/

    /// @dev Internal function to forward calldata to target contract.
    /// @param _to The address of contract to call.
    /// @param _data The calldata passed to the contract.
    function _doCallback(address _to, bytes memory _data) internal {
        if (_data.length > 0 && _to.code.length > 0) {
            IScrollGatewayCallback(_to).onScrollGatewayCallback(_data);
        }
    }
}

File 19 of 20 : IScrollMessenger.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.16;

interface IScrollMessenger {
    /**********
     * Events *
     **********/

    /// @notice Emitted when a cross domain message is sent.
    /// @param sender The address of the sender who initiates the message.
    /// @param target The address of target contract to call.
    /// @param value The amount of value passed to the target contract.
    /// @param messageNonce The nonce of the message.
    /// @param gasLimit The optional gas limit passed to L1 or L2.
    /// @param message The calldata passed to the target contract.
    event SentMessage(
        address indexed sender,
        address indexed target,
        uint256 value,
        uint256 messageNonce,
        uint256 gasLimit,
        bytes message
    );

    /// @notice Emitted when a cross domain message is relayed successfully.
    /// @param messageHash The hash of the message.
    event RelayedMessage(bytes32 indexed messageHash);

    /// @notice Emitted when a cross domain message is failed to relay.
    /// @param messageHash The hash of the message.
    event FailedRelayedMessage(bytes32 indexed messageHash);

    /**********
     * Errors *
     **********/

    /// @dev Thrown when the given address is `address(0)`.
    error ErrorZeroAddress();

    /*************************
     * Public View Functions *
     *************************/

    /// @notice Return the sender of a cross domain message.
    function xDomainMessageSender() external view returns (address);

    /*****************************
     * Public Mutating Functions *
     *****************************/

    /// @notice Send cross chain message from L1 to L2 or L2 to L1.
    /// @param target The address of account who receive the message.
    /// @param value The amount of ether passed when call target contract.
    /// @param message The content of the message.
    /// @param gasLimit Gas limit required to complete the message relay on corresponding chain.
    function sendMessage(
        address target,
        uint256 value,
        bytes calldata message,
        uint256 gasLimit
    ) external payable;

    /// @notice Send cross chain message from L1 to L2 or L2 to L1.
    /// @param target The address of account who receive the message.
    /// @param value The amount of ether passed when call target contract.
    /// @param message The content of the message.
    /// @param gasLimit Gas limit required to complete the message relay on corresponding chain.
    /// @param refundAddress The address of account who will receive the refunded fee.
    function sendMessage(
        address target,
        uint256 value,
        bytes calldata message,
        uint256 gasLimit,
        address refundAddress
    ) external payable;
}

File 20 of 20 : ITokenRateLimiter.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.16;

interface ITokenRateLimiter {
    /**********
     * Events *
     **********/

    /// @notice Emitted when the total limit is updated.
    /// @param oldTotalLimit The previous value of total limit before updating.
    /// @param newTotalLimit The current value of total limit after updating.
    event UpdateTotalLimit(address indexed token, uint256 oldTotalLimit, uint256 newTotalLimit);

    /**********
     * Errors *
     **********/

    /// @dev Thrown when the `periodDuration` is initialized to zero.
    error PeriodIsZero();

    /// @dev Thrown when the `totalAmount` is initialized to zero.
    /// @param token The address of the token.
    error TotalLimitIsZero(address token);

    /// @dev Thrown when an amount breaches the total limit in the period.
    /// @param token The address of the token.
    error ExceedTotalLimit(address token);

    /*****************************
     * Public Mutating Functions *
     *****************************/

    /// @notice Request some token usage for `sender`.
    /// @param token The address of the token.
    /// @param amount The amount of token to use.
    function addUsedAmount(address token, uint256 amount) external;
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_counterpart","type":"address"},{"internalType":"address","name":"_messenger","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ErrorCallerIsNotCounterpartGateway","type":"error"},{"inputs":[],"name":"ErrorCallerIsNotMessenger","type":"error"},{"inputs":[],"name":"ErrorNotInDropMessageContext","type":"error"},{"inputs":[],"name":"ErrorZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_l1Token","type":"address"},{"indexed":true,"internalType":"address","name":"_l2Token","type":"address"},{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":false,"internalType":"address","name":"_to","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"}],"name":"BatchDepositERC721","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"BatchRefundERC721","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_l1Token","type":"address"},{"indexed":true,"internalType":"address","name":"_l2Token","type":"address"},{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":false,"internalType":"address","name":"_to","type":"address"},{"indexed":false,"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"DepositERC721","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_l1Token","type":"address"},{"indexed":true,"internalType":"address","name":"_l2Token","type":"address"},{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":false,"internalType":"address","name":"_to","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"}],"name":"FinalizeBatchWithdrawERC721","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_l1Token","type":"address"},{"indexed":true,"internalType":"address","name":"_l2Token","type":"address"},{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":false,"internalType":"address","name":"_to","type":"address"},{"indexed":false,"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"FinalizeWithdrawERC721","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"RefundERC721","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"l1Token","type":"address"},{"indexed":true,"internalType":"address","name":"oldL2Token","type":"address"},{"indexed":true,"internalType":"address","name":"newL2Token","type":"address"}],"name":"UpdateTokenMapping","type":"event"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"internalType":"uint256","name":"_gasLimit","type":"uint256"}],"name":"batchDepositERC721","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"internalType":"uint256","name":"_gasLimit","type":"uint256"}],"name":"batchDepositERC721","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"counterpart","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_gasLimit","type":"uint256"}],"name":"depositERC721","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_gasLimit","type":"uint256"}],"name":"depositERC721","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_l1Token","type":"address"},{"internalType":"address","name":"_l2Token","type":"address"},{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"}],"name":"finalizeBatchWithdrawERC721","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_l1Token","type":"address"},{"internalType":"address","name":"_l2Token","type":"address"},{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"finalizeWithdrawERC721","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_counterpart","type":"address"},{"internalType":"address","name":"_messenger","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"messenger","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"_message","type":"bytes"}],"name":"onDropMessage","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"router","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokenMapping","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_l1Token","type":"address"},{"internalType":"address","name":"_l2Token","type":"address"}],"name":"updateTokenMapping","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60e06040523480156200001157600080fd5b506040516200204d3803806200204d83398101604081905262000034916200017d565b816000826001600160a01b03831615806200005657506001600160a01b038116155b15620000755760405163a7f9319d60e01b815260040160405180910390fd5b6001600160a01b0392831660805290821660a0521660c052620000976200009f565b5050620001b5565b600054610100900460ff16156200010c5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff908116146200015e576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b80516001600160a01b03811681146200017857600080fd5b919050565b600080604083850312156200019157600080fd5b6200019c8362000160565b9150620001ac6020840162000160565b90509250929050565b60805160a05160c051611e1462000239600039600081816101990152818161037f015281816103c7015281816108bb0152818161090301528181610b6901528181610bb10152818161102c01526113210152600061032801526000818161022d0152818161098e01528181610c3c0152818161105b01526113500152611e146000f3fe6080604052600436106100fe5760003560e01c8063797594b011610095578063d606b4dc11610064578063d606b4dc146102c3578063d96c8ecf146102e3578063f2fde38b146102f6578063f887ea4014610316578063fac752eb1461034a57600080fd5b8063797594b01461021b5780638da5cb5b1461024f5780639f0a68b31461026d578063ba27f50b1461028d57600080fd5b80633cb747bf116100d15780633cb747bf1461018757806345a4276b146101d3578063485cc955146101e6578063715018a61461020657600080fd5b80630a7aa1961461010357806314298c5114610118578063150b7a021461012b5780631b997a9314610174575b600080fd5b6101166101113660046115c6565b61036a565b005b61011661012636600461160c565b61037c565b34801561013757600080fd5b506101566101463660046116c5565b630a85bd0160e11b949350505050565b6040516001600160e01b031990911681526020015b60405180910390f35b6101166101823660046117d5565b610761565b34801561019357600080fd5b506101bb7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161016b565b6101166101e1366004611842565b610775565b3480156101f257600080fd5b50610116610201366004611877565b610786565b34801561021257600080fd5b506101166108a4565b34801561022757600080fd5b506101bb7f000000000000000000000000000000000000000000000000000000000000000081565b34801561025b57600080fd5b506097546001600160a01b03166101bb565b34801561027957600080fd5b506101166102883660046118b0565b6108b8565b34801561029957600080fd5b506101bb6102a836600461193e565b60fb602052600090815260409020546001600160a01b031681565b3480156102cf57600080fd5b506101166102de366004611962565b610b66565b6101166102f13660046119c6565b610dca565b34801561030257600080fd5b5061011661031136600461193e565b610dd7565b34801561032257600080fd5b506101bb7f000000000000000000000000000000000000000000000000000000000000000081565b34801561035657600080fd5b50610116610365366004611877565b610e50565b61037684848484610ee2565b50505050565b337f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316146103c5576040516385bd908d60e01b815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316636e296e456040518163ffffffff1660e01b8152600401602060405180830381865afa158015610423573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104479190611a22565b6001600160a01b0316736f297c61b5c92ef107ffd30cd56affe5a273e8416001600160a01b03161461048c57604051630d08b8ff60e01b815260040160405180910390fd5b610494611119565b34156104db5760405162461bcd60e51b81526020600482015260116024820152706e6f6e7a65726f206d73672e76616c756560781b60448201526064015b60405180910390fd5b63f8c3cf2560e01b6104f1600460008486611a3f565b6104fa91611a69565b6001600160e01b031916036105e6576000808061051a8460048188611a3f565b8101906105279190611962565b9450509350509250826001600160a01b03166342842e0e3084846040518463ffffffff1660e01b815260040161055f93929190611a99565b600060405180830381600087803b15801561057957600080fd5b505af115801561058d573d6000803e3d6000fd5b50505050816001600160a01b0316836001600160a01b03167fb9a838365634e4fb87a9333edf0ea86f82836e361b311a125aefd14135581208836040516105d691815260200190565b60405180910390a3505050610753565b63982b151f60e01b6105fc600460008486611a3f565b61060591611a69565b6001600160e01b0319160361071857600080806106258460048188611a3f565b8101906106329190611abd565b945050935050925060005b81518110156106d457836001600160a01b03166342842e0e308585858151811061066957610669611bb0565b60200260200101516040518463ffffffff1660e01b815260040161068f93929190611a99565b600060405180830381600087803b1580156106a957600080fd5b505af11580156106bd573d6000803e3d6000fd5b5050505080806106cc90611bc6565b91505061063d565b50816001600160a01b0316836001600160a01b03167f998a3ef0a23771412ff48d871a2288502a89da39c5db04a2a66e5eb85586cc22836040516105d69190611bed565b60405162461bcd60e51b815260206004820152601060248201526f34b73b30b634b21039b2b632b1ba37b960811b60448201526064016104d2565b61075d6001603355565b5050565b61076e8585858585611179565b5050505050565b61078183338484610ee2565b505050565b600054610100900460ff16158080156107a65750600054600160ff909116105b806107c05750303b1580156107c0575060005460ff166001145b6108235760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016104d2565b6000805460ff191660011790558015610846576000805461ff0019166101001790555b61084e611419565b61085a83600084611440565b8015610781576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050565b6108ac611450565b6108b660006114aa565b565b337f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031614610901576040516385bd908d60e01b815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316636e296e456040518163ffffffff1660e01b8152600401602060405180830381865afa15801561095f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109839190611a22565b6001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316146109d4576040516307b140f360e51b815260040160405180910390fd5b6109dc611119565b6001600160a01b038516610a025760405162461bcd60e51b81526004016104d290611c31565b6001600160a01b03808716600090815260fb6020526040902054868216911614610a625760405162461bcd60e51b81526020600482015260116024820152700d86440e8ded6cadc40dad2e6dac2e8c6d607b1b60448201526064016104d2565b60005b81811015610afa57866001600160a01b03166342842e0e3086868686818110610a9057610a90611bb0565b905060200201356040518463ffffffff1660e01b8152600401610ab593929190611a99565b600060405180830381600087803b158015610acf57600080fd5b505af1158015610ae3573d6000803e3d6000fd5b505050508080610af290611bc6565b915050610a65565b50836001600160a01b0316856001600160a01b0316876001600160a01b03167f9b8e51c8f180115b421b26c9042287d6bf95e0ce9c0c5434784e2af3d0b9de7d868686604051610b4c93929190611c9a565b60405180910390a4610b5e6001603355565b505050505050565b337f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031614610baf576040516385bd908d60e01b815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316636e296e456040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c0d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c319190611a22565b6001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031614610c82576040516307b140f360e51b815260040160405180910390fd5b610c8a611119565b6001600160a01b038416610cb05760405162461bcd60e51b81526004016104d290611c31565b6001600160a01b03808616600090815260fb6020526040902054858216911614610d105760405162461bcd60e51b81526020600482015260116024820152700d86440e8ded6cadc40dad2e6dac2e8c6d607b1b60448201526064016104d2565b604051632142170760e11b81526001600160a01b038616906342842e0e90610d4090309086908690600401611a99565b600060405180830381600087803b158015610d5a57600080fd5b505af1158015610d6e573d6000803e3d6000fd5b5050604080516001600160a01b03868116825260208201869052808816945088811693508916917facdbfefc030b5ccccd5f60ca6d9ca371c6d6d6956fe16ebe10f81920198206e9910160405180910390a461076e6001603355565b6103768433858585611179565b610ddf611450565b6001600160a01b038116610e445760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104d2565b610e4d816114aa565b50565b610e58611450565b6001600160a01b038116610e7e5760405162461bcd60e51b81526004016104d290611c31565b6001600160a01b03808316600081815260fb602052604080822080548686166001600160a01b0319821681179092559151919094169392849290917f2069a26c43c36ffaabe0c2d19bf65e55dd03abecdc449f5cc9663491e97f709d9190a4505050565b610eea611119565b6001600160a01b03808516600090815260fb60205260409020541680610f4e5760405162461bcd60e51b815260206004820152601960248201527837379031b7b93932b9b837b73234b733903619103a37b5b2b760391b60448201526064016104d2565b604051632142170760e11b815233906001600160a01b038716906342842e0e90610f8090849030908990600401611a99565b600060405180830381600087803b158015610f9a57600080fd5b505af1158015610fae573d6000803e3d6000fd5b50506040516001600160a01b03808a166024830152808616604483015280851660648301528816608482015260a481018790526000925060c401905060408051601f198184030181529181526020820180516001600160e01b031663f8c3cf2560e01b17905251635f7b157760e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690635f7b157790349061108c907f00000000000000000000000000000000000000000000000000000000000000009060009087908b908a90600401611cc8565b6000604051808303818588803b1580156110a557600080fd5b505af11580156110b9573d6000803e3d6000fd5b5050604080516001600160a01b038b81168252602082018b9052808816955088811694508c1692507ffc1d17c06ff1e4678321cc30660a73f3f1436df8195108a288d3159a961febec910160405180910390a45050506103766001603355565b60026033540361116b5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016104d2565b6002603355565b6001603355565b611181611119565b816111c45760405162461bcd60e51b81526020600482015260136024820152721b9bc81d1bdad95b881d1bc819195c1bdcda5d606a1b60448201526064016104d2565b6001600160a01b03808616600090815260fb602052604090205416806112285760405162461bcd60e51b815260206004820152601960248201527837379031b7b93932b9b837b73234b733903619103a37b5b2b760391b60448201526064016104d2565b3360005b848110156112c157876001600160a01b03166342842e0e833089898681811061125757611257611bb0565b905060200201356040518463ffffffff1660e01b815260040161127c93929190611a99565b600060405180830381600087803b15801561129657600080fd5b505af11580156112aa573d6000803e3d6000fd5b5050505080806112b990611bc6565b91505061122c565b5060008783838989896040516024016112df96959493929190611d4a565b60408051601f198184030181529181526020820180516001600160e01b031663982b151f60e01b17905251635f7b157760e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690635f7b1577903490611381907f00000000000000000000000000000000000000000000000000000000000000009060009087908b908a90600401611cc8565b6000604051808303818588803b15801561139a57600080fd5b505af11580156113ae573d6000803e3d6000fd5b5050505050816001600160a01b0316836001600160a01b0316896001600160a01b03167ff05915e3b4fbd6f61b8b6f80b07f10e1cad039ccc7abe7c7fec115d038fe3dd68a8a8a60405161140493929190611c9a565b60405180910390a450505061076e6001603355565b600054610100900460ff166108b65760405162461bcd60e51b81526004016104d290611d93565b6114486114fc565b61078161152b565b6097546001600160a01b031633146108b65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016104d2565b609780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166115235760405162461bcd60e51b81526004016104d290611d93565b6108b661155a565b600054610100900460ff166115525760405162461bcd60e51b81526004016104d290611d93565b6108b6611581565b600054610100900460ff166111725760405162461bcd60e51b81526004016104d290611d93565b600054610100900460ff166115a85760405162461bcd60e51b81526004016104d290611d93565b6108b6336114aa565b6001600160a01b0381168114610e4d57600080fd5b600080600080608085870312156115dc57600080fd5b84356115e7816115b1565b935060208501356115f7816115b1565b93969395505050506040820135916060013590565b6000806020838503121561161f57600080fd5b823567ffffffffffffffff8082111561163757600080fd5b818501915085601f83011261164b57600080fd5b81358181111561165a57600080fd5b86602082850101111561166c57600080fd5b60209290920196919550909350505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156116bd576116bd61167e565b604052919050565b600080600080608085870312156116db57600080fd5b84356116e6816115b1565b93506020858101356116f7816115b1565b935060408601359250606086013567ffffffffffffffff8082111561171b57600080fd5b818801915088601f83011261172f57600080fd5b8135818111156117415761174161167e565b611753601f8201601f19168501611694565b9150808252898482850101111561176957600080fd5b808484018584013760008482840101525080935050505092959194509250565b60008083601f84011261179b57600080fd5b50813567ffffffffffffffff8111156117b357600080fd5b6020830191508360208260051b85010111156117ce57600080fd5b9250929050565b6000806000806000608086880312156117ed57600080fd5b85356117f8816115b1565b94506020860135611808816115b1565b9350604086013567ffffffffffffffff81111561182457600080fd5b61183088828901611789565b96999598509660600135949350505050565b60008060006060848603121561185757600080fd5b8335611862816115b1565b95602085013595506040909401359392505050565b6000806040838503121561188a57600080fd5b8235611895816115b1565b915060208301356118a5816115b1565b809150509250929050565b60008060008060008060a087890312156118c957600080fd5b86356118d4816115b1565b955060208701356118e4816115b1565b945060408701356118f4816115b1565b93506060870135611904816115b1565b9250608087013567ffffffffffffffff81111561192057600080fd5b61192c89828a01611789565b979a9699509497509295939492505050565b60006020828403121561195057600080fd5b813561195b816115b1565b9392505050565b600080600080600060a0868803121561197a57600080fd5b8535611985816115b1565b94506020860135611995816115b1565b935060408601356119a5816115b1565b925060608601356119b5816115b1565b949793965091946080013592915050565b600080600080606085870312156119dc57600080fd5b84356119e7816115b1565b9350602085013567ffffffffffffffff811115611a0357600080fd5b611a0f87828801611789565b9598909750949560400135949350505050565b600060208284031215611a3457600080fd5b815161195b816115b1565b60008085851115611a4f57600080fd5b83861115611a5c57600080fd5b5050820193919092039150565b6001600160e01b03198135818116916004851015611a915780818660040360031b1b83161692505b505092915050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b600080600080600060a08688031215611ad557600080fd5b8535611ae0816115b1565b9450602086810135611af1816115b1565b94506040870135611b01816115b1565b93506060870135611b11816115b1565b9250608087013567ffffffffffffffff80821115611b2e57600080fd5b818901915089601f830112611b4257600080fd5b813581811115611b5457611b5461167e565b8060051b9150611b65848301611694565b818152918301840191848101908c841115611b7f57600080fd5b938501935b83851015611b9d57843582529385019390850190611b84565b8096505050505050509295509295909350565b634e487b7160e01b600052603260045260246000fd5b600060018201611be657634e487b7160e01b600052601160045260246000fd5b5060010190565b6020808252825182820181905260009190848201906040850190845b81811015611c2557835183529284019291840191600101611c09565b50909695505050505050565b60208082526019908201527f746f6b656e20616464726573732063616e6e6f74206265203000000000000000604082015260600190565b81835260006001600160fb1b03831115611c8157600080fd5b8260051b80836020870137939093016020019392505050565b6001600160a01b0384168152604060208201819052600090611cbf9083018486611c68565b95945050505050565b60018060a01b038616815260006020868184015260a0604084015285518060a085015260005b81811015611d0a5787810183015185820160c001528201611cee565b50600060c0828601015260c0601f19601f83011685010192505050836060830152611d4060808301846001600160a01b03169052565b9695505050505050565b6001600160a01b038781168252868116602083015285811660408301528416606082015260a060808201819052600090611d879083018486611c68565b98975050505050505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fea264697066735822122059a04d8bd06509600ba5229767e784e3bb89c32a2c7cf946422d9d2ed19f341c64736f6c634300081000330000000000000000000000007bc08e1c04fb41d75f1410363f0c5746eae805820000000000000000000000006774bcbd5cecef1336b5300fb5186a12ddd8b367

Deployed Bytecode

0x6080604052600436106100fe5760003560e01c8063797594b011610095578063d606b4dc11610064578063d606b4dc146102c3578063d96c8ecf146102e3578063f2fde38b146102f6578063f887ea4014610316578063fac752eb1461034a57600080fd5b8063797594b01461021b5780638da5cb5b1461024f5780639f0a68b31461026d578063ba27f50b1461028d57600080fd5b80633cb747bf116100d15780633cb747bf1461018757806345a4276b146101d3578063485cc955146101e6578063715018a61461020657600080fd5b80630a7aa1961461010357806314298c5114610118578063150b7a021461012b5780631b997a9314610174575b600080fd5b6101166101113660046115c6565b61036a565b005b61011661012636600461160c565b61037c565b34801561013757600080fd5b506101566101463660046116c5565b630a85bd0160e11b949350505050565b6040516001600160e01b031990911681526020015b60405180910390f35b6101166101823660046117d5565b610761565b34801561019357600080fd5b506101bb7f0000000000000000000000006774bcbd5cecef1336b5300fb5186a12ddd8b36781565b6040516001600160a01b03909116815260200161016b565b6101166101e1366004611842565b610775565b3480156101f257600080fd5b50610116610201366004611877565b610786565b34801561021257600080fd5b506101166108a4565b34801561022757600080fd5b506101bb7f0000000000000000000000007bc08e1c04fb41d75f1410363f0c5746eae8058281565b34801561025b57600080fd5b506097546001600160a01b03166101bb565b34801561027957600080fd5b506101166102883660046118b0565b6108b8565b34801561029957600080fd5b506101bb6102a836600461193e565b60fb602052600090815260409020546001600160a01b031681565b3480156102cf57600080fd5b506101166102de366004611962565b610b66565b6101166102f13660046119c6565b610dca565b34801561030257600080fd5b5061011661031136600461193e565b610dd7565b34801561032257600080fd5b506101bb7f000000000000000000000000000000000000000000000000000000000000000081565b34801561035657600080fd5b50610116610365366004611877565b610e50565b61037684848484610ee2565b50505050565b337f0000000000000000000000006774bcbd5cecef1336b5300fb5186a12ddd8b3676001600160a01b0316146103c5576040516385bd908d60e01b815260040160405180910390fd5b7f0000000000000000000000006774bcbd5cecef1336b5300fb5186a12ddd8b3676001600160a01b0316636e296e456040518163ffffffff1660e01b8152600401602060405180830381865afa158015610423573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104479190611a22565b6001600160a01b0316736f297c61b5c92ef107ffd30cd56affe5a273e8416001600160a01b03161461048c57604051630d08b8ff60e01b815260040160405180910390fd5b610494611119565b34156104db5760405162461bcd60e51b81526020600482015260116024820152706e6f6e7a65726f206d73672e76616c756560781b60448201526064015b60405180910390fd5b63f8c3cf2560e01b6104f1600460008486611a3f565b6104fa91611a69565b6001600160e01b031916036105e6576000808061051a8460048188611a3f565b8101906105279190611962565b9450509350509250826001600160a01b03166342842e0e3084846040518463ffffffff1660e01b815260040161055f93929190611a99565b600060405180830381600087803b15801561057957600080fd5b505af115801561058d573d6000803e3d6000fd5b50505050816001600160a01b0316836001600160a01b03167fb9a838365634e4fb87a9333edf0ea86f82836e361b311a125aefd14135581208836040516105d691815260200190565b60405180910390a3505050610753565b63982b151f60e01b6105fc600460008486611a3f565b61060591611a69565b6001600160e01b0319160361071857600080806106258460048188611a3f565b8101906106329190611abd565b945050935050925060005b81518110156106d457836001600160a01b03166342842e0e308585858151811061066957610669611bb0565b60200260200101516040518463ffffffff1660e01b815260040161068f93929190611a99565b600060405180830381600087803b1580156106a957600080fd5b505af11580156106bd573d6000803e3d6000fd5b5050505080806106cc90611bc6565b91505061063d565b50816001600160a01b0316836001600160a01b03167f998a3ef0a23771412ff48d871a2288502a89da39c5db04a2a66e5eb85586cc22836040516105d69190611bed565b60405162461bcd60e51b815260206004820152601060248201526f34b73b30b634b21039b2b632b1ba37b960811b60448201526064016104d2565b61075d6001603355565b5050565b61076e8585858585611179565b5050505050565b61078183338484610ee2565b505050565b600054610100900460ff16158080156107a65750600054600160ff909116105b806107c05750303b1580156107c0575060005460ff166001145b6108235760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016104d2565b6000805460ff191660011790558015610846576000805461ff0019166101001790555b61084e611419565b61085a83600084611440565b8015610781576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050565b6108ac611450565b6108b660006114aa565b565b337f0000000000000000000000006774bcbd5cecef1336b5300fb5186a12ddd8b3676001600160a01b031614610901576040516385bd908d60e01b815260040160405180910390fd5b7f0000000000000000000000006774bcbd5cecef1336b5300fb5186a12ddd8b3676001600160a01b0316636e296e456040518163ffffffff1660e01b8152600401602060405180830381865afa15801561095f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109839190611a22565b6001600160a01b03167f0000000000000000000000007bc08e1c04fb41d75f1410363f0c5746eae805826001600160a01b0316146109d4576040516307b140f360e51b815260040160405180910390fd5b6109dc611119565b6001600160a01b038516610a025760405162461bcd60e51b81526004016104d290611c31565b6001600160a01b03808716600090815260fb6020526040902054868216911614610a625760405162461bcd60e51b81526020600482015260116024820152700d86440e8ded6cadc40dad2e6dac2e8c6d607b1b60448201526064016104d2565b60005b81811015610afa57866001600160a01b03166342842e0e3086868686818110610a9057610a90611bb0565b905060200201356040518463ffffffff1660e01b8152600401610ab593929190611a99565b600060405180830381600087803b158015610acf57600080fd5b505af1158015610ae3573d6000803e3d6000fd5b505050508080610af290611bc6565b915050610a65565b50836001600160a01b0316856001600160a01b0316876001600160a01b03167f9b8e51c8f180115b421b26c9042287d6bf95e0ce9c0c5434784e2af3d0b9de7d868686604051610b4c93929190611c9a565b60405180910390a4610b5e6001603355565b505050505050565b337f0000000000000000000000006774bcbd5cecef1336b5300fb5186a12ddd8b3676001600160a01b031614610baf576040516385bd908d60e01b815260040160405180910390fd5b7f0000000000000000000000006774bcbd5cecef1336b5300fb5186a12ddd8b3676001600160a01b0316636e296e456040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c0d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c319190611a22565b6001600160a01b03167f0000000000000000000000007bc08e1c04fb41d75f1410363f0c5746eae805826001600160a01b031614610c82576040516307b140f360e51b815260040160405180910390fd5b610c8a611119565b6001600160a01b038416610cb05760405162461bcd60e51b81526004016104d290611c31565b6001600160a01b03808616600090815260fb6020526040902054858216911614610d105760405162461bcd60e51b81526020600482015260116024820152700d86440e8ded6cadc40dad2e6dac2e8c6d607b1b60448201526064016104d2565b604051632142170760e11b81526001600160a01b038616906342842e0e90610d4090309086908690600401611a99565b600060405180830381600087803b158015610d5a57600080fd5b505af1158015610d6e573d6000803e3d6000fd5b5050604080516001600160a01b03868116825260208201869052808816945088811693508916917facdbfefc030b5ccccd5f60ca6d9ca371c6d6d6956fe16ebe10f81920198206e9910160405180910390a461076e6001603355565b6103768433858585611179565b610ddf611450565b6001600160a01b038116610e445760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104d2565b610e4d816114aa565b50565b610e58611450565b6001600160a01b038116610e7e5760405162461bcd60e51b81526004016104d290611c31565b6001600160a01b03808316600081815260fb602052604080822080548686166001600160a01b0319821681179092559151919094169392849290917f2069a26c43c36ffaabe0c2d19bf65e55dd03abecdc449f5cc9663491e97f709d9190a4505050565b610eea611119565b6001600160a01b03808516600090815260fb60205260409020541680610f4e5760405162461bcd60e51b815260206004820152601960248201527837379031b7b93932b9b837b73234b733903619103a37b5b2b760391b60448201526064016104d2565b604051632142170760e11b815233906001600160a01b038716906342842e0e90610f8090849030908990600401611a99565b600060405180830381600087803b158015610f9a57600080fd5b505af1158015610fae573d6000803e3d6000fd5b50506040516001600160a01b03808a166024830152808616604483015280851660648301528816608482015260a481018790526000925060c401905060408051601f198184030181529181526020820180516001600160e01b031663f8c3cf2560e01b17905251635f7b157760e01b81529091506001600160a01b037f0000000000000000000000006774bcbd5cecef1336b5300fb5186a12ddd8b3671690635f7b157790349061108c907f0000000000000000000000007bc08e1c04fb41d75f1410363f0c5746eae805829060009087908b908a90600401611cc8565b6000604051808303818588803b1580156110a557600080fd5b505af11580156110b9573d6000803e3d6000fd5b5050604080516001600160a01b038b81168252602082018b9052808816955088811694508c1692507ffc1d17c06ff1e4678321cc30660a73f3f1436df8195108a288d3159a961febec910160405180910390a45050506103766001603355565b60026033540361116b5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016104d2565b6002603355565b6001603355565b611181611119565b816111c45760405162461bcd60e51b81526020600482015260136024820152721b9bc81d1bdad95b881d1bc819195c1bdcda5d606a1b60448201526064016104d2565b6001600160a01b03808616600090815260fb602052604090205416806112285760405162461bcd60e51b815260206004820152601960248201527837379031b7b93932b9b837b73234b733903619103a37b5b2b760391b60448201526064016104d2565b3360005b848110156112c157876001600160a01b03166342842e0e833089898681811061125757611257611bb0565b905060200201356040518463ffffffff1660e01b815260040161127c93929190611a99565b600060405180830381600087803b15801561129657600080fd5b505af11580156112aa573d6000803e3d6000fd5b5050505080806112b990611bc6565b91505061122c565b5060008783838989896040516024016112df96959493929190611d4a565b60408051601f198184030181529181526020820180516001600160e01b031663982b151f60e01b17905251635f7b157760e01b81529091506001600160a01b037f0000000000000000000000006774bcbd5cecef1336b5300fb5186a12ddd8b3671690635f7b1577903490611381907f0000000000000000000000007bc08e1c04fb41d75f1410363f0c5746eae805829060009087908b908a90600401611cc8565b6000604051808303818588803b15801561139a57600080fd5b505af11580156113ae573d6000803e3d6000fd5b5050505050816001600160a01b0316836001600160a01b0316896001600160a01b03167ff05915e3b4fbd6f61b8b6f80b07f10e1cad039ccc7abe7c7fec115d038fe3dd68a8a8a60405161140493929190611c9a565b60405180910390a450505061076e6001603355565b600054610100900460ff166108b65760405162461bcd60e51b81526004016104d290611d93565b6114486114fc565b61078161152b565b6097546001600160a01b031633146108b65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016104d2565b609780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166115235760405162461bcd60e51b81526004016104d290611d93565b6108b661155a565b600054610100900460ff166115525760405162461bcd60e51b81526004016104d290611d93565b6108b6611581565b600054610100900460ff166111725760405162461bcd60e51b81526004016104d290611d93565b600054610100900460ff166115a85760405162461bcd60e51b81526004016104d290611d93565b6108b6336114aa565b6001600160a01b0381168114610e4d57600080fd5b600080600080608085870312156115dc57600080fd5b84356115e7816115b1565b935060208501356115f7816115b1565b93969395505050506040820135916060013590565b6000806020838503121561161f57600080fd5b823567ffffffffffffffff8082111561163757600080fd5b818501915085601f83011261164b57600080fd5b81358181111561165a57600080fd5b86602082850101111561166c57600080fd5b60209290920196919550909350505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156116bd576116bd61167e565b604052919050565b600080600080608085870312156116db57600080fd5b84356116e6816115b1565b93506020858101356116f7816115b1565b935060408601359250606086013567ffffffffffffffff8082111561171b57600080fd5b818801915088601f83011261172f57600080fd5b8135818111156117415761174161167e565b611753601f8201601f19168501611694565b9150808252898482850101111561176957600080fd5b808484018584013760008482840101525080935050505092959194509250565b60008083601f84011261179b57600080fd5b50813567ffffffffffffffff8111156117b357600080fd5b6020830191508360208260051b85010111156117ce57600080fd5b9250929050565b6000806000806000608086880312156117ed57600080fd5b85356117f8816115b1565b94506020860135611808816115b1565b9350604086013567ffffffffffffffff81111561182457600080fd5b61183088828901611789565b96999598509660600135949350505050565b60008060006060848603121561185757600080fd5b8335611862816115b1565b95602085013595506040909401359392505050565b6000806040838503121561188a57600080fd5b8235611895816115b1565b915060208301356118a5816115b1565b809150509250929050565b60008060008060008060a087890312156118c957600080fd5b86356118d4816115b1565b955060208701356118e4816115b1565b945060408701356118f4816115b1565b93506060870135611904816115b1565b9250608087013567ffffffffffffffff81111561192057600080fd5b61192c89828a01611789565b979a9699509497509295939492505050565b60006020828403121561195057600080fd5b813561195b816115b1565b9392505050565b600080600080600060a0868803121561197a57600080fd5b8535611985816115b1565b94506020860135611995816115b1565b935060408601356119a5816115b1565b925060608601356119b5816115b1565b949793965091946080013592915050565b600080600080606085870312156119dc57600080fd5b84356119e7816115b1565b9350602085013567ffffffffffffffff811115611a0357600080fd5b611a0f87828801611789565b9598909750949560400135949350505050565b600060208284031215611a3457600080fd5b815161195b816115b1565b60008085851115611a4f57600080fd5b83861115611a5c57600080fd5b5050820193919092039150565b6001600160e01b03198135818116916004851015611a915780818660040360031b1b83161692505b505092915050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b600080600080600060a08688031215611ad557600080fd5b8535611ae0816115b1565b9450602086810135611af1816115b1565b94506040870135611b01816115b1565b93506060870135611b11816115b1565b9250608087013567ffffffffffffffff80821115611b2e57600080fd5b818901915089601f830112611b4257600080fd5b813581811115611b5457611b5461167e565b8060051b9150611b65848301611694565b818152918301840191848101908c841115611b7f57600080fd5b938501935b83851015611b9d57843582529385019390850190611b84565b8096505050505050509295509295909350565b634e487b7160e01b600052603260045260246000fd5b600060018201611be657634e487b7160e01b600052601160045260246000fd5b5060010190565b6020808252825182820181905260009190848201906040850190845b81811015611c2557835183529284019291840191600101611c09565b50909695505050505050565b60208082526019908201527f746f6b656e20616464726573732063616e6e6f74206265203000000000000000604082015260600190565b81835260006001600160fb1b03831115611c8157600080fd5b8260051b80836020870137939093016020019392505050565b6001600160a01b0384168152604060208201819052600090611cbf9083018486611c68565b95945050505050565b60018060a01b038616815260006020868184015260a0604084015285518060a085015260005b81811015611d0a5787810183015185820160c001528201611cee565b50600060c0828601015260c0601f19601f83011685010192505050836060830152611d4060808301846001600160a01b03169052565b9695505050505050565b6001600160a01b038781168252868116602083015285811660408301528416606082015260a060808201819052600090611d879083018486611c68565b98975050505050505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fea264697066735822122059a04d8bd06509600ba5229767e784e3bb89c32a2c7cf946422d9d2ed19f341c64736f6c63430008100033

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

0000000000000000000000007bc08e1c04fb41d75f1410363f0c5746eae805820000000000000000000000006774bcbd5cecef1336b5300fb5186a12ddd8b367

-----Decoded View---------------
Arg [0] : _counterpart (address): 0x7bC08E1c04fb41d75F1410363F0c5746Eae80582
Arg [1] : _messenger (address): 0x6774Bcbd5ceCeF1336b5300fb5186a12DDD8b367

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000007bc08e1c04fb41d75f1410363f0c5746eae80582
Arg [1] : 0000000000000000000000006774bcbd5cecef1336b5300fb5186a12ddd8b367


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
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
Loading...
Loading

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.