ETH Price: $1,880.73 (-1.78%)

Contract

0x659c7F7f6568Ddb3DEE782bb8ec2123BC89D8433
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Deposit199329432024-05-23 13:40:23309 days ago1716471623IN
0x659c7F7f...BC89D8433
0 ETH0.0015184217.68033633
Deposit199019132024-05-19 5:31:11314 days ago1716096671IN
0x659c7F7f...BC89D8433
0 ETH0.000261823.04864862
Deposit198993512024-05-18 20:56:11314 days ago1716065771IN
0x659c7F7f...BC89D8433
0 ETH0.000265523.09170132
Deposit198978172024-05-18 15:47:35314 days ago1716047255IN
0x659c7F7f...BC89D8433
0 ETH0.000283673.30304176
Deposit198915242024-05-17 18:38:11315 days ago1715971091IN
0x659c7F7f...BC89D8433
0 ETH0.000398684.64223389
Deposit198789432024-05-16 0:24:59317 days ago1715819099IN
0x659c7F7f...BC89D8433
0 ETH0.000347654.04806021
Deposit198789352024-05-16 0:23:23317 days ago1715819003IN
0x659c7F7f...BC89D8433
0 ETH0.000415334.83673637
Receive Message198788832024-05-16 0:12:59317 days ago1715818379IN
0x659c7F7f...BC89D8433
0 ETH0.001594685.20467112
Deposit198676032024-05-14 10:17:59318 days ago1715681879IN
0x659c7F7f...BC89D8433
0 ETH0.000661967.70787635
Deposit198675732024-05-14 10:11:59318 days ago1715681519IN
0x659c7F7f...BC89D8433
0 ETH0.000801999.33965036
Deposit198514142024-05-12 3:59:23321 days ago1715486363IN
0x659c7F7f...BC89D8433
0 ETH0.000254063.33116704
Deposit198112472024-05-06 13:09:35326 days ago1715000975IN
0x659c7F7f...BC89D8433
0 ETH0.000711818.28829863
Deposit197862092024-05-03 1:07:59330 days ago1714698479IN
0x659c7F7f...BC89D8433
0 ETH0.000415994.84384822
Receive Message197827402024-05-02 13:28:59330 days ago1714656539IN
0x659c7F7f...BC89D8433
0 ETH0.002985899.79119137
Deposit197823962024-05-02 12:19:47330 days ago1714652387IN
0x659c7F7f...BC89D8433
0 ETH0.0012655914.73638863
Deposit197615162024-04-29 14:19:11333 days ago1714400351IN
0x659c7F7f...BC89D8433
0 ETH0.000857959.98994962
Deposit197594562024-04-29 7:23:23333 days ago1714375403IN
0x659c7F7f...BC89D8433
0 ETH0.000650978.02626241
Deposit197398322024-04-26 13:29:23336 days ago1714138163IN
0x659c7F7f...BC89D8433
0 ETH0.000734159.62427939
Deposit197363432024-04-26 1:45:11337 days ago1714095911IN
0x659c7F7f...BC89D8433
0 ETH0.000496846.12771567
Deposit196706672024-04-16 21:17:35346 days ago1713302255IN
0x659c7F7f...BC89D8433
0 ETH0.0007931310.39747132
Deposit196656122024-04-16 4:17:47347 days ago1713241067IN
0x659c7F7f...BC89D8433
0 ETH0.0009844112.14092926
Deposit196592952024-04-15 7:01:47347 days ago1713164507IN
0x659c7F7f...BC89D8433
0 ETH0.001118214.66109128
Deposit195938832024-04-06 3:04:11357 days ago1712372651IN
0x659c7F7f...BC89D8433
0 ETH0.0009343511.52358065
Deposit195863592024-04-05 1:46:47358 days ago1712281607IN
0x659c7F7f...BC89D8433
0 ETH0.0012184915.02789445
Deposit195758012024-04-03 14:20:47359 days ago1712154047IN
0x659c7F7f...BC89D8433
0 ETH0.0043745853.93666878
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
FxERC20RootTunnel

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 200 runs

Other Settings:
london EvmVersion, MIT license
File 1 of 16 : FxERC20RootTunnel.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {ERC20} from "../lib/ERC20.sol";
import {Create2} from "../lib/Create2.sol";
import {FxBaseRootTunnel} from "../tunnel/FxBaseRootTunnel.sol";
import {SafeERC20, IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

contract FxERC20RootTunnel is FxBaseRootTunnel, Create2 {
    using SafeERC20 for IERC20;
    // maybe DEPOSIT and MAP_TOKEN can be reduced to bytes4
    bytes32 public constant DEPOSIT = keccak256("DEPOSIT");
    bytes32 public constant MAP_TOKEN = keccak256("MAP_TOKEN");
    
    event TokenMappedERC20(address indexed rootToken, address indexed childToken);
    event FxWithdrawERC20(
        address indexed rootToken,
        address indexed childToken,
        address indexed userAddress,
        uint256 amount
    );
    event FxDepositERC20(
        address indexed rootToken,
        address indexed depositor,
        address indexed userAddress,
        uint256 amount
    );

    mapping(address => address) public rootToChildTokens;
    mapping(address => address) public deployerMap;
    
    constructor(
        address _checkpointManager,
        address _fxRoot
    ) FxBaseRootTunnel(_checkpointManager, _fxRoot) {
        // compute child token template code hash        
    }

    /**
     * @notice Map a token to enable its movement via the PoS Portal, callable by everyone
     * @param rootToken address of token on root chain
     * @param childToken address of token on child chain
     */
    function mapToken(address rootToken, address childToken) public {
        // check if token is already mapped or token requester
        require(rootToChildTokens[rootToken] == address(0x0) || deployerMap[rootToken] == msg.sender, "FxERC20RootTunnel: ALREADY_MAPPED_OK");
        
        // name, symbol and decimals
        ERC20 rootTokenContract = ERC20(rootToken);
        string memory name = rootTokenContract.name();
        string memory symbol = rootTokenContract.symbol();
        uint8 decimals = rootTokenContract.decimals();

        // MAP_TOKEN, encode(rootToken, name, symbol, decimals)
        bytes memory message = abi.encode(MAP_TOKEN, abi.encode(rootToken, name, symbol, decimals, childToken, msg.sender));
        // slither-disable-next-line reentrancy-no-eth
        _sendMessageToChild(message);

        // add into mapped tokens
        rootToChildTokens[rootToken] = childToken;
        deployerMap[rootToken] = msg.sender;

        emit TokenMappedERC20(rootToken, childToken);
    }

    function deposit(address rootToken, address user, uint256 amount, bytes memory data) public {
        // map token if not mapped
        require(rootToChildTokens[rootToken] != address(0x0), "FxERC20RootTunnel: NOT MAPPED");

        // transfer from depositor to this contract
        IERC20(rootToken).safeTransferFrom(
            msg.sender, // depositor
            address(this), // manager contract
            amount
        );

        // DEPOSIT, encode(rootToken, depositor, user, amount, extra data)
        bytes memory message = abi.encode(DEPOSIT, abi.encode(rootToken, msg.sender, user, amount, data));
        _sendMessageToChild(message);
        emit FxDepositERC20(rootToken, msg.sender, user, amount);
    }

    // exit processor
    function _processMessageFromChild(bytes memory data) internal override {
        (address rootToken, address childToken, address to, uint256 amount) = abi.decode(
            data,
            (address, address, address, uint256)
        );
        // validate mapping for root to child
        require(rootToChildTokens[rootToken] == childToken, "FxERC20RootTunnel: INVALID_MAPPING");

        // transfer from tokens to
        IERC20(rootToken).safeTransfer(to, amount);
        emit FxWithdrawERC20(rootToken, childToken, to, amount);
    }
}

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

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

File 3 of 16 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 4 of 16 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

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

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

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

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

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

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

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

File 5 of 16 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [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://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (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 6 of 16 : FxRoot.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IStateSender {
    function syncState(address receiver, bytes calldata data) external;
}

interface IFxStateSender {
    function sendMessageToChild(address _receiver, bytes calldata _data) external;
}

contract FxRoot is IFxStateSender {
    IStateSender public stateSender;
    address public fxChild;

    constructor(address _stateSender) {
        stateSender = IStateSender(_stateSender);
    }

    function setFxChild(address _fxChild) public {
        require(fxChild == address(0x0));
        fxChild = _fxChild;
    }

    // @custom:security non-reentrant
    function sendMessageToChild(address _receiver, bytes calldata _data) public override {
        bytes memory data = abi.encode(msg.sender, _receiver, _data);
        stateSender.syncState(fxChild, data);
    }
}

File 7 of 16 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

    function _msgData() internal view virtual returns (bytes calldata) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

File 8 of 16 : Create2.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

// Create2 adds common methods for minimal proxy with create2
abstract contract Create2 {
    // creates clone using minimal proxy
    function createClone(bytes32 _salt, address _target) internal returns (address _result) {
        bytes20 _targetBytes = bytes20(_target);

        assembly {
            let clone := mload(0x40)
            mstore(clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
            mstore(add(clone, 0x14), _targetBytes)
            mstore(add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
            _result := create2(0, clone, 0x37, _salt)
        }

        require(_result != address(0), "Create2: Failed on minimal deploy");
    }

    // get minimal proxy creation code
    function minimalProxyCreationCode(address logic) internal pure returns (bytes memory) {
        bytes10 creation = 0x3d602d80600a3d3981f3;
        bytes10 prefix = 0x363d3d373d3d3d363d73;
        bytes20 targetBytes = bytes20(logic);
        bytes15 suffix = 0x5af43d82803e903d91602b57fd5bf3;
        return abi.encodePacked(creation, prefix, targetBytes, suffix);
    }

    // get computed create2 address
    function computedCreate2Address(
        bytes32 salt,
        bytes32 bytecodeHash,
        address deployer
    ) public pure returns (address) {
        bytes32 _data = keccak256(abi.encodePacked(bytes1(0xff), deployer, salt, bytecodeHash));
        return address(uint160(uint256(_data)));
    }
}

File 9 of 16 : ERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./IERC20Metadata.sol";
import "./Context.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;
    uint8 private _decimals;

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless this function is
     * overridden;
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return _decimals;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address to, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `amount`.
     */
    function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, amount);
        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, allowance(owner, spender) + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        address owner = _msgSender();
        uint256 currentAllowance = allowance(owner, spender);
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(owner, spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     */
    function _transfer(address from, address to, uint256 amount) internal virtual {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
        }
        _balances[to] += amount;

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
        }
        _totalSupply -= amount;

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(address owner, address spender, uint256 amount) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `amount`.
     *
     * Does not update the allowance amount in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Might emit an {Approval} event.
     */
    function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(currentAllowance >= amount, "ERC20: insufficient allowance");
            unchecked {
                _approve(owner, spender, currentAllowance - amount);
            }
        }
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}

    function _setupMetaData(string memory name_, string memory symbol_, uint8 decimals_) internal virtual {
        _name = name_;
        _symbol = symbol_;
        _decimals = decimals_;
    }

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}
}

File 10 of 16 : ExitPayloadReader.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {RLPReader} from "./RLPReader.sol";

library ExitPayloadReader {
    using RLPReader for bytes;
    using RLPReader for RLPReader.RLPItem;

    uint8 constant WORD_SIZE = 32;

    struct ExitPayload {
        RLPReader.RLPItem[] data;
    }

    struct Receipt {
        RLPReader.RLPItem[] data;
        bytes raw;
        uint256 logIndex;
    }

    struct Log {
        RLPReader.RLPItem data;
        RLPReader.RLPItem[] list;
    }

    struct LogTopics {
        RLPReader.RLPItem[] data;
    }

    // copy paste of private copy() from RLPReader to avoid changing of existing contracts
    function copy(uint256 src, uint256 dest, uint256 len) private pure {
        if (len == 0) return;

        // copy as many word sizes as possible
        for (; len >= WORD_SIZE; len -= WORD_SIZE) {
            assembly {
                mstore(dest, mload(src))
            }

            src += WORD_SIZE;
            dest += WORD_SIZE;
        }

        if (len == 0) return;

        // left over bytes. Mask is used to remove unwanted bytes from the word
        uint256 mask = 256 ** (WORD_SIZE - len) - 1;
        assembly {
            let srcpart := and(mload(src), not(mask)) // zero out src
            let destpart := and(mload(dest), mask) // retrieve the bytes
            mstore(dest, or(destpart, srcpart))
        }
    }

    function toExitPayload(bytes memory data) internal pure returns (ExitPayload memory) {
        RLPReader.RLPItem[] memory payloadData = data.toRlpItem().toList();

        return ExitPayload(payloadData);
    }

    function getHeaderNumber(ExitPayload memory payload) internal pure returns (uint256) {
        return payload.data[0].toUint();
    }

    function getBlockProof(ExitPayload memory payload) internal pure returns (bytes memory) {
        return payload.data[1].toBytes();
    }

    function getBlockNumber(ExitPayload memory payload) internal pure returns (uint256) {
        return payload.data[2].toUint();
    }

    function getBlockTime(ExitPayload memory payload) internal pure returns (uint256) {
        return payload.data[3].toUint();
    }

    function getTxRoot(ExitPayload memory payload) internal pure returns (bytes32) {
        return bytes32(payload.data[4].toUint());
    }

    function getReceiptRoot(ExitPayload memory payload) internal pure returns (bytes32) {
        return bytes32(payload.data[5].toUint());
    }

    function getReceipt(ExitPayload memory payload) internal pure returns (Receipt memory receipt) {
        receipt.raw = payload.data[6].toBytes();
        RLPReader.RLPItem memory receiptItem = receipt.raw.toRlpItem();

        if (receiptItem.isList()) {
            // legacy tx
            receipt.data = receiptItem.toList();
        } else {
            // pop first byte before parsing receipt
            bytes memory typedBytes = receipt.raw;
            bytes memory result = new bytes(typedBytes.length - 1);
            uint256 srcPtr;
            uint256 destPtr;
            assembly {
                srcPtr := add(33, typedBytes)
                destPtr := add(0x20, result)
            }

            copy(srcPtr, destPtr, result.length);
            receipt.data = result.toRlpItem().toList();
        }

        receipt.logIndex = getReceiptLogIndex(payload);
        return receipt;
    }

    function getReceiptProof(ExitPayload memory payload) internal pure returns (bytes memory) {
        return payload.data[7].toBytes();
    }

    function getBranchMaskAsBytes(ExitPayload memory payload) internal pure returns (bytes memory) {
        return payload.data[8].toBytes();
    }

    function getBranchMaskAsUint(ExitPayload memory payload) internal pure returns (uint256) {
        return payload.data[8].toUint();
    }

    function getReceiptLogIndex(ExitPayload memory payload) internal pure returns (uint256) {
        return payload.data[9].toUint();
    }

    // Receipt methods
    function toBytes(Receipt memory receipt) internal pure returns (bytes memory) {
        return receipt.raw;
    }

    function getLog(Receipt memory receipt) internal pure returns (Log memory) {
        RLPReader.RLPItem memory logData = receipt.data[3].toList()[receipt.logIndex];
        return Log(logData, logData.toList());
    }

    // Log methods
    function getEmitter(Log memory log) internal pure returns (address) {
        return RLPReader.toAddress(log.list[0]);
    }

    function getTopics(Log memory log) internal pure returns (LogTopics memory) {
        return LogTopics(log.list[1].toList());
    }

    function getData(Log memory log) internal pure returns (bytes memory) {
        return log.list[2].toBytes();
    }

    function toRlpBytes(Log memory log) internal pure returns (bytes memory) {
        return log.data.toRlpBytes();
    }

    // LogTopics methods
    function getField(LogTopics memory topics, uint256 index) internal pure returns (RLPReader.RLPItem memory) {
        return topics.data[index];
    }
}

File 11 of 16 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

File 12 of 16 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "./IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

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

library Merkle {
    function checkMembership(
        bytes32 leaf,
        uint256 index,
        bytes32 rootHash,
        bytes memory proof
    ) internal pure returns (bool) {
        require(proof.length % 32 == 0, "Invalid proof length");
        uint256 proofHeight = proof.length / 32;
        // Proof of size n means, height of the tree is n+1.
        // In a tree of height n+1, max #leafs possible is 2 ^ n
        require(index < 2 ** proofHeight, "Leaf index is too big");

        bytes32 proofElement;
        bytes32 computedHash = leaf;
        for (uint256 i = 32; i <= proof.length; i += 32) {
            assembly {
                proofElement := mload(add(proof, i))
            }

            if (index % 2 == 0) {
                computedHash = keccak256(abi.encodePacked(computedHash, proofElement));
            } else {
                computedHash = keccak256(abi.encodePacked(proofElement, computedHash));
            }

            index = index / 2;
        }
        return computedHash == rootHash;
    }
}

File 14 of 16 : MerklePatriciaProof.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {RLPReader} from "./RLPReader.sol";

library MerklePatriciaProof {
    /*
     * @dev Verifies a merkle patricia proof.
     * @param value The terminating value in the trie.
     * @param encodedPath The path in the trie leading to value.
     * @param rlpParentNodes The rlp encoded stack of nodes.
     * @param root The root hash of the trie.
     * @return The boolean validity of the proof.
     */
    function verify(
        bytes memory value,
        bytes memory encodedPath,
        bytes memory rlpParentNodes,
        bytes32 root
    ) internal pure returns (bool) {
        RLPReader.RLPItem memory item = RLPReader.toRlpItem(rlpParentNodes);
        RLPReader.RLPItem[] memory parentNodes = RLPReader.toList(item);

        bytes memory currentNode;
        RLPReader.RLPItem[] memory currentNodeList;

        bytes32 nodeKey = root;
        uint256 pathPtr = 0;

        bytes memory path = _getNibbleArray(encodedPath);
        if (path.length == 0) {
            return false;
        }

        for (uint256 i = 0; i < parentNodes.length; i++) {
            if (pathPtr > path.length) {
                return false;
            }

            currentNode = RLPReader.toRlpBytes(parentNodes[i]);
            if (nodeKey != keccak256(currentNode)) {
                return false;
            }
            currentNodeList = RLPReader.toList(parentNodes[i]);

            if (currentNodeList.length == 17) {
                if (pathPtr == path.length) {
                    if (keccak256(RLPReader.toBytes(currentNodeList[16])) == keccak256(value)) {
                        return true;
                    } else {
                        return false;
                    }
                }

                uint8 nextPathNibble = uint8(path[pathPtr]);
                if (nextPathNibble > 16) {
                    return false;
                }
                nodeKey = bytes32(RLPReader.toUintStrict(currentNodeList[nextPathNibble]));
                pathPtr += 1;
            } else if (currentNodeList.length == 2) {
                uint256 traversed = _nibblesToTraverse(RLPReader.toBytes(currentNodeList[0]), path, pathPtr);
                if (pathPtr + traversed == path.length) {
                    //leaf node
                    if (keccak256(RLPReader.toBytes(currentNodeList[1])) == keccak256(value)) {
                        return true;
                    } else {
                        return false;
                    }
                }

                //extension node
                if (traversed == 0) {
                    return false;
                }

                pathPtr += traversed;
                nodeKey = bytes32(RLPReader.toUintStrict(currentNodeList[1]));
            } else {
                return false;
            }
        }
    }

    function _nibblesToTraverse(
        bytes memory encodedPartialPath,
        bytes memory path,
        uint256 pathPtr
    ) private pure returns (uint256) {
        uint256 len = 0;
        // encodedPartialPath has elements that are each two hex characters (1 byte), but partialPath
        // and slicedPath have elements that are each one hex character (1 nibble)
        bytes memory partialPath = _getNibbleArray(encodedPartialPath);
        bytes memory slicedPath = new bytes(partialPath.length);

        // pathPtr counts nibbles in path
        // partialPath.length is a number of nibbles
        for (uint256 i = pathPtr; i < pathPtr + partialPath.length; i++) {
            bytes1 pathNibble = path[i];
            slicedPath[i - pathPtr] = pathNibble;
        }

        if (keccak256(partialPath) == keccak256(slicedPath)) {
            len = partialPath.length;
        } else {
            len = 0;
        }
        return len;
    }

    // bytes b must be hp encoded
    function _getNibbleArray(bytes memory b) internal pure returns (bytes memory) {
        bytes memory nibbles = "";
        if (b.length > 0) {
            uint8 offset;
            uint8 hpNibble = uint8(_getNthNibbleOfBytes(0, b));
            if (hpNibble == 1 || hpNibble == 3) {
                nibbles = new bytes(b.length * 2 - 1);
                bytes1 oddNibble = _getNthNibbleOfBytes(1, b);
                nibbles[0] = oddNibble;
                offset = 1;
            } else {
                nibbles = new bytes(b.length * 2 - 2);
                offset = 0;
            }

            for (uint256 i = offset; i < nibbles.length; i++) {
                nibbles[i] = _getNthNibbleOfBytes(i - offset + 2, b);
            }
        }
        return nibbles;
    }

    function _getNthNibbleOfBytes(uint256 n, bytes memory str) private pure returns (bytes1) {
        return bytes1(n % 2 == 0 ? uint8(str[n / 2]) / 0x10 : uint8(str[n / 2]) % 0x10);
    }
}

File 15 of 16 : RLPReader.sol
// SPDX-License-Identifier: Apache-2.0

/*
 * @author Hamdi Allam [email protected]
 * Please reach out with any questions or concerns
 */

pragma solidity ^0.8.0;

library RLPReader {
    uint8 constant STRING_SHORT_START = 0x80;
    uint8 constant STRING_LONG_START = 0xb8;
    uint8 constant LIST_SHORT_START = 0xc0;
    uint8 constant LIST_LONG_START = 0xf8;
    uint8 constant WORD_SIZE = 32;

    struct RLPItem {
        uint256 len;
        uint256 memPtr;
    }

    struct Iterator {
        RLPItem item; // Item that's being iterated over.
        uint256 nextPtr; // Position of the next item in the list.
    }

    /*
     * @dev Returns the next element in the iteration. Reverts if it has not next element.
     * @param self The iterator.
     * @return The next element in the iteration.
     */
    function next(Iterator memory self) internal pure returns (RLPItem memory) {
        require(hasNext(self));

        uint256 ptr = self.nextPtr;
        uint256 itemLength = _itemLength(ptr);
        self.nextPtr = ptr + itemLength;

        return RLPItem(itemLength, ptr);
    }

    /*
     * @dev Returns true if the iteration has more elements.
     * @param self The iterator.
     * @return true if the iteration has more elements.
     */
    function hasNext(Iterator memory self) internal pure returns (bool) {
        RLPItem memory item = self.item;
        return self.nextPtr < item.memPtr + item.len;
    }

    /*
     * @param item RLP encoded bytes
     */
    function toRlpItem(bytes memory item) internal pure returns (RLPItem memory) {
        uint256 memPtr;
        assembly {
            memPtr := add(item, 0x20)
        }

        return RLPItem(item.length, memPtr);
    }

    /*
     * @dev Create an iterator. Reverts if item is not a list.
     * @param self The RLP item.
     * @return An 'Iterator' over the item.
     */
    function iterator(RLPItem memory self) internal pure returns (Iterator memory) {
        require(isList(self));

        uint256 ptr = self.memPtr + _payloadOffset(self.memPtr);
        return Iterator(self, ptr);
    }

    /*
     * @param item RLP encoded bytes
     */
    function rlpLen(RLPItem memory item) internal pure returns (uint256) {
        return item.len;
    }

    /*
     * @param item RLP encoded bytes
     */
    function payloadLen(RLPItem memory item) internal pure returns (uint256) {
        return item.len - _payloadOffset(item.memPtr);
    }

    /*
     * @param item RLP encoded list in bytes
     */
    function toList(RLPItem memory item) internal pure returns (RLPItem[] memory) {
        require(isList(item));

        uint256 items = numItems(item);
        RLPItem[] memory result = new RLPItem[](items);

        uint256 memPtr = item.memPtr + _payloadOffset(item.memPtr);
        uint256 dataLen;
        for (uint256 i = 0; i < items; i++) {
            dataLen = _itemLength(memPtr);
            result[i] = RLPItem(dataLen, memPtr);
            memPtr = memPtr + dataLen;
        }

        return result;
    }

    // @return indicator whether encoded payload is a list. negate this function call for isData.
    function isList(RLPItem memory item) internal pure returns (bool) {
        if (item.len == 0) return false;

        uint8 byte0;
        uint256 memPtr = item.memPtr;
        assembly {
            byte0 := byte(0, mload(memPtr))
        }

        if (byte0 < LIST_SHORT_START) return false;
        return true;
    }

    /*
     * @dev A cheaper version of keccak256(toRlpBytes(item)) that avoids copying memory.
     * @return keccak256 hash of RLP encoded bytes.
     */
    function rlpBytesKeccak256(RLPItem memory item) internal pure returns (bytes32) {
        uint256 ptr = item.memPtr;
        uint256 len = item.len;
        bytes32 result;
        assembly {
            result := keccak256(ptr, len)
        }
        return result;
    }

    function payloadLocation(RLPItem memory item) internal pure returns (uint256, uint256) {
        uint256 offset = _payloadOffset(item.memPtr);
        uint256 memPtr = item.memPtr + offset;
        uint256 len = item.len - offset; // data length
        return (memPtr, len);
    }

    /*
     * @dev A cheaper version of keccak256(toBytes(item)) that avoids copying memory.
     * @return keccak256 hash of the item payload.
     */
    function payloadKeccak256(RLPItem memory item) internal pure returns (bytes32) {
        (uint256 memPtr, uint256 len) = payloadLocation(item);
        bytes32 result;
        assembly {
            result := keccak256(memPtr, len)
        }
        return result;
    }

    /** RLPItem conversions into data types **/

    // @returns raw rlp encoding in bytes
    function toRlpBytes(RLPItem memory item) internal pure returns (bytes memory) {
        bytes memory result = new bytes(item.len);
        if (result.length == 0) return result;

        uint256 ptr;
        assembly {
            ptr := add(0x20, result)
        }

        copy(item.memPtr, ptr, item.len);
        return result;
    }

    // any non-zero byte < 128 is considered true
    function toBoolean(RLPItem memory item) internal pure returns (bool) {
        require(item.len == 1);
        uint256 result;
        uint256 memPtr = item.memPtr;
        assembly {
            result := byte(0, mload(memPtr))
        }

        return result == 0 ? false : true;
    }

    function toAddress(RLPItem memory item) internal pure returns (address) {
        // 1 byte for the length prefix
        require(item.len == 21);

        return address(uint160(toUint(item)));
    }

    function toUint(RLPItem memory item) internal pure returns (uint256) {
        require(item.len > 0 && item.len <= 33);

        uint256 offset = _payloadOffset(item.memPtr);
        uint256 len = item.len - offset;

        uint256 result;
        uint256 memPtr = item.memPtr + offset;
        assembly {
            result := mload(memPtr)

            // shift to the correct location if neccesary
            if lt(len, 32) {
                result := div(result, exp(256, sub(32, len)))
            }
        }

        return result;
    }

    // enforces 32 byte length
    function toUintStrict(RLPItem memory item) internal pure returns (uint256) {
        // one byte prefix
        require(item.len == 33);

        uint256 result;
        uint256 memPtr = item.memPtr + 1;
        assembly {
            result := mload(memPtr)
        }

        return result;
    }

    function toBytes(RLPItem memory item) internal pure returns (bytes memory) {
        require(item.len > 0);

        uint256 offset = _payloadOffset(item.memPtr);
        uint256 len = item.len - offset; // data length
        bytes memory result = new bytes(len);

        uint256 destPtr;
        assembly {
            destPtr := add(0x20, result)
        }

        copy(item.memPtr + offset, destPtr, len);
        return result;
    }

    /*
     * Private Helpers
     */

    // @return number of payload items inside an encoded list.
    function numItems(RLPItem memory item) private pure returns (uint256) {
        if (item.len == 0) return 0;

        uint256 count = 0;
        uint256 currPtr = item.memPtr + _payloadOffset(item.memPtr);
        uint256 endPtr = item.memPtr + item.len;
        while (currPtr < endPtr) {
            currPtr = currPtr + _itemLength(currPtr); // skip over an item
            count++;
        }

        return count;
    }

    // @return entire rlp item byte length
    function _itemLength(uint256 memPtr) private pure returns (uint256) {
        uint256 itemLen;
        uint256 byte0;
        assembly {
            byte0 := byte(0, mload(memPtr))
        }

        if (byte0 < STRING_SHORT_START) itemLen = 1;
        else if (byte0 < STRING_LONG_START) itemLen = byte0 - STRING_SHORT_START + 1;
        else if (byte0 < LIST_SHORT_START) {
            assembly {
                let byteLen := sub(byte0, 0xb7) // # of bytes the actual length is
                memPtr := add(memPtr, 1) // skip over the first byte
                /* 32 byte word size */
                let dataLen := div(mload(memPtr), exp(256, sub(32, byteLen))) // right shifting to get the len
                itemLen := add(dataLen, add(byteLen, 1))
            }
        } else if (byte0 < LIST_LONG_START) {
            itemLen = byte0 - LIST_SHORT_START + 1;
        } else {
            assembly {
                let byteLen := sub(byte0, 0xf7)
                memPtr := add(memPtr, 1)

                let dataLen := div(mload(memPtr), exp(256, sub(32, byteLen))) // right shifting to the correct length
                itemLen := add(dataLen, add(byteLen, 1))
            }
        }

        return itemLen;
    }

    // @return number of bytes until the data
    function _payloadOffset(uint256 memPtr) private pure returns (uint256) {
        uint256 byte0;
        assembly {
            byte0 := byte(0, mload(memPtr))
        }

        if (byte0 < STRING_SHORT_START) return 0;
        else if (byte0 < STRING_LONG_START || (byte0 >= LIST_SHORT_START && byte0 < LIST_LONG_START)) return 1;
        else if (byte0 < LIST_SHORT_START)
            // being explicit
            return byte0 - (STRING_LONG_START - 1) + 1;
        else return byte0 - (LIST_LONG_START - 1) + 1;
    }

    /*
     * @param src Pointer to source
     * @param dest Pointer to destination
     * @param len Amount of memory to copy from the source
     */
    function copy(uint256 src, uint256 dest, uint256 len) private pure {
        if (len == 0) return;

        // copy as many word sizes as possible
        for (; len >= WORD_SIZE; len -= WORD_SIZE) {
            assembly {
                mstore(dest, mload(src))
            }

            src += WORD_SIZE;
            dest += WORD_SIZE;
        }

        if (len == 0) return;

        // left over bytes. Mask is used to remove unwanted bytes from the word
        uint256 mask = 256 ** (WORD_SIZE - len) - 1;

        assembly {
            let srcpart := and(mload(src), not(mask)) // zero out src
            let destpart := and(mload(dest), mask) // retrieve the bytes
            mstore(dest, or(destpart, srcpart))
        }
    }
}

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

import {RLPReader} from "../lib/RLPReader.sol";
import {MerklePatriciaProof} from "../lib/MerklePatriciaProof.sol";
import {Merkle} from "../lib/Merkle.sol";
import "../lib/ExitPayloadReader.sol";
import {IFxStateSender} from "../FxRoot.sol";

contract ICheckpointManager {
    struct HeaderBlock {
        bytes32 root;
        uint256 start;
        uint256 end;
        uint256 createdAt;
        address proposer;
    }

    /**
     * @notice mapping of checkpoint header numbers to block details
     * @dev These checkpoints are submited by plasma contracts
     */
    mapping(uint256 => HeaderBlock) public headerBlocks;
}

abstract contract FxBaseRootTunnel {
    using RLPReader for RLPReader.RLPItem;
    using Merkle for bytes32;
    using ExitPayloadReader for bytes;
    using ExitPayloadReader for ExitPayloadReader.ExitPayload;
    using ExitPayloadReader for ExitPayloadReader.Log;
    using ExitPayloadReader for ExitPayloadReader.LogTopics;
    using ExitPayloadReader for ExitPayloadReader.Receipt;

    // keccak256(MessageSent(bytes))
    bytes32 public constant SEND_MESSAGE_EVENT_SIG = 0x8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b036;

    // state sender contract
    IFxStateSender public fxRoot;
    // root chain manager
    ICheckpointManager public checkpointManager;
    // child tunnel contract which receives and sends messages
    address public fxChildTunnel;

    // storage to avoid duplicate exits
    mapping(bytes32 => bool) public processedExits;

    constructor(address _checkpointManager, address _fxRoot) {
        checkpointManager = ICheckpointManager(_checkpointManager);
        fxRoot = IFxStateSender(_fxRoot);
    }

    // set fxChildTunnel if not set already
    function setFxChildTunnel(address _fxChildTunnel) public virtual {
        require(fxChildTunnel == address(0x0), "FxBaseRootTunnel: CHILD_TUNNEL_ALREADY_SET");
        fxChildTunnel = _fxChildTunnel;
    }

    /**
     * @notice Send bytes message to Child Tunnel
     * @param message bytes message that will be sent to Child Tunnel
     * some message examples -
     *   abi.encode(tokenId);
     *   abi.encode(tokenId, tokenMetadata);
     *   abi.encode(messageType, messageData);
     * @custom:security non-reentrant
     */
    function _sendMessageToChild(bytes memory message) internal {
        fxRoot.sendMessageToChild(fxChildTunnel, message);
    }

    function _validateAndExtractMessage(bytes memory inputData) internal returns (bytes memory) {
        ExitPayloadReader.ExitPayload memory payload = inputData.toExitPayload();

        bytes memory branchMaskBytes = payload.getBranchMaskAsBytes();
        uint256 blockNumber = payload.getBlockNumber();
        // checking if exit has already been processed
        // unique exit is identified using hash of (blockNumber, branchMask, receiptLogIndex)
        bytes32 exitHash = keccak256(
            abi.encodePacked(
                blockNumber,
                // first 2 nibbles are dropped while generating nibble array
                // this allows branch masks that are valid but bypass exitHash check (changing first 2 nibbles only)
                // so converting to nibble array and then hashing it
                MerklePatriciaProof._getNibbleArray(branchMaskBytes),
                payload.getReceiptLogIndex()
            )
        );
        require(processedExits[exitHash] == false, "FxRootTunnel: EXIT_ALREADY_PROCESSED");
        processedExits[exitHash] = true;

        ExitPayloadReader.Receipt memory receipt = payload.getReceipt();
        ExitPayloadReader.Log memory log = receipt.getLog();

        // check child tunnel
        require(fxChildTunnel == log.getEmitter(), "FxRootTunnel: INVALID_FX_CHILD_TUNNEL");

        bytes32 receiptRoot = payload.getReceiptRoot();
        // verify receipt inclusion
        require(
            MerklePatriciaProof.verify(receipt.toBytes(), branchMaskBytes, payload.getReceiptProof(), receiptRoot),
            "FxRootTunnel: INVALID_RECEIPT_PROOF"
        );

        // verify checkpoint inclusion
        _checkBlockMembershipInCheckpoint(
            blockNumber,
            payload.getBlockTime(),
            payload.getTxRoot(),
            receiptRoot,
            payload.getHeaderNumber(),
            payload.getBlockProof()
        );

        ExitPayloadReader.LogTopics memory topics = log.getTopics();

        require(
            bytes32(topics.getField(0).toUint()) == SEND_MESSAGE_EVENT_SIG, // topic0 is event sig
            "FxRootTunnel: INVALID_SIGNATURE"
        );

        // received message data
        bytes memory message = abi.decode(log.getData(), (bytes)); // event decodes params again, so decoding bytes to get message
        return message;
    }

    function _checkBlockMembershipInCheckpoint(
        uint256 blockNumber,
        uint256 blockTime,
        bytes32 txRoot,
        bytes32 receiptRoot,
        uint256 headerNumber,
        bytes memory blockProof
    ) private view {
        (bytes32 headerRoot, uint256 startBlock, , uint256 createdAt, ) = checkpointManager.headerBlocks(headerNumber);

        require(
            keccak256(abi.encodePacked(blockNumber, blockTime, txRoot, receiptRoot)).checkMembership(
                blockNumber - startBlock,
                headerRoot,
                blockProof
            ),
            "FxRootTunnel: INVALID_HEADER"
        );
    }

    /**
     * @notice receive message from  L2 to L1, validated by proof
     * @dev This function verifies if the transaction actually happened on child chain
     *
     * @param inputData RLP encoded data of the reference tx containing following list of fields
     *  0 - headerNumber - Checkpoint header block number containing the reference tx
     *  1 - blockProof - Proof that the block header (in the child chain) is a leaf in the submitted merkle root
     *  2 - blockNumber - Block number containing the reference tx on child chain
     *  3 - blockTime - Reference tx block time
     *  4 - txRoot - Transactions root of block
     *  5 - receiptRoot - Receipts root of block
     *  6 - receipt - Receipt of the reference transaction
     *  7 - receiptProof - Merkle proof of the reference receipt
     *  8 - branchMask - 32 bits denoting the path of receipt in merkle tree
     *  9 - receiptLogIndex - Log Index to read from the receipt
     */
    function receiveMessage(bytes memory inputData) public virtual {
        bytes memory message = _validateAndExtractMessage(inputData);
        _processMessageFromChild(message);
    }

    /**
     * @notice Process message received from Child Tunnel
     * @dev function needs to be implemented to handle message as per requirement
     * This is called by receiveMessage function.
     * Since it is called via a system call, any event will not be emitted during its execution.
     * @param message bytes message that was sent from Child Tunnel
     */
    function _processMessageFromChild(bytes memory message) internal virtual;
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_checkpointManager","type":"address"},{"internalType":"address","name":"_fxRoot","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"rootToken","type":"address"},{"indexed":true,"internalType":"address","name":"depositor","type":"address"},{"indexed":true,"internalType":"address","name":"userAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FxDepositERC20","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"rootToken","type":"address"},{"indexed":true,"internalType":"address","name":"childToken","type":"address"},{"indexed":true,"internalType":"address","name":"userAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FxWithdrawERC20","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"rootToken","type":"address"},{"indexed":true,"internalType":"address","name":"childToken","type":"address"}],"name":"TokenMappedERC20","type":"event"},{"inputs":[],"name":"DEPOSIT","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAP_TOKEN","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SEND_MESSAGE_EVENT_SIG","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"checkpointManager","outputs":[{"internalType":"contract ICheckpointManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"bytes32","name":"bytecodeHash","type":"bytes32"},{"internalType":"address","name":"deployer","type":"address"}],"name":"computedCreate2Address","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"deployerMap","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"rootToken","type":"address"},{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"fxChildTunnel","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fxRoot","outputs":[{"internalType":"contract IFxStateSender","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"rootToken","type":"address"},{"internalType":"address","name":"childToken","type":"address"}],"name":"mapToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"processedExits","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"inputData","type":"bytes"}],"name":"receiveMessage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rootToChildTokens","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_fxChildTunnel","type":"address"}],"name":"setFxChildTunnel","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b506040516200295738038062002957833981016040819052620000349162000083565b600180546001600160a01b039384166001600160a01b03199182161790915560008054929093169116179055620000bb565b80516001600160a01b03811681146200007e57600080fd5b919050565b600080604083850312156200009757600080fd5b620000a28362000066565b9150620000b26020840162000066565b90509250929050565b61288c80620000cb6000396000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c8063972c49281161008c578063d81c8e5211610066578063d81c8e521461024e578063de9b771f14610275578063e9c670ad14610288578063f953cec71461029b57600080fd5b8063972c492814610215578063aea4e49e14610228578063c0857ba01461023b57600080fd5b8063607f2d42116100c8578063607f2d421461017f5780637337957f146101b2578063886a69ba146101c557806388e70068146101ec57600080fd5b80630e387de6146100ef578063474002691461012957806358162d971461013e575b600080fd5b6101167f8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b03681565b6040519081526020015b60405180910390f35b61013c610137366004612161565b6102ae565b005b61016761014c36600461219a565b6005602052600090815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610120565b6101a261018d3660046121b7565b60036020526000908152604090205460ff1681565b6040519015158152602001610120565b6101676101c03660046121d0565b610573565b6101167f2cef46a936bdc5b7e6e8c71aa04560c41cf7d88bb26901a7e7f4936ff02accad81565b6101676101fa36600461219a565b6004602052600090815260409020546001600160a01b031681565b600254610167906001600160a01b031681565b61013c61023636600461219a565b6105d0565b600154610167906001600160a01b031681565b6101167f87a7811f4bfedea3d341ad165680ae306b01aaeacc205d227629cf157dd9f82181565b600054610167906001600160a01b031681565b61013c6102963660046122ce565b61065e565b61013c6102a936600461233a565b6107ac565b6001600160a01b038281166000908152600460205260409020541615806102ee57506001600160a01b038281166000908152600560205260409020541633145b61034b5760405162461bcd60e51b8152602060048201526024808201527f46784552433230526f6f7454756e6e656c3a20414c52454144595f4d41505045604482015263445f4f4b60e01b60648201526084015b60405180910390fd5b60008290506000816001600160a01b03166306fdde036040518163ffffffff1660e01b8152600401600060405180830381865afa158015610390573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526103b891908101906123c3565b90506000826001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa1580156103fa573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261042291908101906123c3565b90506000836001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610464573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610488919061240c565b905060007f2cef46a936bdc5b7e6e8c71aa04560c41cf7d88bb26901a7e7f4936ff02accad878585858a336040516020016104c89695949392919061245b565b60408051601f19818403018152908290526104e692916020016124b3565b6040516020818303038152906040529050610500816107c6565b6001600160a01b0380881660008181526004602090815260408083208054958c166001600160a01b0319968716811790915560059092528083208054909516331790945592517fc21cd413746aa9146d86960ed90847c18aa555d8dfd256e0aac3954c41e3cfe29190a350505050505050565b604080516001600160f81b0319602080830191909152606084901b6bffffffffffffffffffffffff1916602183015260358201869052605580830186905283518084039091018152607590920190925280519101205b9392505050565b6002546001600160a01b03161561063c5760405162461bcd60e51b815260206004820152602a60248201527f467842617365526f6f7454756e6e656c3a204348494c445f54554e4e454c5f4160448201526913149150511657d4d15560b21b6064820152608401610342565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03848116600090815260046020526040902054166106c55760405162461bcd60e51b815260206004820152601d60248201527f46784552433230526f6f7454756e6e656c3a204e4f54204d41505045440000006044820152606401610342565b6106da6001600160a01b038516333085610831565b60007f87a7811f4bfedea3d341ad165680ae306b01aaeacc205d227629cf157dd9f82185338686866040516020016107169594939291906124cc565b60408051601f198184030181529082905261073492916020016124b3565b604051602081830303815290604052905061074e816107c6565b836001600160a01b0316336001600160a01b0316866001600160a01b03167f8a58355ceb4626422a66b0f36743672dde8507c6be664f0e5b9de8350a1321598660405161079d91815260200190565b60405180910390a45050505050565b60006107b7826108a2565b90506107c281610b87565b5050565b60005460025460405163b472047760e01b81526001600160a01b039283169263b4720477926107fc929116908590600401612507565b600060405180830381600087803b15801561081657600080fd5b505af115801561082a573d6000803e3d6000fd5b5050505050565b6040516001600160a01b038085166024830152831660448201526064810182905261089c9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610c86565b50505050565b606060006108af83610d5d565b905060006108bc82610dbc565b905060006108c983610deb565b90506000816108d784610e14565b6108e086610fd2565b6040516020016108f29392919061252b565b60408051601f1981840301815291815281516020928301206000818152600390935291205490915060ff16156109765760405162461bcd60e51b8152602060048201526024808201527f4678526f6f7454756e6e656c3a20455849545f414c52454144595f50524f434560448201526314d4d15160e21b6064820152608401610342565b6000818152600360205260408120805460ff1916600117905561099885610fee565b905060006109a582611138565b90506109b0816111c8565b6002546001600160a01b03908116911614610a1b5760405162461bcd60e51b815260206004820152602560248201527f4678526f6f7454756e6e656c3a20494e56414c49445f46585f4348494c445f54604482015264155393915360da1b6064820152608401610342565b6000610a26876111f1565b9050610a46610a36846020015190565b87610a408a61120d565b84611229565b610a9e5760405162461bcd60e51b815260206004820152602360248201527f4678526f6f7454756e6e656c3a20494e56414c49445f524543454950545f505260448201526227a7a360e91b6064820152608401610342565b610acc85610aab896114dc565b610ab48a6114f8565b84610abe8c611514565b610ac78d611530565b61154c565b6000610ad78361166c565b90507f8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b036610b0d610b088360006116a8565b6116e0565b14610b5a5760405162461bcd60e51b815260206004820152601f60248201527f4678526f6f7454756e6e656c3a20494e56414c49445f5349474e4154555245006044820152606401610342565b6000610b658461175b565b806020019051810190610b7891906123c3565b9b9a5050505050505050505050565b60008060008084806020019051810190610ba19190612558565b6001600160a01b038481166000908152600460205260409020549498509296509094509250848116911614610c235760405162461bcd60e51b815260206004820152602260248201527f46784552433230526f6f7454756e6e656c3a20494e56414c49445f4d415050496044820152614e4760f01b6064820152608401610342565b610c376001600160a01b0385168383611777565b816001600160a01b0316836001600160a01b0316856001600160a01b03167f1a77c658a097b28097b54b8acb928a569a3830a6cbed2de1f60001c0757eb0d68460405161079d91815260200190565b6000610cdb826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166117a79092919063ffffffff16565b805190915015610d585780806020019051810190610cf991906125ab565b610d585760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610342565b505050565b6040805160208101909152606081526000610da7610da28460408051808201825260008082526020918201528151808301909252825182529182019181019190915290565b6117b6565b60408051602081019091529081529392505050565b6060610de58260000151600881518110610dd857610dd86125cd565b60200260200101516118cc565b92915050565b6000610de58260000151600281518110610e0757610e076125cd565b60200260200101516116e0565b60408051602081019091526000815281516060919015610de557600080610e3c600086611969565b60f81c90506001811480610e5357508060ff166003145b15610efb57600185516002610e6891906125f9565b610e729190612610565b67ffffffffffffffff811115610e8a57610e8a612209565b6040519080825280601f01601f191660200182016040528015610eb4576020820181803683370190505b5092506000610ec4600187611969565b90508084600081518110610eda57610eda6125cd565b60200101906001600160f81b031916908160001a9053506001925050610f5f565b600285516002610f0b91906125f9565b610f159190612610565b67ffffffffffffffff811115610f2d57610f2d612209565b6040519080825280601f01601f191660200182016040528015610f57576020820181803683370190505b509250600091505b60ff82165b8351811015610fc957610f8e610f7d60ff851683612610565b610f88906002612623565b87611969565b848281518110610fa057610fa06125cd565b60200101906001600160f81b031916908160001a90535080610fc181612636565b915050610f64565b50505092915050565b6000610de58260000151600981518110610e0757610e076125cd565b61101260405180606001604052806060815260200160608152602001600081525090565b61102c8260000151600681518110610dd857610dd86125cd565b602082810182905260408051808201825260008082529083015280518082019091528251815291810190820152611062816119ea565b1561107757611070816117b6565b8252611124565b6020820151805160009061108d90600190612610565b67ffffffffffffffff8111156110a5576110a5612209565b6040519080825280601f01601f1916602001820160405280156110cf576020820181803683370190505b5090506000808360210191508260200190506110ed82828551611a25565b60408051808201825260008082526020918201528151808301909252845182528085019082015261111d906117b6565b8652505050505b61112d83610fd2565b604083015250919050565b6040805160808101825260009181018281526060808301939093528152602081019190915260006111868360000151600381518110611179576111796125cd565b60200260200101516117b6565b83604001518151811061119b5761119b6125cd565b6020026020010151905060405180604001604052808281526020016111bf836117b6565b90529392505050565b6000610de582602001516000815181106111e4576111e46125cd565b6020026020010151611ab0565b6000610de58260000151600581518110610e0757610e076125cd565b6060610de58260000151600781518110610dd857610dd86125cd565b60008061125d8460408051808201825260008082526020918201528151808301909252825182529182019181019190915290565b9050600061126a826117b6565b90506060808560008061127c8b610e14565b905080516000036112975760009750505050505050506114d4565b60005b86518110156114cb5781518311156112bd576000985050505050505050506114d4565b6112df8782815181106112d2576112d26125cd565b6020026020010151611aca565b955085805190602001208414611300576000985050505050505050506114d4565b611315878281518110611179576111796125cd565b945084516011036113e75781518303611374578c8051906020012061134686601081518110610dd857610dd86125cd565b8051906020012003611363576001985050505050505050506114d4565b6000985050505050505050506114d4565b6000828481518110611388576113886125cd565b016020015160f81c905060108111156113ad57600099505050505050505050506114d4565b6113d2868260ff16815181106113c5576113c56125cd565b6020026020010151611b49565b94506113df600185612623565b9350506114b9565b845160020361136357600061141261140b87600081518110610dd857610dd86125cd565b8486611b77565b83519091506114218286612623565b03611474578d8051906020012061144487600181518110610dd857610dd86125cd565b805190602001200361146257600199505050505050505050506114d4565b600099505050505050505050506114d4565b8060000361148e57600099505050505050505050506114d4565b6114988185612623565b93506114b0866001815181106113c5576113c56125cd565b94506114b99050565b806114c381612636565b91505061129a565b50505050505050505b949350505050565b6000610de58260000151600381518110610e0757610e076125cd565b6000610de58260000151600481518110610e0757610e076125cd565b6000610de58260000151600081518110610e0757610e076125cd565b6060610de58260000151600181518110610dd857610dd86125cd565b6001546040516320a9cea560e11b815260048101849052600091829182916001600160a01b0316906341539d4a9060240160a060405180830381865afa15801561159a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115be919061264f565b5093505092509250611615828a6115d59190612610565b6040805160208082018e90528183018d9052606082018c905260808083018c90528351808403909101815260a09092019092528051910120908587611c7f565b6116615760405162461bcd60e51b815260206004820152601c60248201527f4678526f6f7454756e6e656c3a20494e56414c49445f484541444552000000006044820152606401610342565b505050505050505050565b60408051602081019091526060815260405180602001604052806116a08460200151600181518110611179576111796125cd565b905292915050565b604080518082019091526000808252602082015282518051839081106116d0576116d06125cd565b6020026020010151905092915050565b8051600090158015906116f557508151602110155b6116fe57600080fd5b600061170d8360200151611de7565b905060008184600001516117219190612610565b90506000808386602001516117369190612623565b905080519150602083101561175257826020036101000a820491505b50949350505050565b6060610de58260200151600281518110610dd857610dd86125cd565b6040516001600160a01b038316602482015260448101829052610d5890849063a9059cbb60e01b90606401610865565b60606114d48484600085611e62565b60606117c1826119ea565b6117ca57600080fd5b60006117d583611f3d565b905060008167ffffffffffffffff8111156117f2576117f2612209565b60405190808252806020026020018201604052801561183757816020015b60408051808201909152600080825260208201528152602001906001900390816118105790505b50905060006118498560200151611de7565b85602001516118589190612623565b90506000805b848110156118c15761186f83611fc2565b9150604051806040016040528083815260200184815250848281518110611898576118986125cd565b60209081029190910101526118ad8284612623565b9250806118b981612636565b91505061185e565b509195945050505050565b80516060906118da57600080fd5b60006118e98360200151611de7565b905060008184600001516118fd9190612610565b905060008167ffffffffffffffff81111561191a5761191a612209565b6040519080825280601f01601f191660200182016040528015611944576020820181803683370190505b50905060008160200190506117528487602001516119629190612623565b8285612066565b60006119766002846126b2565b156119b0576010826119896002866126c6565b81518110611999576119996125cd565b01602001516119ab919060f81c6126da565b6119e0565b6010826119be6002866126c6565b815181106119ce576119ce6125cd565b01602001516119e0919060f81c6126fc565b60f81b9392505050565b805160009081036119fd57506000919050565b6020820151805160001a9060c0821015611a1b575060009392505050565b5060019392505050565b80600003611a3257505050565b60208110611a6a5782518252611a49602084612623565b9250611a56602083612623565b9150611a63602082612610565b9050611a32565b80600003611a7757505050565b60006001611a86836020612610565b611a9290610100612802565b611a9c9190612610565b935183518516941916939093179091525050565b8051600090601514611ac157600080fd5b610de5826116e0565b60606000826000015167ffffffffffffffff811115611aeb57611aeb612209565b6040519080825280601f01601f191660200182016040528015611b15576020820181803683370190505b5090508051600003611b275792915050565b6000816020019050611b428460200151828660000151612066565b5092915050565b8051600090602114611b5a57600080fd5b60008083602001516001611b6e9190612623565b51949350505050565b60008080611b8486610e14565b90506000815167ffffffffffffffff811115611ba257611ba2612209565b6040519080825280601f01601f191660200182016040528015611bcc576020820181803683370190505b509050845b8251611bdd9087612623565b811015611c50576000878281518110611bf857611bf86125cd565b01602001516001600160f81b03191690508083611c158985612610565b81518110611c2557611c256125cd565b60200101906001600160f81b031916908160001a905350508080611c4890612636565b915050611bd1565b508080519060200120828051906020012003611c6f5781519250611c74565b600092505b509095945050505050565b600060208251611c8f91906126b2565b15611cd35760405162461bcd60e51b8152602060048201526014602482015273092dcecc2d8d2c840e0e4dedecc40d8cadccee8d60631b6044820152606401610342565b600060208351611ce391906126c6565b9050611cf0816002612802565b8510611d365760405162461bcd60e51b81526020600482015260156024820152744c65616620696e64657820697320746f6f2062696760581b6044820152606401610342565b60008660205b85518111611dd957858101519250611d556002896126b2565b600003611d8d576040805160208101849052908101849052606001604051602081830303815290604052805190602001209150611dba565b60408051602081018590529081018390526060016040516020818303038152906040528051906020012091505b611dc56002896126c6565b9750611dd2602082612623565b9050611d3c565b509094149695505050505050565b8051600090811a6080811015611e005750600092915050565b60b8811080611e1b575060c08110801590611e1b575060f881105b15611e295750600192915050565b60c0811015611e5657611e3e600160b861280e565b611e4b9060ff1682612610565b6105c9906001612623565b611e3e600160f861280e565b606082471015611ec35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610342565b600080866001600160a01b03168587604051611edf9190612827565b60006040518083038185875af1925050503d8060008114611f1c576040519150601f19603f3d011682016040523d82523d6000602084013e611f21565b606091505b5091509150611f32878383876120ab565b979650505050505050565b80516000908103611f5057506000919050565b600080611f608460200151611de7565b8460200151611f6f9190612623565b9050600084600001518560200151611f879190612623565b90505b80821015611fb957611f9b82611fc2565b611fa59083612623565b915082611fb181612636565b935050611f8a565b50909392505050565b80516000908190811a6080811015611fdd5760019150611b42565b60b881101561200357611ff1608082612610565b611ffc906001612623565b9150611b42565b60c08110156120305760b78103600185019450806020036101000a85510460018201810193505050611b42565b60f881101561204457611ff160c082612610565b60019390930151602084900360f7016101000a900490920160f5190192915050565b8060000361207357505050565b60208110611a6a578251825261208a602084612623565b9250612097602083612623565b91506120a4602082612610565b9050612073565b6060831561211a578251600003612113576001600160a01b0385163b6121135760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610342565b50816114d4565b6114d4838381511561212f5781518083602001fd5b8060405162461bcd60e51b81526004016103429190612843565b6001600160a01b038116811461215e57600080fd5b50565b6000806040838503121561217457600080fd5b823561217f81612149565b9150602083013561218f81612149565b809150509250929050565b6000602082840312156121ac57600080fd5b81356105c981612149565b6000602082840312156121c957600080fd5b5035919050565b6000806000606084860312156121e557600080fd5b833592506020840135915060408401356121fe81612149565b809150509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561224857612248612209565b604052919050565b600067ffffffffffffffff82111561226a5761226a612209565b50601f01601f191660200190565b600082601f83011261228957600080fd5b813561229c61229782612250565b61221f565b8181528460208386010111156122b157600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080608085870312156122e457600080fd5b84356122ef81612149565b935060208501356122ff81612149565b925060408501359150606085013567ffffffffffffffff81111561232257600080fd5b61232e87828801612278565b91505092959194509250565b60006020828403121561234c57600080fd5b813567ffffffffffffffff81111561236357600080fd5b6114d484828501612278565b60005b8381101561238a578181015183820152602001612372565b50506000910152565b60006123a161229784612250565b90508281528383830111156123b557600080fd5b6105c983602083018461236f565b6000602082840312156123d557600080fd5b815167ffffffffffffffff8111156123ec57600080fd5b8201601f810184136123fd57600080fd5b6114d484825160208401612393565b60006020828403121561241e57600080fd5b815160ff811681146105c957600080fd5b6000815180845261244781602086016020860161236f565b601f01601f19169290920160200192915050565b600060018060a01b03808916835260c0602084015261247d60c084018961242f565b838103604085015261248f818961242f565b60ff97909716606085015250938416608083015250911660a0909101529392505050565b8281526040602082015260006114d4604083018461242f565b6001600160a01b0386811682528581166020830152841660408201526060810183905260a060808201819052600090611f329083018461242f565b6001600160a01b03831681526040602082018190526000906114d49083018461242f565b8381526000835161254381602085016020880161236f565b60209201918201929092526040019392505050565b6000806000806080858703121561256e57600080fd5b845161257981612149565b602086015190945061258a81612149565b604086015190935061259b81612149565b6060959095015193969295505050565b6000602082840312156125bd57600080fd5b815180151581146105c957600080fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610de557610de56125e3565b81810381811115610de557610de56125e3565b80820180821115610de557610de56125e3565b600060018201612648576126486125e3565b5060010190565b600080600080600060a0868803121561266757600080fd5b85519450602086015193506040860151925060608601519150608086015161268e81612149565b809150509295509295909350565b634e487b7160e01b600052601260045260246000fd5b6000826126c1576126c161269c565b500690565b6000826126d5576126d561269c565b500490565b600060ff8316806126ed576126ed61269c565b8060ff84160691505092915050565b600060ff83168061270f5761270f61269c565b8060ff84160491505092915050565b600181815b8085111561275957816000190482111561273f5761273f6125e3565b8085161561274c57918102915b93841c9390800290612723565b509250929050565b60008261277057506001610de5565b8161277d57506000610de5565b8160018114612793576002811461279d576127b9565b6001915050610de5565b60ff8411156127ae576127ae6125e3565b50506001821b610de5565b5060208310610133831016604e8410600b84101617156127dc575081810a610de5565b6127e6838361271e565b80600019048211156127fa576127fa6125e3565b029392505050565b60006105c98383612761565b60ff8281168282160390811115610de557610de56125e3565b6000825161283981846020870161236f565b9190910192915050565b6020815260006105c9602083018461242f56fea26469706673582212203edb0c156dad23bab218a6f611cd3eb6bbf9cced422d440191f7c47979a6c30464736f6c6343000811003300000000000000000000000086e4dc95c7fbdbf52e33d563bbdb00823894c287000000000000000000000000fe5e5d361b2ad62c541bab87c45a0b9b018389a2

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c8063972c49281161008c578063d81c8e5211610066578063d81c8e521461024e578063de9b771f14610275578063e9c670ad14610288578063f953cec71461029b57600080fd5b8063972c492814610215578063aea4e49e14610228578063c0857ba01461023b57600080fd5b8063607f2d42116100c8578063607f2d421461017f5780637337957f146101b2578063886a69ba146101c557806388e70068146101ec57600080fd5b80630e387de6146100ef578063474002691461012957806358162d971461013e575b600080fd5b6101167f8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b03681565b6040519081526020015b60405180910390f35b61013c610137366004612161565b6102ae565b005b61016761014c36600461219a565b6005602052600090815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610120565b6101a261018d3660046121b7565b60036020526000908152604090205460ff1681565b6040519015158152602001610120565b6101676101c03660046121d0565b610573565b6101167f2cef46a936bdc5b7e6e8c71aa04560c41cf7d88bb26901a7e7f4936ff02accad81565b6101676101fa36600461219a565b6004602052600090815260409020546001600160a01b031681565b600254610167906001600160a01b031681565b61013c61023636600461219a565b6105d0565b600154610167906001600160a01b031681565b6101167f87a7811f4bfedea3d341ad165680ae306b01aaeacc205d227629cf157dd9f82181565b600054610167906001600160a01b031681565b61013c6102963660046122ce565b61065e565b61013c6102a936600461233a565b6107ac565b6001600160a01b038281166000908152600460205260409020541615806102ee57506001600160a01b038281166000908152600560205260409020541633145b61034b5760405162461bcd60e51b8152602060048201526024808201527f46784552433230526f6f7454756e6e656c3a20414c52454144595f4d41505045604482015263445f4f4b60e01b60648201526084015b60405180910390fd5b60008290506000816001600160a01b03166306fdde036040518163ffffffff1660e01b8152600401600060405180830381865afa158015610390573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526103b891908101906123c3565b90506000826001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa1580156103fa573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261042291908101906123c3565b90506000836001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610464573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610488919061240c565b905060007f2cef46a936bdc5b7e6e8c71aa04560c41cf7d88bb26901a7e7f4936ff02accad878585858a336040516020016104c89695949392919061245b565b60408051601f19818403018152908290526104e692916020016124b3565b6040516020818303038152906040529050610500816107c6565b6001600160a01b0380881660008181526004602090815260408083208054958c166001600160a01b0319968716811790915560059092528083208054909516331790945592517fc21cd413746aa9146d86960ed90847c18aa555d8dfd256e0aac3954c41e3cfe29190a350505050505050565b604080516001600160f81b0319602080830191909152606084901b6bffffffffffffffffffffffff1916602183015260358201869052605580830186905283518084039091018152607590920190925280519101205b9392505050565b6002546001600160a01b03161561063c5760405162461bcd60e51b815260206004820152602a60248201527f467842617365526f6f7454756e6e656c3a204348494c445f54554e4e454c5f4160448201526913149150511657d4d15560b21b6064820152608401610342565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03848116600090815260046020526040902054166106c55760405162461bcd60e51b815260206004820152601d60248201527f46784552433230526f6f7454756e6e656c3a204e4f54204d41505045440000006044820152606401610342565b6106da6001600160a01b038516333085610831565b60007f87a7811f4bfedea3d341ad165680ae306b01aaeacc205d227629cf157dd9f82185338686866040516020016107169594939291906124cc565b60408051601f198184030181529082905261073492916020016124b3565b604051602081830303815290604052905061074e816107c6565b836001600160a01b0316336001600160a01b0316866001600160a01b03167f8a58355ceb4626422a66b0f36743672dde8507c6be664f0e5b9de8350a1321598660405161079d91815260200190565b60405180910390a45050505050565b60006107b7826108a2565b90506107c281610b87565b5050565b60005460025460405163b472047760e01b81526001600160a01b039283169263b4720477926107fc929116908590600401612507565b600060405180830381600087803b15801561081657600080fd5b505af115801561082a573d6000803e3d6000fd5b5050505050565b6040516001600160a01b038085166024830152831660448201526064810182905261089c9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610c86565b50505050565b606060006108af83610d5d565b905060006108bc82610dbc565b905060006108c983610deb565b90506000816108d784610e14565b6108e086610fd2565b6040516020016108f29392919061252b565b60408051601f1981840301815291815281516020928301206000818152600390935291205490915060ff16156109765760405162461bcd60e51b8152602060048201526024808201527f4678526f6f7454756e6e656c3a20455849545f414c52454144595f50524f434560448201526314d4d15160e21b6064820152608401610342565b6000818152600360205260408120805460ff1916600117905561099885610fee565b905060006109a582611138565b90506109b0816111c8565b6002546001600160a01b03908116911614610a1b5760405162461bcd60e51b815260206004820152602560248201527f4678526f6f7454756e6e656c3a20494e56414c49445f46585f4348494c445f54604482015264155393915360da1b6064820152608401610342565b6000610a26876111f1565b9050610a46610a36846020015190565b87610a408a61120d565b84611229565b610a9e5760405162461bcd60e51b815260206004820152602360248201527f4678526f6f7454756e6e656c3a20494e56414c49445f524543454950545f505260448201526227a7a360e91b6064820152608401610342565b610acc85610aab896114dc565b610ab48a6114f8565b84610abe8c611514565b610ac78d611530565b61154c565b6000610ad78361166c565b90507f8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b036610b0d610b088360006116a8565b6116e0565b14610b5a5760405162461bcd60e51b815260206004820152601f60248201527f4678526f6f7454756e6e656c3a20494e56414c49445f5349474e4154555245006044820152606401610342565b6000610b658461175b565b806020019051810190610b7891906123c3565b9b9a5050505050505050505050565b60008060008084806020019051810190610ba19190612558565b6001600160a01b038481166000908152600460205260409020549498509296509094509250848116911614610c235760405162461bcd60e51b815260206004820152602260248201527f46784552433230526f6f7454756e6e656c3a20494e56414c49445f4d415050496044820152614e4760f01b6064820152608401610342565b610c376001600160a01b0385168383611777565b816001600160a01b0316836001600160a01b0316856001600160a01b03167f1a77c658a097b28097b54b8acb928a569a3830a6cbed2de1f60001c0757eb0d68460405161079d91815260200190565b6000610cdb826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166117a79092919063ffffffff16565b805190915015610d585780806020019051810190610cf991906125ab565b610d585760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610342565b505050565b6040805160208101909152606081526000610da7610da28460408051808201825260008082526020918201528151808301909252825182529182019181019190915290565b6117b6565b60408051602081019091529081529392505050565b6060610de58260000151600881518110610dd857610dd86125cd565b60200260200101516118cc565b92915050565b6000610de58260000151600281518110610e0757610e076125cd565b60200260200101516116e0565b60408051602081019091526000815281516060919015610de557600080610e3c600086611969565b60f81c90506001811480610e5357508060ff166003145b15610efb57600185516002610e6891906125f9565b610e729190612610565b67ffffffffffffffff811115610e8a57610e8a612209565b6040519080825280601f01601f191660200182016040528015610eb4576020820181803683370190505b5092506000610ec4600187611969565b90508084600081518110610eda57610eda6125cd565b60200101906001600160f81b031916908160001a9053506001925050610f5f565b600285516002610f0b91906125f9565b610f159190612610565b67ffffffffffffffff811115610f2d57610f2d612209565b6040519080825280601f01601f191660200182016040528015610f57576020820181803683370190505b509250600091505b60ff82165b8351811015610fc957610f8e610f7d60ff851683612610565b610f88906002612623565b87611969565b848281518110610fa057610fa06125cd565b60200101906001600160f81b031916908160001a90535080610fc181612636565b915050610f64565b50505092915050565b6000610de58260000151600981518110610e0757610e076125cd565b61101260405180606001604052806060815260200160608152602001600081525090565b61102c8260000151600681518110610dd857610dd86125cd565b602082810182905260408051808201825260008082529083015280518082019091528251815291810190820152611062816119ea565b1561107757611070816117b6565b8252611124565b6020820151805160009061108d90600190612610565b67ffffffffffffffff8111156110a5576110a5612209565b6040519080825280601f01601f1916602001820160405280156110cf576020820181803683370190505b5090506000808360210191508260200190506110ed82828551611a25565b60408051808201825260008082526020918201528151808301909252845182528085019082015261111d906117b6565b8652505050505b61112d83610fd2565b604083015250919050565b6040805160808101825260009181018281526060808301939093528152602081019190915260006111868360000151600381518110611179576111796125cd565b60200260200101516117b6565b83604001518151811061119b5761119b6125cd565b6020026020010151905060405180604001604052808281526020016111bf836117b6565b90529392505050565b6000610de582602001516000815181106111e4576111e46125cd565b6020026020010151611ab0565b6000610de58260000151600581518110610e0757610e076125cd565b6060610de58260000151600781518110610dd857610dd86125cd565b60008061125d8460408051808201825260008082526020918201528151808301909252825182529182019181019190915290565b9050600061126a826117b6565b90506060808560008061127c8b610e14565b905080516000036112975760009750505050505050506114d4565b60005b86518110156114cb5781518311156112bd576000985050505050505050506114d4565b6112df8782815181106112d2576112d26125cd565b6020026020010151611aca565b955085805190602001208414611300576000985050505050505050506114d4565b611315878281518110611179576111796125cd565b945084516011036113e75781518303611374578c8051906020012061134686601081518110610dd857610dd86125cd565b8051906020012003611363576001985050505050505050506114d4565b6000985050505050505050506114d4565b6000828481518110611388576113886125cd565b016020015160f81c905060108111156113ad57600099505050505050505050506114d4565b6113d2868260ff16815181106113c5576113c56125cd565b6020026020010151611b49565b94506113df600185612623565b9350506114b9565b845160020361136357600061141261140b87600081518110610dd857610dd86125cd565b8486611b77565b83519091506114218286612623565b03611474578d8051906020012061144487600181518110610dd857610dd86125cd565b805190602001200361146257600199505050505050505050506114d4565b600099505050505050505050506114d4565b8060000361148e57600099505050505050505050506114d4565b6114988185612623565b93506114b0866001815181106113c5576113c56125cd565b94506114b99050565b806114c381612636565b91505061129a565b50505050505050505b949350505050565b6000610de58260000151600381518110610e0757610e076125cd565b6000610de58260000151600481518110610e0757610e076125cd565b6000610de58260000151600081518110610e0757610e076125cd565b6060610de58260000151600181518110610dd857610dd86125cd565b6001546040516320a9cea560e11b815260048101849052600091829182916001600160a01b0316906341539d4a9060240160a060405180830381865afa15801561159a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115be919061264f565b5093505092509250611615828a6115d59190612610565b6040805160208082018e90528183018d9052606082018c905260808083018c90528351808403909101815260a09092019092528051910120908587611c7f565b6116615760405162461bcd60e51b815260206004820152601c60248201527f4678526f6f7454756e6e656c3a20494e56414c49445f484541444552000000006044820152606401610342565b505050505050505050565b60408051602081019091526060815260405180602001604052806116a08460200151600181518110611179576111796125cd565b905292915050565b604080518082019091526000808252602082015282518051839081106116d0576116d06125cd565b6020026020010151905092915050565b8051600090158015906116f557508151602110155b6116fe57600080fd5b600061170d8360200151611de7565b905060008184600001516117219190612610565b90506000808386602001516117369190612623565b905080519150602083101561175257826020036101000a820491505b50949350505050565b6060610de58260200151600281518110610dd857610dd86125cd565b6040516001600160a01b038316602482015260448101829052610d5890849063a9059cbb60e01b90606401610865565b60606114d48484600085611e62565b60606117c1826119ea565b6117ca57600080fd5b60006117d583611f3d565b905060008167ffffffffffffffff8111156117f2576117f2612209565b60405190808252806020026020018201604052801561183757816020015b60408051808201909152600080825260208201528152602001906001900390816118105790505b50905060006118498560200151611de7565b85602001516118589190612623565b90506000805b848110156118c15761186f83611fc2565b9150604051806040016040528083815260200184815250848281518110611898576118986125cd565b60209081029190910101526118ad8284612623565b9250806118b981612636565b91505061185e565b509195945050505050565b80516060906118da57600080fd5b60006118e98360200151611de7565b905060008184600001516118fd9190612610565b905060008167ffffffffffffffff81111561191a5761191a612209565b6040519080825280601f01601f191660200182016040528015611944576020820181803683370190505b50905060008160200190506117528487602001516119629190612623565b8285612066565b60006119766002846126b2565b156119b0576010826119896002866126c6565b81518110611999576119996125cd565b01602001516119ab919060f81c6126da565b6119e0565b6010826119be6002866126c6565b815181106119ce576119ce6125cd565b01602001516119e0919060f81c6126fc565b60f81b9392505050565b805160009081036119fd57506000919050565b6020820151805160001a9060c0821015611a1b575060009392505050565b5060019392505050565b80600003611a3257505050565b60208110611a6a5782518252611a49602084612623565b9250611a56602083612623565b9150611a63602082612610565b9050611a32565b80600003611a7757505050565b60006001611a86836020612610565b611a9290610100612802565b611a9c9190612610565b935183518516941916939093179091525050565b8051600090601514611ac157600080fd5b610de5826116e0565b60606000826000015167ffffffffffffffff811115611aeb57611aeb612209565b6040519080825280601f01601f191660200182016040528015611b15576020820181803683370190505b5090508051600003611b275792915050565b6000816020019050611b428460200151828660000151612066565b5092915050565b8051600090602114611b5a57600080fd5b60008083602001516001611b6e9190612623565b51949350505050565b60008080611b8486610e14565b90506000815167ffffffffffffffff811115611ba257611ba2612209565b6040519080825280601f01601f191660200182016040528015611bcc576020820181803683370190505b509050845b8251611bdd9087612623565b811015611c50576000878281518110611bf857611bf86125cd565b01602001516001600160f81b03191690508083611c158985612610565b81518110611c2557611c256125cd565b60200101906001600160f81b031916908160001a905350508080611c4890612636565b915050611bd1565b508080519060200120828051906020012003611c6f5781519250611c74565b600092505b509095945050505050565b600060208251611c8f91906126b2565b15611cd35760405162461bcd60e51b8152602060048201526014602482015273092dcecc2d8d2c840e0e4dedecc40d8cadccee8d60631b6044820152606401610342565b600060208351611ce391906126c6565b9050611cf0816002612802565b8510611d365760405162461bcd60e51b81526020600482015260156024820152744c65616620696e64657820697320746f6f2062696760581b6044820152606401610342565b60008660205b85518111611dd957858101519250611d556002896126b2565b600003611d8d576040805160208101849052908101849052606001604051602081830303815290604052805190602001209150611dba565b60408051602081018590529081018390526060016040516020818303038152906040528051906020012091505b611dc56002896126c6565b9750611dd2602082612623565b9050611d3c565b509094149695505050505050565b8051600090811a6080811015611e005750600092915050565b60b8811080611e1b575060c08110801590611e1b575060f881105b15611e295750600192915050565b60c0811015611e5657611e3e600160b861280e565b611e4b9060ff1682612610565b6105c9906001612623565b611e3e600160f861280e565b606082471015611ec35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610342565b600080866001600160a01b03168587604051611edf9190612827565b60006040518083038185875af1925050503d8060008114611f1c576040519150601f19603f3d011682016040523d82523d6000602084013e611f21565b606091505b5091509150611f32878383876120ab565b979650505050505050565b80516000908103611f5057506000919050565b600080611f608460200151611de7565b8460200151611f6f9190612623565b9050600084600001518560200151611f879190612623565b90505b80821015611fb957611f9b82611fc2565b611fa59083612623565b915082611fb181612636565b935050611f8a565b50909392505050565b80516000908190811a6080811015611fdd5760019150611b42565b60b881101561200357611ff1608082612610565b611ffc906001612623565b9150611b42565b60c08110156120305760b78103600185019450806020036101000a85510460018201810193505050611b42565b60f881101561204457611ff160c082612610565b60019390930151602084900360f7016101000a900490920160f5190192915050565b8060000361207357505050565b60208110611a6a578251825261208a602084612623565b9250612097602083612623565b91506120a4602082612610565b9050612073565b6060831561211a578251600003612113576001600160a01b0385163b6121135760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610342565b50816114d4565b6114d4838381511561212f5781518083602001fd5b8060405162461bcd60e51b81526004016103429190612843565b6001600160a01b038116811461215e57600080fd5b50565b6000806040838503121561217457600080fd5b823561217f81612149565b9150602083013561218f81612149565b809150509250929050565b6000602082840312156121ac57600080fd5b81356105c981612149565b6000602082840312156121c957600080fd5b5035919050565b6000806000606084860312156121e557600080fd5b833592506020840135915060408401356121fe81612149565b809150509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561224857612248612209565b604052919050565b600067ffffffffffffffff82111561226a5761226a612209565b50601f01601f191660200190565b600082601f83011261228957600080fd5b813561229c61229782612250565b61221f565b8181528460208386010111156122b157600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080608085870312156122e457600080fd5b84356122ef81612149565b935060208501356122ff81612149565b925060408501359150606085013567ffffffffffffffff81111561232257600080fd5b61232e87828801612278565b91505092959194509250565b60006020828403121561234c57600080fd5b813567ffffffffffffffff81111561236357600080fd5b6114d484828501612278565b60005b8381101561238a578181015183820152602001612372565b50506000910152565b60006123a161229784612250565b90508281528383830111156123b557600080fd5b6105c983602083018461236f565b6000602082840312156123d557600080fd5b815167ffffffffffffffff8111156123ec57600080fd5b8201601f810184136123fd57600080fd5b6114d484825160208401612393565b60006020828403121561241e57600080fd5b815160ff811681146105c957600080fd5b6000815180845261244781602086016020860161236f565b601f01601f19169290920160200192915050565b600060018060a01b03808916835260c0602084015261247d60c084018961242f565b838103604085015261248f818961242f565b60ff97909716606085015250938416608083015250911660a0909101529392505050565b8281526040602082015260006114d4604083018461242f565b6001600160a01b0386811682528581166020830152841660408201526060810183905260a060808201819052600090611f329083018461242f565b6001600160a01b03831681526040602082018190526000906114d49083018461242f565b8381526000835161254381602085016020880161236f565b60209201918201929092526040019392505050565b6000806000806080858703121561256e57600080fd5b845161257981612149565b602086015190945061258a81612149565b604086015190935061259b81612149565b6060959095015193969295505050565b6000602082840312156125bd57600080fd5b815180151581146105c957600080fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610de557610de56125e3565b81810381811115610de557610de56125e3565b80820180821115610de557610de56125e3565b600060018201612648576126486125e3565b5060010190565b600080600080600060a0868803121561266757600080fd5b85519450602086015193506040860151925060608601519150608086015161268e81612149565b809150509295509295909350565b634e487b7160e01b600052601260045260246000fd5b6000826126c1576126c161269c565b500690565b6000826126d5576126d561269c565b500490565b600060ff8316806126ed576126ed61269c565b8060ff84160691505092915050565b600060ff83168061270f5761270f61269c565b8060ff84160491505092915050565b600181815b8085111561275957816000190482111561273f5761273f6125e3565b8085161561274c57918102915b93841c9390800290612723565b509250929050565b60008261277057506001610de5565b8161277d57506000610de5565b8160018114612793576002811461279d576127b9565b6001915050610de5565b60ff8411156127ae576127ae6125e3565b50506001821b610de5565b5060208310610133831016604e8410600b84101617156127dc575081810a610de5565b6127e6838361271e565b80600019048211156127fa576127fa6125e3565b029392505050565b60006105c98383612761565b60ff8281168282160390811115610de557610de56125e3565b6000825161283981846020870161236f565b9190910192915050565b6020815260006105c9602083018461242f56fea26469706673582212203edb0c156dad23bab218a6f611cd3eb6bbf9cced422d440191f7c47979a6c30464736f6c63430008110033

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

00000000000000000000000086e4dc95c7fbdbf52e33d563bbdb00823894c287000000000000000000000000fe5e5d361b2ad62c541bab87c45a0b9b018389a2

-----Decoded View---------------
Arg [0] : _checkpointManager (address): 0x86E4Dc95c7FBdBf52e33D563BbDB00823894C287
Arg [1] : _fxRoot (address): 0xfe5e5D361b2ad62c541bAb87C45a0B9B018389a2

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 00000000000000000000000086e4dc95c7fbdbf52e33d563bbdb00823894c287
Arg [1] : 000000000000000000000000fe5e5d361b2ad62c541bab87c45a0b9b018389a2


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
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.