APE Price: $1.24 (+8.09%)

Contract

0xa16e00C26786B9861b3e105296197eA0f891c879

Overview

APE Balance

Apechain LogoApechain LogoApechain Logo0 APE

APE Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Transfer Ownersh...48839262024-11-21 13:48:1544 hrs ago1732196895IN
0xa16e00C2...0f891c879
0 APE0.0007289325.42069
Set Trusted Remo...46590232024-11-19 12:19:453 days ago1732018785IN
0xa16e00C2...0f891c879
0 APE0.0023848425.42069
Set Trusted Remo...46590032024-11-19 12:19:183 days ago1732018758IN
0xa16e00C2...0f891c879
0 APE0.0023848125.42069
Set Trusted Remo...46589892024-11-19 12:18:563 days ago1732018736IN
0xa16e00C2...0f891c879
0 APE0.0023848125.42069
0x60c0604046582752024-11-19 12:05:313 days ago1732017931IN
 Create: ERC20Bridge
0 APE0.0772099825.42069

Parent Transaction Hash Block From To
View All Internal Transactions

Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ERC20Bridge

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion
File 1 of 16 : ERC20Bridge.sol
//SPDX-License-Identifier: MIT
import "@layerzerolabs/solidity-examples/contracts/lzApp/NonblockingLzApp.sol";
import "./abstract/ERC20BridgeRateLimiter.sol";

pragma solidity 0.8.17;

contract ERC20Bridge is NonblockingLzApp, ERC20BridgeRateLimiter {

    // Structs
    struct MintMessage {
        address to;
        uint amount;
    }

    // Events
    event MintMessageReceived(uint16 indexed srcChainId, address indexed to, uint amount);
    event BridgingInitiated(uint16 indexed targetChainId, address indexed to, uint amount);

    constructor(
        address _lzEndpoint,
        IERC20MintableBurnable _token,
        address _owner,
        uint _maxEpochLimit,
        uint _epochDuration,
        uint _epochLimit
    ) NonblockingLzApp(_lzEndpoint) ERC20BridgeRateLimiter(
        _token,
        _owner,
        _maxEpochLimit,
        _epochDuration,
        _epochLimit
    ) {}

    // @dev Helper to build MintMessage
    function buildBridgeMessage(address to, uint amount) private pure returns (bytes memory) {
        return abi.encode(
            MintMessage({
                to: to,
                amount: amount
            })
        );
    }

    // @notice Mints GNS bridged from the other side, can only be invoked by a trusted remote
    // @param payload message sent from the other side
    function _nonblockingLzReceive(
        uint16 srcChainId,
        bytes memory /* srcAddress */,
        uint64 /* nonce */,
        bytes memory payload
    ) internal override {
        MintMessage memory message = abi.decode(payload, (MintMessage));
        
        if(paused()){
            addPendingClaim(message.to, message.amount);
        }else{
            tryMint(message.to, message.amount);
        }
        
        emit MintMessageReceived(srcChainId, message.to, message.amount);
    }

    // @notice Burns GNS from caller, then sends a cross-chain message to the destination chain.
    // @param dstChainId The **LayerZero** destination chain ID.
    function bridgeTokens(uint16 dstChainId, uint amount) external payable whenNotPaused {
        require(msg.value != 0, "!fee");
        require(amount > 0, "!amount");

        address sender = _msgSender();
        tryBurn(sender, amount);

        _lzSend(
            dstChainId,
            buildBridgeMessage(sender, amount),
            payable(sender),  // refund address (LayerZero will refund any extra gas back to caller)
            address(0x0),     // unused
            bytes(""),        // unused
            msg.value         // native fee amount
        );

        emit BridgingInitiated(dstChainId, sender, amount);
    }

    // @notice Used by the frontend to estimate how much native token should be sent with bridgeTokens() for LayerZero fees.
    // @param dstChainId The **LayerZero** destination chain ID.
    function estimateNativeFee(
        uint16 dstChainId,
        address to,
        uint amount
    ) external view returns (uint nativeFee) {
        (nativeFee, ) = lzEndpoint.estimateFees(
            dstChainId,
            address(this),
            buildBridgeMessage(to, amount),
            false,
            bytes("")
        );
    }
}

File 2 of 16 : ILayerZeroEndpoint.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.5.0;

import "./ILayerZeroUserApplicationConfig.sol";

interface ILayerZeroEndpoint is ILayerZeroUserApplicationConfig {
    // @notice send a LayerZero message to the specified address at a LayerZero endpoint.
    // @param _dstChainId - the destination chain identifier
    // @param _destination - the address on destination chain (in bytes). address length/format may vary by chains
    // @param _payload - a custom bytes payload to send to the destination contract
    // @param _refundAddress - if the source transaction is cheaper than the amount of value passed, refund the additional amount to this address
    // @param _zroPaymentAddress - the address of the ZRO token holder who would pay for the transaction
    // @param _adapterParams - parameters for custom functionality. e.g. receive airdropped native gas from the relayer on destination
    function send(uint16 _dstChainId, bytes calldata _destination, bytes calldata _payload, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams) external payable;

    // @notice used by the messaging library to publish verified payload
    // @param _srcChainId - the source chain identifier
    // @param _srcAddress - the source contract (as bytes) at the source chain
    // @param _dstAddress - the address on destination chain
    // @param _nonce - the unbound message ordering nonce
    // @param _gasLimit - the gas limit for external contract execution
    // @param _payload - verified payload to send to the destination contract
    function receivePayload(uint16 _srcChainId, bytes calldata _srcAddress, address _dstAddress, uint64 _nonce, uint _gasLimit, bytes calldata _payload) external;

    // @notice get the inboundNonce of a lzApp from a source chain which could be EVM or non-EVM chain
    // @param _srcChainId - the source chain identifier
    // @param _srcAddress - the source chain contract address
    function getInboundNonce(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (uint64);

    // @notice get the outboundNonce from this source chain which, consequently, is always an EVM
    // @param _srcAddress - the source chain contract address
    function getOutboundNonce(uint16 _dstChainId, address _srcAddress) external view returns (uint64);

    // @notice gets a quote in source native gas, for the amount that send() requires to pay for message delivery
    // @param _dstChainId - the destination chain identifier
    // @param _userApplication - the user app address on this EVM chain
    // @param _payload - the custom message to send over LayerZero
    // @param _payInZRO - if false, user app pays the protocol fee in native token
    // @param _adapterParam - parameters for the adapter service, e.g. send some dust native token to dstChain
    function estimateFees(uint16 _dstChainId, address _userApplication, bytes calldata _payload, bool _payInZRO, bytes calldata _adapterParam) external view returns (uint nativeFee, uint zroFee);

    // @notice get this Endpoint's immutable source identifier
    function getChainId() external view returns (uint16);

    // @notice the interface to retry failed message on this Endpoint destination
    // @param _srcChainId - the source chain identifier
    // @param _srcAddress - the source chain contract address
    // @param _payload - the payload to be retried
    function retryPayload(uint16 _srcChainId, bytes calldata _srcAddress, bytes calldata _payload) external;

    // @notice query if any STORED payload (message blocking) at the endpoint.
    // @param _srcChainId - the source chain identifier
    // @param _srcAddress - the source chain contract address
    function hasStoredPayload(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (bool);

    // @notice query if the _libraryAddress is valid for sending msgs.
    // @param _userApplication - the user app address on this EVM chain
    function getSendLibraryAddress(address _userApplication) external view returns (address);

    // @notice query if the _libraryAddress is valid for receiving msgs.
    // @param _userApplication - the user app address on this EVM chain
    function getReceiveLibraryAddress(address _userApplication) external view returns (address);

    // @notice query if the non-reentrancy guard for send() is on
    // @return true if the guard is on. false otherwise
    function isSendingPayload() external view returns (bool);

    // @notice query if the non-reentrancy guard for receive() is on
    // @return true if the guard is on. false otherwise
    function isReceivingPayload() external view returns (bool);

    // @notice get the configuration of the LayerZero messaging library of the specified version
    // @param _version - messaging library version
    // @param _chainId - the chainId for the pending config change
    // @param _userApplication - the contract address of the user application
    // @param _configType - type of configuration. every messaging library has its own convention.
    function getConfig(uint16 _version, uint16 _chainId, address _userApplication, uint _configType) external view returns (bytes memory);

    // @notice get the send() LayerZero messaging library version
    // @param _userApplication - the contract address of the user application
    function getSendVersion(address _userApplication) external view returns (uint16);

    // @notice get the lzReceive() LayerZero messaging library version
    // @param _userApplication - the contract address of the user application
    function getReceiveVersion(address _userApplication) external view returns (uint16);
}

File 3 of 16 : ILayerZeroReceiver.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.5.0;

interface ILayerZeroReceiver {
    // @notice LayerZero endpoint will invoke this function to deliver the message on the destination
    // @param _srcChainId - the source endpoint identifier
    // @param _srcAddress - the source sending contract address from the source chain
    // @param _nonce - the ordered message nonce
    // @param _payload - the signed payload is the UA bytes has encoded to be sent
    function lzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) external;
}

File 4 of 16 : ILayerZeroUserApplicationConfig.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.5.0;

interface ILayerZeroUserApplicationConfig {
    // @notice set the configuration of the LayerZero messaging library of the specified version
    // @param _version - messaging library version
    // @param _chainId - the chainId for the pending config change
    // @param _configType - type of configuration. every messaging library has its own convention.
    // @param _config - configuration in the bytes. can encode arbitrary content.
    function setConfig(uint16 _version, uint16 _chainId, uint _configType, bytes calldata _config) external;

    // @notice set the send() LayerZero messaging library version to _version
    // @param _version - new messaging library version
    function setSendVersion(uint16 _version) external;

    // @notice set the lzReceive() LayerZero messaging library version to _version
    // @param _version - new messaging library version
    function setReceiveVersion(uint16 _version) external;

    // @notice Only when the UA needs to resume the message flow in blocking mode and clear the stored payload
    // @param _srcChainId - the chainId of the source chain
    // @param _srcAddress - the contract address of the source contract at the source chain
    function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) external;
}

File 5 of 16 : LzApp.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/access/Ownable.sol";
import "../interfaces/ILayerZeroReceiver.sol";
import "../interfaces/ILayerZeroUserApplicationConfig.sol";
import "../interfaces/ILayerZeroEndpoint.sol";
import "../util/BytesLib.sol";

/*
 * a generic LzReceiver implementation
 */
abstract contract LzApp is Ownable, ILayerZeroReceiver, ILayerZeroUserApplicationConfig {
    using BytesLib for bytes;

    ILayerZeroEndpoint public immutable lzEndpoint;
    mapping(uint16 => bytes) public trustedRemoteLookup;
    mapping(uint16 => mapping(uint16 => uint)) public minDstGasLookup;
    address public precrime;

    event SetPrecrime(address precrime);
    event SetTrustedRemote(uint16 _remoteChainId, bytes _path);
    event SetTrustedRemoteAddress(uint16 _remoteChainId, bytes _remoteAddress);
    event SetMinDstGas(uint16 _dstChainId, uint16 _type, uint _minDstGas);

    constructor(address _endpoint) {
        lzEndpoint = ILayerZeroEndpoint(_endpoint);
    }

    function lzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) public virtual override {
        // lzReceive must be called by the endpoint for security
        require(_msgSender() == address(lzEndpoint), "LzApp: invalid endpoint caller");

        bytes memory trustedRemote = trustedRemoteLookup[_srcChainId];
        // if will still block the message pathway from (srcChainId, srcAddress). should not receive message from untrusted remote.
        require(_srcAddress.length == trustedRemote.length && trustedRemote.length > 0 && keccak256(_srcAddress) == keccak256(trustedRemote), "LzApp: invalid source sending contract");

        _blockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload);
    }

    // abstract function - the default behaviour of LayerZero is blocking. See: NonblockingLzApp if you dont need to enforce ordered messaging
    function _blockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual;

    function _lzSend(uint16 _dstChainId, bytes memory _payload, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams, uint _nativeFee) internal virtual {
        bytes memory trustedRemote = trustedRemoteLookup[_dstChainId];
        require(trustedRemote.length != 0, "LzApp: destination chain is not a trusted source");
        lzEndpoint.send{value: _nativeFee}(_dstChainId, trustedRemote, _payload, _refundAddress, _zroPaymentAddress, _adapterParams);
    }

    function _checkGasLimit(uint16 _dstChainId, uint16 _type, bytes memory _adapterParams, uint _extraGas) internal view virtual {
        uint providedGasLimit = _getGasLimit(_adapterParams);
        uint minGasLimit = minDstGasLookup[_dstChainId][_type] + _extraGas;
        require(minGasLimit > 0, "LzApp: minGasLimit not set");
        require(providedGasLimit >= minGasLimit, "LzApp: gas limit is too low");
    }

    function _getGasLimit(bytes memory _adapterParams) internal pure virtual returns (uint gasLimit) {
        require(_adapterParams.length >= 34, "LzApp: invalid adapterParams");
        assembly {
            gasLimit := mload(add(_adapterParams, 34))
        }
    }

    //---------------------------UserApplication config----------------------------------------
    function getConfig(uint16 _version, uint16 _chainId, address, uint _configType) external view returns (bytes memory) {
        return lzEndpoint.getConfig(_version, _chainId, address(this), _configType);
    }

    // generic config for LayerZero user Application
    function setConfig(uint16 _version, uint16 _chainId, uint _configType, bytes calldata _config) external override onlyOwner {
        lzEndpoint.setConfig(_version, _chainId, _configType, _config);
    }

    function setSendVersion(uint16 _version) external override onlyOwner {
        lzEndpoint.setSendVersion(_version);
    }

    function setReceiveVersion(uint16 _version) external override onlyOwner {
        lzEndpoint.setReceiveVersion(_version);
    }

    function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) external override onlyOwner {
        lzEndpoint.forceResumeReceive(_srcChainId, _srcAddress);
    }

    // _path = abi.encodePacked(remoteAddress, localAddress)
    // this function set the trusted path for the cross-chain communication
    function setTrustedRemote(uint16 _srcChainId, bytes calldata _path) external onlyOwner {
        trustedRemoteLookup[_srcChainId] = _path;
        emit SetTrustedRemote(_srcChainId, _path);
    }

    function setTrustedRemoteAddress(uint16 _remoteChainId, bytes calldata _remoteAddress) external onlyOwner {
        trustedRemoteLookup[_remoteChainId] = abi.encodePacked(_remoteAddress, address(this));
        emit SetTrustedRemoteAddress(_remoteChainId, _remoteAddress);
    }

    function getTrustedRemoteAddress(uint16 _remoteChainId) external view returns (bytes memory) {
        bytes memory path = trustedRemoteLookup[_remoteChainId];
        require(path.length != 0, "LzApp: no trusted path record");
        return path.slice(0, path.length - 20); // the last 20 bytes should be address(this)
    }

    function setPrecrime(address _precrime) external onlyOwner {
        precrime = _precrime;
        emit SetPrecrime(_precrime);
    }

    function setMinDstGas(uint16 _dstChainId, uint16 _packetType, uint _minGas) external onlyOwner {
        require(_minGas > 0, "LzApp: invalid minGas");
        minDstGasLookup[_dstChainId][_packetType] = _minGas;
        emit SetMinDstGas(_dstChainId, _packetType, _minGas);
    }

    //--------------------------- VIEW FUNCTION ----------------------------------------
    function isTrustedRemote(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (bool) {
        bytes memory trustedSource = trustedRemoteLookup[_srcChainId];
        return keccak256(trustedSource) == keccak256(_srcAddress);
    }
}

File 6 of 16 : NonblockingLzApp.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./LzApp.sol";
import "../util/ExcessivelySafeCall.sol";

/*
 * the default LayerZero messaging behaviour is blocking, i.e. any failed message will block the channel
 * this abstract class try-catch all fail messages and store locally for future retry. hence, non-blocking
 * NOTE: if the srcAddress is not configured properly, it will still block the message pathway from (srcChainId, srcAddress)
 */
abstract contract NonblockingLzApp is LzApp {
    using ExcessivelySafeCall for address;

    constructor(address _endpoint) LzApp(_endpoint) {}

    mapping(uint16 => mapping(bytes => mapping(uint64 => bytes32))) public failedMessages;

    event MessageFailed(uint16 _srcChainId, bytes _srcAddress, uint64 _nonce, bytes _payload, bytes _reason);
    event RetryMessageSuccess(uint16 _srcChainId, bytes _srcAddress, uint64 _nonce, bytes32 _payloadHash);

    // overriding the virtual function in LzReceiver
    function _blockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual override {
        (bool success, bytes memory reason) = address(this).excessivelySafeCall(gasleft(), 150, abi.encodeWithSelector(this.nonblockingLzReceive.selector, _srcChainId, _srcAddress, _nonce, _payload));
        // try-catch all errors/exceptions
        if (!success) {
            _storeFailedMessage(_srcChainId, _srcAddress, _nonce, _payload, reason);
        }
    }

    function _storeFailedMessage(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload, bytes memory _reason) internal virtual {
        failedMessages[_srcChainId][_srcAddress][_nonce] = keccak256(_payload);
        emit MessageFailed(_srcChainId, _srcAddress, _nonce, _payload, _reason);
    }

    function nonblockingLzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) public virtual {
        // only internal transaction
        require(_msgSender() == address(this), "NonblockingLzApp: caller must be LzApp");
        _nonblockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload);
    }

    //@notice override this function
    function _nonblockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual;

    function retryMessage(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) public payable virtual {
        // assert there is message to retry
        bytes32 payloadHash = failedMessages[_srcChainId][_srcAddress][_nonce];
        require(payloadHash != bytes32(0), "NonblockingLzApp: no stored message");
        require(keccak256(_payload) == payloadHash, "NonblockingLzApp: invalid payload");
        // clear the stored message
        failedMessages[_srcChainId][_srcAddress][_nonce] = bytes32(0);
        // execute the message. revert if it fails again
        _nonblockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload);
        emit RetryMessageSuccess(_srcChainId, _srcAddress, _nonce, payloadHash);
    }
}

File 7 of 16 : BytesLib.sol
// SPDX-License-Identifier: Unlicense
/*
 * @title Solidity Bytes Arrays Utils
 * @author Gonçalo Sá <[email protected]>
 *
 * @dev Bytes tightly packed arrays utility library for ethereum contracts written in Solidity.
 *      The library lets you concatenate, slice and type cast bytes arrays both in memory and storage.
 */
pragma solidity >=0.8.0 <0.9.0;


library BytesLib {
    function concat(
        bytes memory _preBytes,
        bytes memory _postBytes
    )
    internal
    pure
    returns (bytes memory)
    {
        bytes memory tempBytes;

        assembly {
        // Get a location of some free memory and store it in tempBytes as
        // Solidity does for memory variables.
            tempBytes := mload(0x40)

        // Store the length of the first bytes array at the beginning of
        // the memory for tempBytes.
            let length := mload(_preBytes)
            mstore(tempBytes, length)

        // Maintain a memory counter for the current write location in the
        // temp bytes array by adding the 32 bytes for the array length to
        // the starting location.
            let mc := add(tempBytes, 0x20)
        // Stop copying when the memory counter reaches the length of the
        // first bytes array.
            let end := add(mc, length)

            for {
            // Initialize a copy counter to the start of the _preBytes data,
            // 32 bytes into its memory.
                let cc := add(_preBytes, 0x20)
            } lt(mc, end) {
            // Increase both counters by 32 bytes each iteration.
                mc := add(mc, 0x20)
                cc := add(cc, 0x20)
            } {
            // Write the _preBytes data into the tempBytes memory 32 bytes
            // at a time.
                mstore(mc, mload(cc))
            }

        // Add the length of _postBytes to the current length of tempBytes
        // and store it as the new length in the first 32 bytes of the
        // tempBytes memory.
            length := mload(_postBytes)
            mstore(tempBytes, add(length, mload(tempBytes)))

        // Move the memory counter back from a multiple of 0x20 to the
        // actual end of the _preBytes data.
            mc := end
        // Stop copying when the memory counter reaches the new combined
        // length of the arrays.
            end := add(mc, length)

            for {
                let cc := add(_postBytes, 0x20)
            } lt(mc, end) {
                mc := add(mc, 0x20)
                cc := add(cc, 0x20)
            } {
                mstore(mc, mload(cc))
            }

        // Update the free-memory pointer by padding our last write location
        // to 32 bytes: add 31 bytes to the end of tempBytes to move to the
        // next 32 byte block, then round down to the nearest multiple of
        // 32. If the sum of the length of the two arrays is zero then add
        // one before rounding down to leave a blank 32 bytes (the length block with 0).
            mstore(0x40, and(
            add(add(end, iszero(add(length, mload(_preBytes)))), 31),
            not(31) // Round down to the nearest 32 bytes.
            ))
        }

        return tempBytes;
    }

    function concatStorage(bytes storage _preBytes, bytes memory _postBytes) internal {
        assembly {
        // Read the first 32 bytes of _preBytes storage, which is the length
        // of the array. (We don't need to use the offset into the slot
        // because arrays use the entire slot.)
            let fslot := sload(_preBytes.slot)
        // Arrays of 31 bytes or less have an even value in their slot,
        // while longer arrays have an odd value. The actual length is
        // the slot divided by two for odd values, and the lowest order
        // byte divided by two for even values.
        // If the slot is even, bitwise and the slot with 255 and divide by
        // two to get the length. If the slot is odd, bitwise and the slot
        // with -1 and divide by two.
            let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2)
            let mlength := mload(_postBytes)
            let newlength := add(slength, mlength)
        // slength can contain both the length and contents of the array
        // if length < 32 bytes so let's prepare for that
        // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage
            switch add(lt(slength, 32), lt(newlength, 32))
            case 2 {
            // Since the new array still fits in the slot, we just need to
            // update the contents of the slot.
            // uint256(bytes_storage) = uint256(bytes_storage) + uint256(bytes_memory) + new_length
                sstore(
                _preBytes.slot,
                // all the modifications to the slot are inside this
                // next block
                add(
                // we can just add to the slot contents because the
                // bytes we want to change are the LSBs
                fslot,
                add(
                mul(
                div(
                // load the bytes from memory
                mload(add(_postBytes, 0x20)),
                // zero all bytes to the right
                exp(0x100, sub(32, mlength))
                ),
                // and now shift left the number of bytes to
                // leave space for the length in the slot
                exp(0x100, sub(32, newlength))
                ),
                // increase length by the double of the memory
                // bytes length
                mul(mlength, 2)
                )
                )
                )
            }
            case 1 {
            // The stored value fits in the slot, but the combined value
            // will exceed it.
            // get the keccak hash to get the contents of the array
                mstore(0x0, _preBytes.slot)
                let sc := add(keccak256(0x0, 0x20), div(slength, 32))

            // save new length
                sstore(_preBytes.slot, add(mul(newlength, 2), 1))

            // The contents of the _postBytes array start 32 bytes into
            // the structure. Our first read should obtain the `submod`
            // bytes that can fit into the unused space in the last word
            // of the stored array. To get this, we read 32 bytes starting
            // from `submod`, so the data we read overlaps with the array
            // contents by `submod` bytes. Masking the lowest-order
            // `submod` bytes allows us to add that value directly to the
            // stored value.

                let submod := sub(32, slength)
                let mc := add(_postBytes, submod)
                let end := add(_postBytes, mlength)
                let mask := sub(exp(0x100, submod), 1)

                sstore(
                sc,
                add(
                and(
                fslot,
                0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00
                ),
                and(mload(mc), mask)
                )
                )

                for {
                    mc := add(mc, 0x20)
                    sc := add(sc, 1)
                } lt(mc, end) {
                    sc := add(sc, 1)
                    mc := add(mc, 0x20)
                } {
                    sstore(sc, mload(mc))
                }

                mask := exp(0x100, sub(mc, end))

                sstore(sc, mul(div(mload(mc), mask), mask))
            }
            default {
            // get the keccak hash to get the contents of the array
                mstore(0x0, _preBytes.slot)
            // Start copying to the last used word of the stored array.
                let sc := add(keccak256(0x0, 0x20), div(slength, 32))

            // save new length
                sstore(_preBytes.slot, add(mul(newlength, 2), 1))

            // Copy over the first `submod` bytes of the new data as in
            // case 1 above.
                let slengthmod := mod(slength, 32)
                let mlengthmod := mod(mlength, 32)
                let submod := sub(32, slengthmod)
                let mc := add(_postBytes, submod)
                let end := add(_postBytes, mlength)
                let mask := sub(exp(0x100, submod), 1)

                sstore(sc, add(sload(sc), and(mload(mc), mask)))

                for {
                    sc := add(sc, 1)
                    mc := add(mc, 0x20)
                } lt(mc, end) {
                    sc := add(sc, 1)
                    mc := add(mc, 0x20)
                } {
                    sstore(sc, mload(mc))
                }

                mask := exp(0x100, sub(mc, end))

                sstore(sc, mul(div(mload(mc), mask), mask))
            }
        }
    }

    function slice(
        bytes memory _bytes,
        uint256 _start,
        uint256 _length
    )
    internal
    pure
    returns (bytes memory)
    {
        require(_length + 31 >= _length, "slice_overflow");
        require(_bytes.length >= _start + _length, "slice_outOfBounds");

        bytes memory tempBytes;

        assembly {
            switch iszero(_length)
            case 0 {
            // Get a location of some free memory and store it in tempBytes as
            // Solidity does for memory variables.
                tempBytes := mload(0x40)

            // The first word of the slice result is potentially a partial
            // word read from the original array. To read it, we calculate
            // the length of that partial word and start copying that many
            // bytes into the array. The first word we copy will start with
            // data we don't care about, but the last `lengthmod` bytes will
            // land at the beginning of the contents of the new array. When
            // we're done copying, we overwrite the full first word with
            // the actual length of the slice.
                let lengthmod := and(_length, 31)

            // The multiplication in the next line is necessary
            // because when slicing multiples of 32 bytes (lengthmod == 0)
            // the following copy loop was copying the origin's length
            // and then ending prematurely not copying everything it should.
                let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))
                let end := add(mc, _length)

                for {
                // The multiplication in the next line has the same exact purpose
                // as the one above.
                    let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)
                } lt(mc, end) {
                    mc := add(mc, 0x20)
                    cc := add(cc, 0x20)
                } {
                    mstore(mc, mload(cc))
                }

                mstore(tempBytes, _length)

            //update free-memory pointer
            //allocating the array padded to 32 bytes like the compiler does now
                mstore(0x40, and(add(mc, 31), not(31)))
            }
            //if we want a zero-length slice let's just return a zero-length array
            default {
                tempBytes := mload(0x40)
            //zero out the 32 bytes slice we are about to return
            //we need to do it because Solidity does not garbage collect
                mstore(tempBytes, 0)

                mstore(0x40, add(tempBytes, 0x20))
            }
        }

        return tempBytes;
    }

    function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) {
        require(_bytes.length >= _start + 20, "toAddress_outOfBounds");
        address tempAddress;

        assembly {
            tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)
        }

        return tempAddress;
    }

    function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) {
        require(_bytes.length >= _start + 1 , "toUint8_outOfBounds");
        uint8 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x1), _start))
        }

        return tempUint;
    }

    function toUint16(bytes memory _bytes, uint256 _start) internal pure returns (uint16) {
        require(_bytes.length >= _start + 2, "toUint16_outOfBounds");
        uint16 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x2), _start))
        }

        return tempUint;
    }

    function toUint32(bytes memory _bytes, uint256 _start) internal pure returns (uint32) {
        require(_bytes.length >= _start + 4, "toUint32_outOfBounds");
        uint32 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x4), _start))
        }

        return tempUint;
    }

    function toUint64(bytes memory _bytes, uint256 _start) internal pure returns (uint64) {
        require(_bytes.length >= _start + 8, "toUint64_outOfBounds");
        uint64 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x8), _start))
        }

        return tempUint;
    }

    function toUint96(bytes memory _bytes, uint256 _start) internal pure returns (uint96) {
        require(_bytes.length >= _start + 12, "toUint96_outOfBounds");
        uint96 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0xc), _start))
        }

        return tempUint;
    }

    function toUint128(bytes memory _bytes, uint256 _start) internal pure returns (uint128) {
        require(_bytes.length >= _start + 16, "toUint128_outOfBounds");
        uint128 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x10), _start))
        }

        return tempUint;
    }

    function toUint256(bytes memory _bytes, uint256 _start) internal pure returns (uint256) {
        require(_bytes.length >= _start + 32, "toUint256_outOfBounds");
        uint256 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x20), _start))
        }

        return tempUint;
    }

    function toBytes32(bytes memory _bytes, uint256 _start) internal pure returns (bytes32) {
        require(_bytes.length >= _start + 32, "toBytes32_outOfBounds");
        bytes32 tempBytes32;

        assembly {
            tempBytes32 := mload(add(add(_bytes, 0x20), _start))
        }

        return tempBytes32;
    }

    function equal(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bool) {
        bool success = true;

        assembly {
            let length := mload(_preBytes)

        // if lengths don't match the arrays are not equal
            switch eq(length, mload(_postBytes))
            case 1 {
            // cb is a circuit breaker in the for loop since there's
            //  no said feature for inline assembly loops
            // cb = 1 - don't breaker
            // cb = 0 - break
                let cb := 1

                let mc := add(_preBytes, 0x20)
                let end := add(mc, length)

                for {
                    let cc := add(_postBytes, 0x20)
                // the next line is the loop condition:
                // while(uint256(mc < end) + cb == 2)
                } eq(add(lt(mc, end), cb), 2) {
                    mc := add(mc, 0x20)
                    cc := add(cc, 0x20)
                } {
                // if any of these checks fails then arrays are not equal
                    if iszero(eq(mload(mc), mload(cc))) {
                    // unsuccess:
                        success := 0
                        cb := 0
                    }
                }
            }
            default {
            // unsuccess:
                success := 0
            }
        }

        return success;
    }

    function equalStorage(
        bytes storage _preBytes,
        bytes memory _postBytes
    )
    internal
    view
    returns (bool)
    {
        bool success = true;

        assembly {
        // we know _preBytes_offset is 0
            let fslot := sload(_preBytes.slot)
        // Decode the length of the stored array like in concatStorage().
            let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2)
            let mlength := mload(_postBytes)

        // if lengths don't match the arrays are not equal
            switch eq(slength, mlength)
            case 1 {
            // slength can contain both the length and contents of the array
            // if length < 32 bytes so let's prepare for that
            // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage
                if iszero(iszero(slength)) {
                    switch lt(slength, 32)
                    case 1 {
                    // blank the last byte which is the length
                        fslot := mul(div(fslot, 0x100), 0x100)

                        if iszero(eq(fslot, mload(add(_postBytes, 0x20)))) {
                        // unsuccess:
                            success := 0
                        }
                    }
                    default {
                    // cb is a circuit breaker in the for loop since there's
                    //  no said feature for inline assembly loops
                    // cb = 1 - don't breaker
                    // cb = 0 - break
                        let cb := 1

                    // get the keccak hash to get the contents of the array
                        mstore(0x0, _preBytes.slot)
                        let sc := keccak256(0x0, 0x20)

                        let mc := add(_postBytes, 0x20)
                        let end := add(mc, mlength)

                    // the next line is the loop condition:
                    // while(uint256(mc < end) + cb == 2)
                        for {} eq(add(lt(mc, end), cb), 2) {
                            sc := add(sc, 1)
                            mc := add(mc, 0x20)
                        } {
                            if iszero(eq(sload(sc), mload(mc))) {
                            // unsuccess:
                                success := 0
                                cb := 0
                            }
                        }
                    }
                }
            }
            default {
            // unsuccess:
                success := 0
            }
        }

        return success;
    }
}

File 8 of 16 : ExcessivelySafeCall.sol
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.7.6;

library ExcessivelySafeCall {
    uint256 constant LOW_28_MASK =
    0x00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff;

    /// @notice Use when you _really_ really _really_ don't trust the called
    /// contract. This prevents the called contract from causing reversion of
    /// the caller in as many ways as we can.
    /// @dev The main difference between this and a solidity low-level call is
    /// that we limit the number of bytes that the callee can cause to be
    /// copied to caller memory. This prevents stupid things like malicious
    /// contracts returning 10,000,000 bytes causing a local OOG when copying
    /// to memory.
    /// @param _target The address to call
    /// @param _gas The amount of gas to forward to the remote contract
    /// @param _maxCopy The maximum number of bytes of returndata to copy
    /// to memory.
    /// @param _calldata The data to send to the remote contract
    /// @return success and returndata, as `.call()`. Returndata is capped to
    /// `_maxCopy` bytes.
    function excessivelySafeCall(
        address _target,
        uint256 _gas,
        uint16 _maxCopy,
        bytes memory _calldata
    ) internal returns (bool, bytes memory) {
        // set up for assembly call
        uint256 _toCopy;
        bool _success;
        bytes memory _returnData = new bytes(_maxCopy);
        // dispatch message to recipient
        // by assembly calling "handle" function
        // we call via assembly to avoid memcopying a very large returndata
        // returned by a malicious contract
        assembly {
            _success := call(
            _gas, // gas
            _target, // recipient
            0, // ether value
            add(_calldata, 0x20), // inloc
            mload(_calldata), // inlen
            0, // outloc
            0 // outlen
            )
        // limit our copy to 256 bytes
            _toCopy := returndatasize()
            if gt(_toCopy, _maxCopy) {
                _toCopy := _maxCopy
            }
        // Store the length of the copied bytes
            mstore(_returnData, _toCopy)
        // copy the bytes from returndata[0:_toCopy]
            returndatacopy(add(_returnData, 0x20), 0, _toCopy)
        }
        return (_success, _returnData);
    }

    /// @notice Use when you _really_ really _really_ don't trust the called
    /// contract. This prevents the called contract from causing reversion of
    /// the caller in as many ways as we can.
    /// @dev The main difference between this and a solidity low-level call is
    /// that we limit the number of bytes that the callee can cause to be
    /// copied to caller memory. This prevents stupid things like malicious
    /// contracts returning 10,000,000 bytes causing a local OOG when copying
    /// to memory.
    /// @param _target The address to call
    /// @param _gas The amount of gas to forward to the remote contract
    /// @param _maxCopy The maximum number of bytes of returndata to copy
    /// to memory.
    /// @param _calldata The data to send to the remote contract
    /// @return success and returndata, as `.call()`. Returndata is capped to
    /// `_maxCopy` bytes.
    function excessivelySafeStaticCall(
        address _target,
        uint256 _gas,
        uint16 _maxCopy,
        bytes memory _calldata
    ) internal view returns (bool, bytes memory) {
        // set up for assembly call
        uint256 _toCopy;
        bool _success;
        bytes memory _returnData = new bytes(_maxCopy);
        // dispatch message to recipient
        // by assembly calling "handle" function
        // we call via assembly to avoid memcopying a very large returndata
        // returned by a malicious contract
        assembly {
            _success := staticcall(
            _gas, // gas
            _target, // recipient
            add(_calldata, 0x20), // inloc
            mload(_calldata), // inlen
            0, // outloc
            0 // outlen
            )
        // limit our copy to 256 bytes
            _toCopy := returndatasize()
            if gt(_toCopy, _maxCopy) {
                _toCopy := _maxCopy
            }
        // Store the length of the copied bytes
            mstore(_returnData, _toCopy)
        // copy the bytes from returndata[0:_toCopy]
            returndatacopy(add(_returnData, 0x20), 0, _toCopy)
        }
        return (_success, _returnData);
    }

    /**
     * @notice Swaps function selectors in encoded contract calls
     * @dev Allows reuse of encoded calldata for functions with identical
     * argument types but different names. It simply swaps out the first 4 bytes
     * for the new selector. This function modifies memory in place, and should
     * only be used with caution.
     * @param _newSelector The new 4-byte selector
     * @param _buf The encoded contract args
     */
    function swapSelector(bytes4 _newSelector, bytes memory _buf)
    internal
    pure
    {
        require(_buf.length >= 4);
        uint256 _mask = LOW_28_MASK;
        assembly {
        // load the first word of
            let _word := mload(add(_buf, 0x20))
        // mask out the top 4 bytes
        // /x
            _word := and(_word, _mask)
            _word := or(_newSelector, _word)
            mstore(add(_buf, 0x20), _word)
        }
    }
}

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

pragma solidity ^0.8.0;

import "../utils/Context.sol";

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

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

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

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

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

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

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

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

File 10 of 16 : Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

File 11 of 16 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

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) {
        return msg.data;
    }
}

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

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1);

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator,
        Rounding rounding
    ) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10**64) {
                value /= 10**64;
                result += 64;
            }
            if (value >= 10**32) {
                value /= 10**32;
                result += 32;
            }
            if (value >= 10**16) {
                value /= 10**16;
                result += 16;
            }
            if (value >= 10**8) {
                value /= 10**8;
                result += 8;
            }
            if (value >= 10**4) {
                value /= 10**4;
                result += 4;
            }
            if (value >= 10**2) {
                value /= 10**2;
                result += 2;
            }
            if (value >= 10**1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
        }
    }
}

File 13 of 16 : EpochBasedLimiter.sol
//SPDX-License-Identifier: MIT
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";

import "./../interfaces/IEpochBasedLimiter.sol";

pragma solidity 0.8.17;

abstract contract EpochBasedLimiter is Ownable, Pausable, IEpochBasedLimiter {
    
    // Constants
    uint public constant MIN_EPOCH_DURATION = 30 minutes;
    uint public constant MAX_EPOCH_DURATION = 1 weeks;
    uint public immutable MAX_EPOCH_LIMIT;

    // Epoch params
    uint public epochDuration;
    uint public epochLimit;

    // Epoch state
    uint public currentEpoch;
    uint public currentEpochStart;
    uint public currentEpochCount;

    // Blacklist
    mapping(address => bool) public blacklist;

    // Events
    event EpochDurationUpdated(uint epochDuration);
    event EpochLimitUpdated(uint epochLimit);
    event EpochStarted(uint indexed epochId, uint epochStart);
    event Blacklisted(address indexed receiver, bool isBlacklisted);

    constructor(
        address _owner,
        uint _maxEpochLimit,
        uint _epochDuration,
        uint _epochLimit
    ) {
        require(
            _owner != address(0) &&
            _maxEpochLimit > 0 &&
            _epochDuration >= MIN_EPOCH_DURATION &&
            _epochDuration <= MAX_EPOCH_DURATION &&
            _epochLimit <= _maxEpochLimit,
            "WRONG_PARAMS"
        );

        MAX_EPOCH_LIMIT = _maxEpochLimit;

        epochDuration = _epochDuration;
        epochLimit = _epochLimit;

        currentEpoch = 1;
        currentEpochStart = block.timestamp;

        _transferOwnership(_owner);
    }

    // @notice Pause functions
    function pause() external onlyOwner {
        _pause();
    }

    function unpause() external onlyOwner {
        _unpause();
    }

    // @dev Updates duration of epoch in seconds
    function updateEpochDuration(uint _epochDuration) external onlyOwner {
        require(
            _epochDuration >= MIN_EPOCH_DURATION && _epochDuration <= MAX_EPOCH_DURATION,
            "INVALID_EPOCH_DURATION"
        );
        epochDuration = _epochDuration;

        emit EpochDurationUpdated(_epochDuration);
    }

    // @dev Update epoch limit
    function updateEpochLimit(uint _epochLimit) external onlyOwner {
        require(_epochLimit <= MAX_EPOCH_LIMIT, "INVALID_EPOCH_LIMIT");
        epochLimit = _epochLimit;

        emit EpochLimitUpdated(_epochLimit);
    }

    // @dev Adds address to blacklist. Prevents minting, burning, and using pending claims.
    function blacklistReceiver(address receiver, bool blacklisted) external onlyOwner {
        blacklist[receiver] = blacklisted;
        emit Blacklisted(receiver, blacklisted);
    }

    // @dev Tries to rotate epoch window
    function tryUpdateEpoch() public {
        if (block.timestamp >= currentEpochStart + epochDuration) {
            currentEpoch ++;
            currentEpochStart = block.timestamp;
            currentEpochCount = 0;
            
            emit EpochStarted(currentEpoch, currentEpochStart);
        }
    }
}

File 14 of 16 : ERC20BridgeRateLimiter.sol
//SPDX-License-Identifier: MIT
import "@openzeppelin/contracts/utils/math/Math.sol";

import "./../interfaces/IERC20MintableBurnable.sol";
import "./EpochBasedLimiter.sol";

pragma solidity 0.8.17;

abstract contract ERC20BridgeRateLimiter is EpochBasedLimiter {

    // Addresses
    IERC20MintableBurnable public token;

    // Pending claims
    struct PendingClaim {
        uint amount;
        uint claimTimestamp;
    }
    mapping(address => PendingClaim) public pendingClaims;

    // Events
    event Burned(address indexed from, uint amount);
    event Minted(address indexed to, uint amount);
    event PendingClaimUpdated(address indexed to, uint amount, uint claimTimestamp);
    event PendingClaimExecuted(address indexed to, uint amount);

    constructor(
        IERC20MintableBurnable _token,
        address _owner,
        uint _maxEpochLimit,
        uint _epochDuration,
        uint _epochLimit
    ) EpochBasedLimiter(
        _owner,
        _maxEpochLimit,
        _epochDuration,
        _epochLimit
    ) {
        require(address(_token) != address(0), "ADDRESS_0");
        token = _token;
    }

    // @dev Initiating the bridging. Throttled by epoch limit and blacklist.
    function tryBurn(address from, uint amount) internal whenNotPaused {
        require(amount <= epochLimit, "AMOUNT_TOO_HIGH");
        require(!blacklist[from], "BLACKLISTED");
        token.burn(from, amount);
        
        emit Burned(from, amount);
    }

    // @dev Executing the second part of the bridging. Throttled by epoch limit and blacklist.
    function tryMint(address to, uint amount) internal whenNotPaused {
        require(amount <= MAX_EPOCH_LIMIT, "AMOUNT_TOO_HIGH");
        require(!blacklist[to], "BLACKLISTED");
        
        tryUpdateEpoch();

        uint mintAmount = Math.min(
            amount,
            epochLimit - Math.min(epochLimit, currentEpochCount)
        );

        // If epoch limit reached, add to pending claims and emit event
        if (mintAmount < amount) {
            addPendingClaim(to, amount - mintAmount);
        }

        currentEpochCount += mintAmount;
        token.mint(to, mintAmount);

        emit Minted(to, mintAmount);
    }

    // @dev Add pending claim when throttled by epoch limit
    function addPendingClaim(address to, uint amount) internal {
        PendingClaim storage pendingClaim = pendingClaims[to];
        pendingClaim.amount += amount;
        pendingClaim.claimTimestamp = block.timestamp + epochDuration;

        emit PendingClaimUpdated(to, pendingClaim.amount, pendingClaim.claimTimestamp);
    }

    // @notice Executes pending claim for receiver. Throttled by epoch limit and blacklist.
    function executePendingClaim(address receiver) external whenNotPaused {
        PendingClaim storage pendingClaim = pendingClaims[receiver];

        require(pendingClaim.amount > 0, "NO_PENDING_CLAIM");
        require(pendingClaim.claimTimestamp <= block.timestamp, "TOO_EARLY");
        require(!blacklist[receiver], "RECEIVER_BLACKLISTED");

        tryUpdateEpoch();

        uint claimAmount = Math.min(
            pendingClaim.amount,
            epochLimit - Math.min(epochLimit, currentEpochCount)
        );

        pendingClaim.amount -= claimAmount;

        if (pendingClaim.amount > 0) {
            pendingClaim.claimTimestamp = block.timestamp + epochDuration;

            emit PendingClaimUpdated(
                receiver,
                pendingClaim.amount,
                pendingClaim.claimTimestamp
            );
        }

        currentEpochCount += claimAmount;
        token.mint(receiver, claimAmount);

        emit PendingClaimExecuted(receiver, claimAmount);
    }
}

File 15 of 16 : IEpochBasedLimiter.sol
//SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

interface IEpochBasedLimiter {
    function epochLimit() external view returns (uint);
    function epochDuration() external view returns (uint);
    function currentEpoch() external view returns (uint);
    function currentEpochStart() external view returns (uint);
    function currentEpochCount() external view returns (uint);
    function tryUpdateEpoch() external;
}

File 16 of 16 : IERC20MintableBurnable.sol
//SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

interface IERC20MintableBurnable {
    function burn(address from, uint amount) external;
    function mint(address to, uint amount) external;
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_lzEndpoint","type":"address"},{"internalType":"contract IERC20MintableBurnable","name":"_token","type":"address"},{"internalType":"address","name":"_owner","type":"address"},{"internalType":"uint256","name":"_maxEpochLimit","type":"uint256"},{"internalType":"uint256","name":"_epochDuration","type":"uint256"},{"internalType":"uint256","name":"_epochLimit","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"bool","name":"isBlacklisted","type":"bool"}],"name":"Blacklisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint16","name":"targetChainId","type":"uint16"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"BridgingInitiated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Burned","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"epochDuration","type":"uint256"}],"name":"EpochDurationUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"epochLimit","type":"uint256"}],"name":"EpochLimitUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"epochId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"epochStart","type":"uint256"}],"name":"EpochStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"indexed":false,"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"indexed":false,"internalType":"uint64","name":"_nonce","type":"uint64"},{"indexed":false,"internalType":"bytes","name":"_payload","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"_reason","type":"bytes"}],"name":"MessageFailed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint16","name":"srcChainId","type":"uint16"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"MintMessageReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Minted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PendingClaimExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"claimTimestamp","type":"uint256"}],"name":"PendingClaimUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"indexed":false,"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"indexed":false,"internalType":"uint64","name":"_nonce","type":"uint64"},{"indexed":false,"internalType":"bytes32","name":"_payloadHash","type":"bytes32"}],"name":"RetryMessageSuccess","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"_type","type":"uint16"},{"indexed":false,"internalType":"uint256","name":"_minDstGas","type":"uint256"}],"name":"SetMinDstGas","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"precrime","type":"address"}],"name":"SetPrecrime","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_remoteChainId","type":"uint16"},{"indexed":false,"internalType":"bytes","name":"_path","type":"bytes"}],"name":"SetTrustedRemote","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_remoteChainId","type":"uint16"},{"indexed":false,"internalType":"bytes","name":"_remoteAddress","type":"bytes"}],"name":"SetTrustedRemoteAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"MAX_EPOCH_DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_EPOCH_LIMIT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_EPOCH_DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"blacklist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"bool","name":"blacklisted","type":"bool"}],"name":"blacklistReceiver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"dstChainId","type":"uint16"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"bridgeTokens","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"currentEpoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentEpochCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentEpochStart","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"epochDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"epochLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"dstChainId","type":"uint16"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"estimateNativeFee","outputs":[{"internalType":"uint256","name":"nativeFee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"executePendingClaim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"},{"internalType":"bytes","name":"","type":"bytes"},{"internalType":"uint64","name":"","type":"uint64"}],"name":"failedMessages","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"}],"name":"forceResumeReceive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_version","type":"uint16"},{"internalType":"uint16","name":"_chainId","type":"uint16"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"_configType","type":"uint256"}],"name":"getConfig","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_remoteChainId","type":"uint16"}],"name":"getTrustedRemoteAddress","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"}],"name":"isTrustedRemote","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lzEndpoint","outputs":[{"internalType":"contract ILayerZeroEndpoint","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"internalType":"uint64","name":"_nonce","type":"uint64"},{"internalType":"bytes","name":"_payload","type":"bytes"}],"name":"lzReceive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"},{"internalType":"uint16","name":"","type":"uint16"}],"name":"minDstGasLookup","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"internalType":"uint64","name":"_nonce","type":"uint64"},{"internalType":"bytes","name":"_payload","type":"bytes"}],"name":"nonblockingLzReceive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"pendingClaims","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"claimTimestamp","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"precrime","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"internalType":"uint64","name":"_nonce","type":"uint64"},{"internalType":"bytes","name":"_payload","type":"bytes"}],"name":"retryMessage","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_version","type":"uint16"},{"internalType":"uint16","name":"_chainId","type":"uint16"},{"internalType":"uint256","name":"_configType","type":"uint256"},{"internalType":"bytes","name":"_config","type":"bytes"}],"name":"setConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"uint16","name":"_packetType","type":"uint16"},{"internalType":"uint256","name":"_minGas","type":"uint256"}],"name":"setMinDstGas","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_precrime","type":"address"}],"name":"setPrecrime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_version","type":"uint16"}],"name":"setReceiveVersion","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_version","type":"uint16"}],"name":"setSendVersion","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_path","type":"bytes"}],"name":"setTrustedRemote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_remoteChainId","type":"uint16"},{"internalType":"bytes","name":"_remoteAddress","type":"bytes"}],"name":"setTrustedRemoteAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"contract IERC20MintableBurnable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"}],"name":"trustedRemoteLookup","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tryUpdateEpoch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_epochDuration","type":"uint256"}],"name":"updateEpochDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_epochLimit","type":"uint256"}],"name":"updateEpochLimit","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60c06040523480156200001157600080fd5b5060405162003631380380620036318339810160408190526200003491620001e8565b8484848484838383838e806200004a336200017f565b6001600160a01b039081166080526005805460ff1916905585161580159150620000745750600083115b80156200008357506107088210155b801562000093575062093a808211155b8015620000a05750828111155b620000e15760405162461bcd60e51b815260206004820152600c60248201526b57524f4e475f504152414d5360a01b60448201526064015b60405180910390fd5b60a08390526006829055600781905560016008554260095562000104846200017f565b5050506001600160a01b03861690506200014d5760405162461bcd60e51b81526020600482015260096024820152680414444524553535f360bc1b6044820152606401620000d8565b5050600c80546001600160a01b0319166001600160a01b03949094169390931790925550620002589650505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0381168114620001e557600080fd5b50565b60008060008060008060c087890312156200020257600080fd5b86516200020f81620001cf565b60208801519096506200022281620001cf565b60408801519095506200023581620001cf565b80945050606087015192506080870151915060a087015190509295509295509295565b60805160a05161336d620002c46000396000818161035401528181610ed801526126da0152600081816106c00152818161089c01528181610b1b01528181610bbd01528181610c9d01528181610e670152818161180401528181611cb601526122d5015261336d6000f3fe6080604052600436106102db5760003560e01c80638456cb5911610184578063bb4176f0116100d6578063df2a5b3b1161008a578063f5ecbdbc11610064578063f5ecbdbc14610829578063f9f92be414610849578063fc0c546a1461087957600080fd5b8063df2a5b3b146107c9578063eb8d72b7146107e9578063f2fde38b1461080957600080fd5b8063cbed8b9c116100bb578063cbed8b9c14610780578063d1deba1f146107a0578063d784ee2b146107b357600080fd5b8063bb4176f014610717578063ca78533d1461073757600080fd5b8063a6c3d16511610138578063b353aaa711610112578063b353aaa7146106ae578063b704d910146106e2578063baf3292d146106f757600080fd5b8063a6c3d16514610658578063aa05ffc614610678578063b31b007b1461069857600080fd5b80638da5cb5b116101695780638da5cb5b146105e6578063950c8a74146106185780639f38369a1461063857600080fd5b80638456cb59146105995780638cfd8f5c146105ae57600080fd5b80634f17a2fa1161023d57806365cdce19116101f15780637533d788116101cb5780637533d7881461054357806376671808146105705780637d8ed8971461058657600080fd5b806365cdce19146104f857806366ad5c8a1461050e578063715018a61461052e57600080fd5b80635b8c41e6116102225780635b8c41e61461047b5780635c975abb146104ca57806361a8c8c4146104e257600080fd5b80634f17a2fa1461044e5780634ff0876a1461046557600080fd5b806337f2ee39116102945780633f4ba83a116102795780633f4ba83a146103f957806342d65a8d1461040e5780634d5cf0da1461042e57600080fd5b806337f2ee39146103a95780633d8b38f6146103c957600080fd5b806310ddb137116102c557806310ddb1371461032257806321c15502146103425780632a5d2cd01461038957600080fd5b80621d3567146102e057806307e0db1714610302575b600080fd5b3480156102ec57600080fd5b506103006102fb366004612908565b610899565b005b34801561030e57600080fd5b5061030061031d36600461299c565b610ae1565b34801561032e57600080fd5b5061030061033d36600461299c565b610b83565b34801561034e57600080fd5b506103767f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b34801561039557600080fd5b506103006103a43660046129b7565b610bf4565b3480156103b557600080fd5b506103766103c43660046129e5565b610c99565b3480156103d557600080fd5b506103e96103e4366004612a24565b610d51565b6040519015158152602001610380565b34801561040557600080fd5b50610300610e1d565b34801561041a57600080fd5b50610300610429366004612a24565b610e2f565b34801561043a57600080fd5b506103006104493660046129b7565b610ece565b34801561045a57600080fd5b5061037662093a8081565b34801561047157600080fd5b5061037660065481565b34801561048757600080fd5b50610376610496366004612ae6565b6004602090815260009384526040808520845180860184018051928152908401958401959095209452929052825290205481565b3480156104d657600080fd5b5060055460ff166103e9565b3480156104ee57600080fd5b5061037660095481565b34801561050457600080fd5b5061037661070881565b34801561051a57600080fd5b50610300610529366004612908565b610f7b565b34801561053a57600080fd5b5061030061106e565b34801561054f57600080fd5b5061056361055e36600461299c565b611080565b6040516103809190612bd7565b34801561057c57600080fd5b5061037660085481565b610300610594366004612bea565b61111a565b3480156105a557600080fd5b50610300611243565b3480156105ba57600080fd5b506103766105c9366004612c14565b600260209081526000928352604080842090915290825290205481565b3480156105f257600080fd5b506000546001600160a01b03165b6040516001600160a01b039091168152602001610380565b34801561062457600080fd5b50600354610600906001600160a01b031681565b34801561064457600080fd5b5061056361065336600461299c565b611253565b34801561066457600080fd5b50610300610673366004612a24565b611369565b34801561068457600080fd5b50610300610693366004612c47565b6113f2565b3480156106a457600080fd5b5061037660075481565b3480156106ba57600080fd5b506106007f000000000000000000000000000000000000000000000000000000000000000081565b3480156106ee57600080fd5b50610300611692565b34801561070357600080fd5b50610300610712366004612c47565b611701565b34801561072357600080fd5b50610300610732366004612c64565b611764565b34801561074357600080fd5b5061076b610752366004612c47565b600d602052600090815260409020805460019091015482565b60408051928352602083019190915201610380565b34801561078c57600080fd5b5061030061079b366004612ca2565b6117cc565b6103006107ae366004612908565b61187a565b3480156107bf57600080fd5b50610376600a5481565b3480156107d557600080fd5b506103006107e4366004612d11565b611ac8565b3480156107f557600080fd5b50610300610804366004612a24565b611b82565b34801561081557600080fd5b50610300610824366004612c47565b611bdc565b34801561083557600080fd5b50610563610844366004612d4d565b611c6c565b34801561085557600080fd5b506103e9610864366004612c47565b600b6020526000908152604090205460ff1681565b34801561088557600080fd5b50600c54610600906001600160a01b031681565b337f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316146109165760405162461bcd60e51b815260206004820152601e60248201527f4c7a4170703a20696e76616c696420656e64706f696e742063616c6c6572000060448201526064015b60405180910390fd5b61ffff86166000908152600160205260408120805461093490612d9a565b80601f016020809104026020016040519081016040528092919081815260200182805461096090612d9a565b80156109ad5780601f10610982576101008083540402835291602001916109ad565b820191906000526020600020905b81548152906001019060200180831161099057829003601f168201915b505050505090508051868690501480156109c8575060008151115b80156109f05750805160208201206040516109e69088908890612dd4565b6040518091039020145b610a625760405162461bcd60e51b815260206004820152602660248201527f4c7a4170703a20696e76616c696420736f757263652073656e64696e6720636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161090d565b610ad88787878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8a018190048102820181019092528881528a935091508890889081908401838280828437600092019190915250611d3692505050565b50505050505050565b610ae9611ddc565b6040517f07e0db1700000000000000000000000000000000000000000000000000000000815261ffff821660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906307e0db17906024015b600060405180830381600087803b158015610b6857600080fd5b505af1158015610b7c573d6000803e3d6000fd5b5050505050565b610b8b611ddc565b6040517f10ddb13700000000000000000000000000000000000000000000000000000000815261ffff821660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906310ddb13790602401610b4e565b610bfc611ddc565b6107088110158015610c11575062093a808111155b610c5d5760405162461bcd60e51b815260206004820152601660248201527f494e56414c49445f45504f43485f4455524154494f4e00000000000000000000604482015260640161090d565b60068190556040518181527fbfdcfb557a8f4a07f749e7d744a90c02e13eb5af308b561c2f4f17e58069c836906020015b60405180910390a150565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166340a7bb108530610cd68787611e36565b6000604051806020016040528060008152506040518663ffffffff1660e01b8152600401610d08959493929190612de4565b6040805180830381865afa158015610d24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d489190612e36565b50949350505050565b61ffff831660009081526001602052604081208054829190610d7290612d9a565b80601f0160208091040260200160405190810160405280929190818152602001828054610d9e90612d9a565b8015610deb5780601f10610dc057610100808354040283529160200191610deb565b820191906000526020600020905b815481529060010190602001808311610dce57829003601f168201915b505050505090508383604051610e02929190612dd4565b60405180910390208180519060200120149150509392505050565b610e25611ddc565b610e2d611e7a565b565b610e37611ddc565b6040517f42d65a8d0000000000000000000000000000000000000000000000000000000081526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906342d65a8d90610ea090869086908690600401612e83565b600060405180830381600087803b158015610eba57600080fd5b505af1158015610ad8573d6000803e3d6000fd5b610ed6611ddc565b7f0000000000000000000000000000000000000000000000000000000000000000811115610f465760405162461bcd60e51b815260206004820152601360248201527f494e56414c49445f45504f43485f4c494d495400000000000000000000000000604482015260640161090d565b60078190556040518181527f09a3a2f7e5773d8aa3bdcc4202ea276b4e452478c0557ebe0ce044ba0799df4090602001610c8e565b333014610ff05760405162461bcd60e51b815260206004820152602660248201527f4e6f6e626c6f636b696e674c7a4170703a2063616c6c6572206d75737420626560448201527f204c7a4170700000000000000000000000000000000000000000000000000000606482015260840161090d565b6110668686868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f890181900481028201810190925287815289935091508790879081908401838280828437600092019190915250611ecc92505050565b505050505050565b611076611ddc565b610e2d6000611f75565b6001602052600090815260409020805461109990612d9a565b80601f01602080910402602001604051908101604052809291908181526020018280546110c590612d9a565b80156111125780601f106110e757610100808354040283529160200191611112565b820191906000526020600020905b8154815290600101906020018083116110f557829003601f168201915b505050505081565b611122611fd2565b346000036111745760405162461bcd60e51b815260040161090d9060208082526004908201527f2166656500000000000000000000000000000000000000000000000000000000604082015260600190565b600081116111c45760405162461bcd60e51b815260206004820152600760248201527f21616d6f756e7400000000000000000000000000000000000000000000000000604482015260640161090d565b336111cf8183612025565b6111f6836111dd8385611e36565b8360006040518060200160405280600081525034612190565b806001600160a01b03168361ffff167fe9a689be8d43846dbd2be0ca20f835a28509406ff5fcd16b7de8e34671dbcea48460405161123691815260200190565b60405180910390a3505050565b61124b611ddc565b610e2d612351565b61ffff811660009081526001602052604081208054606092919061127690612d9a565b80601f01602080910402602001604051908101604052809291908181526020018280546112a290612d9a565b80156112ef5780601f106112c4576101008083540402835291602001916112ef565b820191906000526020600020905b8154815290600101906020018083116112d257829003601f168201915b5050505050905080516000036113475760405162461bcd60e51b815260206004820152601d60248201527f4c7a4170703a206e6f20747275737465642070617468207265636f7264000000604482015260640161090d565b61136260006014835161135a9190612eb7565b83919061238e565b9392505050565b611371611ddc565b81813060405160200161138693929190612eca565b60408051601f1981840301815291815261ffff85166000908152600160205220906113b19082612f3b565b507f8c0400cfe2d1199b1a725c78960bcc2a344d869b80590d0f2bd005db15a572ce8383836040516113e593929190612e83565b60405180910390a1505050565b6113fa611fd2565b6001600160a01b0381166000908152600d6020526040902080546114605760405162461bcd60e51b815260206004820152601060248201527f4e4f5f50454e44494e475f434c41494d00000000000000000000000000000000604482015260640161090d565b42816001015411156114b45760405162461bcd60e51b815260206004820152600960248201527f544f4f5f4541524c590000000000000000000000000000000000000000000000604482015260640161090d565b6001600160a01b0382166000908152600b602052604090205460ff161561151d5760405162461bcd60e51b815260206004820152601460248201527f52454345495645525f424c41434b4c4953544544000000000000000000000000604482015260640161090d565b611525611692565b600061154f826000015461153d600754600a546124b6565b60075461154a9190612eb7565b6124b6565b9050808260000160008282546115659190612eb7565b90915550508154156115cd5760065461157e9042612ffb565b6001830181905582546040805191825260208201929092526001600160a01b038516917f78dcc7b17cd99d8c5b52f26b192ace95a7ca8163ccc322c6d1f54985840cb68d910160405180910390a25b80600a60008282546115df9190612ffb565b9091555050600c546040516340c10f1960e01b81526001600160a01b03858116600483015260248201849052909116906340c10f1990604401600060405180830381600087803b15801561163257600080fd5b505af1158015611646573d6000803e3d6000fd5b50505050826001600160a01b03167f5ec7c833b65cadee0b8c3448865b103040c811c910a9c3fbbf697870f0a721718260405161168591815260200190565b60405180910390a2505050565b6006546009546116a29190612ffb565b4210610e2d57600880549060006116b88361300e565b90915550504260098190556000600a55600854604051918252907f41787f1277821474072e18df95f0bd9ed9f117003aa97732ebbd737225b32b029060200160405180910390a2565b611709611ddc565b6003805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040519081527f5db758e995a17ec1ad84bdef7e8c3293a0bd6179bcce400dff5d4c3d87db726b90602001610c8e565b61176c611ddc565b6001600160a01b0382166000818152600b6020908152604091829020805460ff191685151590811790915591519182527fcf3473b85df1594d47b6958f29a32bea0abff9dd68296f7bf33443646793cfd891015b60405180910390a25050565b6117d4611ddc565b6040517fcbed8b9c0000000000000000000000000000000000000000000000000000000081526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063cbed8b9c906118419088908890889088908890600401613027565b600060405180830381600087803b15801561185b57600080fd5b505af115801561186f573d6000803e3d6000fd5b505050505050505050565b61ffff8616600090815260046020526040808220905161189d9088908890612dd4565b908152604080516020928190038301902067ffffffffffffffff8716600090815292529020549050806119385760405162461bcd60e51b815260206004820152602360248201527f4e6f6e626c6f636b696e674c7a4170703a206e6f2073746f726564206d65737360448201527f6167650000000000000000000000000000000000000000000000000000000000606482015260840161090d565b808383604051611949929190612dd4565b6040518091039020146119c45760405162461bcd60e51b815260206004820152602160248201527f4e6f6e626c6f636b696e674c7a4170703a20696e76616c6964207061796c6f6160448201527f6400000000000000000000000000000000000000000000000000000000000000606482015260840161090d565b61ffff871660009081526004602052604080822090516119e79089908990612dd4565b908152604080516020928190038301812067ffffffffffffffff8916600090815290845282902093909355601f88018290048202830182019052868252611a80918991899089908190840183828082843760009201919091525050604080516020601f8a018190048102820181019092528881528a935091508890889081908401838280828437600092019190915250611ecc92505050565b7fc264d91f3adc5588250e1551f547752ca0cfa8f6b530d243b9f9f4cab10ea8e58787878785604051611ab7959493929190613060565b60405180910390a150505050505050565b611ad0611ddc565b60008111611b205760405162461bcd60e51b815260206004820152601560248201527f4c7a4170703a20696e76616c6964206d696e4761730000000000000000000000604482015260640161090d565b61ffff83811660008181526002602090815260408083209487168084529482529182902085905581519283528201929092529081018290527f9d5c7c0b934da8fefa9c7760c98383778a12dfbfc0c3b3106518f43fb9508ac0906060016113e5565b611b8a611ddc565b61ffff83166000908152600160205260409020611ba882848361309c565b507ffa41487ad5d6728f0b19276fa1eddc16558578f5109fc39d2dc33c3230470dab8383836040516113e593929190612e83565b611be4611ddc565b6001600160a01b038116611c605760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161090d565b611c6981611f75565b50565b6040517ff5ecbdbc00000000000000000000000000000000000000000000000000000000815261ffff808616600483015284166024820152306044820152606481018290526060907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063f5ecbdbc90608401600060405180830381865afa158015611d05573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611d2d919081019061315c565b95945050505050565b600080611dc65a60966366ad5c8a60e01b89898989604051602401611d5e94939291906131ca565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152309291906124cc565b9150915081611066576110668686868685612557565b6000546001600160a01b03163314610e2d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161090d565b6040805180820182526001600160a01b0384168082526020918201848152835192830191909152518183015281518082038301815260609091019091525b92915050565b611e826125f5565b6005805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600081806020019051810190611ee29190613209565b9050611ef060055460ff1690565b15611f0c57611f0781600001518260200151612647565b611f1e565b611f1e816000015182602001516126d0565b80600001516001600160a01b03168561ffff167f9664398b763718216b638e1979dee262872db5d2ec052195db9dc1ad029b97488360200151604051611f6691815260200190565b60405180910390a35050505050565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60055460ff1615610e2d5760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a2070617573656400000000000000000000000000000000604482015260640161090d565b61202d611fd2565b60075481111561207f5760405162461bcd60e51b815260206004820152600f60248201527f414d4f554e545f544f4f5f484947480000000000000000000000000000000000604482015260640161090d565b6001600160a01b0382166000908152600b602052604090205460ff16156120d65760405162461bcd60e51b815260206004820152600b60248201526a10931050d2d31254d5115160aa1b604482015260640161090d565b600c546040517f9dc29fac0000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301526024820184905290911690639dc29fac90604401600060405180830381600087803b15801561213d57600080fd5b505af1158015612151573d6000803e3d6000fd5b50505050816001600160a01b03167f696de425f79f4a40bc6d2122ca50507f0efbeabbff86a84871b7196ab8ea8df7826040516117c091815260200190565b61ffff8616600090815260016020526040812080546121ae90612d9a565b80601f01602080910402602001604051908101604052809291908181526020018280546121da90612d9a565b80156122275780601f106121fc57610100808354040283529160200191612227565b820191906000526020600020905b81548152906001019060200180831161220a57829003601f168201915b5050505050905080516000036122a55760405162461bcd60e51b815260206004820152603060248201527f4c7a4170703a2064657374696e6174696f6e20636861696e206973206e6f742060448201527f61207472757374656420736f7572636500000000000000000000000000000000606482015260840161090d565b6040517fc58031000000000000000000000000000000000000000000000000000000000081526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c5803100908490612316908b9086908c908c908c908c90600401613261565b6000604051808303818588803b15801561232f57600080fd5b505af1158015612343573d6000803e3d6000fd5b505050505050505050505050565b612359611fd2565b6005805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611eaf3390565b60608161239c81601f612ffb565b10156123ea5760405162461bcd60e51b815260206004820152600e60248201527f736c6963655f6f766572666c6f77000000000000000000000000000000000000604482015260640161090d565b6123f48284612ffb565b845110156124445760405162461bcd60e51b815260206004820152601160248201527f736c6963655f6f75744f66426f756e6473000000000000000000000000000000604482015260640161090d565b6060821580156124635760405191506000825260208201604052610d48565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561249c578051835260209283019201612484565b5050858452601f01601f1916604052505090509392505050565b60008183106124c55781611362565b5090919050565b6000606060008060008661ffff1667ffffffffffffffff8111156124f2576124f2612a77565b6040519080825280601f01601f19166020018201604052801561251c576020820181803683370190505b50905060008087516020890160008d8df191503d92508683111561253e578692505b828152826000602083013e909890975095505050505050565b8180519060200120600460008761ffff1661ffff1681526020019081526020016000208560405161258891906132c8565b90815260408051918290036020908101832067ffffffffffffffff88166000908152915220919091557fe183f33de2837795525b4792ca4cd60535bd77c53b7e7030060bfcf5734d6b0c906125e690879087908790879087906132e4565b60405180910390a15050505050565b60055460ff16610e2d5760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f7420706175736564000000000000000000000000604482015260640161090d565b6001600160a01b0382166000908152600d60205260408120805490918391839190612673908490612ffb565b90915550506006546126859042612ffb565b6001820181905581546040805191825260208201929092526001600160a01b038516917f78dcc7b17cd99d8c5b52f26b192ace95a7ca8163ccc322c6d1f54985840cb68d9101611685565b6126d8611fd2565b7f00000000000000000000000000000000000000000000000000000000000000008111156127485760405162461bcd60e51b815260206004820152600f60248201527f414d4f554e545f544f4f5f484947480000000000000000000000000000000000604482015260640161090d565b6001600160a01b0382166000908152600b602052604090205460ff161561279f5760405162461bcd60e51b815260206004820152600b60248201526a10931050d2d31254d5115160aa1b604482015260640161090d565b6127a7611692565b60006127bb8261153d600754600a546124b6565b9050818110156127d8576127d8836127d38385612eb7565b612647565b80600a60008282546127ea9190612ffb565b9091555050600c546040516340c10f1960e01b81526001600160a01b03858116600483015260248201849052909116906340c10f1990604401600060405180830381600087803b15801561283d57600080fd5b505af1158015612851573d6000803e3d6000fd5b50505050826001600160a01b03167f30385c845b448a36257a6a1716e6ad2e1bc2cbe333cde1e69fe849ad6511adfe8260405161168591815260200190565b803561ffff811681146128a257600080fd5b919050565b60008083601f8401126128b957600080fd5b50813567ffffffffffffffff8111156128d157600080fd5b6020830191508360208285010111156128e957600080fd5b9250929050565b803567ffffffffffffffff811681146128a257600080fd5b6000806000806000806080878903121561292157600080fd5b61292a87612890565b9550602087013567ffffffffffffffff8082111561294757600080fd5b6129538a838b016128a7565b909750955085915061296760408a016128f0565b9450606089013591508082111561297d57600080fd5b5061298a89828a016128a7565b979a9699509497509295939492505050565b6000602082840312156129ae57600080fd5b61136282612890565b6000602082840312156129c957600080fd5b5035919050565b6001600160a01b0381168114611c6957600080fd5b6000806000606084860312156129fa57600080fd5b612a0384612890565b92506020840135612a13816129d0565b929592945050506040919091013590565b600080600060408486031215612a3957600080fd5b612a4284612890565b9250602084013567ffffffffffffffff811115612a5e57600080fd5b612a6a868287016128a7565b9497909650939450505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715612ab657612ab6612a77565b604052919050565b600067ffffffffffffffff821115612ad857612ad8612a77565b50601f01601f191660200190565b600080600060608486031215612afb57600080fd5b612b0484612890565b9250602084013567ffffffffffffffff811115612b2057600080fd5b8401601f81018613612b3157600080fd5b8035612b44612b3f82612abe565b612a8d565b818152876020838501011115612b5957600080fd5b81602084016020830137600060208383010152809450505050612b7e604085016128f0565b90509250925092565b60005b83811015612ba2578181015183820152602001612b8a565b50506000910152565b60008151808452612bc3816020860160208601612b87565b601f01601f19169290920160200192915050565b6020815260006113626020830184612bab565b60008060408385031215612bfd57600080fd5b612c0683612890565b946020939093013593505050565b60008060408385031215612c2757600080fd5b612c3083612890565b9150612c3e60208401612890565b90509250929050565b600060208284031215612c5957600080fd5b8135611362816129d0565b60008060408385031215612c7757600080fd5b8235612c82816129d0565b915060208301358015158114612c9757600080fd5b809150509250929050565b600080600080600060808688031215612cba57600080fd5b612cc386612890565b9450612cd160208701612890565b935060408601359250606086013567ffffffffffffffff811115612cf457600080fd5b612d00888289016128a7565b969995985093965092949392505050565b600080600060608486031215612d2657600080fd5b612d2f84612890565b9250612d3d60208501612890565b9150604084013590509250925092565b60008060008060808587031215612d6357600080fd5b612d6c85612890565b9350612d7a60208601612890565b92506040850135612d8a816129d0565b9396929550929360600135925050565b600181811c90821680612dae57607f821691505b602082108103612dce57634e487b7160e01b600052602260045260246000fd5b50919050565b8183823760009101908152919050565b61ffff861681526001600160a01b038516602082015260a060408201526000612e1060a0830186612bab565b84151560608401528281036080840152612e2a8185612bab565b98975050505050505050565b60008060408385031215612e4957600080fd5b505080516020909101519092909150565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b61ffff84168152604060208201526000611d2d604083018486612e5a565b634e487b7160e01b600052601160045260246000fd5b81810381811115611e7457611e74612ea1565b8284823760609190911b6bffffffffffffffffffffffff19169101908152601401919050565b601f821115612f3657600081815260208120601f850160051c81016020861015612f175750805b601f850160051c820191505b8181101561106657828155600101612f23565b505050565b815167ffffffffffffffff811115612f5557612f55612a77565b612f6981612f638454612d9a565b84612ef0565b602080601f831160018114612f9e5760008415612f865750858301515b600019600386901b1c1916600185901b178555611066565b600085815260208120601f198616915b82811015612fcd57888601518255948401946001909101908401612fae565b5085821015612feb5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b80820180821115611e7457611e74612ea1565b60006001820161302057613020612ea1565b5060010190565b600061ffff808816835280871660208401525084604083015260806060830152613055608083018486612e5a565b979650505050505050565b61ffff8616815260806020820152600061307e608083018688612e5a565b67ffffffffffffffff94909416604083015250606001529392505050565b67ffffffffffffffff8311156130b4576130b4612a77565b6130c8836130c28354612d9a565b83612ef0565b6000601f8411600181146130fc57600085156130e45750838201355b600019600387901b1c1916600186901b178355610b7c565b600083815260209020601f19861690835b8281101561312d578685013582556020948501946001909201910161310d565b508682101561314a5760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b60006020828403121561316e57600080fd5b815167ffffffffffffffff81111561318557600080fd5b8201601f8101841361319657600080fd5b80516131a4612b3f82612abe565b8181528560208385010111156131b957600080fd5b611d2d826020830160208601612b87565b61ffff851681526080602082015260006131e76080830186612bab565b67ffffffffffffffff8516604084015282810360608401526130558185612bab565b60006040828403121561321b57600080fd5b6040516040810181811067ffffffffffffffff8211171561323e5761323e612a77565b604052825161324c816129d0565b81526020928301519281019290925250919050565b61ffff8716815260c06020820152600061327e60c0830188612bab565b82810360408401526132908188612bab565b6001600160a01b0387811660608601528616608085015283810360a085015290506132bb8185612bab565b9998505050505050505050565b600082516132da818460208701612b87565b9190910192915050565b61ffff8616815260a06020820152600061330160a0830187612bab565b67ffffffffffffffff8616604084015282810360608401526133238186612bab565b90508281036080840152612e2a8185612bab56fea264697066735822122076e17870c5d4b54289b3a4c857972c4672cdc28b5f0d307f444ece9d25e22c3e64736f6c63430008110033000000000000000000000000b6319cc6c8c27a8f5daf0dd3df91ea35c4720dd7000000000000000000000000e31c676d8235437597581b44c1c4f8a30e90b38a00000000000000000000000080fd0accc8da81b0852d2dca17b5ddab68f2225300000000000000000000000000000000000000000001a784379d99db42000000000000000000000000000000000000000000000000000000000000000000546000000000000000000000000000000000000000000000d3c21bcecceda1000000

Deployed Bytecode

0x6080604052600436106102db5760003560e01c80638456cb5911610184578063bb4176f0116100d6578063df2a5b3b1161008a578063f5ecbdbc11610064578063f5ecbdbc14610829578063f9f92be414610849578063fc0c546a1461087957600080fd5b8063df2a5b3b146107c9578063eb8d72b7146107e9578063f2fde38b1461080957600080fd5b8063cbed8b9c116100bb578063cbed8b9c14610780578063d1deba1f146107a0578063d784ee2b146107b357600080fd5b8063bb4176f014610717578063ca78533d1461073757600080fd5b8063a6c3d16511610138578063b353aaa711610112578063b353aaa7146106ae578063b704d910146106e2578063baf3292d146106f757600080fd5b8063a6c3d16514610658578063aa05ffc614610678578063b31b007b1461069857600080fd5b80638da5cb5b116101695780638da5cb5b146105e6578063950c8a74146106185780639f38369a1461063857600080fd5b80638456cb59146105995780638cfd8f5c146105ae57600080fd5b80634f17a2fa1161023d57806365cdce19116101f15780637533d788116101cb5780637533d7881461054357806376671808146105705780637d8ed8971461058657600080fd5b806365cdce19146104f857806366ad5c8a1461050e578063715018a61461052e57600080fd5b80635b8c41e6116102225780635b8c41e61461047b5780635c975abb146104ca57806361a8c8c4146104e257600080fd5b80634f17a2fa1461044e5780634ff0876a1461046557600080fd5b806337f2ee39116102945780633f4ba83a116102795780633f4ba83a146103f957806342d65a8d1461040e5780634d5cf0da1461042e57600080fd5b806337f2ee39146103a95780633d8b38f6146103c957600080fd5b806310ddb137116102c557806310ddb1371461032257806321c15502146103425780632a5d2cd01461038957600080fd5b80621d3567146102e057806307e0db1714610302575b600080fd5b3480156102ec57600080fd5b506103006102fb366004612908565b610899565b005b34801561030e57600080fd5b5061030061031d36600461299c565b610ae1565b34801561032e57600080fd5b5061030061033d36600461299c565b610b83565b34801561034e57600080fd5b506103767f00000000000000000000000000000000000000000001a784379d99db4200000081565b6040519081526020015b60405180910390f35b34801561039557600080fd5b506103006103a43660046129b7565b610bf4565b3480156103b557600080fd5b506103766103c43660046129e5565b610c99565b3480156103d557600080fd5b506103e96103e4366004612a24565b610d51565b6040519015158152602001610380565b34801561040557600080fd5b50610300610e1d565b34801561041a57600080fd5b50610300610429366004612a24565b610e2f565b34801561043a57600080fd5b506103006104493660046129b7565b610ece565b34801561045a57600080fd5b5061037662093a8081565b34801561047157600080fd5b5061037660065481565b34801561048757600080fd5b50610376610496366004612ae6565b6004602090815260009384526040808520845180860184018051928152908401958401959095209452929052825290205481565b3480156104d657600080fd5b5060055460ff166103e9565b3480156104ee57600080fd5b5061037660095481565b34801561050457600080fd5b5061037661070881565b34801561051a57600080fd5b50610300610529366004612908565b610f7b565b34801561053a57600080fd5b5061030061106e565b34801561054f57600080fd5b5061056361055e36600461299c565b611080565b6040516103809190612bd7565b34801561057c57600080fd5b5061037660085481565b610300610594366004612bea565b61111a565b3480156105a557600080fd5b50610300611243565b3480156105ba57600080fd5b506103766105c9366004612c14565b600260209081526000928352604080842090915290825290205481565b3480156105f257600080fd5b506000546001600160a01b03165b6040516001600160a01b039091168152602001610380565b34801561062457600080fd5b50600354610600906001600160a01b031681565b34801561064457600080fd5b5061056361065336600461299c565b611253565b34801561066457600080fd5b50610300610673366004612a24565b611369565b34801561068457600080fd5b50610300610693366004612c47565b6113f2565b3480156106a457600080fd5b5061037660075481565b3480156106ba57600080fd5b506106007f000000000000000000000000b6319cc6c8c27a8f5daf0dd3df91ea35c4720dd781565b3480156106ee57600080fd5b50610300611692565b34801561070357600080fd5b50610300610712366004612c47565b611701565b34801561072357600080fd5b50610300610732366004612c64565b611764565b34801561074357600080fd5b5061076b610752366004612c47565b600d602052600090815260409020805460019091015482565b60408051928352602083019190915201610380565b34801561078c57600080fd5b5061030061079b366004612ca2565b6117cc565b6103006107ae366004612908565b61187a565b3480156107bf57600080fd5b50610376600a5481565b3480156107d557600080fd5b506103006107e4366004612d11565b611ac8565b3480156107f557600080fd5b50610300610804366004612a24565b611b82565b34801561081557600080fd5b50610300610824366004612c47565b611bdc565b34801561083557600080fd5b50610563610844366004612d4d565b611c6c565b34801561085557600080fd5b506103e9610864366004612c47565b600b6020526000908152604090205460ff1681565b34801561088557600080fd5b50600c54610600906001600160a01b031681565b337f000000000000000000000000b6319cc6c8c27a8f5daf0dd3df91ea35c4720dd76001600160a01b0316146109165760405162461bcd60e51b815260206004820152601e60248201527f4c7a4170703a20696e76616c696420656e64706f696e742063616c6c6572000060448201526064015b60405180910390fd5b61ffff86166000908152600160205260408120805461093490612d9a565b80601f016020809104026020016040519081016040528092919081815260200182805461096090612d9a565b80156109ad5780601f10610982576101008083540402835291602001916109ad565b820191906000526020600020905b81548152906001019060200180831161099057829003601f168201915b505050505090508051868690501480156109c8575060008151115b80156109f05750805160208201206040516109e69088908890612dd4565b6040518091039020145b610a625760405162461bcd60e51b815260206004820152602660248201527f4c7a4170703a20696e76616c696420736f757263652073656e64696e6720636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161090d565b610ad88787878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8a018190048102820181019092528881528a935091508890889081908401838280828437600092019190915250611d3692505050565b50505050505050565b610ae9611ddc565b6040517f07e0db1700000000000000000000000000000000000000000000000000000000815261ffff821660048201527f000000000000000000000000b6319cc6c8c27a8f5daf0dd3df91ea35c4720dd76001600160a01b0316906307e0db17906024015b600060405180830381600087803b158015610b6857600080fd5b505af1158015610b7c573d6000803e3d6000fd5b5050505050565b610b8b611ddc565b6040517f10ddb13700000000000000000000000000000000000000000000000000000000815261ffff821660048201527f000000000000000000000000b6319cc6c8c27a8f5daf0dd3df91ea35c4720dd76001600160a01b0316906310ddb13790602401610b4e565b610bfc611ddc565b6107088110158015610c11575062093a808111155b610c5d5760405162461bcd60e51b815260206004820152601660248201527f494e56414c49445f45504f43485f4455524154494f4e00000000000000000000604482015260640161090d565b60068190556040518181527fbfdcfb557a8f4a07f749e7d744a90c02e13eb5af308b561c2f4f17e58069c836906020015b60405180910390a150565b60007f000000000000000000000000b6319cc6c8c27a8f5daf0dd3df91ea35c4720dd76001600160a01b03166340a7bb108530610cd68787611e36565b6000604051806020016040528060008152506040518663ffffffff1660e01b8152600401610d08959493929190612de4565b6040805180830381865afa158015610d24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d489190612e36565b50949350505050565b61ffff831660009081526001602052604081208054829190610d7290612d9a565b80601f0160208091040260200160405190810160405280929190818152602001828054610d9e90612d9a565b8015610deb5780601f10610dc057610100808354040283529160200191610deb565b820191906000526020600020905b815481529060010190602001808311610dce57829003601f168201915b505050505090508383604051610e02929190612dd4565b60405180910390208180519060200120149150509392505050565b610e25611ddc565b610e2d611e7a565b565b610e37611ddc565b6040517f42d65a8d0000000000000000000000000000000000000000000000000000000081526001600160a01b037f000000000000000000000000b6319cc6c8c27a8f5daf0dd3df91ea35c4720dd716906342d65a8d90610ea090869086908690600401612e83565b600060405180830381600087803b158015610eba57600080fd5b505af1158015610ad8573d6000803e3d6000fd5b610ed6611ddc565b7f00000000000000000000000000000000000000000001a784379d99db42000000811115610f465760405162461bcd60e51b815260206004820152601360248201527f494e56414c49445f45504f43485f4c494d495400000000000000000000000000604482015260640161090d565b60078190556040518181527f09a3a2f7e5773d8aa3bdcc4202ea276b4e452478c0557ebe0ce044ba0799df4090602001610c8e565b333014610ff05760405162461bcd60e51b815260206004820152602660248201527f4e6f6e626c6f636b696e674c7a4170703a2063616c6c6572206d75737420626560448201527f204c7a4170700000000000000000000000000000000000000000000000000000606482015260840161090d565b6110668686868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f890181900481028201810190925287815289935091508790879081908401838280828437600092019190915250611ecc92505050565b505050505050565b611076611ddc565b610e2d6000611f75565b6001602052600090815260409020805461109990612d9a565b80601f01602080910402602001604051908101604052809291908181526020018280546110c590612d9a565b80156111125780601f106110e757610100808354040283529160200191611112565b820191906000526020600020905b8154815290600101906020018083116110f557829003601f168201915b505050505081565b611122611fd2565b346000036111745760405162461bcd60e51b815260040161090d9060208082526004908201527f2166656500000000000000000000000000000000000000000000000000000000604082015260600190565b600081116111c45760405162461bcd60e51b815260206004820152600760248201527f21616d6f756e7400000000000000000000000000000000000000000000000000604482015260640161090d565b336111cf8183612025565b6111f6836111dd8385611e36565b8360006040518060200160405280600081525034612190565b806001600160a01b03168361ffff167fe9a689be8d43846dbd2be0ca20f835a28509406ff5fcd16b7de8e34671dbcea48460405161123691815260200190565b60405180910390a3505050565b61124b611ddc565b610e2d612351565b61ffff811660009081526001602052604081208054606092919061127690612d9a565b80601f01602080910402602001604051908101604052809291908181526020018280546112a290612d9a565b80156112ef5780601f106112c4576101008083540402835291602001916112ef565b820191906000526020600020905b8154815290600101906020018083116112d257829003601f168201915b5050505050905080516000036113475760405162461bcd60e51b815260206004820152601d60248201527f4c7a4170703a206e6f20747275737465642070617468207265636f7264000000604482015260640161090d565b61136260006014835161135a9190612eb7565b83919061238e565b9392505050565b611371611ddc565b81813060405160200161138693929190612eca565b60408051601f1981840301815291815261ffff85166000908152600160205220906113b19082612f3b565b507f8c0400cfe2d1199b1a725c78960bcc2a344d869b80590d0f2bd005db15a572ce8383836040516113e593929190612e83565b60405180910390a1505050565b6113fa611fd2565b6001600160a01b0381166000908152600d6020526040902080546114605760405162461bcd60e51b815260206004820152601060248201527f4e4f5f50454e44494e475f434c41494d00000000000000000000000000000000604482015260640161090d565b42816001015411156114b45760405162461bcd60e51b815260206004820152600960248201527f544f4f5f4541524c590000000000000000000000000000000000000000000000604482015260640161090d565b6001600160a01b0382166000908152600b602052604090205460ff161561151d5760405162461bcd60e51b815260206004820152601460248201527f52454345495645525f424c41434b4c4953544544000000000000000000000000604482015260640161090d565b611525611692565b600061154f826000015461153d600754600a546124b6565b60075461154a9190612eb7565b6124b6565b9050808260000160008282546115659190612eb7565b90915550508154156115cd5760065461157e9042612ffb565b6001830181905582546040805191825260208201929092526001600160a01b038516917f78dcc7b17cd99d8c5b52f26b192ace95a7ca8163ccc322c6d1f54985840cb68d910160405180910390a25b80600a60008282546115df9190612ffb565b9091555050600c546040516340c10f1960e01b81526001600160a01b03858116600483015260248201849052909116906340c10f1990604401600060405180830381600087803b15801561163257600080fd5b505af1158015611646573d6000803e3d6000fd5b50505050826001600160a01b03167f5ec7c833b65cadee0b8c3448865b103040c811c910a9c3fbbf697870f0a721718260405161168591815260200190565b60405180910390a2505050565b6006546009546116a29190612ffb565b4210610e2d57600880549060006116b88361300e565b90915550504260098190556000600a55600854604051918252907f41787f1277821474072e18df95f0bd9ed9f117003aa97732ebbd737225b32b029060200160405180910390a2565b611709611ddc565b6003805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040519081527f5db758e995a17ec1ad84bdef7e8c3293a0bd6179bcce400dff5d4c3d87db726b90602001610c8e565b61176c611ddc565b6001600160a01b0382166000818152600b6020908152604091829020805460ff191685151590811790915591519182527fcf3473b85df1594d47b6958f29a32bea0abff9dd68296f7bf33443646793cfd891015b60405180910390a25050565b6117d4611ddc565b6040517fcbed8b9c0000000000000000000000000000000000000000000000000000000081526001600160a01b037f000000000000000000000000b6319cc6c8c27a8f5daf0dd3df91ea35c4720dd7169063cbed8b9c906118419088908890889088908890600401613027565b600060405180830381600087803b15801561185b57600080fd5b505af115801561186f573d6000803e3d6000fd5b505050505050505050565b61ffff8616600090815260046020526040808220905161189d9088908890612dd4565b908152604080516020928190038301902067ffffffffffffffff8716600090815292529020549050806119385760405162461bcd60e51b815260206004820152602360248201527f4e6f6e626c6f636b696e674c7a4170703a206e6f2073746f726564206d65737360448201527f6167650000000000000000000000000000000000000000000000000000000000606482015260840161090d565b808383604051611949929190612dd4565b6040518091039020146119c45760405162461bcd60e51b815260206004820152602160248201527f4e6f6e626c6f636b696e674c7a4170703a20696e76616c6964207061796c6f6160448201527f6400000000000000000000000000000000000000000000000000000000000000606482015260840161090d565b61ffff871660009081526004602052604080822090516119e79089908990612dd4565b908152604080516020928190038301812067ffffffffffffffff8916600090815290845282902093909355601f88018290048202830182019052868252611a80918991899089908190840183828082843760009201919091525050604080516020601f8a018190048102820181019092528881528a935091508890889081908401838280828437600092019190915250611ecc92505050565b7fc264d91f3adc5588250e1551f547752ca0cfa8f6b530d243b9f9f4cab10ea8e58787878785604051611ab7959493929190613060565b60405180910390a150505050505050565b611ad0611ddc565b60008111611b205760405162461bcd60e51b815260206004820152601560248201527f4c7a4170703a20696e76616c6964206d696e4761730000000000000000000000604482015260640161090d565b61ffff83811660008181526002602090815260408083209487168084529482529182902085905581519283528201929092529081018290527f9d5c7c0b934da8fefa9c7760c98383778a12dfbfc0c3b3106518f43fb9508ac0906060016113e5565b611b8a611ddc565b61ffff83166000908152600160205260409020611ba882848361309c565b507ffa41487ad5d6728f0b19276fa1eddc16558578f5109fc39d2dc33c3230470dab8383836040516113e593929190612e83565b611be4611ddc565b6001600160a01b038116611c605760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161090d565b611c6981611f75565b50565b6040517ff5ecbdbc00000000000000000000000000000000000000000000000000000000815261ffff808616600483015284166024820152306044820152606481018290526060907f000000000000000000000000b6319cc6c8c27a8f5daf0dd3df91ea35c4720dd76001600160a01b03169063f5ecbdbc90608401600060405180830381865afa158015611d05573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611d2d919081019061315c565b95945050505050565b600080611dc65a60966366ad5c8a60e01b89898989604051602401611d5e94939291906131ca565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152309291906124cc565b9150915081611066576110668686868685612557565b6000546001600160a01b03163314610e2d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161090d565b6040805180820182526001600160a01b0384168082526020918201848152835192830191909152518183015281518082038301815260609091019091525b92915050565b611e826125f5565b6005805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600081806020019051810190611ee29190613209565b9050611ef060055460ff1690565b15611f0c57611f0781600001518260200151612647565b611f1e565b611f1e816000015182602001516126d0565b80600001516001600160a01b03168561ffff167f9664398b763718216b638e1979dee262872db5d2ec052195db9dc1ad029b97488360200151604051611f6691815260200190565b60405180910390a35050505050565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60055460ff1615610e2d5760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a2070617573656400000000000000000000000000000000604482015260640161090d565b61202d611fd2565b60075481111561207f5760405162461bcd60e51b815260206004820152600f60248201527f414d4f554e545f544f4f5f484947480000000000000000000000000000000000604482015260640161090d565b6001600160a01b0382166000908152600b602052604090205460ff16156120d65760405162461bcd60e51b815260206004820152600b60248201526a10931050d2d31254d5115160aa1b604482015260640161090d565b600c546040517f9dc29fac0000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301526024820184905290911690639dc29fac90604401600060405180830381600087803b15801561213d57600080fd5b505af1158015612151573d6000803e3d6000fd5b50505050816001600160a01b03167f696de425f79f4a40bc6d2122ca50507f0efbeabbff86a84871b7196ab8ea8df7826040516117c091815260200190565b61ffff8616600090815260016020526040812080546121ae90612d9a565b80601f01602080910402602001604051908101604052809291908181526020018280546121da90612d9a565b80156122275780601f106121fc57610100808354040283529160200191612227565b820191906000526020600020905b81548152906001019060200180831161220a57829003601f168201915b5050505050905080516000036122a55760405162461bcd60e51b815260206004820152603060248201527f4c7a4170703a2064657374696e6174696f6e20636861696e206973206e6f742060448201527f61207472757374656420736f7572636500000000000000000000000000000000606482015260840161090d565b6040517fc58031000000000000000000000000000000000000000000000000000000000081526001600160a01b037f000000000000000000000000b6319cc6c8c27a8f5daf0dd3df91ea35c4720dd7169063c5803100908490612316908b9086908c908c908c908c90600401613261565b6000604051808303818588803b15801561232f57600080fd5b505af1158015612343573d6000803e3d6000fd5b505050505050505050505050565b612359611fd2565b6005805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611eaf3390565b60608161239c81601f612ffb565b10156123ea5760405162461bcd60e51b815260206004820152600e60248201527f736c6963655f6f766572666c6f77000000000000000000000000000000000000604482015260640161090d565b6123f48284612ffb565b845110156124445760405162461bcd60e51b815260206004820152601160248201527f736c6963655f6f75744f66426f756e6473000000000000000000000000000000604482015260640161090d565b6060821580156124635760405191506000825260208201604052610d48565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561249c578051835260209283019201612484565b5050858452601f01601f1916604052505090509392505050565b60008183106124c55781611362565b5090919050565b6000606060008060008661ffff1667ffffffffffffffff8111156124f2576124f2612a77565b6040519080825280601f01601f19166020018201604052801561251c576020820181803683370190505b50905060008087516020890160008d8df191503d92508683111561253e578692505b828152826000602083013e909890975095505050505050565b8180519060200120600460008761ffff1661ffff1681526020019081526020016000208560405161258891906132c8565b90815260408051918290036020908101832067ffffffffffffffff88166000908152915220919091557fe183f33de2837795525b4792ca4cd60535bd77c53b7e7030060bfcf5734d6b0c906125e690879087908790879087906132e4565b60405180910390a15050505050565b60055460ff16610e2d5760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f7420706175736564000000000000000000000000604482015260640161090d565b6001600160a01b0382166000908152600d60205260408120805490918391839190612673908490612ffb565b90915550506006546126859042612ffb565b6001820181905581546040805191825260208201929092526001600160a01b038516917f78dcc7b17cd99d8c5b52f26b192ace95a7ca8163ccc322c6d1f54985840cb68d9101611685565b6126d8611fd2565b7f00000000000000000000000000000000000000000001a784379d99db420000008111156127485760405162461bcd60e51b815260206004820152600f60248201527f414d4f554e545f544f4f5f484947480000000000000000000000000000000000604482015260640161090d565b6001600160a01b0382166000908152600b602052604090205460ff161561279f5760405162461bcd60e51b815260206004820152600b60248201526a10931050d2d31254d5115160aa1b604482015260640161090d565b6127a7611692565b60006127bb8261153d600754600a546124b6565b9050818110156127d8576127d8836127d38385612eb7565b612647565b80600a60008282546127ea9190612ffb565b9091555050600c546040516340c10f1960e01b81526001600160a01b03858116600483015260248201849052909116906340c10f1990604401600060405180830381600087803b15801561283d57600080fd5b505af1158015612851573d6000803e3d6000fd5b50505050826001600160a01b03167f30385c845b448a36257a6a1716e6ad2e1bc2cbe333cde1e69fe849ad6511adfe8260405161168591815260200190565b803561ffff811681146128a257600080fd5b919050565b60008083601f8401126128b957600080fd5b50813567ffffffffffffffff8111156128d157600080fd5b6020830191508360208285010111156128e957600080fd5b9250929050565b803567ffffffffffffffff811681146128a257600080fd5b6000806000806000806080878903121561292157600080fd5b61292a87612890565b9550602087013567ffffffffffffffff8082111561294757600080fd5b6129538a838b016128a7565b909750955085915061296760408a016128f0565b9450606089013591508082111561297d57600080fd5b5061298a89828a016128a7565b979a9699509497509295939492505050565b6000602082840312156129ae57600080fd5b61136282612890565b6000602082840312156129c957600080fd5b5035919050565b6001600160a01b0381168114611c6957600080fd5b6000806000606084860312156129fa57600080fd5b612a0384612890565b92506020840135612a13816129d0565b929592945050506040919091013590565b600080600060408486031215612a3957600080fd5b612a4284612890565b9250602084013567ffffffffffffffff811115612a5e57600080fd5b612a6a868287016128a7565b9497909650939450505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715612ab657612ab6612a77565b604052919050565b600067ffffffffffffffff821115612ad857612ad8612a77565b50601f01601f191660200190565b600080600060608486031215612afb57600080fd5b612b0484612890565b9250602084013567ffffffffffffffff811115612b2057600080fd5b8401601f81018613612b3157600080fd5b8035612b44612b3f82612abe565b612a8d565b818152876020838501011115612b5957600080fd5b81602084016020830137600060208383010152809450505050612b7e604085016128f0565b90509250925092565b60005b83811015612ba2578181015183820152602001612b8a565b50506000910152565b60008151808452612bc3816020860160208601612b87565b601f01601f19169290920160200192915050565b6020815260006113626020830184612bab565b60008060408385031215612bfd57600080fd5b612c0683612890565b946020939093013593505050565b60008060408385031215612c2757600080fd5b612c3083612890565b9150612c3e60208401612890565b90509250929050565b600060208284031215612c5957600080fd5b8135611362816129d0565b60008060408385031215612c7757600080fd5b8235612c82816129d0565b915060208301358015158114612c9757600080fd5b809150509250929050565b600080600080600060808688031215612cba57600080fd5b612cc386612890565b9450612cd160208701612890565b935060408601359250606086013567ffffffffffffffff811115612cf457600080fd5b612d00888289016128a7565b969995985093965092949392505050565b600080600060608486031215612d2657600080fd5b612d2f84612890565b9250612d3d60208501612890565b9150604084013590509250925092565b60008060008060808587031215612d6357600080fd5b612d6c85612890565b9350612d7a60208601612890565b92506040850135612d8a816129d0565b9396929550929360600135925050565b600181811c90821680612dae57607f821691505b602082108103612dce57634e487b7160e01b600052602260045260246000fd5b50919050565b8183823760009101908152919050565b61ffff861681526001600160a01b038516602082015260a060408201526000612e1060a0830186612bab565b84151560608401528281036080840152612e2a8185612bab565b98975050505050505050565b60008060408385031215612e4957600080fd5b505080516020909101519092909150565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b61ffff84168152604060208201526000611d2d604083018486612e5a565b634e487b7160e01b600052601160045260246000fd5b81810381811115611e7457611e74612ea1565b8284823760609190911b6bffffffffffffffffffffffff19169101908152601401919050565b601f821115612f3657600081815260208120601f850160051c81016020861015612f175750805b601f850160051c820191505b8181101561106657828155600101612f23565b505050565b815167ffffffffffffffff811115612f5557612f55612a77565b612f6981612f638454612d9a565b84612ef0565b602080601f831160018114612f9e5760008415612f865750858301515b600019600386901b1c1916600185901b178555611066565b600085815260208120601f198616915b82811015612fcd57888601518255948401946001909101908401612fae565b5085821015612feb5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b80820180821115611e7457611e74612ea1565b60006001820161302057613020612ea1565b5060010190565b600061ffff808816835280871660208401525084604083015260806060830152613055608083018486612e5a565b979650505050505050565b61ffff8616815260806020820152600061307e608083018688612e5a565b67ffffffffffffffff94909416604083015250606001529392505050565b67ffffffffffffffff8311156130b4576130b4612a77565b6130c8836130c28354612d9a565b83612ef0565b6000601f8411600181146130fc57600085156130e45750838201355b600019600387901b1c1916600186901b178355610b7c565b600083815260209020601f19861690835b8281101561312d578685013582556020948501946001909201910161310d565b508682101561314a5760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b60006020828403121561316e57600080fd5b815167ffffffffffffffff81111561318557600080fd5b8201601f8101841361319657600080fd5b80516131a4612b3f82612abe565b8181528560208385010111156131b957600080fd5b611d2d826020830160208601612b87565b61ffff851681526080602082015260006131e76080830186612bab565b67ffffffffffffffff8516604084015282810360608401526130558185612bab565b60006040828403121561321b57600080fd5b6040516040810181811067ffffffffffffffff8211171561323e5761323e612a77565b604052825161324c816129d0565b81526020928301519281019290925250919050565b61ffff8716815260c06020820152600061327e60c0830188612bab565b82810360408401526132908188612bab565b6001600160a01b0387811660608601528616608085015283810360a085015290506132bb8185612bab565b9998505050505050505050565b600082516132da818460208701612b87565b9190910192915050565b61ffff8616815260a06020820152600061330160a0830187612bab565b67ffffffffffffffff8616604084015282810360608401526133238186612bab565b90508281036080840152612e2a8185612bab56fea264697066735822122076e17870c5d4b54289b3a4c857972c4672cdc28b5f0d307f444ece9d25e22c3e64736f6c63430008110033

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

000000000000000000000000b6319cc6c8c27a8f5daf0dd3df91ea35c4720dd7000000000000000000000000e31c676d8235437597581b44c1c4f8a30e90b38a00000000000000000000000080fd0accc8da81b0852d2dca17b5ddab68f2225300000000000000000000000000000000000000000001a784379d99db42000000000000000000000000000000000000000000000000000000000000000000546000000000000000000000000000000000000000000000d3c21bcecceda1000000

-----Decoded View---------------
Arg [0] : _lzEndpoint (address): 0xb6319cC6c8c27A8F5dAF0dD3DF91EA35C4720dd7
Arg [1] : _token (address): 0xe31C676d8235437597581b44c1c4f8A30e90b38a
Arg [2] : _owner (address): 0x80fd0accC8Da81b0852d2Dca17b5DDab68f22253
Arg [3] : _maxEpochLimit (uint256): 2000000000000000000000000
Arg [4] : _epochDuration (uint256): 21600
Arg [5] : _epochLimit (uint256): 1000000000000000000000000

-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 000000000000000000000000b6319cc6c8c27a8f5daf0dd3df91ea35c4720dd7
Arg [1] : 000000000000000000000000e31c676d8235437597581b44c1c4f8a30e90b38a
Arg [2] : 00000000000000000000000080fd0accc8da81b0852d2dca17b5ddab68f22253
Arg [3] : 00000000000000000000000000000000000000000001a784379d99db42000000
Arg [4] : 0000000000000000000000000000000000000000000000000000000000005460
Arg [5] : 00000000000000000000000000000000000000000000d3c21bcecceda1000000


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
[ 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.