ETH Price: $3,761.37 (-2.30%)

Contract

0xCEB404fDf35AEEFD9229e844964a3946f1026D2d

Overview

ETH Balance

0 ETH

ETH Value

$0.00
Transaction Hash
Method
Block
From
To
Deposit1181113872024-03-30 17:59:11254 days ago1711821551IN
0xCEB404fD...6f1026D2d
0.000127810347022 ETH0.000021406380.05760769
Deposit1181108682024-03-30 17:41:53254 days ago1711820513IN
0xCEB404fD...6f1026D2d
0.000131576079022 ETH0.0000230564080.0594204
Set Bridge Fee A...1175968642024-03-18 20:08:25266 days ago1710792505IN
0xCEB404fD...6f1026D2d
0 ETH0.000000374330.0059661
Whitelist Token1174254862024-03-14 20:55:49270 days ago1710449749IN
0xCEB404fD...6f1026D2d
0 ETH0.0000099575710.05930641
Set Peer1173014672024-03-12 0:01:51273 days ago1710201711IN
0xCEB404fD...6f1026D2d
0 ETH0.0001147990940.00097025
Set Peer1173013842024-03-11 23:59:05273 days ago1710201545IN
0xCEB404fD...6f1026D2d
0 ETH0.0001083173410.00091292
Set Peer1173013722024-03-11 23:58:41273 days ago1710201521IN
0xCEB404fD...6f1026D2d
0 ETH0.0001117209790.00097025
Set Peer1173013562024-03-11 23:58:09273 days ago1710201489IN
0xCEB404fD...6f1026D2d
0 ETH0.0001148035540.00097025
Set Peer1173013432024-03-11 23:57:43273 days ago1710201463IN
0xCEB404fD...6f1026D2d
0 ETH0.0001104328820.00074301
Set Peer1173013272024-03-11 23:57:11273 days ago1710201431IN
0xCEB404fD...6f1026D2d
0 ETH0.0000867032290.00004436
Set Peer1173013212024-03-11 23:56:59273 days ago1710201419IN
0xCEB404fD...6f1026D2d
0 ETH0.0000898968040.00094115
Set Peer1173013152024-03-11 23:56:47273 days ago1710201407IN
0xCEB404fD...6f1026D2d
0 ETH0.0000926297860.00094115
Set Peer1173013102024-03-11 23:56:37273 days ago1710201397IN
0xCEB404fD...6f1026D2d
0 ETH0.000090772940.00097025
Set Peer1173013012024-03-11 23:56:19273 days ago1710201379IN
0xCEB404fD...6f1026D2d
0 ETH0.0000830452330.0011643

Latest 2 internal transactions

Advanced mode:
Parent Transaction Hash Block From To
1181113872024-03-30 17:59:11254 days ago1711821551
0xCEB404fD...6f1026D2d
0.000127810347022 ETH
1181108682024-03-30 17:41:53254 days ago1711820513
0xCEB404fD...6f1026D2d
0.000131576079022 ETH

Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
BridgeV2

Compiler Version
v0.8.22+commit.4fc1097e

Optimization Enabled:
Yes with 1000000 runs

Other Settings:
paris EvmVersion
File 1 of 29 : BridgeV2.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.22;

import {OAppSender, MessagingFee} from "@layerzerolabs/lz-evm-oapp-v2/contracts/oapp/OAppSender.sol";
import {OApp} from "@layerzerolabs/lz-evm-oapp-v2/contracts/oapp/OApp.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {OAppReceiver, Origin} from "@layerzerolabs/lz-evm-oapp-v2/contracts/oapp/OAppReceiver.sol";
import {OptionsBuilder} from "@layerzerolabs/lz-evm-oapp-v2/contracts/oapp/libs/OptionsBuilder.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";

interface IERC20Mintable {

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

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


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

pragma solidity ^0.8.13;

error Token__Not__Whitelisted(address tokenName);
error Native__Transfer__Failed(address _receiver);

contract BridgeV2 is OApp, AccessControl {
    //stores the failed values of a native token incase balance is not enough on dest
    mapping(address => uint256) public failedNativeTransfer;

    mapping(string => bool) public nameToNative;

    using OptionsBuilder for bytes;

    mapping(address => bool) public isWhitelistedAdd;

    mapping(string => bool) public isWhitelistedName;

    mapping(string => address) public whitelistedTokenAddress;

    mapping(address => string) public whitelistedTokenName;

    bool public isBlocked;

    uint256 public bridgeFeePercent;

    string[] private whitelistedTokenNames;

    mapping(string => uint256) public mapWhiltelistTokenNames;

    address payable public bridgeFeeAddress;

    //default gas for dest
    uint128 public defaultGas;

    bytes32 public constant ONLY_ALLOWED = "ONLY_ALLOWED";

    bytes32 public constant ONLY_ADMIN = "ONLY_ADMIN";

    modifier onlyAllowed() {
        _;
    }

    event DEPOSIT(
        uint256 amount,
        address sender,
        address tokenAddress,
        string destChain
    );
    event WITHDRAW(uint256 amount, address sender, address tokenAddress);

    /// @notice Emitted when a message is received through _lzReceive.
    /// @param token token to be send
    /// @param _user user to receive funds
    /// @param senderEid What LayerZero Endpoint sent the message.
    /// @param guid The global unique identier for the packet.
    event MessageReceived(
        string token,
        address _user,
        uint256 amount,
        uint32 senderEid,
        bytes32 guid
    );

    event FailedNative(
        address indexed _user,
        uint256 indexed _amount,
        uint256 _time
    );

    constructor(
        address _endpoint,
        address _owner,
        string memory chainName //the chain this bridge is deplyed: should be nave token initials
    ) OApp(_endpoint, _owner) Ownable(_owner) {
        _grantRole(DEFAULT_ADMIN_ROLE, _owner);
        nameToNative[chainName] = true;
        isWhitelistedAdd[address(0)] = true;
        isWhitelistedName[chainName] = true;
        whitelistedTokenName[address(0)] = chainName;
        whitelistedTokenAddress[chainName] = address(0);
        mapWhiltelistTokenNames[chainName] = whitelistedTokenNames.length;
        whitelistedTokenNames.push(chainName);
        defaultGas = 500000;
        bridgeFeePercent = 5;
    }

    function getMessage(
        uint256 amount,
        address tokenAddress
    ) public view returns (bytes memory payload) {
        string memory tokenName = whitelistedTokenName[tokenAddress];
        payload = abi.encode(tokenName, msg.sender, amount);
    }

    function getGas(
        uint32 _dstEid,
        bytes memory _message,
        uint128 gas
    ) external view returns (MessagingFee memory fee) {
        bytes memory _options = getLzReceiveOption(gas, 0);

        fee = _quote(_dstEid, _message, _options, false);
    }

    function getFee(
        uint32 _dstEid,
        bytes memory _message,
        bytes memory _options
    ) public view returns (MessagingFee memory fee) {
        fee = _quote(_dstEid, _message, _options, false);
    }

    //Functions to block or unblock the bridge
    function blockBridge() external onlyOwner returns (bool) {
        isBlocked = true;
        return true;
    }

    function unblockBridge() external onlyOwner returns (bool) {
        isBlocked = false;
        return true;
    }

    //Function to retreive
    function getTokensLocked(
        address tokenAddress
    ) public view returns (uint256) {
        return IERC20Mintable(tokenAddress).balanceOf(address(this));
    }

    function setBridgeFeeAddress(
        address payable bridgeFeeAddress_
    ) public onlyOwner {
        require(bridgeFeeAddress_ != address(0), "Cannot be address 0");
        bridgeFeeAddress = bridgeFeeAddress_;
    }

    //Whitelisting and Initializing of Tokens
    function whitelistToken(
        address tokenAddress,
        string memory tokenName
    ) external onlyOwner returns (bool) {
        require(!isWhitelistedAdd[tokenAddress], "Duplicate token");
        require(!isWhitelistedName[tokenName], "Duplicate token");
        isWhitelistedAdd[tokenAddress] = true;
        isWhitelistedName[tokenName] = true;
        whitelistedTokenName[tokenAddress] = tokenName;
        whitelistedTokenAddress[tokenName] = tokenAddress;
        mapWhiltelistTokenNames[tokenName] = whitelistedTokenNames.length;
        whitelistedTokenNames.push(tokenName);
        return true;
    }

    function removeTokenFromWhitelist(
        address tokenAddress
    ) external onlyOwner returns (bool) {
        if (isWhitelistedAdd[tokenAddress]) {
            string memory tokenName = whitelistedTokenName[tokenAddress];
            delete whitelistedTokenAddress[tokenName];
            delete whitelistedTokenName[tokenAddress];
            uint256 i = mapWhiltelistTokenNames[tokenName];
            string memory lastTokenName = whitelistedTokenNames[
                ((whitelistedTokenNames.length) - 1)
            ];
            mapWhiltelistTokenNames[lastTokenName] = i;
            whitelistedTokenNames[i] = lastTokenName;
            whitelistedTokenNames.pop();
            delete mapWhiltelistTokenNames[tokenName];
            isWhitelistedAdd[tokenAddress] = false;
            isWhitelistedName[tokenName] = false;
            return true;
        } else {
            revert Token__Not__Whitelisted(tokenAddress);
        }
    }

    /// @notice Creates options for executing `lzReceive` on the destination chain.
    /// @param _gas The gas amount for the `lzReceive` execution.
    /// @param _value The msg.value for the `lzReceive` execution.
    /// @return bytes-encoded option set for `lzReceive` executor.
    function getLzReceiveOption(
        uint128 _gas,
        uint128 _value
    ) public pure returns (bytes memory) {
        return
            OptionsBuilder.newOptions().addExecutorLzReceiveOption(
                _gas,
                _value
            );
    }

    function updateContractGas(uint128 _gas) external onlyOwner {
        defaultGas = _gas;
    }

    /**
     * @notice used to deposit nave tokens to the contract
     * @param _destEid destination chain l0 ID
     * @param amount token amount
     * @param destChain destination chain
     */
    function depositNative(
        uint32 _destEid,
        uint256 amount,
        string memory destChain
    ) external payable returns (bool) {
        require(isBlocked != true, "blocked");
        require(isWhitelistedAdd[address(0)], "not Whitelisted");

        bytes memory _options = getLzReceiveOption(defaultGas, 0);

        string memory tokenName = whitelistedTokenName[address(0)];

        bytes memory payload = abi.encode(tokenName, msg.sender, amount);

        MessagingFee memory fee = getFee(_destEid, payload, _options);
        require(msg.value >= amount + fee.nativeFee, "not enough balance");

        _lzSend(_destEid, payload, _options, fee, msg.sender);
        emit DEPOSIT(amount, msg.sender, address(0), destChain);
        return true;
    }

    /**
     * @notice used to deposit nave tokens to the contract
     * @param _destEid destination chain l0 ID
     * @param amount token amount
     * @param tokenAddress destination chain l0 ID
     * @param destChain destination chain
     */
    function deposit(
        uint32 _destEid,
        uint256 amount,
        address tokenAddress,
        string memory destChain
    ) external payable returns (bool) {
        require(isBlocked != true, "blocked");
        require(
            isWhitelistedAdd[tokenAddress],
            "not Whitelisted"
        );

        IERC20Mintable(tokenAddress).transferFrom(
            msg.sender,
            address(this),
            (amount)
        );

        bytes memory _options = getLzReceiveOption(defaultGas, 0);

        bytes memory payload = getMessage(amount, tokenAddress);

        MessagingFee memory fee = getFee(_destEid, payload, _options);

        require(msg.value >= fee.nativeFee, "not enough fee");
        _lzSend(_destEid, payload, _options, fee, payable(msg.sender));
        emit DEPOSIT(amount, msg.sender, tokenAddress, destChain);
        return true;
    }

    // Withdraw function
    function withdraw(
        uint256 amount,
        string memory tokenName,
        address receiver
    ) private returns (bool) {
        address tokenAddress = whitelistedTokenAddress[tokenName];
        require(!isBlocked, "Bridge is blocked right now");

        uint256 feeAmount = (amount * bridgeFeePercent);
        amount = (amount * 1000) - feeAmount;

        IERC20Mintable(tokenAddress).transfer(receiver, (amount / 1000));
        IERC20Mintable(tokenAddress).transfer(
            bridgeFeeAddress,
            (feeAmount / 1000)
        );

        emit WITHDRAW((amount / 1000), receiver, tokenAddress);
        return true;
    }

    function withdrawAxl(
        uint256 amount,
        string memory tokenName,
        address receiver
    ) external onlyRole(ONLY_ALLOWED) returns (bool) {
        address tokenAddress = whitelistedTokenAddress[tokenName];
        uint256 feeAmount = (amount * bridgeFeePercent);
        amount = (amount * 1000) - feeAmount;

        IERC20Mintable(tokenAddress).transfer(receiver, (amount / 1000));
        IERC20Mintable(tokenAddress).transfer(
            bridgeFeeAddress,
            (feeAmount / 1000)
        );

        emit WITHDRAW((amount / 1000), receiver, tokenAddress);
        return true;
    }

    ///@notice addAllowed will enable spherium bridge to be invoved by multiple routers
    function addAllowed(address _address) external onlyRole(ONLY_ADMIN) {
        _grantRole(ONLY_ALLOWED, _address);
    }

    /**
     * @dev Called when data is received from the protocol. It overrides the equivalent function in the parent contract.
     * Protocol messages are defined as packets, comprised of the following parameters.
     * @param _origin A struct containing information about where the packet came from.
     * @param _guid A global unique identifier for tracking the packet.
     * @param payload Encoded message.
     */
    function _lzReceive(
        Origin calldata _origin,
        bytes32 _guid,
        bytes calldata payload,
        address, // Executor address as specified by the OApp.
        bytes calldata // Any extra data or options to trigger on receipt.
    ) internal override {
        // Decode the payload to get the message

        // Extract the sender's EID from the origin
        uint32 senderEid = _origin.srcEid;
        //bytes32 sender = _origin.sender;
        (string memory _token, address user, uint256 amount) = abi.decode(
            payload,
            (string, address, uint256)
        );
        if (nameToNative[_token]) {
            withdrawNative(amount, payable(user));
        } else {
            withdraw(amount, _token, user);
        }
        emit MessageReceived(_token, user, amount, senderEid, _guid);

        //Emit the event
    }

    function withdrawNative(
        uint256 amount,
        address payable _receiver
    ) private returns (bool success) {
        if (amount > address(this).balance) {
            failedNativeTransfer[_receiver] = amount;

            emit FailedNative(_receiver, amount, block.timestamp);
        } else {
            uint256 feeAmount = (amount * bridgeFeePercent);
            amount = (amount * 1000) - feeAmount;
            (success, ) = _receiver.call{value: amount / 1000}("");
            (bool done, ) = bridgeFeeAddress.call{value: feeAmount / 1000}("");
            if (success && done) {
                emit WITHDRAW((amount / 1000), _receiver, address(0));
            } else {
                revert Native__Transfer__Failed(_receiver);
            }
        }
    }

    function withdrawNativeAxl(
        uint256 amount,
        address payable _receiver
    ) external onlyRole(ONLY_ALLOWED) returns (bool success) {
        if (amount > address(this).balance) {
            failedNativeTransfer[_receiver] = amount;

            emit FailedNative(_receiver, amount, block.timestamp);
        } else {
            uint256 feeAmount = (amount * bridgeFeePercent);
            amount = (amount * 1000) - feeAmount;
            (success, ) = _receiver.call{value: amount / 1000}("");
            (bool done, ) = bridgeFeeAddress.call{value: feeAmount / 1000}("");
            if (success && done) {
                emit WITHDRAW((amount / 1000), _receiver, address(0));
            } else {
                revert Native__Transfer__Failed(_receiver);
            }
        }
    }

    //Function to change the bridge fee percentage
    function changeBridgeFee(uint256 value) external onlyOwner returns (bool) {
        require(value != 0, "Value cannot be 0");
        bridgeFeePercent = value;
        return true;
    }

    //Function to get names of all whitelisted tokens
    function getAllWhitelistedTokenNames()
        external
        view
        returns (string[] memory)
    {
        return whitelistedTokenNames;
    }

    function unlockToken(
        address tokenAddress,
        uint256 amount,
        address receiver
    ) external onlyOwner {
        IERC20Mintable(tokenAddress).transfer(receiver, amount);
    }

    function unlockNative(
        address payable _destinanion,
        uint256 _amount
    ) external onlyOwner returns (bool success) {
        require(address(this).balance >= _amount, "balance err");
        (success, ) = _destinanion.call{value: _amount}("");
    }

    receive() external payable {}
}

File 2 of 29 : DVNOptions.sol
// SPDX-License-Identifier: LZBL-1.2

pragma solidity ^0.8.22;

import { BytesLib } from "solidity-bytes-utils/contracts/BytesLib.sol";

import { BitMap256 } from "@layerzerolabs/lz-evm-protocol-v2/contracts/messagelib/libs/BitMaps.sol";
import { CalldataBytesLib } from "@layerzerolabs/lz-evm-protocol-v2/contracts/libs/CalldataBytesLib.sol";

library DVNOptions {
    using CalldataBytesLib for bytes;
    using BytesLib for bytes;

    uint8 internal constant WORKER_ID = 2;
    uint8 internal constant OPTION_TYPE_PRECRIME = 1;

    error InvalidDVNIdx();
    error InvalidDVNOptions(uint256 cursor);

    /// @dev group dvn options by its idx
    /// @param _options [dvn_id][dvn_option][dvn_id][dvn_option]...
    ///        dvn_option = [option_size][dvn_idx][option_type][option]
    ///        option_size = len(dvn_idx) + len(option_type) + len(option)
    ///        dvn_id: uint8, dvn_idx: uint8, option_size: uint16, option_type: uint8, option: bytes
    /// @return dvnOptions the grouped options, still share the same format of _options
    /// @return dvnIndices the dvn indices
    function groupDVNOptionsByIdx(
        bytes memory _options
    ) internal pure returns (bytes[] memory dvnOptions, uint8[] memory dvnIndices) {
        if (_options.length == 0) return (dvnOptions, dvnIndices);

        uint8 numDVNs = getNumDVNs(_options);

        // if there is only 1 dvn, we can just return the whole options
        if (numDVNs == 1) {
            dvnOptions = new bytes[](1);
            dvnOptions[0] = _options;

            dvnIndices = new uint8[](1);
            dvnIndices[0] = _options.toUint8(3); // dvn idx
            return (dvnOptions, dvnIndices);
        }

        // otherwise, we need to group the options by dvn_idx
        dvnIndices = new uint8[](numDVNs);
        dvnOptions = new bytes[](numDVNs);
        unchecked {
            uint256 cursor = 0;
            uint256 start = 0;
            uint8 lastDVNIdx = 255; // 255 is an invalid dvn_idx

            while (cursor < _options.length) {
                ++cursor; // skip worker_id

                // optionLength asserted in getNumDVNs (skip check)
                uint16 optionLength = _options.toUint16(cursor);
                cursor += 2;

                // dvnIdx asserted in getNumDVNs (skip check)
                uint8 dvnIdx = _options.toUint8(cursor);

                // dvnIdx must equal to the lastDVNIdx for the first option
                // so it is always skipped in the first option
                // this operation slices out options whenever the scan finds a different lastDVNIdx
                if (lastDVNIdx == 255) {
                    lastDVNIdx = dvnIdx;
                } else if (dvnIdx != lastDVNIdx) {
                    uint256 len = cursor - start - 3; // 3 is for worker_id and option_length
                    bytes memory opt = _options.slice(start, len);
                    _insertDVNOptions(dvnOptions, dvnIndices, lastDVNIdx, opt);

                    // reset the start and lastDVNIdx
                    start += len;
                    lastDVNIdx = dvnIdx;
                }

                cursor += optionLength;
            }

            // skip check the cursor here because the cursor is asserted in getNumDVNs
            // if we have reached the end of the options, we need to process the last dvn
            uint256 size = cursor - start;
            bytes memory op = _options.slice(start, size);
            _insertDVNOptions(dvnOptions, dvnIndices, lastDVNIdx, op);

            // revert dvnIndices to start from 0
            for (uint8 i = 0; i < numDVNs; ++i) {
                --dvnIndices[i];
            }
        }
    }

    function _insertDVNOptions(
        bytes[] memory _dvnOptions,
        uint8[] memory _dvnIndices,
        uint8 _dvnIdx,
        bytes memory _newOptions
    ) internal pure {
        // dvnIdx starts from 0 but default value of dvnIndices is 0,
        // so we tell if the slot is empty by adding 1 to dvnIdx
        if (_dvnIdx == 255) revert InvalidDVNIdx();
        uint8 dvnIdxAdj = _dvnIdx + 1;

        for (uint256 j = 0; j < _dvnIndices.length; ++j) {
            uint8 index = _dvnIndices[j];
            if (dvnIdxAdj == index) {
                _dvnOptions[j] = abi.encodePacked(_dvnOptions[j], _newOptions);
                break;
            } else if (index == 0) {
                // empty slot, that means it is the first time we see this dvn
                _dvnIndices[j] = dvnIdxAdj;
                _dvnOptions[j] = _newOptions;
                break;
            }
        }
    }

    /// @dev get the number of unique dvns
    /// @param _options the format is the same as groupDVNOptionsByIdx
    function getNumDVNs(bytes memory _options) internal pure returns (uint8 numDVNs) {
        uint256 cursor = 0;
        BitMap256 bitmap;

        // find number of unique dvn_idx
        unchecked {
            while (cursor < _options.length) {
                ++cursor; // skip worker_id

                uint16 optionLength = _options.toUint16(cursor);
                cursor += 2;
                if (optionLength < 2) revert InvalidDVNOptions(cursor); // at least 1 byte for dvn_idx and 1 byte for option_type

                uint8 dvnIdx = _options.toUint8(cursor);

                // if dvnIdx is not set, increment numDVNs
                // max num of dvns is 255, 255 is an invalid dvn_idx
                // The order of the dvnIdx is not required to be sequential, as enforcing the order may weaken
                // the composability of the options. e.g. if we refrain from enforcing the order, an OApp that has
                // already enforced certain options can append additional options to the end of the enforced
                // ones without restrictions.
                if (dvnIdx == 255) revert InvalidDVNIdx();
                if (!bitmap.get(dvnIdx)) {
                    ++numDVNs;
                    bitmap = bitmap.set(dvnIdx);
                }

                cursor += optionLength;
            }
        }
        if (cursor != _options.length) revert InvalidDVNOptions(cursor);
    }

    /// @dev decode the next dvn option from _options starting from the specified cursor
    /// @param _options the format is the same as groupDVNOptionsByIdx
    /// @param _cursor the cursor to start decoding
    /// @return optionType the type of the option
    /// @return option the option
    /// @return cursor the cursor to start decoding the next option
    function nextDVNOption(
        bytes calldata _options,
        uint256 _cursor
    ) internal pure returns (uint8 optionType, bytes calldata option, uint256 cursor) {
        unchecked {
            // skip worker id
            cursor = _cursor + 1;

            // read option size
            uint16 size = _options.toU16(cursor);
            cursor += 2;

            // read option type
            optionType = _options.toU8(cursor + 1); // skip dvn_idx

            // startCursor and endCursor are used to slice the option from _options
            uint256 startCursor = cursor + 2; // skip option type and dvn_idx
            uint256 endCursor = cursor + size;
            option = _options[startCursor:endCursor];
            cursor += size;
        }
    }
}

File 3 of 29 : IOAppCore.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.22;

import { ILayerZeroEndpointV2 } from "@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroEndpointV2.sol";

/**
 * @title IOAppCore
 */
interface IOAppCore {
    // Custom error messages
    error OnlyPeer(uint32 eid, bytes32 sender);
    error NoPeer(uint32 eid);
    error InvalidEndpointCall();

    // Event emitted when a peer (OApp) is set for a corresponding endpoint
    event PeerSet(uint32 eid, bytes32 peer);

    /**
     * @notice Retrieves the OApp version information.
     * @return senderVersion The version of the OAppSender.sol contract.
     * @return receiverVersion The version of the OAppReceiver.sol contract.
     */
    function oAppVersion() external view returns (uint64 senderVersion, uint64 receiverVersion);

    /**
     * @notice Retrieves the LayerZero endpoint associated with the OApp.
     * @return iEndpoint The LayerZero endpoint as an interface.
     */
    function endpoint() external view returns (ILayerZeroEndpointV2 iEndpoint);

    /**
     * @notice Retrieves the peer (OApp) associated with a corresponding endpoint.
     * @param _eid The endpoint ID.
     * @return peer The peer address (OApp instance) associated with the corresponding endpoint.
     */
    function peers(uint32 _eid) external view returns (bytes32 peer);

    /**
     * @notice Sets the peer address (OApp instance) for a corresponding endpoint.
     * @param _eid The endpoint ID.
     * @param _peer The address of the peer to be associated with the corresponding endpoint.
     */
    function setPeer(uint32 _eid, bytes32 _peer) external;

    /**
     * @notice Sets the delegate address for the OApp Core.
     * @param _delegate The address of the delegate to be set.
     */
    function setDelegate(address _delegate) external;
}

File 4 of 29 : OptionsBuilder.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.22;

import { BytesLib } from "solidity-bytes-utils/contracts/BytesLib.sol";
import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol";

import { ExecutorOptions } from "@layerzerolabs/lz-evm-protocol-v2/contracts/messagelib/libs/ExecutorOptions.sol";
import { DVNOptions } from "@layerzerolabs/lz-evm-messagelib-v2/contracts/uln/libs/DVNOptions.sol";

/**
 * @title OptionsBuilder
 * @dev Library for building and encoding various message options.
 */
library OptionsBuilder {
    using SafeCast for uint256;
    using BytesLib for bytes;

    // Constants for options types
    uint16 internal constant TYPE_1 = 1; // legacy options type 1
    uint16 internal constant TYPE_2 = 2; // legacy options type 2
    uint16 internal constant TYPE_3 = 3;

    // Custom error message
    error InvalidSize(uint256 max, uint256 actual);
    error InvalidOptionType(uint16 optionType);

    // Modifier to ensure only options of type 3 are used
    modifier onlyType3(bytes memory _options) {
        if (_options.toUint16(0) != TYPE_3) revert InvalidOptionType(_options.toUint16(0));
        _;
    }

    /**
     * @dev Creates a new options container with type 3.
     * @return options The newly created options container.
     */
    function newOptions() internal pure returns (bytes memory) {
        return abi.encodePacked(TYPE_3);
    }

    /**
     * @dev Adds an executor LZ receive option to the existing options.
     * @param _options The existing options container.
     * @param _gas The gasLimit used on the lzReceive() function in the OApp.
     * @param _value The msg.value passed to the lzReceive() function in the OApp.
     * @return options The updated options container.
     *
     * @dev When multiples of this option are added, they are summed by the executor
     * eg. if (_gas: 200k, and _value: 1 ether) AND (_gas: 100k, _value: 0.5 ether) are sent in an option to the LayerZeroEndpoint,
     * that becomes (300k, 1.5 ether) when the message is executed on the remote lzReceive() function.
     */
    function addExecutorLzReceiveOption(
        bytes memory _options,
        uint128 _gas,
        uint128 _value
    ) internal pure onlyType3(_options) returns (bytes memory) {
        bytes memory option = ExecutorOptions.encodeLzReceiveOption(_gas, _value);
        return addExecutorOption(_options, ExecutorOptions.OPTION_TYPE_LZRECEIVE, option);
    }

    /**
     * @dev Adds an executor native drop option to the existing options.
     * @param _options The existing options container.
     * @param _amount The amount for the native value that is airdropped to the 'receiver'.
     * @param _receiver The receiver address for the native drop option.
     * @return options The updated options container.
     *
     * @dev When multiples of this option are added, they are summed by the executor on the remote chain.
     */
    function addExecutorNativeDropOption(
        bytes memory _options,
        uint128 _amount,
        bytes32 _receiver
    ) internal pure onlyType3(_options) returns (bytes memory) {
        bytes memory option = ExecutorOptions.encodeNativeDropOption(_amount, _receiver);
        return addExecutorOption(_options, ExecutorOptions.OPTION_TYPE_NATIVE_DROP, option);
    }

    /**
     * @dev Adds an executor LZ compose option to the existing options.
     * @param _options The existing options container.
     * @param _index The index for the lzCompose() function call.
     * @param _gas The gasLimit for the lzCompose() function call.
     * @param _value The msg.value for the lzCompose() function call.
     * @return options The updated options container.
     *
     * @dev When multiples of this option are added, they are summed PER index by the executor on the remote chain.
     * @dev If the OApp sends N lzCompose calls on the remote, you must provide N incremented indexes starting with 0.
     * ie. When your remote OApp composes (N = 3) messages, you must set this option for index 0,1,2
     */
    function addExecutorLzComposeOption(
        bytes memory _options,
        uint16 _index,
        uint128 _gas,
        uint128 _value
    ) internal pure onlyType3(_options) returns (bytes memory) {
        bytes memory option = ExecutorOptions.encodeLzComposeOption(_index, _gas, _value);
        return addExecutorOption(_options, ExecutorOptions.OPTION_TYPE_LZCOMPOSE, option);
    }

    /**
     * @dev Adds an executor ordered execution option to the existing options.
     * @param _options The existing options container.
     * @return options The updated options container.
     */
    function addExecutorOrderedExecutionOption(
        bytes memory _options
    ) internal pure onlyType3(_options) returns (bytes memory) {
        return addExecutorOption(_options, ExecutorOptions.OPTION_TYPE_ORDERED_EXECUTION, bytes(""));
    }

    /**
     * @dev Adds a DVN pre-crime option to the existing options.
     * @param _options The existing options container.
     * @param _dvnIdx The DVN index for the pre-crime option.
     * @return options The updated options container.
     */
    function addDVNPreCrimeOption(
        bytes memory _options,
        uint8 _dvnIdx
    ) internal pure onlyType3(_options) returns (bytes memory) {
        return addDVNOption(_options, _dvnIdx, DVNOptions.OPTION_TYPE_PRECRIME, bytes(""));
    }

    /**
     * @dev Adds an executor option to the existing options.
     * @param _options The existing options container.
     * @param _optionType The type of the executor option.
     * @param _option The encoded data for the executor option.
     * @return options The updated options container.
     */
    function addExecutorOption(
        bytes memory _options,
        uint8 _optionType,
        bytes memory _option
    ) internal pure onlyType3(_options) returns (bytes memory) {
        return
            abi.encodePacked(
                _options,
                ExecutorOptions.WORKER_ID,
                _option.length.toUint16() + 1, // +1 for optionType
                _optionType,
                _option
            );
    }

    /**
     * @dev Adds a DVN option to the existing options.
     * @param _options The existing options container.
     * @param _dvnIdx The DVN index for the DVN option.
     * @param _optionType The type of the DVN option.
     * @param _option The encoded data for the DVN option.
     * @return options The updated options container.
     */
    function addDVNOption(
        bytes memory _options,
        uint8 _dvnIdx,
        uint8 _optionType,
        bytes memory _option
    ) internal pure onlyType3(_options) returns (bytes memory) {
        return
            abi.encodePacked(
                _options,
                DVNOptions.WORKER_ID,
                _option.length.toUint16() + 2, // +2 for optionType and dvnIdx
                _dvnIdx,
                _optionType,
                _option
            );
    }

    /**
     * @dev Encodes legacy options of type 1.
     * @param _executionGas The gasLimit value passed to lzReceive().
     * @return legacyOptions The encoded legacy options.
     */
    function encodeLegacyOptionsType1(uint256 _executionGas) internal pure returns (bytes memory) {
        if (_executionGas > type(uint128).max) revert InvalidSize(type(uint128).max, _executionGas);
        return abi.encodePacked(TYPE_1, _executionGas);
    }

    /**
     * @dev Encodes legacy options of type 2.
     * @param _executionGas The gasLimit value passed to lzReceive().
     * @param _nativeForDst The amount of native air dropped to the receiver.
     * @param _receiver The _nativeForDst receiver address.
     * @return legacyOptions The encoded legacy options of type 2.
     */
    function encodeLegacyOptionsType2(
        uint256 _executionGas,
        uint256 _nativeForDst,
        bytes memory _receiver // @dev Use bytes instead of bytes32 in legacy type 2 for _receiver.
    ) internal pure returns (bytes memory) {
        if (_executionGas > type(uint128).max) revert InvalidSize(type(uint128).max, _executionGas);
        if (_nativeForDst > type(uint128).max) revert InvalidSize(type(uint128).max, _nativeForDst);
        if (_receiver.length > 32) revert InvalidSize(32, _receiver.length);
        return abi.encodePacked(TYPE_2, _executionGas, _nativeForDst, _receiver);
    }
}

File 5 of 29 : OApp.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.22;

// @dev Import the 'MessagingFee' so it's exposed to OApp implementers
// solhint-disable-next-line no-unused-import
import { OAppSender, MessagingFee } from "./OAppSender.sol";
// @dev Import the 'Origin' so it's exposed to OApp implementers
// solhint-disable-next-line no-unused-import
import { OAppReceiver, Origin } from "./OAppReceiver.sol";
import { OAppCore } from "./OAppCore.sol";

/**
 * @title OApp
 * @dev Abstract contract serving as the base for OApp implementation, combining OAppSender and OAppReceiver functionality.
 */
abstract contract OApp is OAppSender, OAppReceiver {
    /**
     * @dev Constructor to initialize the OApp with the provided endpoint and owner.
     * @param _endpoint The address of the LOCAL LayerZero endpoint.
     * @param _owner The address of the owner of the OApp.
     */
    constructor(address _endpoint, address _owner) OAppCore(_endpoint, _owner) {}

    /**
     * @notice Retrieves the OApp version information.
     * @return senderVersion The version of the OAppSender.sol implementation.
     * @return receiverVersion The version of the OAppReceiver.sol implementation.
     */
    function oAppVersion()
        public
        pure
        virtual
        override(OAppSender, OAppReceiver)
        returns (uint64 senderVersion, uint64 receiverVersion)
    {
        return (SENDER_VERSION, RECEIVER_VERSION);
    }
}

File 6 of 29 : OAppCore.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.22;

import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { IOAppCore, ILayerZeroEndpointV2 } from "./interfaces/IOAppCore.sol";

/**
 * @title OAppCore
 * @dev Abstract contract implementing the IOAppCore interface with basic OApp configurations.
 */
abstract contract OAppCore is IOAppCore, Ownable {
    // The LayerZero endpoint associated with the given OApp
    ILayerZeroEndpointV2 public immutable endpoint;

    // Mapping to store peers associated with corresponding endpoints
    mapping(uint32 eid => bytes32 peer) public peers;

    /**
     * @dev Constructor to initialize the OAppCore with the provided endpoint and owner.
     * @param _endpoint The address of the LOCAL Layer Zero endpoint.
     * @param _owner The address of the owner of the OAppCore.
     */
    constructor(address _endpoint, address _owner) {
        _transferOwnership(_owner);
        endpoint = ILayerZeroEndpointV2(_endpoint);
        endpoint.setDelegate(_owner); // @dev By default, the owner is the delegate
    }

    /**
     * @notice Sets the peer address (OApp instance) for a corresponding endpoint.
     * @param _eid The endpoint ID.
     * @param _peer The address of the peer to be associated with the corresponding endpoint.
     *
     * @dev Only the owner/admin of the OApp can call this function.
     * @dev Indicates that the peer is trusted to send LayerZero messages to this OApp.
     * @dev Set this to bytes32(0) to remove the peer address.
     * @dev Peer is a bytes32 to accommodate non-evm chains.
     */
    function setPeer(uint32 _eid, bytes32 _peer) public virtual onlyOwner {
        peers[_eid] = _peer;
        emit PeerSet(_eid, _peer);
    }

    /**
     * @notice Internal function to get the peer address associated with a specific endpoint; reverts if NOT set.
     * ie. the peer is set to bytes32(0).
     * @param _eid The endpoint ID.
     * @return peer The address of the peer associated with the specified endpoint.
     */
    function _getPeerOrRevert(uint32 _eid) internal view virtual returns (bytes32) {
        bytes32 peer = peers[_eid];
        if (peer == bytes32(0)) revert NoPeer(_eid);
        return peer;
    }

    /**
     * @notice Sets the delegate address for the OApp.
     * @param _delegate The address of the delegate to be set.
     *
     * @dev Only the owner/admin of the OApp can call this function.
     * @dev Provides the ability for a delegate to set configs, on behalf of the OApp, directly on the Endpoint contract.
     * @dev Defaults to the owner of the OApp.
     */
    function setDelegate(address _delegate) public onlyOwner {
        endpoint.setDelegate(_delegate);
    }
}

File 7 of 29 : OAppReceiver.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.22;

import { ILayerZeroReceiver, Origin } from "@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroReceiver.sol";
import { OAppCore } from "./OAppCore.sol";

/**
 * @title OAppReceiver
 * @dev Abstract contract implementing the ILayerZeroReceiver interface and extending OAppCore for OApp receivers.
 */
abstract contract OAppReceiver is ILayerZeroReceiver, OAppCore {
    // Custom error message for when the caller is not the registered endpoint/
    error OnlyEndpoint(address addr);

    // @dev The version of the OAppReceiver implementation.
    // @dev Version is bumped when changes are made to this contract.
    uint64 internal constant RECEIVER_VERSION = 1;

    /**
     * @notice Retrieves the OApp version information.
     * @return senderVersion The version of the OAppSender.sol contract.
     * @return receiverVersion The version of the OAppReceiver.sol contract.
     *
     * @dev Providing 0 as the default for OAppSender version. Indicates that the OAppSender is not implemented.
     * ie. this is a SEND only OApp.
     * @dev If the OApp uses both OAppSender and OAppReceiver, then this needs to be override returning the correct versions.
     */
    function oAppVersion() public view virtual returns (uint64 senderVersion, uint64 receiverVersion) {
        return (0, RECEIVER_VERSION);
    }

    /**
     * @notice Checks if the path initialization is allowed based on the provided origin.
     * @param origin The origin information containing the source endpoint and sender address.
     * @return Whether the path has been initialized.
     *
     * @dev This indicates to the endpoint that the OApp has enabled msgs for this particular path to be received.
     * @dev This defaults to assuming if a peer has been set, its initialized.
     * Can be overridden by the OApp if there is other logic to determine this.
     */
    function allowInitializePath(Origin calldata origin) public view virtual returns (bool) {
        return peers[origin.srcEid] == origin.sender;
    }

    /**
     * @notice Retrieves the next nonce for a given source endpoint and sender address.
     * @dev _srcEid The source endpoint ID.
     * @dev _sender The sender address.
     * @return nonce The next nonce.
     *
     * @dev The path nonce starts from 1. If 0 is returned it means that there is NO nonce ordered enforcement.
     * @dev Is required by the off-chain executor to determine the OApp expects msg execution is ordered.
     * @dev This is also enforced by the OApp.
     * @dev By default this is NOT enabled. ie. nextNonce is hardcoded to return 0.
     */
    function nextNonce(uint32 /*_srcEid*/, bytes32 /*_sender*/) public view virtual returns (uint64 nonce) {
        return 0;
    }

    /**
     * @dev Entry point for receiving messages or packets from the endpoint.
     * @param _origin The origin information containing the source endpoint and sender address.
     *  - srcEid: The source chain endpoint ID.
     *  - sender: The sender address on the src chain.
     *  - nonce: The nonce of the message.
     * @param _guid The unique identifier for the received LayerZero message.
     * @param _message The payload of the received message.
     * @param _executor The address of the executor for the received message.
     * @param _extraData Additional arbitrary data provided by the corresponding executor.
     *
     * @dev Entry point for receiving msg/packet from the LayerZero endpoint.
     */
    function lzReceive(
        Origin calldata _origin,
        bytes32 _guid,
        bytes calldata _message,
        address _executor,
        bytes calldata _extraData
    ) public payable virtual {
        // Ensures that only the endpoint can attempt to lzReceive() messages to this OApp.
        if (address(endpoint) != msg.sender) revert OnlyEndpoint(msg.sender);

        // Ensure that the sender matches the expected peer for the source endpoint.
        if (_getPeerOrRevert(_origin.srcEid) != _origin.sender) revert OnlyPeer(_origin.srcEid, _origin.sender);

        // Call the internal OApp implementation of lzReceive.
        _lzReceive(_origin, _guid, _message, _executor, _extraData);
    }

    /**
     * @dev Internal function to implement lzReceive logic without needing to copy the basic parameter validation.
     */
    function _lzReceive(
        Origin calldata _origin,
        bytes32 _guid,
        bytes calldata _message,
        address _executor,
        bytes calldata _extraData
    ) internal virtual;
}

File 8 of 29 : OAppSender.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.22;

import { SafeERC20, IERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { MessagingParams, MessagingFee, MessagingReceipt } from "@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroEndpointV2.sol";
import { OAppCore } from "./OAppCore.sol";

/**
 * @title OAppSender
 * @dev Abstract contract implementing the OAppSender functionality for sending messages to a LayerZero endpoint.
 */
abstract contract OAppSender is OAppCore {
    using SafeERC20 for IERC20;

    // Custom error messages
    error NotEnoughNative(uint256 msgValue);
    error LzTokenUnavailable();

    // @dev The version of the OAppSender implementation.
    // @dev Version is bumped when changes are made to this contract.
    uint64 internal constant SENDER_VERSION = 1;

    /**
     * @notice Retrieves the OApp version information.
     * @return senderVersion The version of the OAppSender.sol contract.
     * @return receiverVersion The version of the OAppReceiver.sol contract.
     *
     * @dev Providing 0 as the default for OAppReceiver version. Indicates that the OAppReceiver is not implemented.
     * ie. this is a RECEIVE only OApp.
     * @dev If the OApp uses both OAppSender and OAppReceiver, then this needs to be override returning the correct versions
     */
    function oAppVersion() public view virtual returns (uint64 senderVersion, uint64 receiverVersion) {
        return (SENDER_VERSION, 0);
    }

    /**
     * @dev Internal function to interact with the LayerZero EndpointV2.quote() for fee calculation.
     * @param _dstEid The destination endpoint ID.
     * @param _message The message payload.
     * @param _options Additional options for the message.
     * @param _payInLzToken Flag indicating whether to pay the fee in LZ tokens.
     * @return fee The calculated MessagingFee for the message.
     *      - nativeFee: The native fee for the message.
     *      - lzTokenFee: The LZ token fee for the message.
     */
    function _quote(
        uint32 _dstEid,
        bytes memory _message,
        bytes memory _options,
        bool _payInLzToken
    ) internal view virtual returns (MessagingFee memory fee) {
        return
            endpoint.quote(
                MessagingParams(_dstEid, _getPeerOrRevert(_dstEid), _message, _options, _payInLzToken),
                address(this)
            );
    }

    /**
     * @dev Internal function to interact with the LayerZero EndpointV2.send() for sending a message.
     * @param _dstEid The destination endpoint ID.
     * @param _message The message payload.
     * @param _options Additional options for the message.
     * @param _fee The calculated LayerZero fee for the message.
     *      - nativeFee: The native fee.
     *      - lzTokenFee: The lzToken fee.
     * @param _refundAddress The address to receive any excess fee values sent to the endpoint.
     * @return receipt The receipt for the sent message.
     *      - guid: The unique identifier for the sent message.
     *      - nonce: The nonce of the sent message.
     *      - fee: The LayerZero fee incurred for the message.
     */
    function _lzSend(
        uint32 _dstEid,
        bytes memory _message,
        bytes memory _options,
        MessagingFee memory _fee,
        address _refundAddress
    ) internal virtual returns (MessagingReceipt memory receipt) {
        // @dev Push corresponding fees to the endpoint, any excess is sent back to the _refundAddress from the endpoint.
        uint256 messageValue = _payNative(_fee.nativeFee);
        if (_fee.lzTokenFee > 0) _payLzToken(_fee.lzTokenFee);

        return
            // solhint-disable-next-line check-send-result
            endpoint.send{ value: messageValue }(
                MessagingParams(_dstEid, _getPeerOrRevert(_dstEid), _message, _options, _fee.lzTokenFee > 0),
                _refundAddress
            );
    }

    /**
     * @dev Internal function to pay the native fee associated with the message.
     * @param _nativeFee The native fee to be paid.
     * @return nativeFee The amount of native currency paid.
     *
     * @dev If the OApp needs to initiate MULTIPLE LayerZero messages in a single transaction,
     * this will need to be overridden because msg.value would contain multiple lzFees.
     * @dev Should be overridden in the event the LayerZero endpoint requires a different native currency.
     * @dev Some EVMs use an ERC20 as a method for paying transactions/gasFees.
     * @dev The endpoint is EITHER/OR, ie. it will NOT support both types of native payment at a time.
     */
    function _payNative(uint256 _nativeFee) internal virtual returns (uint256 nativeFee) {
        if (msg.value != _nativeFee) revert NotEnoughNative(msg.value);
        return _nativeFee;
    }

    /**
     * @dev Internal function to pay the LZ token fee associated with the message.
     * @param _lzTokenFee The LZ token fee to be paid.
     *
     * @dev If the caller is trying to pay in the specified lzToken, then the lzTokenFee is passed to the endpoint.
     * @dev Any excess sent, is passed back to the specified _refundAddress in the _lzSend().
     */
    function _payLzToken(uint256 _lzTokenFee) internal virtual {
        // @dev Cannot cache the token because it is not immutable in the endpoint.
        address lzToken = endpoint.lzToken();
        if (lzToken == address(0)) revert LzTokenUnavailable();

        // Pay LZ token fee by sending tokens to the endpoint.
        IERC20(lzToken).safeTransferFrom(msg.sender, address(endpoint), _lzTokenFee);
    }
}

File 9 of 29 : ILayerZeroEndpointV2.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.8.0;

import { IMessageLibManager } from "./IMessageLibManager.sol";
import { IMessagingComposer } from "./IMessagingComposer.sol";
import { IMessagingChannel } from "./IMessagingChannel.sol";
import { IMessagingContext } from "./IMessagingContext.sol";

struct MessagingParams {
    uint32 dstEid;
    bytes32 receiver;
    bytes message;
    bytes options;
    bool payInLzToken;
}

struct MessagingReceipt {
    bytes32 guid;
    uint64 nonce;
    MessagingFee fee;
}

struct MessagingFee {
    uint256 nativeFee;
    uint256 lzTokenFee;
}

struct Origin {
    uint32 srcEid;
    bytes32 sender;
    uint64 nonce;
}

enum ExecutionState {
    NotExecutable,
    Executable,
    Executed
}

interface ILayerZeroEndpointV2 is IMessageLibManager, IMessagingComposer, IMessagingChannel, IMessagingContext {
    event PacketSent(bytes encodedPayload, bytes options, address sendLibrary);

    event PacketVerified(Origin origin, address receiver, bytes32 payloadHash);

    event PacketDelivered(Origin origin, address receiver);

    event LzReceiveAlert(
        address indexed receiver,
        address indexed executor,
        Origin origin,
        bytes32 guid,
        uint256 gas,
        uint256 value,
        bytes message,
        bytes extraData,
        bytes reason
    );

    event LzTokenSet(address token);

    function quote(MessagingParams calldata _params, address _sender) external view returns (MessagingFee memory);

    function send(
        MessagingParams calldata _params,
        address _refundAddress
    ) external payable returns (MessagingReceipt memory);

    function verify(Origin calldata _origin, address _receiver, bytes32 _payloadHash) external;

    function verifiable(
        Origin calldata _origin,
        address _receiver,
        address _receiveLib,
        bytes32 _payloadHash
    ) external view returns (bool);

    function executable(Origin calldata _origin, address _receiver) external view returns (ExecutionState);

    function lzReceive(
        Origin calldata _origin,
        address _receiver,
        bytes32 _guid,
        bytes calldata _message,
        bytes calldata _extraData
    ) external payable;

    // oapp can burn messages partially by calling this function with its own business logic if messages are verified in order
    function clear(address _oapp, Origin calldata _origin, bytes32 _guid, bytes calldata _message) external;

    function setLzToken(address _lzToken) external;

    function lzToken() external view returns (address);

    function nativeToken() external view returns (address);

    function setDelegate(address _delegate) external;
}

File 10 of 29 : ILayerZeroReceiver.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.8.0;

import { Origin } from "./ILayerZeroEndpointV2.sol";

interface ILayerZeroReceiver {
    function allowInitializePath(Origin calldata _origin) external view returns (bool);

    // todo: move to OAppReceiver? it is just convention for executor. we may can change it in a new Receiver version
    function nextNonce(uint32 _eid, bytes32 _sender) external view returns (uint64);

    function lzReceive(
        Origin calldata _origin,
        bytes32 _guid,
        bytes calldata _message,
        address _executor,
        bytes calldata _extraData
    ) external payable;
}

File 11 of 29 : IMessageLibManager.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.8.0;

struct SetConfigParam {
    uint32 eid;
    uint32 configType;
    bytes config;
}

interface IMessageLibManager {
    struct Timeout {
        address lib;
        uint256 expiry;
    }

    event LibraryRegistered(address newLib);
    event DefaultSendLibrarySet(uint32 eid, address newLib);
    event DefaultReceiveLibrarySet(uint32 eid, address oldLib, address newLib);
    event DefaultReceiveLibraryTimeoutSet(uint32 eid, address oldLib, uint256 expiry);
    event SendLibrarySet(address sender, uint32 eid, address newLib);
    event ReceiveLibrarySet(address receiver, uint32 eid, address oldLib, address newLib);
    event ReceiveLibraryTimeoutSet(address receiver, uint32 eid, address oldLib, uint256 timeout);

    function registerLibrary(address _lib) external;

    function isRegisteredLibrary(address _lib) external view returns (bool);

    function getRegisteredLibraries() external view returns (address[] memory);

    function setDefaultSendLibrary(uint32 _eid, address _newLib) external;

    function defaultSendLibrary(uint32 _eid) external view returns (address);

    function setDefaultReceiveLibrary(uint32 _eid, address _newLib, uint256 _timeout) external;

    function defaultReceiveLibrary(uint32 _eid) external view returns (address);

    function setDefaultReceiveLibraryTimeout(uint32 _eid, address _lib, uint256 _expiry) external;

    function defaultReceiveLibraryTimeout(uint32 _eid) external view returns (address lib, uint256 expiry);

    function isSupportedEid(uint32 _eid) external view returns (bool);

    /// ------------------- OApp interfaces -------------------
    function setSendLibrary(address _oapp, uint32 _eid, address _newLib) external;

    function getSendLibrary(address _sender, uint32 _eid) external view returns (address lib);

    function isDefaultSendLibrary(address _sender, uint32 _eid) external view returns (bool);

    function setReceiveLibrary(address _oapp, uint32 _eid, address _newLib, uint256 _gracePeriod) external;

    function getReceiveLibrary(address _receiver, uint32 _eid) external view returns (address lib, bool isDefault);

    function setReceiveLibraryTimeout(address _oapp, uint32 _eid, address _lib, uint256 _gracePeriod) external;

    function receiveLibraryTimeout(address _receiver, uint32 _eid) external view returns (address lib, uint256 expiry);

    function setConfig(address _oapp, address _lib, SetConfigParam[] calldata _params) external;

    function getConfig(
        address _oapp,
        address _lib,
        uint32 _eid,
        uint32 _configType
    ) external view returns (bytes memory config);
}

File 12 of 29 : IMessagingChannel.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.8.0;

interface IMessagingChannel {
    event InboundNonceSkipped(uint32 srcEid, bytes32 sender, address receiver, uint64 nonce);
    event PacketNilified(uint32 srcEid, bytes32 sender, address receiver, uint64 nonce, bytes32 payloadHash);
    event PacketBurnt(uint32 srcEid, bytes32 sender, address receiver, uint64 nonce, bytes32 payloadHash);

    function eid() external view returns (uint32);

    // this is an emergency function if a message cannot be verified for some reasons
    // required to provide _nextNonce to avoid race condition
    function skip(address _oapp, uint32 _srcEid, bytes32 _sender, uint64 _nonce) external;

    function nilify(address _oapp, uint32 _srcEid, bytes32 _sender, uint64 _nonce, bytes32 _payloadHash) external;

    function burn(address _oapp, uint32 _srcEid, bytes32 _sender, uint64 _nonce, bytes32 _payloadHash) external;

    function nextGuid(address _sender, uint32 _dstEid, bytes32 _receiver) external view returns (bytes32);

    function inboundNonce(address _receiver, uint32 _srcEid, bytes32 _sender) external view returns (uint64);

    function outboundNonce(address _sender, uint32 _dstEid, bytes32 _receiver) external view returns (uint64);

    function inboundPayloadHash(
        address _receiver,
        uint32 _srcEid,
        bytes32 _sender,
        uint64 _nonce
    ) external view returns (bytes32);
}

File 13 of 29 : IMessagingComposer.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.8.0;

interface IMessagingComposer {
    event ComposeSent(address from, address to, bytes32 guid, uint16 index, bytes message);
    event ComposeDelivered(address from, address to, bytes32 guid, uint16 index);
    event LzComposeAlert(
        address indexed from,
        address indexed to,
        address indexed executor,
        bytes32 guid,
        uint16 index,
        uint256 gas,
        uint256 value,
        bytes message,
        bytes extraData,
        bytes reason
    );

    function composeQueue(
        address _from,
        address _to,
        bytes32 _guid,
        uint16 _index
    ) external view returns (bytes32 messageHash);

    function sendCompose(address _to, bytes32 _guid, uint16 _index, bytes calldata _message) external;

    function lzCompose(
        address _from,
        address _to,
        bytes32 _guid,
        uint16 _index,
        bytes calldata _message,
        bytes calldata _extraData
    ) external payable;
}

File 14 of 29 : IMessagingContext.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.8.0;

interface IMessagingContext {
    function isSendingMessage() external view returns (bool);

    function getSendContext() external view returns (uint32 dstEid, address sender);
}

File 15 of 29 : CalldataBytesLib.sol
// SPDX-License-Identifier: LZBL-1.2

pragma solidity ^0.8.22;

library CalldataBytesLib {
    function toU8(bytes calldata _bytes, uint256 _start) internal pure returns (uint8) {
        return uint8(_bytes[_start]);
    }

    function toU16(bytes calldata _bytes, uint256 _start) internal pure returns (uint16) {
        unchecked {
            uint256 end = _start + 2;
            return uint16(bytes2(_bytes[_start:end]));
        }
    }

    function toU32(bytes calldata _bytes, uint256 _start) internal pure returns (uint32) {
        unchecked {
            uint256 end = _start + 4;
            return uint32(bytes4(_bytes[_start:end]));
        }
    }

    function toU64(bytes calldata _bytes, uint256 _start) internal pure returns (uint64) {
        unchecked {
            uint256 end = _start + 8;
            return uint64(bytes8(_bytes[_start:end]));
        }
    }

    function toU128(bytes calldata _bytes, uint256 _start) internal pure returns (uint128) {
        unchecked {
            uint256 end = _start + 16;
            return uint128(bytes16(_bytes[_start:end]));
        }
    }

    function toU256(bytes calldata _bytes, uint256 _start) internal pure returns (uint256) {
        unchecked {
            uint256 end = _start + 32;
            return uint256(bytes32(_bytes[_start:end]));
        }
    }

    function toAddr(bytes calldata _bytes, uint256 _start) internal pure returns (address) {
        unchecked {
            uint256 end = _start + 20;
            return address(bytes20(_bytes[_start:end]));
        }
    }

    function toB32(bytes calldata _bytes, uint256 _start) internal pure returns (bytes32) {
        unchecked {
            uint256 end = _start + 32;
            return bytes32(_bytes[_start:end]);
        }
    }
}

File 16 of 29 : BitMaps.sol
// SPDX-License-Identifier: MIT

// modified from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/structs/BitMaps.sol
pragma solidity ^0.8.22;

type BitMap256 is uint256;

using BitMaps for BitMap256 global;

library BitMaps {
    /**
     * @dev Returns whether the bit at `index` is set.
     */
    function get(BitMap256 bitmap, uint8 index) internal pure returns (bool) {
        uint256 mask = 1 << index;
        return BitMap256.unwrap(bitmap) & mask != 0;
    }

    /**
     * @dev Sets the bit at `index`.
     */
    function set(BitMap256 bitmap, uint8 index) internal pure returns (BitMap256) {
        uint256 mask = 1 << index;
        return BitMap256.wrap(BitMap256.unwrap(bitmap) | mask);
    }
}

File 17 of 29 : ExecutorOptions.sol
// SPDX-License-Identifier: LZBL-1.2

pragma solidity ^0.8.22;

import { CalldataBytesLib } from "../../libs/CalldataBytesLib.sol";

library ExecutorOptions {
    using CalldataBytesLib for bytes;

    uint8 internal constant WORKER_ID = 1;

    uint8 internal constant OPTION_TYPE_LZRECEIVE = 1;
    uint8 internal constant OPTION_TYPE_NATIVE_DROP = 2;
    uint8 internal constant OPTION_TYPE_LZCOMPOSE = 3;
    uint8 internal constant OPTION_TYPE_ORDERED_EXECUTION = 4;

    error InvalidLzReceiveOption();
    error InvalidNativeDropOption();
    error InvalidLzComposeOption();

    /// @dev decode the next executor option from the options starting from the specified cursor
    /// @param _options [executor_id][executor_option][executor_id][executor_option]...
    ///        executor_option = [option_size][option_type][option]
    ///        option_size = len(option_type) + len(option)
    ///        executor_id: uint8, option_size: uint16, option_type: uint8, option: bytes
    /// @param _cursor the cursor to start decoding from
    /// @return optionType the type of the option
    /// @return option the option of the executor
    /// @return cursor the cursor to start decoding the next executor option
    function nextExecutorOption(
        bytes calldata _options,
        uint256 _cursor
    ) internal pure returns (uint8 optionType, bytes calldata option, uint256 cursor) {
        unchecked {
            // skip worker id
            cursor = _cursor + 1;

            // read option size
            uint16 size = _options.toU16(cursor);
            cursor += 2;

            // read option type
            optionType = _options.toU8(cursor);

            // startCursor and endCursor are used to slice the option from _options
            uint256 startCursor = cursor + 1; // skip option type
            uint256 endCursor = cursor + size;
            option = _options[startCursor:endCursor];
            cursor += size;
        }
    }

    function decodeLzReceiveOption(bytes calldata _option) internal pure returns (uint128 gas, uint128 value) {
        if (_option.length != 16 && _option.length != 32) revert InvalidLzReceiveOption();
        gas = _option.toU128(0);
        value = _option.length == 32 ? _option.toU128(16) : 0;
    }

    function decodeNativeDropOption(bytes calldata _option) internal pure returns (uint128 amount, bytes32 receiver) {
        if (_option.length != 48) revert InvalidNativeDropOption();
        amount = _option.toU128(0);
        receiver = _option.toB32(16);
    }

    function decodeLzComposeOption(
        bytes calldata _option
    ) internal pure returns (uint16 index, uint128 gas, uint128 value) {
        if (_option.length != 18 && _option.length != 34) revert InvalidLzComposeOption();
        index = _option.toU16(0);
        gas = _option.toU128(2);
        value = _option.length == 34 ? _option.toU128(18) : 0;
    }

    function encodeLzReceiveOption(uint128 _gas, uint128 _value) internal pure returns (bytes memory) {
        return _value == 0 ? abi.encodePacked(_gas) : abi.encodePacked(_gas, _value);
    }

    function encodeNativeDropOption(uint128 _amount, bytes32 _receiver) internal pure returns (bytes memory) {
        return abi.encodePacked(_amount, _receiver);
    }

    function encodeLzComposeOption(uint16 _index, uint128 _gas, uint128 _value) internal pure returns (bytes memory) {
        return _value == 0 ? abi.encodePacked(_index, _gas) : abi.encodePacked(_index, _gas, _value);
    }
}

File 18 of 29 : AccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)

pragma solidity ^0.8.20;

import {IAccessControl} from "./IAccessControl.sol";
import {Context} from "../utils/Context.sol";
import {ERC165} from "../utils/introspection/ERC165.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```solidity
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```solidity
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
 * to enforce additional security measures for this role.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address account => bool) hasRole;
        bytes32 adminRole;
    }

    mapping(bytes32 role => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with an {AccessControlUnauthorizedAccount} error including the required role.
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual returns (bool) {
        return _roles[role].hasRole[account];
    }

    /**
     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`
     * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`
     * is missing `role`.
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert AccessControlUnauthorizedAccount(account, role);
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleGranted} event.
     */
    function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleRevoked} event.
     */
    function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `callerConfirmation`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address callerConfirmation) public virtual {
        if (callerConfirmation != _msgSender()) {
            revert AccessControlBadConfirmation();
        }

        _revokeRole(role, callerConfirmation);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual returns (bool) {
        if (!hasRole(role, account)) {
            _roles[role].hasRole[account] = true;
            emit RoleGranted(role, account, _msgSender());
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {
        if (hasRole(role, account)) {
            _roles[role].hasRole[account] = false;
            emit RoleRevoked(role, account, _msgSender());
            return true;
        } else {
            return false;
        }
    }
}

File 19 of 29 : IAccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)

pragma solidity ^0.8.20;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev The `account` is missing a role.
     */
    error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);

    /**
     * @dev The caller of a function is not the expected one.
     *
     * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.
     */
    error AccessControlBadConfirmation();

    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `callerConfirmation`.
     */
    function renounceRole(bytes32 role, address callerConfirmation) external;
}

File 20 of 29 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {Context} from "../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.
 *
 * The initial owner is set to the address provided by the deployer. 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;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

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

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @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 {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _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 21 of 29 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     *
     * CAUTION: See Security Considerations above.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

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

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

File 22 of 29 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

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

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

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

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

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

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

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

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

File 23 of 29 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../utils/Address.sol";

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

    /**
     * @dev An operation with an ERC20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));

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

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

        bytes memory returndata = address(token).functionCall(data);
        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;
    }
}

File 24 of 29 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)

pragma solidity ^0.8.20;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error AddressInsufficientBalance(address account);

    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedInnerCall();

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        if (address(this).balance < amount) {
            revert AddressInsufficientBalance(address(this));
        }

        (bool success, ) = recipient.call{value: amount}("");
        if (!success) {
            revert FailedInnerCall();
        }
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert AddressInsufficientBalance(address(this));
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

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

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

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
     * unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {FailedInnerCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

    /**
     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
     */
    function _revert(bytes memory returndata) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert FailedInnerCall();
        }
    }
}

File 25 of 29 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

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

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

File 26 of 29 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)

pragma solidity ^0.8.20;

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

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

File 27 of 29 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 28 of 29 : SafeCast.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SafeCast.sol)
// This file was procedurally generated from scripts/generate/templates/SafeCast.js.

pragma solidity ^0.8.20;

/**
 * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
 * checks.
 *
 * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
 * easily result in undesired exploitation or bugs, since developers usually
 * assume that overflows raise errors. `SafeCast` restores this intuition by
 * reverting the transaction when such an operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeCast {
    /**
     * @dev Value doesn't fit in an uint of `bits` size.
     */
    error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value);

    /**
     * @dev An int value doesn't fit in an uint of `bits` size.
     */
    error SafeCastOverflowedIntToUint(int256 value);

    /**
     * @dev Value doesn't fit in an int of `bits` size.
     */
    error SafeCastOverflowedIntDowncast(uint8 bits, int256 value);

    /**
     * @dev An uint value doesn't fit in an int of `bits` size.
     */
    error SafeCastOverflowedUintToInt(uint256 value);

    /**
     * @dev Returns the downcasted uint248 from uint256, reverting on
     * overflow (when the input is greater than largest uint248).
     *
     * Counterpart to Solidity's `uint248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     */
    function toUint248(uint256 value) internal pure returns (uint248) {
        if (value > type(uint248).max) {
            revert SafeCastOverflowedUintDowncast(248, value);
        }
        return uint248(value);
    }

    /**
     * @dev Returns the downcasted uint240 from uint256, reverting on
     * overflow (when the input is greater than largest uint240).
     *
     * Counterpart to Solidity's `uint240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     */
    function toUint240(uint256 value) internal pure returns (uint240) {
        if (value > type(uint240).max) {
            revert SafeCastOverflowedUintDowncast(240, value);
        }
        return uint240(value);
    }

    /**
     * @dev Returns the downcasted uint232 from uint256, reverting on
     * overflow (when the input is greater than largest uint232).
     *
     * Counterpart to Solidity's `uint232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     */
    function toUint232(uint256 value) internal pure returns (uint232) {
        if (value > type(uint232).max) {
            revert SafeCastOverflowedUintDowncast(232, value);
        }
        return uint232(value);
    }

    /**
     * @dev Returns the downcasted uint224 from uint256, reverting on
     * overflow (when the input is greater than largest uint224).
     *
     * Counterpart to Solidity's `uint224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     */
    function toUint224(uint256 value) internal pure returns (uint224) {
        if (value > type(uint224).max) {
            revert SafeCastOverflowedUintDowncast(224, value);
        }
        return uint224(value);
    }

    /**
     * @dev Returns the downcasted uint216 from uint256, reverting on
     * overflow (when the input is greater than largest uint216).
     *
     * Counterpart to Solidity's `uint216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     */
    function toUint216(uint256 value) internal pure returns (uint216) {
        if (value > type(uint216).max) {
            revert SafeCastOverflowedUintDowncast(216, value);
        }
        return uint216(value);
    }

    /**
     * @dev Returns the downcasted uint208 from uint256, reverting on
     * overflow (when the input is greater than largest uint208).
     *
     * Counterpart to Solidity's `uint208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     */
    function toUint208(uint256 value) internal pure returns (uint208) {
        if (value > type(uint208).max) {
            revert SafeCastOverflowedUintDowncast(208, value);
        }
        return uint208(value);
    }

    /**
     * @dev Returns the downcasted uint200 from uint256, reverting on
     * overflow (when the input is greater than largest uint200).
     *
     * Counterpart to Solidity's `uint200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     */
    function toUint200(uint256 value) internal pure returns (uint200) {
        if (value > type(uint200).max) {
            revert SafeCastOverflowedUintDowncast(200, value);
        }
        return uint200(value);
    }

    /**
     * @dev Returns the downcasted uint192 from uint256, reverting on
     * overflow (when the input is greater than largest uint192).
     *
     * Counterpart to Solidity's `uint192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     */
    function toUint192(uint256 value) internal pure returns (uint192) {
        if (value > type(uint192).max) {
            revert SafeCastOverflowedUintDowncast(192, value);
        }
        return uint192(value);
    }

    /**
     * @dev Returns the downcasted uint184 from uint256, reverting on
     * overflow (when the input is greater than largest uint184).
     *
     * Counterpart to Solidity's `uint184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     */
    function toUint184(uint256 value) internal pure returns (uint184) {
        if (value > type(uint184).max) {
            revert SafeCastOverflowedUintDowncast(184, value);
        }
        return uint184(value);
    }

    /**
     * @dev Returns the downcasted uint176 from uint256, reverting on
     * overflow (when the input is greater than largest uint176).
     *
     * Counterpart to Solidity's `uint176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     */
    function toUint176(uint256 value) internal pure returns (uint176) {
        if (value > type(uint176).max) {
            revert SafeCastOverflowedUintDowncast(176, value);
        }
        return uint176(value);
    }

    /**
     * @dev Returns the downcasted uint168 from uint256, reverting on
     * overflow (when the input is greater than largest uint168).
     *
     * Counterpart to Solidity's `uint168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     */
    function toUint168(uint256 value) internal pure returns (uint168) {
        if (value > type(uint168).max) {
            revert SafeCastOverflowedUintDowncast(168, value);
        }
        return uint168(value);
    }

    /**
     * @dev Returns the downcasted uint160 from uint256, reverting on
     * overflow (when the input is greater than largest uint160).
     *
     * Counterpart to Solidity's `uint160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     */
    function toUint160(uint256 value) internal pure returns (uint160) {
        if (value > type(uint160).max) {
            revert SafeCastOverflowedUintDowncast(160, value);
        }
        return uint160(value);
    }

    /**
     * @dev Returns the downcasted uint152 from uint256, reverting on
     * overflow (when the input is greater than largest uint152).
     *
     * Counterpart to Solidity's `uint152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     */
    function toUint152(uint256 value) internal pure returns (uint152) {
        if (value > type(uint152).max) {
            revert SafeCastOverflowedUintDowncast(152, value);
        }
        return uint152(value);
    }

    /**
     * @dev Returns the downcasted uint144 from uint256, reverting on
     * overflow (when the input is greater than largest uint144).
     *
     * Counterpart to Solidity's `uint144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     */
    function toUint144(uint256 value) internal pure returns (uint144) {
        if (value > type(uint144).max) {
            revert SafeCastOverflowedUintDowncast(144, value);
        }
        return uint144(value);
    }

    /**
     * @dev Returns the downcasted uint136 from uint256, reverting on
     * overflow (when the input is greater than largest uint136).
     *
     * Counterpart to Solidity's `uint136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     */
    function toUint136(uint256 value) internal pure returns (uint136) {
        if (value > type(uint136).max) {
            revert SafeCastOverflowedUintDowncast(136, value);
        }
        return uint136(value);
    }

    /**
     * @dev Returns the downcasted uint128 from uint256, reverting on
     * overflow (when the input is greater than largest uint128).
     *
     * Counterpart to Solidity's `uint128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     */
    function toUint128(uint256 value) internal pure returns (uint128) {
        if (value > type(uint128).max) {
            revert SafeCastOverflowedUintDowncast(128, value);
        }
        return uint128(value);
    }

    /**
     * @dev Returns the downcasted uint120 from uint256, reverting on
     * overflow (when the input is greater than largest uint120).
     *
     * Counterpart to Solidity's `uint120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     */
    function toUint120(uint256 value) internal pure returns (uint120) {
        if (value > type(uint120).max) {
            revert SafeCastOverflowedUintDowncast(120, value);
        }
        return uint120(value);
    }

    /**
     * @dev Returns the downcasted uint112 from uint256, reverting on
     * overflow (when the input is greater than largest uint112).
     *
     * Counterpart to Solidity's `uint112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     */
    function toUint112(uint256 value) internal pure returns (uint112) {
        if (value > type(uint112).max) {
            revert SafeCastOverflowedUintDowncast(112, value);
        }
        return uint112(value);
    }

    /**
     * @dev Returns the downcasted uint104 from uint256, reverting on
     * overflow (when the input is greater than largest uint104).
     *
     * Counterpart to Solidity's `uint104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     */
    function toUint104(uint256 value) internal pure returns (uint104) {
        if (value > type(uint104).max) {
            revert SafeCastOverflowedUintDowncast(104, value);
        }
        return uint104(value);
    }

    /**
     * @dev Returns the downcasted uint96 from uint256, reverting on
     * overflow (when the input is greater than largest uint96).
     *
     * Counterpart to Solidity's `uint96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     */
    function toUint96(uint256 value) internal pure returns (uint96) {
        if (value > type(uint96).max) {
            revert SafeCastOverflowedUintDowncast(96, value);
        }
        return uint96(value);
    }

    /**
     * @dev Returns the downcasted uint88 from uint256, reverting on
     * overflow (when the input is greater than largest uint88).
     *
     * Counterpart to Solidity's `uint88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     */
    function toUint88(uint256 value) internal pure returns (uint88) {
        if (value > type(uint88).max) {
            revert SafeCastOverflowedUintDowncast(88, value);
        }
        return uint88(value);
    }

    /**
     * @dev Returns the downcasted uint80 from uint256, reverting on
     * overflow (when the input is greater than largest uint80).
     *
     * Counterpart to Solidity's `uint80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     */
    function toUint80(uint256 value) internal pure returns (uint80) {
        if (value > type(uint80).max) {
            revert SafeCastOverflowedUintDowncast(80, value);
        }
        return uint80(value);
    }

    /**
     * @dev Returns the downcasted uint72 from uint256, reverting on
     * overflow (when the input is greater than largest uint72).
     *
     * Counterpart to Solidity's `uint72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     */
    function toUint72(uint256 value) internal pure returns (uint72) {
        if (value > type(uint72).max) {
            revert SafeCastOverflowedUintDowncast(72, value);
        }
        return uint72(value);
    }

    /**
     * @dev Returns the downcasted uint64 from uint256, reverting on
     * overflow (when the input is greater than largest uint64).
     *
     * Counterpart to Solidity's `uint64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     */
    function toUint64(uint256 value) internal pure returns (uint64) {
        if (value > type(uint64).max) {
            revert SafeCastOverflowedUintDowncast(64, value);
        }
        return uint64(value);
    }

    /**
     * @dev Returns the downcasted uint56 from uint256, reverting on
     * overflow (when the input is greater than largest uint56).
     *
     * Counterpart to Solidity's `uint56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     */
    function toUint56(uint256 value) internal pure returns (uint56) {
        if (value > type(uint56).max) {
            revert SafeCastOverflowedUintDowncast(56, value);
        }
        return uint56(value);
    }

    /**
     * @dev Returns the downcasted uint48 from uint256, reverting on
     * overflow (when the input is greater than largest uint48).
     *
     * Counterpart to Solidity's `uint48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     */
    function toUint48(uint256 value) internal pure returns (uint48) {
        if (value > type(uint48).max) {
            revert SafeCastOverflowedUintDowncast(48, value);
        }
        return uint48(value);
    }

    /**
     * @dev Returns the downcasted uint40 from uint256, reverting on
     * overflow (when the input is greater than largest uint40).
     *
     * Counterpart to Solidity's `uint40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     */
    function toUint40(uint256 value) internal pure returns (uint40) {
        if (value > type(uint40).max) {
            revert SafeCastOverflowedUintDowncast(40, value);
        }
        return uint40(value);
    }

    /**
     * @dev Returns the downcasted uint32 from uint256, reverting on
     * overflow (when the input is greater than largest uint32).
     *
     * Counterpart to Solidity's `uint32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     */
    function toUint32(uint256 value) internal pure returns (uint32) {
        if (value > type(uint32).max) {
            revert SafeCastOverflowedUintDowncast(32, value);
        }
        return uint32(value);
    }

    /**
     * @dev Returns the downcasted uint24 from uint256, reverting on
     * overflow (when the input is greater than largest uint24).
     *
     * Counterpart to Solidity's `uint24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     */
    function toUint24(uint256 value) internal pure returns (uint24) {
        if (value > type(uint24).max) {
            revert SafeCastOverflowedUintDowncast(24, value);
        }
        return uint24(value);
    }

    /**
     * @dev Returns the downcasted uint16 from uint256, reverting on
     * overflow (when the input is greater than largest uint16).
     *
     * Counterpart to Solidity's `uint16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     */
    function toUint16(uint256 value) internal pure returns (uint16) {
        if (value > type(uint16).max) {
            revert SafeCastOverflowedUintDowncast(16, value);
        }
        return uint16(value);
    }

    /**
     * @dev Returns the downcasted uint8 from uint256, reverting on
     * overflow (when the input is greater than largest uint8).
     *
     * Counterpart to Solidity's `uint8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     */
    function toUint8(uint256 value) internal pure returns (uint8) {
        if (value > type(uint8).max) {
            revert SafeCastOverflowedUintDowncast(8, value);
        }
        return uint8(value);
    }

    /**
     * @dev Converts a signed int256 into an unsigned uint256.
     *
     * Requirements:
     *
     * - input must be greater than or equal to 0.
     */
    function toUint256(int256 value) internal pure returns (uint256) {
        if (value < 0) {
            revert SafeCastOverflowedIntToUint(value);
        }
        return uint256(value);
    }

    /**
     * @dev Returns the downcasted int248 from int256, reverting on
     * overflow (when the input is less than smallest int248 or
     * greater than largest int248).
     *
     * Counterpart to Solidity's `int248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     */
    function toInt248(int256 value) internal pure returns (int248 downcasted) {
        downcasted = int248(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(248, value);
        }
    }

    /**
     * @dev Returns the downcasted int240 from int256, reverting on
     * overflow (when the input is less than smallest int240 or
     * greater than largest int240).
     *
     * Counterpart to Solidity's `int240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     */
    function toInt240(int256 value) internal pure returns (int240 downcasted) {
        downcasted = int240(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(240, value);
        }
    }

    /**
     * @dev Returns the downcasted int232 from int256, reverting on
     * overflow (when the input is less than smallest int232 or
     * greater than largest int232).
     *
     * Counterpart to Solidity's `int232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     */
    function toInt232(int256 value) internal pure returns (int232 downcasted) {
        downcasted = int232(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(232, value);
        }
    }

    /**
     * @dev Returns the downcasted int224 from int256, reverting on
     * overflow (when the input is less than smallest int224 or
     * greater than largest int224).
     *
     * Counterpart to Solidity's `int224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     */
    function toInt224(int256 value) internal pure returns (int224 downcasted) {
        downcasted = int224(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(224, value);
        }
    }

    /**
     * @dev Returns the downcasted int216 from int256, reverting on
     * overflow (when the input is less than smallest int216 or
     * greater than largest int216).
     *
     * Counterpart to Solidity's `int216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     */
    function toInt216(int256 value) internal pure returns (int216 downcasted) {
        downcasted = int216(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(216, value);
        }
    }

    /**
     * @dev Returns the downcasted int208 from int256, reverting on
     * overflow (when the input is less than smallest int208 or
     * greater than largest int208).
     *
     * Counterpart to Solidity's `int208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     */
    function toInt208(int256 value) internal pure returns (int208 downcasted) {
        downcasted = int208(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(208, value);
        }
    }

    /**
     * @dev Returns the downcasted int200 from int256, reverting on
     * overflow (when the input is less than smallest int200 or
     * greater than largest int200).
     *
     * Counterpart to Solidity's `int200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     */
    function toInt200(int256 value) internal pure returns (int200 downcasted) {
        downcasted = int200(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(200, value);
        }
    }

    /**
     * @dev Returns the downcasted int192 from int256, reverting on
     * overflow (when the input is less than smallest int192 or
     * greater than largest int192).
     *
     * Counterpart to Solidity's `int192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     */
    function toInt192(int256 value) internal pure returns (int192 downcasted) {
        downcasted = int192(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(192, value);
        }
    }

    /**
     * @dev Returns the downcasted int184 from int256, reverting on
     * overflow (when the input is less than smallest int184 or
     * greater than largest int184).
     *
     * Counterpart to Solidity's `int184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     */
    function toInt184(int256 value) internal pure returns (int184 downcasted) {
        downcasted = int184(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(184, value);
        }
    }

    /**
     * @dev Returns the downcasted int176 from int256, reverting on
     * overflow (when the input is less than smallest int176 or
     * greater than largest int176).
     *
     * Counterpart to Solidity's `int176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     */
    function toInt176(int256 value) internal pure returns (int176 downcasted) {
        downcasted = int176(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(176, value);
        }
    }

    /**
     * @dev Returns the downcasted int168 from int256, reverting on
     * overflow (when the input is less than smallest int168 or
     * greater than largest int168).
     *
     * Counterpart to Solidity's `int168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     */
    function toInt168(int256 value) internal pure returns (int168 downcasted) {
        downcasted = int168(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(168, value);
        }
    }

    /**
     * @dev Returns the downcasted int160 from int256, reverting on
     * overflow (when the input is less than smallest int160 or
     * greater than largest int160).
     *
     * Counterpart to Solidity's `int160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     */
    function toInt160(int256 value) internal pure returns (int160 downcasted) {
        downcasted = int160(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(160, value);
        }
    }

    /**
     * @dev Returns the downcasted int152 from int256, reverting on
     * overflow (when the input is less than smallest int152 or
     * greater than largest int152).
     *
     * Counterpart to Solidity's `int152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     */
    function toInt152(int256 value) internal pure returns (int152 downcasted) {
        downcasted = int152(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(152, value);
        }
    }

    /**
     * @dev Returns the downcasted int144 from int256, reverting on
     * overflow (when the input is less than smallest int144 or
     * greater than largest int144).
     *
     * Counterpart to Solidity's `int144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     */
    function toInt144(int256 value) internal pure returns (int144 downcasted) {
        downcasted = int144(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(144, value);
        }
    }

    /**
     * @dev Returns the downcasted int136 from int256, reverting on
     * overflow (when the input is less than smallest int136 or
     * greater than largest int136).
     *
     * Counterpart to Solidity's `int136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     */
    function toInt136(int256 value) internal pure returns (int136 downcasted) {
        downcasted = int136(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(136, value);
        }
    }

    /**
     * @dev Returns the downcasted int128 from int256, reverting on
     * overflow (when the input is less than smallest int128 or
     * greater than largest int128).
     *
     * Counterpart to Solidity's `int128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     */
    function toInt128(int256 value) internal pure returns (int128 downcasted) {
        downcasted = int128(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(128, value);
        }
    }

    /**
     * @dev Returns the downcasted int120 from int256, reverting on
     * overflow (when the input is less than smallest int120 or
     * greater than largest int120).
     *
     * Counterpart to Solidity's `int120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     */
    function toInt120(int256 value) internal pure returns (int120 downcasted) {
        downcasted = int120(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(120, value);
        }
    }

    /**
     * @dev Returns the downcasted int112 from int256, reverting on
     * overflow (when the input is less than smallest int112 or
     * greater than largest int112).
     *
     * Counterpart to Solidity's `int112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     */
    function toInt112(int256 value) internal pure returns (int112 downcasted) {
        downcasted = int112(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(112, value);
        }
    }

    /**
     * @dev Returns the downcasted int104 from int256, reverting on
     * overflow (when the input is less than smallest int104 or
     * greater than largest int104).
     *
     * Counterpart to Solidity's `int104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     */
    function toInt104(int256 value) internal pure returns (int104 downcasted) {
        downcasted = int104(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(104, value);
        }
    }

    /**
     * @dev Returns the downcasted int96 from int256, reverting on
     * overflow (when the input is less than smallest int96 or
     * greater than largest int96).
     *
     * Counterpart to Solidity's `int96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     */
    function toInt96(int256 value) internal pure returns (int96 downcasted) {
        downcasted = int96(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(96, value);
        }
    }

    /**
     * @dev Returns the downcasted int88 from int256, reverting on
     * overflow (when the input is less than smallest int88 or
     * greater than largest int88).
     *
     * Counterpart to Solidity's `int88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     */
    function toInt88(int256 value) internal pure returns (int88 downcasted) {
        downcasted = int88(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(88, value);
        }
    }

    /**
     * @dev Returns the downcasted int80 from int256, reverting on
     * overflow (when the input is less than smallest int80 or
     * greater than largest int80).
     *
     * Counterpart to Solidity's `int80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     */
    function toInt80(int256 value) internal pure returns (int80 downcasted) {
        downcasted = int80(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(80, value);
        }
    }

    /**
     * @dev Returns the downcasted int72 from int256, reverting on
     * overflow (when the input is less than smallest int72 or
     * greater than largest int72).
     *
     * Counterpart to Solidity's `int72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     */
    function toInt72(int256 value) internal pure returns (int72 downcasted) {
        downcasted = int72(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(72, value);
        }
    }

    /**
     * @dev Returns the downcasted int64 from int256, reverting on
     * overflow (when the input is less than smallest int64 or
     * greater than largest int64).
     *
     * Counterpart to Solidity's `int64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     */
    function toInt64(int256 value) internal pure returns (int64 downcasted) {
        downcasted = int64(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(64, value);
        }
    }

    /**
     * @dev Returns the downcasted int56 from int256, reverting on
     * overflow (when the input is less than smallest int56 or
     * greater than largest int56).
     *
     * Counterpart to Solidity's `int56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     */
    function toInt56(int256 value) internal pure returns (int56 downcasted) {
        downcasted = int56(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(56, value);
        }
    }

    /**
     * @dev Returns the downcasted int48 from int256, reverting on
     * overflow (when the input is less than smallest int48 or
     * greater than largest int48).
     *
     * Counterpart to Solidity's `int48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     */
    function toInt48(int256 value) internal pure returns (int48 downcasted) {
        downcasted = int48(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(48, value);
        }
    }

    /**
     * @dev Returns the downcasted int40 from int256, reverting on
     * overflow (when the input is less than smallest int40 or
     * greater than largest int40).
     *
     * Counterpart to Solidity's `int40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     */
    function toInt40(int256 value) internal pure returns (int40 downcasted) {
        downcasted = int40(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(40, value);
        }
    }

    /**
     * @dev Returns the downcasted int32 from int256, reverting on
     * overflow (when the input is less than smallest int32 or
     * greater than largest int32).
     *
     * Counterpart to Solidity's `int32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     */
    function toInt32(int256 value) internal pure returns (int32 downcasted) {
        downcasted = int32(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(32, value);
        }
    }

    /**
     * @dev Returns the downcasted int24 from int256, reverting on
     * overflow (when the input is less than smallest int24 or
     * greater than largest int24).
     *
     * Counterpart to Solidity's `int24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     */
    function toInt24(int256 value) internal pure returns (int24 downcasted) {
        downcasted = int24(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(24, value);
        }
    }

    /**
     * @dev Returns the downcasted int16 from int256, reverting on
     * overflow (when the input is less than smallest int16 or
     * greater than largest int16).
     *
     * Counterpart to Solidity's `int16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     */
    function toInt16(int256 value) internal pure returns (int16 downcasted) {
        downcasted = int16(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(16, value);
        }
    }

    /**
     * @dev Returns the downcasted int8 from int256, reverting on
     * overflow (when the input is less than smallest int8 or
     * greater than largest int8).
     *
     * Counterpart to Solidity's `int8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     */
    function toInt8(int256 value) internal pure returns (int8 downcasted) {
        downcasted = int8(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(8, value);
        }
    }

    /**
     * @dev Converts an unsigned uint256 into a signed int256.
     *
     * Requirements:
     *
     * - input must be less than or equal to maxInt256.
     */
    function toInt256(uint256 value) internal pure returns (int256) {
        // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
        if (value > uint256(type(int256).max)) {
            revert SafeCastOverflowedUintToInt(value);
        }
        return int256(value);
    }
}

File 29 of 29 : 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 equal_nonAligned(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 endMinusWord := add(_preBytes, length)
                let mc := add(_preBytes, 0x20)
                let cc := add(_postBytes, 0x20)

                for {
                // the next line is the loop condition:
                // while(uint256(mc < endWord) + cb == 2)
                } eq(add(lt(mc, endMinusWord), 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
                    }
                }

                // Only if still successful
                // For <1 word tail bytes
                if gt(success, 0) {
                    // Get the remainder of length/32
                    // length % 32 = AND(length, 32 - 1)
                    let numTailBytes := and(length, 0x1f)
                    let mcRem := mload(mc)
                    let ccRem := mload(cc)
                    for {
                        let i := 0
                    // the next line is the loop condition:
                    // while(uint256(i < numTailBytes) + cb == 2)
                    } eq(add(lt(i, numTailBytes), cb), 2) {
                        i := add(i, 1)
                    } {
                        if iszero(eq(byte(i, mcRem), byte(i, ccRem))) {
                            // 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;
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 1000000
  },
  "metadata": {
    "bytecodeHash": "none",
    "useLiteralContent": true
  },
  "evmVersion": "paris",
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_endpoint","type":"address"},{"internalType":"address","name":"_owner","type":"address"},{"internalType":"string","name":"chainName","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"InvalidEndpointCall","type":"error"},{"inputs":[{"internalType":"uint16","name":"optionType","type":"uint16"}],"name":"InvalidOptionType","type":"error"},{"inputs":[],"name":"LzTokenUnavailable","type":"error"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"}],"name":"Native__Transfer__Failed","type":"error"},{"inputs":[{"internalType":"uint32","name":"eid","type":"uint32"}],"name":"NoPeer","type":"error"},{"inputs":[{"internalType":"uint256","name":"msgValue","type":"uint256"}],"name":"NotEnoughNative","type":"error"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"OnlyEndpoint","type":"error"},{"inputs":[{"internalType":"uint32","name":"eid","type":"uint32"},{"internalType":"bytes32","name":"sender","type":"bytes32"}],"name":"OnlyPeer","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"uint8","name":"bits","type":"uint8"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"SafeCastOverflowedUintDowncast","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[{"internalType":"address","name":"tokenName","type":"address"}],"name":"Token__Not__Whitelisted","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":false,"internalType":"string","name":"destChain","type":"string"}],"name":"DEPOSIT","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_user","type":"address"},{"indexed":true,"internalType":"uint256","name":"_amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_time","type":"uint256"}],"name":"FailedNative","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"token","type":"string"},{"indexed":false,"internalType":"address","name":"_user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint32","name":"senderEid","type":"uint32"},{"indexed":false,"internalType":"bytes32","name":"guid","type":"bytes32"}],"name":"MessageReceived","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":"uint32","name":"eid","type":"uint32"},{"indexed":false,"internalType":"bytes32","name":"peer","type":"bytes32"}],"name":"PeerSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"tokenAddress","type":"address"}],"name":"WITHDRAW","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ONLY_ADMIN","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ONLY_ALLOWED","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"addAllowed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"srcEid","type":"uint32"},{"internalType":"bytes32","name":"sender","type":"bytes32"},{"internalType":"uint64","name":"nonce","type":"uint64"}],"internalType":"struct Origin","name":"origin","type":"tuple"}],"name":"allowInitializePath","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"blockBridge","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"bridgeFeeAddress","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bridgeFeePercent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"changeBridgeFee","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"defaultGas","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"_destEid","type":"uint32"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"string","name":"destChain","type":"string"}],"name":"deposit","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_destEid","type":"uint32"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"string","name":"destChain","type":"string"}],"name":"depositNative","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"endpoint","outputs":[{"internalType":"contract ILayerZeroEndpointV2","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"failedNativeTransfer","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllWhitelistedTokenNames","outputs":[{"internalType":"string[]","name":"","type":"string[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"_dstEid","type":"uint32"},{"internalType":"bytes","name":"_message","type":"bytes"},{"internalType":"bytes","name":"_options","type":"bytes"}],"name":"getFee","outputs":[{"components":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"lzTokenFee","type":"uint256"}],"internalType":"struct MessagingFee","name":"fee","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"_dstEid","type":"uint32"},{"internalType":"bytes","name":"_message","type":"bytes"},{"internalType":"uint128","name":"gas","type":"uint128"}],"name":"getGas","outputs":[{"components":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"lzTokenFee","type":"uint256"}],"internalType":"struct MessagingFee","name":"fee","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint128","name":"_gas","type":"uint128"},{"internalType":"uint128","name":"_value","type":"uint128"}],"name":"getLzReceiveOption","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"tokenAddress","type":"address"}],"name":"getMessage","outputs":[{"internalType":"bytes","name":"payload","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"}],"name":"getTokensLocked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isBlocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isWhitelistedAdd","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"","type":"string"}],"name":"isWhitelistedName","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"srcEid","type":"uint32"},{"internalType":"bytes32","name":"sender","type":"bytes32"},{"internalType":"uint64","name":"nonce","type":"uint64"}],"internalType":"struct Origin","name":"_origin","type":"tuple"},{"internalType":"bytes32","name":"_guid","type":"bytes32"},{"internalType":"bytes","name":"_message","type":"bytes"},{"internalType":"address","name":"_executor","type":"address"},{"internalType":"bytes","name":"_extraData","type":"bytes"}],"name":"lzReceive","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"","type":"string"}],"name":"mapWhiltelistTokenNames","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"","type":"string"}],"name":"nameToNative","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"","type":"uint32"},{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"nextNonce","outputs":[{"internalType":"uint64","name":"nonce","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oAppVersion","outputs":[{"internalType":"uint64","name":"senderVersion","type":"uint64"},{"internalType":"uint64","name":"receiverVersion","type":"uint64"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"eid","type":"uint32"}],"name":"peers","outputs":[{"internalType":"bytes32","name":"peer","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"}],"name":"removeTokenFromWhitelist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"bridgeFeeAddress_","type":"address"}],"name":"setBridgeFeeAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_delegate","type":"address"}],"name":"setDelegate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_eid","type":"uint32"},{"internalType":"bytes32","name":"_peer","type":"bytes32"}],"name":"setPeer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unblockBridge","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_destinanion","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"unlockNative","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"unlockToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint128","name":"_gas","type":"uint128"}],"name":"updateContractGas","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"string","name":"tokenName","type":"string"}],"name":"whitelistToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"","type":"string"}],"name":"whitelistedTokenAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelistedTokenName","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"string","name":"tokenName","type":"string"},{"internalType":"address","name":"receiver","type":"address"}],"name":"withdrawAxl","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address payable","name":"_receiver","type":"address"}],"name":"withdrawNativeAxl","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

60a06040523480156200001157600080fd5b5060405162004e2838038062004e288339810160408190526200003491620003f1565b82828181806001600160a01b0381166200006857604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b620000738162000295565b506200007f8162000295565b6001600160a01b03828116608081905260405163ca5eb5e160e01b815291831660048301529063ca5eb5e190602401600060405180830381600087803b158015620000c957600080fd5b505af1158015620000de573d6000803e3d6000fd5b5050505050505050620000fb6000801b83620002e560201b60201c565b506001600482604051620001109190620004d1565b9081526040519081900360209081018220805493151560ff1994851617905560008052600590527f05b8ccbb9d4d8fb16ea74ce3c29a41f1b461fbdaff4714a0d9a8eb05499746bc8054909216600190811790925560069062000175908490620004d1565b90815260405160209181900382019020805460ff19169215159290921790915560008052600890527f5eff886ea0ce6ca488a3d6e336d6c0f75f46d19b42c06ce5ee98e42c96d256c7620001ca828262000580565b506000600782604051620001df9190620004d1565b90815260405190819003602001812080546001600160a01b03939093166001600160a01b031990931692909217909155600b5490600c9062000223908490620004d1565b90815260405190819003602001902055600b80546001810182556000919091527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db90162000271828262000580565b5050600e80546001600160801b0319166207a12017905550506005600a556200064c565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008281526002602090815260408083206001600160a01b038516845290915281205460ff166200038e5760008381526002602090815260408083206001600160a01b03861684529091529020805460ff19166001179055620003453390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600162000392565b5060005b92915050565b80516001600160a01b0381168114620003b057600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620003e8578181015183820152602001620003ce565b50506000910152565b6000806000606084860312156200040757600080fd5b620004128462000398565b9250620004226020850162000398565b60408501519092506001600160401b03808211156200044057600080fd5b818601915086601f8301126200045557600080fd5b8151818111156200046a576200046a620003b5565b604051601f8201601f19908116603f01168101908382118183101715620004955762000495620003b5565b81604052828152896020848701011115620004af57600080fd5b620004c2836020830160208801620003cb565b80955050505050509250925092565b60008251620004e5818460208701620003cb565b9190910192915050565b600181811c908216806200050457607f821691505b6020821081036200052557634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200057b576000816000526020600020601f850160051c81016020861015620005565750805b601f850160051c820191505b81811015620005775782815560010162000562565b5050505b505050565b81516001600160401b038111156200059c576200059c620003b5565b620005b481620005ad8454620004ef565b846200052b565b602080601f831160018114620005ec5760008415620005d35750858301515b600019600386901b1c1916600185901b17855562000577565b600085815260208120601f198616915b828110156200061d57888601518255948401946001909101908401620005fc565b50858210156200063c5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b608051614796620006926000396000818161068f01528181610f9301528181612344015281816127e301528181612c7c01528181612e110152612f0a01526147966000f3fe6080604052600436106103375760003560e01c80637d25a05e116101b0578063bb0b6a53116100ec578063d75f0da711610095578063ee5462cc1161006f578063ee5462cc14610ac2578063f2fde38b14610ae2578063f3837da114610b02578063ff7bd03d14610b1857600080fd5b8063d75f0da714610a54578063d94c9a9814610a6e578063e619a3e314610a8e57600080fd5b8063ca5eb5e1116100c6578063ca5eb5e1146109f4578063cb8523c614610a14578063d547741f14610a3457600080fd5b8063bb0b6a531461097a578063c6bcb11f146109a7578063c713c532146109c757600080fd5b806397f0062c11610159578063a9ec827f11610133578063a9ec827f146108c2578063aa7715d7146108e4578063adc5c26d1461091f578063b3d300f41461093f57600080fd5b806397f0062c14610864578063a217fddf14610898578063a6803128146108ad57600080fd5b806391a275a81161018a57806391a275a8146107ac57806391d14854146107d957806393f9159a1461082c57600080fd5b80637d25a05e146106fb57806384e9a901146107375780638da5cb5b1461078157600080fd5b8063306275be1161027f5780635512b6bc116102285780635e280f11116102025780635e280f111461067d5780636d6cc241146106b15780636f8423ac146106d1578063715018a6146106e657600080fd5b80635512b6bc146105ca5780635a9c78ab1461063d5780635c125e761461065d57600080fd5b806336568abe1161025957806336568abe1461055a5780633da1fd0f1461057a5780634d9569ad1461059a57600080fd5b8063306275be14610507578063322b89e3146105275780633400288b1461053a57600080fd5b806319f22a7b116102e157806323f3368d116102bb57806323f3368d14610489578063248a9ca3146104a95780632f2ff15d146104e757600080fd5b806319f22a7b146104015780631b9ea3e41461043c5780631f3f63641461046957600080fd5b80630f02cc33116103125780630f02cc33146103ab57806313137d65146103cd57806317442b70146103e057600080fd5b8062681d321461034357806301ffc9a71461036b578063064d5a7c1461038b57600080fd5b3661033e57005b600080fd5b610356610351366004613aa2565b610b38565b60405190151581526020015b60405180910390f35b34801561037757600080fd5b50610356610386366004613af9565b610e2b565b34801561039757600080fd5b506103566103a6366004613b3b565b610ec4565b3480156103b757600080fd5b506103cb6103c6366004613b74565b610f46565b005b6103cb6103db366004613c12565b610f91565b3480156103ec57600080fd5b50604080516001808252602082015201610362565b34801561040d57600080fd5b5061035661041c366004613cb2565b805160208183018101805160048252928201919093012091525460ff1681565b34801561044857600080fd5b5061045c610457366004613ce7565b61108b565b6040516103629190613d85565b34801561047557600080fd5b50610356610484366004613ce7565b61116d565b34801561049557600080fd5b5061045c6104a4366004613d98565b6113d5565b3480156104b557600080fd5b506104d96104c4366004613b3b565b60009081526002602052604090206001015490565b604051908152602001610362565b3480156104f357600080fd5b506103cb610502366004613ce7565b61146f565b34801561051357600080fd5b50610356610522366004613d98565b61149a565b610356610535366004613db5565b611861565b34801561054657600080fd5b506103cb610555366004613e1f565b611b08565b34801561056657600080fd5b506103cb610575366004613ce7565b611b65565b34801561058657600080fd5b50610356610595366004613e49565b611bc3565b3480156105a657600080fd5b506103566105b5366004613d98565b60056020526000908152604090205460ff1681565b3480156105d657600080fd5b506106186105e5366004613cb2565b805160208183018101805160078252928201919093012091525473ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610362565b34801561064957600080fd5b506103cb610658366004613e67565b611c9c565b34801561066957600080fd5b506104d9610678366004613d98565b611d3d565b34801561068957600080fd5b506106187f000000000000000000000000000000000000000000000000000000000000000081565b3480156106bd57600080fd5b506103cb6106cc366004613d98565b611dce565b3480156106dd57600080fd5b50610356611e9a565b3480156106f257600080fd5b506103cb611ed6565b34801561070757600080fd5b5061071e610716366004613e1f565b600092915050565b60405167ffffffffffffffff9091168152602001610362565b34801561074357600080fd5b50600e54610760906fffffffffffffffffffffffffffffffff1681565b6040516fffffffffffffffffffffffffffffffff9091168152602001610362565b34801561078d57600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff16610618565b3480156107b857600080fd5b50600d546106189073ffffffffffffffffffffffffffffffffffffffff1681565b3480156107e557600080fd5b506103566107f4366004613ce7565b600091825260026020908152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b34801561083857600080fd5b506104d9610847366004613cb2565b8051602081830181018051600c8252928201919093012091525481565b34801561087057600080fd5b506104d97f4f4e4c595f41444d494e0000000000000000000000000000000000000000000081565b3480156108a457600080fd5b506104d9600081565b3480156108b957600080fd5b50610356611eea565b3480156108ce57600080fd5b506108d7611f22565b6040516103629190613ea9565b3480156108f057600080fd5b506103566108ff366004613cb2565b805160208183018101805160068252928201919093012091525460ff1681565b34801561092b57600080fd5b5061035661093a366004613f2b565b611ffb565b34801561094b57600080fd5b5061095f61095a366004613f7b565b61227f565b60408051825181526020928301519281019290925201610362565b34801561098657600080fd5b506104d9610995366004613fe5565b60016020526000908152604090205481565b3480156109b357600080fd5b5061045c6109c2366004614000565b6122a8565b3480156109d357600080fd5b506104d96109e2366004613d98565b60036020526000908152604090205481565b348015610a0057600080fd5b506103cb610a0f366004613d98565b6122f7565b348015610a2057600080fd5b506103cb610a2f366004613d98565b6123a3565b348015610a4057600080fd5b506103cb610a4f366004613ce7565b6123f7565b348015610a6057600080fd5b506009546103569060ff1681565b348015610a7a57600080fd5b5061095f610a89366004614033565b61241c565b348015610a9a57600080fd5b506104d97f4f4e4c595f414c4c4f574544000000000000000000000000000000000000000081565b348015610ace57600080fd5b50610356610add366004614091565b612455565b348015610aee57600080fd5b506103cb610afd366004613d98565b612716565b348015610b0e57600080fd5b506104d9600a5481565b348015610b2457600080fd5b50610356610b333660046140e1565b61277a565b60095460009060ff161515600103610bb1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600760248201527f626c6f636b65640000000000000000000000000000000000000000000000000060448201526064015b60405180910390fd5b6000805260056020527f05b8ccbb9d4d8fb16ea74ce3c29a41f1b461fbdaff4714a0d9a8eb05499746bc5460ff16610c45576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f6e6f742057686974656c697374656400000000000000000000000000000000006044820152606401610ba8565b600e54600090610c67906fffffffffffffffffffffffffffffffff16826122a8565b600080805260086020527f5eff886ea0ce6ca488a3d6e336d6c0f75f46d19b42c06ce5ee98e42c96d256c780549293509091610ca2906140fd565b80601f0160208091040260200160405190810160405280929190818152602001828054610cce906140fd565b8015610d1b5780601f10610cf057610100808354040283529160200191610d1b565b820191906000526020600020905b815481529060010190602001808311610cfe57829003601f168201915b505050505090506000813387604051602001610d399392919061414a565b60405160208183030381529060405290506000610d5788838661227f565b8051909150610d6690886141b4565b341015610dcf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f6e6f7420656e6f7567682062616c616e636500000000000000000000000000006044820152606401610ba8565b610ddc88838684336127b0565b507f18c58cf0ecca795f4b4398940437122b10629b84a518fbf54724f665bd69e5878733600089604051610e1394939291906141c7565b60405180910390a160019450505050505b9392505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b000000000000000000000000000000000000000000000000000000001480610ebe57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b6000610ece6128c8565b81600003610f38576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f56616c75652063616e6e6f7420626520300000000000000000000000000000006044820152606401610ba8565b50600a81905560015b919050565b610f4e6128c8565b600e80547fffffffffffffffffffffffffffffffff00000000000000000000000000000000166fffffffffffffffffffffffffffffffff92909216919091179055565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163314611002576040517f91ac5e4f000000000000000000000000000000000000000000000000000000008152336004820152602401610ba8565b6020870180359061101c90611017908a613fe5565b61291b565b146110735761102e6020880188613fe5565b6040517fc26bebcc00000000000000000000000000000000000000000000000000000000815263ffffffff909116600482015260208801356024820152604401610ba8565b61108287878787878787612970565b50505050505050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600860205260408120805460609291906110c0906140fd565b80601f01602080910402602001604051908101604052809291908181526020018280546110ec906140fd565b80156111395780601f1061110e57610100808354040283529160200191611139565b820191906000526020600020905b81548152906001019060200180831161111c57829003601f168201915b505050505090508033856040516020016111559392919061414a565b60405160208183030381529060405291505092915050565b60007f4f4e4c595f414c4c4f574544000000000000000000000000000000000000000061119981612a28565b4784111561120b5773ffffffffffffffffffffffffffffffffffffffff831660008181526003602052604090819020869055518591907feddcb470730e19822038f7b6314f2e1d7621d7b184ffde02e3153a6c090524cb906111fe9042815260200190565b60405180910390a36113ce565b6000600a548561121b9190614206565b90508061122a866103e8614206565b611234919061421d565b945073ffffffffffffffffffffffffffffffffffffffff84166112596103e887614230565b604051600081818185875af1925050503d8060008114611295576040519150601f19603f3d011682016040523d82523d6000602084013e61129a565b606091505b5050600d5490935060009073ffffffffffffffffffffffffffffffffffffffff166112c76103e884614230565b604051600081818185875af1925050503d8060008114611303576040519150601f19603f3d011682016040523d82523d6000602084013e611308565b606091505b505090508380156113165750805b15611381577fd7ff2037007d76f0b041f201312e77e4467797134e7ae6f4596295a7337b69716113486103e888614230565b6040805191825273ffffffffffffffffffffffffffffffffffffffff8816602083015260009082015260600160405180910390a16113cb565b6040517facde450600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff86166004820152602401610ba8565b50505b5092915050565b600860205260009081526040902080546113ee906140fd565b80601f016020809104026020016040519081016040528092919081815260200182805461141a906140fd565b80156114675780601f1061143c57610100808354040283529160200191611467565b820191906000526020600020905b81548152906001019060200180831161144a57829003601f168201915b505050505081565b60008281526002602052604090206001015461148a81612a28565b6114948383612a32565b50505050565b60006114a46128c8565b73ffffffffffffffffffffffffffffffffffffffff821660009081526005602052604090205460ff16156118175773ffffffffffffffffffffffffffffffffffffffff821660009081526008602052604081208054611502906140fd565b80601f016020809104026020016040519081016040528092919081815260200182805461152e906140fd565b801561157b5780601f106115505761010080835404028352916020019161157b565b820191906000526020600020905b81548152906001019060200180831161155e57829003601f168201915b50505050509050600781604051611592919061426b565b908152604080516020928190038301902080547fffffffffffffffffffffffff000000000000000000000000000000000000000016905573ffffffffffffffffffffffffffffffffffffffff85166000908152600890925281206115f59161391d565b6000600c82604051611607919061426b565b90815260200160405180910390205490506000600b6001600b8054905061162e919061421d565b8154811061163e5761163e614287565b906000526020600020018054611653906140fd565b80601f016020809104026020016040519081016040528092919081815260200182805461167f906140fd565b80156116cc5780601f106116a1576101008083540402835291602001916116cc565b820191906000526020600020905b8154815290600101906020018083116116af57829003601f168201915b5050505050905081600c826040516116e4919061426b565b90815260200160405180910390208190555080600b838154811061170a5761170a614287565b9060005260206000200190816117209190614306565b50600b80548061173257611732614420565b60019003818190600052602060002001600061174e919061391d565b9055600c83604051611760919061426b565b908152604080516020928190038301812060009081905573ffffffffffffffffffffffffffffffffffffffff89168152600590935290822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556006906117cc90869061426b565b90815260405190819003602001902080549115157fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff009092169190911790555060019250610f41915050565b6040517f5f00e56300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83166004820152602401610ba8565b60095460009060ff1615156001036118d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600760248201527f626c6f636b6564000000000000000000000000000000000000000000000000006044820152606401610ba8565b73ffffffffffffffffffffffffffffffffffffffff831660009081526005602052604090205460ff16611964576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f6e6f742057686974656c697374656400000000000000000000000000000000006044820152606401610ba8565b6040517f23b872dd0000000000000000000000000000000000000000000000000000000081523360048201523060248201526044810185905273ffffffffffffffffffffffffffffffffffffffff8416906323b872dd906064016020604051808303816000875af11580156119dd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a01919061444f565b50600e54600090611a24906fffffffffffffffffffffffffffffffff16826122a8565b90506000611a32868661108b565b90506000611a4188838561227f565b8051909150341015611aaf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f6e6f7420656e6f756768206665650000000000000000000000000000000000006044820152606401610ba8565b611abc88838584336127b0565b507f18c58cf0ecca795f4b4398940437122b10629b84a518fbf54724f665bd69e58787338888604051611af294939291906141c7565b60405180910390a1506001979650505050505050565b611b106128c8565b63ffffffff8216600081815260016020908152604091829020849055815192835282018390527f238399d427b947898edb290f5ff0f9109849b1c3ba196a42e35f00c50a54b98b910160405180910390a15050565b73ffffffffffffffffffffffffffffffffffffffff81163314611bb4576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611bbe8282612b32565b505050565b6000611bcd6128c8565b81471015611c37576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f62616c616e6365206572720000000000000000000000000000000000000000006044820152606401610ba8565b60405173ffffffffffffffffffffffffffffffffffffffff8416908390600081818185875af1925050503d8060008114611c8d576040519150601f19603f3d011682016040523d82523d6000602084013e611c92565b606091505b5090949350505050565b611ca46128c8565b6040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82811660048301526024820184905284169063a9059cbb906044016020604051808303816000875af1158015611d19573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611494919061444f565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8316906370a0823190602401602060405180830381865afa158015611daa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebe9190614471565b611dd66128c8565b73ffffffffffffffffffffffffffffffffffffffff8116611e53576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f43616e6e6f7420626520616464726573732030000000000000000000000000006044820152606401610ba8565b600d80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6000611ea46128c8565b50600980547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915590565b611ede6128c8565b611ee86000612bf1565b565b6000611ef46128c8565b50600980547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055600190565b6060600b805480602002602001604051908101604052809291908181526020016000905b82821015611ff2578382906000526020600020018054611f65906140fd565b80601f0160208091040260200160405190810160405280929190818152602001828054611f91906140fd565b8015611fde5780601f10611fb357610100808354040283529160200191611fde565b820191906000526020600020905b815481529060010190602001808311611fc157829003601f168201915b505050505081526020019060010190611f46565b50505050905090565b60007f4f4e4c595f414c4c4f574544000000000000000000000000000000000000000061202781612a28565b6000600785604051612039919061426b565b90815260405190819003602001902054600a5473ffffffffffffffffffffffffffffffffffffffff90911691506000906120739088614206565b905080612082886103e8614206565b61208c919061421d565b965073ffffffffffffffffffffffffffffffffffffffff821663a9059cbb866120b76103e88b614230565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff909216600483015260248201526044016020604051808303816000875af1158015612127573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061214b919061444f565b50600d5473ffffffffffffffffffffffffffffffffffffffff8084169163a9059cbb911661217b6103e885614230565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff909216600483015260248201526044016020604051808303816000875af11580156121eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061220f919061444f565b507fd7ff2037007d76f0b041f201312e77e4467797134e7ae6f4596295a7337b697161223d6103e889614230565b6040805191825273ffffffffffffffffffffffffffffffffffffffff808916602084015285169082015260600160405180910390a15060019695505050505050565b60408051808201909152600080825260208201526122a08484846000612c66565b949350505050565b6060610e2483836122f0604080517e03000000000000000000000000000000000000000000000000000000000000602082015281516002818303018152602290910190915290565b9190612d4b565b6122ff6128c8565b6040517fca5eb5e100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82811660048301527f0000000000000000000000000000000000000000000000000000000000000000169063ca5eb5e190602401600060405180830381600087803b15801561238857600080fd5b505af115801561239c573d6000803e3d6000fd5b5050505050565b7f4f4e4c595f41444d494e000000000000000000000000000000000000000000006123cd81612a28565b611bbe7f4f4e4c595f414c4c4f574544000000000000000000000000000000000000000083612a32565b60008281526002602052604090206001015461241281612a28565b6114948383612b32565b6040805180820190915260008082526020820152600061243d8360006122a8565b905061244c8585836000612c66565b95945050505050565b600061245f6128c8565b73ffffffffffffffffffffffffffffffffffffffff831660009081526005602052604090205460ff16156124ef576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f4475706c696361746520746f6b656e00000000000000000000000000000000006044820152606401610ba8565b6006826040516124ff919061426b565b9081526040519081900360200190205460ff1615612579576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f4475706c696361746520746f6b656e00000000000000000000000000000000006044820152606401610ba8565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600560205260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915590516006906125dc90859061426b565b908152604080516020928190038301902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169315159390931790925573ffffffffffffffffffffffffffffffffffffffff851660009081526008909152206126478382614306565b5082600783604051612659919061426b565b908152604051908190036020018120805473ffffffffffffffffffffffffffffffffffffffff939093167fffffffffffffffffffffffff000000000000000000000000000000000000000090931692909217909155600b5490600c906126c090859061426b565b90815260405190819003602001902055600b80546001810182556000919091527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db90161270c8382614306565b5060019392505050565b61271e6128c8565b73ffffffffffffffffffffffffffffffffffffffff811661276e576040517f1e4fbdf700000000000000000000000000000000000000000000000000000000815260006004820152602401610ba8565b61277781612bf1565b50565b60006020820180359060019083906127929086613fe5565b63ffffffff1681526020810191909152604001600020541492915050565b6127b8613957565b60006127c78460000151612dcc565b6020850151909150156127e1576127e18460200151612e0d565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16632637a450826040518060a001604052808b63ffffffff16815260200161283e8c61291b565b81526020018a815260200189815260200160008960200151111515815250866040518463ffffffff1660e01b815260040161287a92919061448a565b60806040518083038185885af1158015612898573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906128bd919061457d565b979650505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314611ee8576040517f118cdaa7000000000000000000000000000000000000000000000000000000008152336004820152602401610ba8565b63ffffffff811660009081526001602052604081205480610ebe576040517ff6ff4fb700000000000000000000000000000000000000000000000000000000815263ffffffff84166004820152602401610ba8565b600061297f6020890189613fe5565b905060008080612991888a018a6145ef565b9250925092506004836040516129a7919061426b565b9081526040519081900360200190205460ff16156129cf576129c98183612f33565b506129dc565b6129da81848461316f565b505b7faf01008d00ea7c4f5e5e6d544a9fbbdcdc9336e3e45acccfebec1ebc52cd9719838383878e604051612a13959493929190614649565b60405180910390a15050505050505050505050565b6127778133613434565b600082815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff16612b2a57600083815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055612ac83390565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610ebe565b506000610ebe565b600082815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff1615612b2a57600083815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610ebe565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60408051808201909152600080825260208201527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663ddc28c586040518060a001604052808863ffffffff168152602001612cd68961291b565b8152602001878152602001868152602001851515815250306040518363ffffffff1660e01b8152600401612d0b92919061448a565b6040805180830381865afa158015612d27573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061244c919061469c565b6060836003612d5b8260006134bc565b61ffff1614612da857612d6f8160006134bc565b6040517f3a51740d00000000000000000000000000000000000000000000000000000000815261ffff9091166004820152602401610ba8565b6000612db4858561353c565b9050612dc2866001836135ee565b9695505050505050565b6000813414612e09576040517f9f704120000000000000000000000000000000000000000000000000000000008152346004820152602401610ba8565b5090565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663e4fe1d946040518163ffffffff1660e01b8152600401602060405180830381865afa158015612e7a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e9e91906146b8565b905073ffffffffffffffffffffffffffffffffffffffff8116612eed576040517f5373352a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612f2f73ffffffffffffffffffffffffffffffffffffffff8216337f000000000000000000000000000000000000000000000000000000000000000085613659565b5050565b600047831115612fa75773ffffffffffffffffffffffffffffffffffffffff821660008181526003602052604090819020859055518491907feddcb470730e19822038f7b6314f2e1d7621d7b184ffde02e3153a6c090524cb90612f9a9042815260200190565b60405180910390a3610ebe565b6000600a5484612fb79190614206565b905080612fc6856103e8614206565b612fd0919061421d565b935073ffffffffffffffffffffffffffffffffffffffff8316612ff56103e886614230565b604051600081818185875af1925050503d8060008114613031576040519150601f19603f3d011682016040523d82523d6000602084013e613036565b606091505b5050600d5490925060009073ffffffffffffffffffffffffffffffffffffffff166130636103e884614230565b604051600081818185875af1925050503d806000811461309f576040519150601f19603f3d011682016040523d82523d6000602084013e6130a4565b606091505b505090508280156130b25750805b1561311d577fd7ff2037007d76f0b041f201312e77e4467797134e7ae6f4596295a7337b69716130e46103e887614230565b6040805191825273ffffffffffffffffffffffffffffffffffffffff8716602083015260009082015260600160405180910390a1613167565b6040517facde450600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401610ba8565b505092915050565b600080600784604051613182919061426b565b9081526040519081900360200190205460095473ffffffffffffffffffffffffffffffffffffffff909116915060ff1615613219576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f42726964676520697320626c6f636b6564207269676874206e6f7700000000006044820152606401610ba8565b6000600a54866132299190614206565b905080613238876103e8614206565b613242919061421d565b955073ffffffffffffffffffffffffffffffffffffffff821663a9059cbb8561326d6103e88a614230565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff909216600483015260248201526044016020604051808303816000875af11580156132dd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613301919061444f565b50600d5473ffffffffffffffffffffffffffffffffffffffff8084169163a9059cbb91166133316103e885614230565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff909216600483015260248201526044016020604051808303816000875af11580156133a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133c5919061444f565b507fd7ff2037007d76f0b041f201312e77e4467797134e7ae6f4596295a7337b69716133f36103e888614230565b6040805191825273ffffffffffffffffffffffffffffffffffffffff808816602084015285169082015260600160405180910390a150600195945050505050565b600082815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16612f2f576040517fe2517d3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8216600482015260248101839052604401610ba8565b60006134c98260026141b4565b83511015613533576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f746f55696e7431365f6f75744f66426f756e64730000000000000000000000006044820152606401610ba8565b50016002015190565b60606fffffffffffffffffffffffffffffffff8216156135a557604080517fffffffffffffffffffffffffffffffff00000000000000000000000000000000608086811b8216602084015285901b16603082015201604051602081830303815290604052610e24565b6040517fffffffffffffffffffffffffffffffff00000000000000000000000000000000608085901b166020820152603001604051602081830303815290604052905092915050565b60608360036135fe8260006134bc565b61ffff161461361257612d6f8160006134bc565b84600161361f85516136ee565b61362a9060016146d5565b86866040516020016136409594939291906146f0565b6040516020818303038152906040529150509392505050565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000179052611494908590613736565b600061ffff821115612e09576040517f6dfcc6500000000000000000000000000000000000000000000000000000000081526010600482015260248101839052604401610ba8565b600061375873ffffffffffffffffffffffffffffffffffffffff8416836137cc565b9050805160001415801561377d57508080602001905181019061377b919061444f565b155b15611bbe576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84166004820152602401610ba8565b6060610e2483836000846000808573ffffffffffffffffffffffffffffffffffffffff1684866040516137ff919061426b565b60006040518083038185875af1925050503d806000811461383c576040519150601f19603f3d011682016040523d82523d6000602084013e613841565b606091505b5091509150612dc28683836060826138615761385c826138db565b610e24565b8151158015613885575073ffffffffffffffffffffffffffffffffffffffff84163b155b156138d4576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401610ba8565b5080610e24565b8051156138eb5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b508054613929906140fd565b6000825580601f10613939575050565b601f016020900490600052602060002090810190612777919061399f565b604051806060016040528060008019168152602001600067ffffffffffffffff16815260200161399a604051806040016040528060008152602001600081525090565b905290565b5b80821115612e0957600081556001016139a0565b803563ffffffff81168114610f4157600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f830112613a0857600080fd5b813567ffffffffffffffff80821115613a2357613a236139c8565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908282118183101715613a6957613a696139c8565b81604052838152866020858801011115613a8257600080fd5b836020870160208301376000602085830101528094505050505092915050565b600080600060608486031215613ab757600080fd5b613ac0846139b4565b925060208401359150604084013567ffffffffffffffff811115613ae357600080fd5b613aef868287016139f7565b9150509250925092565b600060208284031215613b0b57600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610e2457600080fd5b600060208284031215613b4d57600080fd5b5035919050565b80356fffffffffffffffffffffffffffffffff81168114610f4157600080fd5b600060208284031215613b8657600080fd5b610e2482613b54565b600060608284031215613ba157600080fd5b50919050565b60008083601f840112613bb957600080fd5b50813567ffffffffffffffff811115613bd157600080fd5b602083019150836020828501011115613be957600080fd5b9250929050565b73ffffffffffffffffffffffffffffffffffffffff8116811461277757600080fd5b600080600080600080600060e0888a031215613c2d57600080fd5b613c378989613b8f565b965060608801359550608088013567ffffffffffffffff80821115613c5b57600080fd5b613c678b838c01613ba7565b909750955060a08a01359150613c7c82613bf0565b90935060c08901359080821115613c9257600080fd5b50613c9f8a828b01613ba7565b989b979a50959850939692959293505050565b600060208284031215613cc457600080fd5b813567ffffffffffffffff811115613cdb57600080fd5b6122a0848285016139f7565b60008060408385031215613cfa57600080fd5b823591506020830135613d0c81613bf0565b809150509250929050565b60005b83811015613d32578181015183820152602001613d1a565b50506000910152565b60008151808452613d53816020860160208601613d17565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b602081526000610e246020830184613d3b565b600060208284031215613daa57600080fd5b8135610e2481613bf0565b60008060008060808587031215613dcb57600080fd5b613dd4856139b4565b9350602085013592506040850135613deb81613bf0565b9150606085013567ffffffffffffffff811115613e0757600080fd5b613e13878288016139f7565b91505092959194509250565b60008060408385031215613e3257600080fd5b613e3b836139b4565b946020939093013593505050565b60008060408385031215613e5c57600080fd5b8235613e3b81613bf0565b600080600060608486031215613e7c57600080fd5b8335613e8781613bf0565b9250602084013591506040840135613e9e81613bf0565b809150509250925092565b600060208083016020845280855180835260408601915060408160051b87010192506020870160005b82811015613f1e577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0888603018452613f0c858351613d3b565b94509285019290850190600101613ed2565b5092979650505050505050565b600080600060608486031215613f4057600080fd5b83359250602084013567ffffffffffffffff811115613f5e57600080fd5b613f6a868287016139f7565b9250506040840135613e9e81613bf0565b600080600060608486031215613f9057600080fd5b613f99846139b4565b9250602084013567ffffffffffffffff80821115613fb657600080fd5b613fc2878388016139f7565b93506040860135915080821115613fd857600080fd5b50613aef868287016139f7565b600060208284031215613ff757600080fd5b610e24826139b4565b6000806040838503121561401357600080fd5b61401c83613b54565b915061402a60208401613b54565b90509250929050565b60008060006060848603121561404857600080fd5b614051846139b4565b9250602084013567ffffffffffffffff81111561406d57600080fd5b614079868287016139f7565b92505061408860408501613b54565b90509250925092565b600080604083850312156140a457600080fd5b82356140af81613bf0565b9150602083013567ffffffffffffffff8111156140cb57600080fd5b6140d7858286016139f7565b9150509250929050565b6000606082840312156140f357600080fd5b610e248383613b8f565b600181811c9082168061411157607f821691505b602082108103613ba1577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60608152600061415d6060830186613d3b565b73ffffffffffffffffffffffffffffffffffffffff9490941660208301525060400152919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b80820180821115610ebe57610ebe614185565b848152600073ffffffffffffffffffffffffffffffffffffffff808616602084015280851660408401525060806060830152612dc26080830184613d3b565b8082028115828204841417610ebe57610ebe614185565b81810381811115610ebe57610ebe614185565b600082614266577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000825161427d818460208701613d17565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b601f821115611bbe576000816000526020600020601f850160051c810160208610156142df5750805b601f850160051c820191505b818110156142fe578281556001016142eb565b505050505050565b815167ffffffffffffffff811115614320576143206139c8565b6143348161432e84546140fd565b846142b6565b602080601f83116001811461438757600084156143515750858301515b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600386901b1c1916600185901b1785556142fe565b6000858152602081207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08616915b828110156143d4578886015182559484019460019091019084016143b5565b508582101561441057878501517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600388901b60f8161c191681555b5050505050600190811b01905550565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60006020828403121561446157600080fd5b81518015158114610e2457600080fd5b60006020828403121561448357600080fd5b5051919050565b6040815263ffffffff8351166040820152602083015160608201526000604084015160a060808401526144c060e0840182613d3b565b905060608501517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08483030160a08501526144fb8282613d3b565b60809690960151151560c085015250505073ffffffffffffffffffffffffffffffffffffffff9190911660209091015290565b60006040828403121561454057600080fd5b6040516040810181811067ffffffffffffffff82111715614563576145636139c8565b604052825181526020928301519281019290925250919050565b60006080828403121561458f57600080fd5b6040516060810167ffffffffffffffff82821081831117156145b3576145b36139c8565b81604052845183526020850151915080821682146145d057600080fd5b5060208201526145e3846040850161452e565b60408201529392505050565b60008060006060848603121561460457600080fd5b833567ffffffffffffffff81111561461b57600080fd5b614627868287016139f7565b935050602084013561463881613bf0565b929592945050506040919091013590565b60a08152600061465c60a0830188613d3b565b905073ffffffffffffffffffffffffffffffffffffffff8616602083015284604083015263ffffffff841660608301528260808301529695505050505050565b6000604082840312156146ae57600080fd5b610e24838361452e565b6000602082840312156146ca57600080fd5b8151610e2481613bf0565b61ffff8181168382160190808211156113ce576113ce614185565b60008651614702818460208b01613d17565b80830190507fff00000000000000000000000000000000000000000000000000000000000000808860f81b1682527fffff0000000000000000000000000000000000000000000000000000000000008760f01b166001830152808660f81b16600383015250835161477a816004840160208801613d17565b0160040197965050505050505056fea164736f6c6343000816000a0000000000000000000000001a44076050125825900e736c501f859c50fe728c0000000000000000000000007a6c9e8b7f0a9cf993ed8c6a4a42fd7fd3bb435a000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000034554480000000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x6080604052600436106103375760003560e01c80637d25a05e116101b0578063bb0b6a53116100ec578063d75f0da711610095578063ee5462cc1161006f578063ee5462cc14610ac2578063f2fde38b14610ae2578063f3837da114610b02578063ff7bd03d14610b1857600080fd5b8063d75f0da714610a54578063d94c9a9814610a6e578063e619a3e314610a8e57600080fd5b8063ca5eb5e1116100c6578063ca5eb5e1146109f4578063cb8523c614610a14578063d547741f14610a3457600080fd5b8063bb0b6a531461097a578063c6bcb11f146109a7578063c713c532146109c757600080fd5b806397f0062c11610159578063a9ec827f11610133578063a9ec827f146108c2578063aa7715d7146108e4578063adc5c26d1461091f578063b3d300f41461093f57600080fd5b806397f0062c14610864578063a217fddf14610898578063a6803128146108ad57600080fd5b806391a275a81161018a57806391a275a8146107ac57806391d14854146107d957806393f9159a1461082c57600080fd5b80637d25a05e146106fb57806384e9a901146107375780638da5cb5b1461078157600080fd5b8063306275be1161027f5780635512b6bc116102285780635e280f11116102025780635e280f111461067d5780636d6cc241146106b15780636f8423ac146106d1578063715018a6146106e657600080fd5b80635512b6bc146105ca5780635a9c78ab1461063d5780635c125e761461065d57600080fd5b806336568abe1161025957806336568abe1461055a5780633da1fd0f1461057a5780634d9569ad1461059a57600080fd5b8063306275be14610507578063322b89e3146105275780633400288b1461053a57600080fd5b806319f22a7b116102e157806323f3368d116102bb57806323f3368d14610489578063248a9ca3146104a95780632f2ff15d146104e757600080fd5b806319f22a7b146104015780631b9ea3e41461043c5780631f3f63641461046957600080fd5b80630f02cc33116103125780630f02cc33146103ab57806313137d65146103cd57806317442b70146103e057600080fd5b8062681d321461034357806301ffc9a71461036b578063064d5a7c1461038b57600080fd5b3661033e57005b600080fd5b610356610351366004613aa2565b610b38565b60405190151581526020015b60405180910390f35b34801561037757600080fd5b50610356610386366004613af9565b610e2b565b34801561039757600080fd5b506103566103a6366004613b3b565b610ec4565b3480156103b757600080fd5b506103cb6103c6366004613b74565b610f46565b005b6103cb6103db366004613c12565b610f91565b3480156103ec57600080fd5b50604080516001808252602082015201610362565b34801561040d57600080fd5b5061035661041c366004613cb2565b805160208183018101805160048252928201919093012091525460ff1681565b34801561044857600080fd5b5061045c610457366004613ce7565b61108b565b6040516103629190613d85565b34801561047557600080fd5b50610356610484366004613ce7565b61116d565b34801561049557600080fd5b5061045c6104a4366004613d98565b6113d5565b3480156104b557600080fd5b506104d96104c4366004613b3b565b60009081526002602052604090206001015490565b604051908152602001610362565b3480156104f357600080fd5b506103cb610502366004613ce7565b61146f565b34801561051357600080fd5b50610356610522366004613d98565b61149a565b610356610535366004613db5565b611861565b34801561054657600080fd5b506103cb610555366004613e1f565b611b08565b34801561056657600080fd5b506103cb610575366004613ce7565b611b65565b34801561058657600080fd5b50610356610595366004613e49565b611bc3565b3480156105a657600080fd5b506103566105b5366004613d98565b60056020526000908152604090205460ff1681565b3480156105d657600080fd5b506106186105e5366004613cb2565b805160208183018101805160078252928201919093012091525473ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610362565b34801561064957600080fd5b506103cb610658366004613e67565b611c9c565b34801561066957600080fd5b506104d9610678366004613d98565b611d3d565b34801561068957600080fd5b506106187f0000000000000000000000001a44076050125825900e736c501f859c50fe728c81565b3480156106bd57600080fd5b506103cb6106cc366004613d98565b611dce565b3480156106dd57600080fd5b50610356611e9a565b3480156106f257600080fd5b506103cb611ed6565b34801561070757600080fd5b5061071e610716366004613e1f565b600092915050565b60405167ffffffffffffffff9091168152602001610362565b34801561074357600080fd5b50600e54610760906fffffffffffffffffffffffffffffffff1681565b6040516fffffffffffffffffffffffffffffffff9091168152602001610362565b34801561078d57600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff16610618565b3480156107b857600080fd5b50600d546106189073ffffffffffffffffffffffffffffffffffffffff1681565b3480156107e557600080fd5b506103566107f4366004613ce7565b600091825260026020908152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b34801561083857600080fd5b506104d9610847366004613cb2565b8051602081830181018051600c8252928201919093012091525481565b34801561087057600080fd5b506104d97f4f4e4c595f41444d494e0000000000000000000000000000000000000000000081565b3480156108a457600080fd5b506104d9600081565b3480156108b957600080fd5b50610356611eea565b3480156108ce57600080fd5b506108d7611f22565b6040516103629190613ea9565b3480156108f057600080fd5b506103566108ff366004613cb2565b805160208183018101805160068252928201919093012091525460ff1681565b34801561092b57600080fd5b5061035661093a366004613f2b565b611ffb565b34801561094b57600080fd5b5061095f61095a366004613f7b565b61227f565b60408051825181526020928301519281019290925201610362565b34801561098657600080fd5b506104d9610995366004613fe5565b60016020526000908152604090205481565b3480156109b357600080fd5b5061045c6109c2366004614000565b6122a8565b3480156109d357600080fd5b506104d96109e2366004613d98565b60036020526000908152604090205481565b348015610a0057600080fd5b506103cb610a0f366004613d98565b6122f7565b348015610a2057600080fd5b506103cb610a2f366004613d98565b6123a3565b348015610a4057600080fd5b506103cb610a4f366004613ce7565b6123f7565b348015610a6057600080fd5b506009546103569060ff1681565b348015610a7a57600080fd5b5061095f610a89366004614033565b61241c565b348015610a9a57600080fd5b506104d97f4f4e4c595f414c4c4f574544000000000000000000000000000000000000000081565b348015610ace57600080fd5b50610356610add366004614091565b612455565b348015610aee57600080fd5b506103cb610afd366004613d98565b612716565b348015610b0e57600080fd5b506104d9600a5481565b348015610b2457600080fd5b50610356610b333660046140e1565b61277a565b60095460009060ff161515600103610bb1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600760248201527f626c6f636b65640000000000000000000000000000000000000000000000000060448201526064015b60405180910390fd5b6000805260056020527f05b8ccbb9d4d8fb16ea74ce3c29a41f1b461fbdaff4714a0d9a8eb05499746bc5460ff16610c45576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f6e6f742057686974656c697374656400000000000000000000000000000000006044820152606401610ba8565b600e54600090610c67906fffffffffffffffffffffffffffffffff16826122a8565b600080805260086020527f5eff886ea0ce6ca488a3d6e336d6c0f75f46d19b42c06ce5ee98e42c96d256c780549293509091610ca2906140fd565b80601f0160208091040260200160405190810160405280929190818152602001828054610cce906140fd565b8015610d1b5780601f10610cf057610100808354040283529160200191610d1b565b820191906000526020600020905b815481529060010190602001808311610cfe57829003601f168201915b505050505090506000813387604051602001610d399392919061414a565b60405160208183030381529060405290506000610d5788838661227f565b8051909150610d6690886141b4565b341015610dcf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f6e6f7420656e6f7567682062616c616e636500000000000000000000000000006044820152606401610ba8565b610ddc88838684336127b0565b507f18c58cf0ecca795f4b4398940437122b10629b84a518fbf54724f665bd69e5878733600089604051610e1394939291906141c7565b60405180910390a160019450505050505b9392505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b000000000000000000000000000000000000000000000000000000001480610ebe57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b6000610ece6128c8565b81600003610f38576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f56616c75652063616e6e6f7420626520300000000000000000000000000000006044820152606401610ba8565b50600a81905560015b919050565b610f4e6128c8565b600e80547fffffffffffffffffffffffffffffffff00000000000000000000000000000000166fffffffffffffffffffffffffffffffff92909216919091179055565b7f0000000000000000000000001a44076050125825900e736c501f859c50fe728c73ffffffffffffffffffffffffffffffffffffffff163314611002576040517f91ac5e4f000000000000000000000000000000000000000000000000000000008152336004820152602401610ba8565b6020870180359061101c90611017908a613fe5565b61291b565b146110735761102e6020880188613fe5565b6040517fc26bebcc00000000000000000000000000000000000000000000000000000000815263ffffffff909116600482015260208801356024820152604401610ba8565b61108287878787878787612970565b50505050505050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600860205260408120805460609291906110c0906140fd565b80601f01602080910402602001604051908101604052809291908181526020018280546110ec906140fd565b80156111395780601f1061110e57610100808354040283529160200191611139565b820191906000526020600020905b81548152906001019060200180831161111c57829003601f168201915b505050505090508033856040516020016111559392919061414a565b60405160208183030381529060405291505092915050565b60007f4f4e4c595f414c4c4f574544000000000000000000000000000000000000000061119981612a28565b4784111561120b5773ffffffffffffffffffffffffffffffffffffffff831660008181526003602052604090819020869055518591907feddcb470730e19822038f7b6314f2e1d7621d7b184ffde02e3153a6c090524cb906111fe9042815260200190565b60405180910390a36113ce565b6000600a548561121b9190614206565b90508061122a866103e8614206565b611234919061421d565b945073ffffffffffffffffffffffffffffffffffffffff84166112596103e887614230565b604051600081818185875af1925050503d8060008114611295576040519150601f19603f3d011682016040523d82523d6000602084013e61129a565b606091505b5050600d5490935060009073ffffffffffffffffffffffffffffffffffffffff166112c76103e884614230565b604051600081818185875af1925050503d8060008114611303576040519150601f19603f3d011682016040523d82523d6000602084013e611308565b606091505b505090508380156113165750805b15611381577fd7ff2037007d76f0b041f201312e77e4467797134e7ae6f4596295a7337b69716113486103e888614230565b6040805191825273ffffffffffffffffffffffffffffffffffffffff8816602083015260009082015260600160405180910390a16113cb565b6040517facde450600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff86166004820152602401610ba8565b50505b5092915050565b600860205260009081526040902080546113ee906140fd565b80601f016020809104026020016040519081016040528092919081815260200182805461141a906140fd565b80156114675780601f1061143c57610100808354040283529160200191611467565b820191906000526020600020905b81548152906001019060200180831161144a57829003601f168201915b505050505081565b60008281526002602052604090206001015461148a81612a28565b6114948383612a32565b50505050565b60006114a46128c8565b73ffffffffffffffffffffffffffffffffffffffff821660009081526005602052604090205460ff16156118175773ffffffffffffffffffffffffffffffffffffffff821660009081526008602052604081208054611502906140fd565b80601f016020809104026020016040519081016040528092919081815260200182805461152e906140fd565b801561157b5780601f106115505761010080835404028352916020019161157b565b820191906000526020600020905b81548152906001019060200180831161155e57829003601f168201915b50505050509050600781604051611592919061426b565b908152604080516020928190038301902080547fffffffffffffffffffffffff000000000000000000000000000000000000000016905573ffffffffffffffffffffffffffffffffffffffff85166000908152600890925281206115f59161391d565b6000600c82604051611607919061426b565b90815260200160405180910390205490506000600b6001600b8054905061162e919061421d565b8154811061163e5761163e614287565b906000526020600020018054611653906140fd565b80601f016020809104026020016040519081016040528092919081815260200182805461167f906140fd565b80156116cc5780601f106116a1576101008083540402835291602001916116cc565b820191906000526020600020905b8154815290600101906020018083116116af57829003601f168201915b5050505050905081600c826040516116e4919061426b565b90815260200160405180910390208190555080600b838154811061170a5761170a614287565b9060005260206000200190816117209190614306565b50600b80548061173257611732614420565b60019003818190600052602060002001600061174e919061391d565b9055600c83604051611760919061426b565b908152604080516020928190038301812060009081905573ffffffffffffffffffffffffffffffffffffffff89168152600590935290822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556006906117cc90869061426b565b90815260405190819003602001902080549115157fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff009092169190911790555060019250610f41915050565b6040517f5f00e56300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83166004820152602401610ba8565b60095460009060ff1615156001036118d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600760248201527f626c6f636b6564000000000000000000000000000000000000000000000000006044820152606401610ba8565b73ffffffffffffffffffffffffffffffffffffffff831660009081526005602052604090205460ff16611964576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f6e6f742057686974656c697374656400000000000000000000000000000000006044820152606401610ba8565b6040517f23b872dd0000000000000000000000000000000000000000000000000000000081523360048201523060248201526044810185905273ffffffffffffffffffffffffffffffffffffffff8416906323b872dd906064016020604051808303816000875af11580156119dd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a01919061444f565b50600e54600090611a24906fffffffffffffffffffffffffffffffff16826122a8565b90506000611a32868661108b565b90506000611a4188838561227f565b8051909150341015611aaf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f6e6f7420656e6f756768206665650000000000000000000000000000000000006044820152606401610ba8565b611abc88838584336127b0565b507f18c58cf0ecca795f4b4398940437122b10629b84a518fbf54724f665bd69e58787338888604051611af294939291906141c7565b60405180910390a1506001979650505050505050565b611b106128c8565b63ffffffff8216600081815260016020908152604091829020849055815192835282018390527f238399d427b947898edb290f5ff0f9109849b1c3ba196a42e35f00c50a54b98b910160405180910390a15050565b73ffffffffffffffffffffffffffffffffffffffff81163314611bb4576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611bbe8282612b32565b505050565b6000611bcd6128c8565b81471015611c37576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f62616c616e6365206572720000000000000000000000000000000000000000006044820152606401610ba8565b60405173ffffffffffffffffffffffffffffffffffffffff8416908390600081818185875af1925050503d8060008114611c8d576040519150601f19603f3d011682016040523d82523d6000602084013e611c92565b606091505b5090949350505050565b611ca46128c8565b6040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82811660048301526024820184905284169063a9059cbb906044016020604051808303816000875af1158015611d19573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611494919061444f565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8316906370a0823190602401602060405180830381865afa158015611daa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebe9190614471565b611dd66128c8565b73ffffffffffffffffffffffffffffffffffffffff8116611e53576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f43616e6e6f7420626520616464726573732030000000000000000000000000006044820152606401610ba8565b600d80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6000611ea46128c8565b50600980547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915590565b611ede6128c8565b611ee86000612bf1565b565b6000611ef46128c8565b50600980547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055600190565b6060600b805480602002602001604051908101604052809291908181526020016000905b82821015611ff2578382906000526020600020018054611f65906140fd565b80601f0160208091040260200160405190810160405280929190818152602001828054611f91906140fd565b8015611fde5780601f10611fb357610100808354040283529160200191611fde565b820191906000526020600020905b815481529060010190602001808311611fc157829003601f168201915b505050505081526020019060010190611f46565b50505050905090565b60007f4f4e4c595f414c4c4f574544000000000000000000000000000000000000000061202781612a28565b6000600785604051612039919061426b565b90815260405190819003602001902054600a5473ffffffffffffffffffffffffffffffffffffffff90911691506000906120739088614206565b905080612082886103e8614206565b61208c919061421d565b965073ffffffffffffffffffffffffffffffffffffffff821663a9059cbb866120b76103e88b614230565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff909216600483015260248201526044016020604051808303816000875af1158015612127573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061214b919061444f565b50600d5473ffffffffffffffffffffffffffffffffffffffff8084169163a9059cbb911661217b6103e885614230565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff909216600483015260248201526044016020604051808303816000875af11580156121eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061220f919061444f565b507fd7ff2037007d76f0b041f201312e77e4467797134e7ae6f4596295a7337b697161223d6103e889614230565b6040805191825273ffffffffffffffffffffffffffffffffffffffff808916602084015285169082015260600160405180910390a15060019695505050505050565b60408051808201909152600080825260208201526122a08484846000612c66565b949350505050565b6060610e2483836122f0604080517e03000000000000000000000000000000000000000000000000000000000000602082015281516002818303018152602290910190915290565b9190612d4b565b6122ff6128c8565b6040517fca5eb5e100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82811660048301527f0000000000000000000000001a44076050125825900e736c501f859c50fe728c169063ca5eb5e190602401600060405180830381600087803b15801561238857600080fd5b505af115801561239c573d6000803e3d6000fd5b5050505050565b7f4f4e4c595f41444d494e000000000000000000000000000000000000000000006123cd81612a28565b611bbe7f4f4e4c595f414c4c4f574544000000000000000000000000000000000000000083612a32565b60008281526002602052604090206001015461241281612a28565b6114948383612b32565b6040805180820190915260008082526020820152600061243d8360006122a8565b905061244c8585836000612c66565b95945050505050565b600061245f6128c8565b73ffffffffffffffffffffffffffffffffffffffff831660009081526005602052604090205460ff16156124ef576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f4475706c696361746520746f6b656e00000000000000000000000000000000006044820152606401610ba8565b6006826040516124ff919061426b565b9081526040519081900360200190205460ff1615612579576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f4475706c696361746520746f6b656e00000000000000000000000000000000006044820152606401610ba8565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600560205260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915590516006906125dc90859061426b565b908152604080516020928190038301902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169315159390931790925573ffffffffffffffffffffffffffffffffffffffff851660009081526008909152206126478382614306565b5082600783604051612659919061426b565b908152604051908190036020018120805473ffffffffffffffffffffffffffffffffffffffff939093167fffffffffffffffffffffffff000000000000000000000000000000000000000090931692909217909155600b5490600c906126c090859061426b565b90815260405190819003602001902055600b80546001810182556000919091527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db90161270c8382614306565b5060019392505050565b61271e6128c8565b73ffffffffffffffffffffffffffffffffffffffff811661276e576040517f1e4fbdf700000000000000000000000000000000000000000000000000000000815260006004820152602401610ba8565b61277781612bf1565b50565b60006020820180359060019083906127929086613fe5565b63ffffffff1681526020810191909152604001600020541492915050565b6127b8613957565b60006127c78460000151612dcc565b6020850151909150156127e1576127e18460200151612e0d565b7f0000000000000000000000001a44076050125825900e736c501f859c50fe728c73ffffffffffffffffffffffffffffffffffffffff16632637a450826040518060a001604052808b63ffffffff16815260200161283e8c61291b565b81526020018a815260200189815260200160008960200151111515815250866040518463ffffffff1660e01b815260040161287a92919061448a565b60806040518083038185885af1158015612898573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906128bd919061457d565b979650505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314611ee8576040517f118cdaa7000000000000000000000000000000000000000000000000000000008152336004820152602401610ba8565b63ffffffff811660009081526001602052604081205480610ebe576040517ff6ff4fb700000000000000000000000000000000000000000000000000000000815263ffffffff84166004820152602401610ba8565b600061297f6020890189613fe5565b905060008080612991888a018a6145ef565b9250925092506004836040516129a7919061426b565b9081526040519081900360200190205460ff16156129cf576129c98183612f33565b506129dc565b6129da81848461316f565b505b7faf01008d00ea7c4f5e5e6d544a9fbbdcdc9336e3e45acccfebec1ebc52cd9719838383878e604051612a13959493929190614649565b60405180910390a15050505050505050505050565b6127778133613434565b600082815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff16612b2a57600083815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055612ac83390565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610ebe565b506000610ebe565b600082815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff1615612b2a57600083815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610ebe565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60408051808201909152600080825260208201527f0000000000000000000000001a44076050125825900e736c501f859c50fe728c73ffffffffffffffffffffffffffffffffffffffff1663ddc28c586040518060a001604052808863ffffffff168152602001612cd68961291b565b8152602001878152602001868152602001851515815250306040518363ffffffff1660e01b8152600401612d0b92919061448a565b6040805180830381865afa158015612d27573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061244c919061469c565b6060836003612d5b8260006134bc565b61ffff1614612da857612d6f8160006134bc565b6040517f3a51740d00000000000000000000000000000000000000000000000000000000815261ffff9091166004820152602401610ba8565b6000612db4858561353c565b9050612dc2866001836135ee565b9695505050505050565b6000813414612e09576040517f9f704120000000000000000000000000000000000000000000000000000000008152346004820152602401610ba8565b5090565b60007f0000000000000000000000001a44076050125825900e736c501f859c50fe728c73ffffffffffffffffffffffffffffffffffffffff1663e4fe1d946040518163ffffffff1660e01b8152600401602060405180830381865afa158015612e7a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e9e91906146b8565b905073ffffffffffffffffffffffffffffffffffffffff8116612eed576040517f5373352a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612f2f73ffffffffffffffffffffffffffffffffffffffff8216337f0000000000000000000000001a44076050125825900e736c501f859c50fe728c85613659565b5050565b600047831115612fa75773ffffffffffffffffffffffffffffffffffffffff821660008181526003602052604090819020859055518491907feddcb470730e19822038f7b6314f2e1d7621d7b184ffde02e3153a6c090524cb90612f9a9042815260200190565b60405180910390a3610ebe565b6000600a5484612fb79190614206565b905080612fc6856103e8614206565b612fd0919061421d565b935073ffffffffffffffffffffffffffffffffffffffff8316612ff56103e886614230565b604051600081818185875af1925050503d8060008114613031576040519150601f19603f3d011682016040523d82523d6000602084013e613036565b606091505b5050600d5490925060009073ffffffffffffffffffffffffffffffffffffffff166130636103e884614230565b604051600081818185875af1925050503d806000811461309f576040519150601f19603f3d011682016040523d82523d6000602084013e6130a4565b606091505b505090508280156130b25750805b1561311d577fd7ff2037007d76f0b041f201312e77e4467797134e7ae6f4596295a7337b69716130e46103e887614230565b6040805191825273ffffffffffffffffffffffffffffffffffffffff8716602083015260009082015260600160405180910390a1613167565b6040517facde450600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401610ba8565b505092915050565b600080600784604051613182919061426b565b9081526040519081900360200190205460095473ffffffffffffffffffffffffffffffffffffffff909116915060ff1615613219576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f42726964676520697320626c6f636b6564207269676874206e6f7700000000006044820152606401610ba8565b6000600a54866132299190614206565b905080613238876103e8614206565b613242919061421d565b955073ffffffffffffffffffffffffffffffffffffffff821663a9059cbb8561326d6103e88a614230565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff909216600483015260248201526044016020604051808303816000875af11580156132dd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613301919061444f565b50600d5473ffffffffffffffffffffffffffffffffffffffff8084169163a9059cbb91166133316103e885614230565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff909216600483015260248201526044016020604051808303816000875af11580156133a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133c5919061444f565b507fd7ff2037007d76f0b041f201312e77e4467797134e7ae6f4596295a7337b69716133f36103e888614230565b6040805191825273ffffffffffffffffffffffffffffffffffffffff808816602084015285169082015260600160405180910390a150600195945050505050565b600082815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16612f2f576040517fe2517d3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8216600482015260248101839052604401610ba8565b60006134c98260026141b4565b83511015613533576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f746f55696e7431365f6f75744f66426f756e64730000000000000000000000006044820152606401610ba8565b50016002015190565b60606fffffffffffffffffffffffffffffffff8216156135a557604080517fffffffffffffffffffffffffffffffff00000000000000000000000000000000608086811b8216602084015285901b16603082015201604051602081830303815290604052610e24565b6040517fffffffffffffffffffffffffffffffff00000000000000000000000000000000608085901b166020820152603001604051602081830303815290604052905092915050565b60608360036135fe8260006134bc565b61ffff161461361257612d6f8160006134bc565b84600161361f85516136ee565b61362a9060016146d5565b86866040516020016136409594939291906146f0565b6040516020818303038152906040529150509392505050565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000179052611494908590613736565b600061ffff821115612e09576040517f6dfcc6500000000000000000000000000000000000000000000000000000000081526010600482015260248101839052604401610ba8565b600061375873ffffffffffffffffffffffffffffffffffffffff8416836137cc565b9050805160001415801561377d57508080602001905181019061377b919061444f565b155b15611bbe576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84166004820152602401610ba8565b6060610e2483836000846000808573ffffffffffffffffffffffffffffffffffffffff1684866040516137ff919061426b565b60006040518083038185875af1925050503d806000811461383c576040519150601f19603f3d011682016040523d82523d6000602084013e613841565b606091505b5091509150612dc28683836060826138615761385c826138db565b610e24565b8151158015613885575073ffffffffffffffffffffffffffffffffffffffff84163b155b156138d4576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401610ba8565b5080610e24565b8051156138eb5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b508054613929906140fd565b6000825580601f10613939575050565b601f016020900490600052602060002090810190612777919061399f565b604051806060016040528060008019168152602001600067ffffffffffffffff16815260200161399a604051806040016040528060008152602001600081525090565b905290565b5b80821115612e0957600081556001016139a0565b803563ffffffff81168114610f4157600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f830112613a0857600080fd5b813567ffffffffffffffff80821115613a2357613a236139c8565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908282118183101715613a6957613a696139c8565b81604052838152866020858801011115613a8257600080fd5b836020870160208301376000602085830101528094505050505092915050565b600080600060608486031215613ab757600080fd5b613ac0846139b4565b925060208401359150604084013567ffffffffffffffff811115613ae357600080fd5b613aef868287016139f7565b9150509250925092565b600060208284031215613b0b57600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610e2457600080fd5b600060208284031215613b4d57600080fd5b5035919050565b80356fffffffffffffffffffffffffffffffff81168114610f4157600080fd5b600060208284031215613b8657600080fd5b610e2482613b54565b600060608284031215613ba157600080fd5b50919050565b60008083601f840112613bb957600080fd5b50813567ffffffffffffffff811115613bd157600080fd5b602083019150836020828501011115613be957600080fd5b9250929050565b73ffffffffffffffffffffffffffffffffffffffff8116811461277757600080fd5b600080600080600080600060e0888a031215613c2d57600080fd5b613c378989613b8f565b965060608801359550608088013567ffffffffffffffff80821115613c5b57600080fd5b613c678b838c01613ba7565b909750955060a08a01359150613c7c82613bf0565b90935060c08901359080821115613c9257600080fd5b50613c9f8a828b01613ba7565b989b979a50959850939692959293505050565b600060208284031215613cc457600080fd5b813567ffffffffffffffff811115613cdb57600080fd5b6122a0848285016139f7565b60008060408385031215613cfa57600080fd5b823591506020830135613d0c81613bf0565b809150509250929050565b60005b83811015613d32578181015183820152602001613d1a565b50506000910152565b60008151808452613d53816020860160208601613d17565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b602081526000610e246020830184613d3b565b600060208284031215613daa57600080fd5b8135610e2481613bf0565b60008060008060808587031215613dcb57600080fd5b613dd4856139b4565b9350602085013592506040850135613deb81613bf0565b9150606085013567ffffffffffffffff811115613e0757600080fd5b613e13878288016139f7565b91505092959194509250565b60008060408385031215613e3257600080fd5b613e3b836139b4565b946020939093013593505050565b60008060408385031215613e5c57600080fd5b8235613e3b81613bf0565b600080600060608486031215613e7c57600080fd5b8335613e8781613bf0565b9250602084013591506040840135613e9e81613bf0565b809150509250925092565b600060208083016020845280855180835260408601915060408160051b87010192506020870160005b82811015613f1e577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0888603018452613f0c858351613d3b565b94509285019290850190600101613ed2565b5092979650505050505050565b600080600060608486031215613f4057600080fd5b83359250602084013567ffffffffffffffff811115613f5e57600080fd5b613f6a868287016139f7565b9250506040840135613e9e81613bf0565b600080600060608486031215613f9057600080fd5b613f99846139b4565b9250602084013567ffffffffffffffff80821115613fb657600080fd5b613fc2878388016139f7565b93506040860135915080821115613fd857600080fd5b50613aef868287016139f7565b600060208284031215613ff757600080fd5b610e24826139b4565b6000806040838503121561401357600080fd5b61401c83613b54565b915061402a60208401613b54565b90509250929050565b60008060006060848603121561404857600080fd5b614051846139b4565b9250602084013567ffffffffffffffff81111561406d57600080fd5b614079868287016139f7565b92505061408860408501613b54565b90509250925092565b600080604083850312156140a457600080fd5b82356140af81613bf0565b9150602083013567ffffffffffffffff8111156140cb57600080fd5b6140d7858286016139f7565b9150509250929050565b6000606082840312156140f357600080fd5b610e248383613b8f565b600181811c9082168061411157607f821691505b602082108103613ba1577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60608152600061415d6060830186613d3b565b73ffffffffffffffffffffffffffffffffffffffff9490941660208301525060400152919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b80820180821115610ebe57610ebe614185565b848152600073ffffffffffffffffffffffffffffffffffffffff808616602084015280851660408401525060806060830152612dc26080830184613d3b565b8082028115828204841417610ebe57610ebe614185565b81810381811115610ebe57610ebe614185565b600082614266577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000825161427d818460208701613d17565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b601f821115611bbe576000816000526020600020601f850160051c810160208610156142df5750805b601f850160051c820191505b818110156142fe578281556001016142eb565b505050505050565b815167ffffffffffffffff811115614320576143206139c8565b6143348161432e84546140fd565b846142b6565b602080601f83116001811461438757600084156143515750858301515b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600386901b1c1916600185901b1785556142fe565b6000858152602081207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08616915b828110156143d4578886015182559484019460019091019084016143b5565b508582101561441057878501517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600388901b60f8161c191681555b5050505050600190811b01905550565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60006020828403121561446157600080fd5b81518015158114610e2457600080fd5b60006020828403121561448357600080fd5b5051919050565b6040815263ffffffff8351166040820152602083015160608201526000604084015160a060808401526144c060e0840182613d3b565b905060608501517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08483030160a08501526144fb8282613d3b565b60809690960151151560c085015250505073ffffffffffffffffffffffffffffffffffffffff9190911660209091015290565b60006040828403121561454057600080fd5b6040516040810181811067ffffffffffffffff82111715614563576145636139c8565b604052825181526020928301519281019290925250919050565b60006080828403121561458f57600080fd5b6040516060810167ffffffffffffffff82821081831117156145b3576145b36139c8565b81604052845183526020850151915080821682146145d057600080fd5b5060208201526145e3846040850161452e565b60408201529392505050565b60008060006060848603121561460457600080fd5b833567ffffffffffffffff81111561461b57600080fd5b614627868287016139f7565b935050602084013561463881613bf0565b929592945050506040919091013590565b60a08152600061465c60a0830188613d3b565b905073ffffffffffffffffffffffffffffffffffffffff8616602083015284604083015263ffffffff841660608301528260808301529695505050505050565b6000604082840312156146ae57600080fd5b610e24838361452e565b6000602082840312156146ca57600080fd5b8151610e2481613bf0565b61ffff8181168382160190808211156113ce576113ce614185565b60008651614702818460208b01613d17565b80830190507fff00000000000000000000000000000000000000000000000000000000000000808860f81b1682527fffff0000000000000000000000000000000000000000000000000000000000008760f01b166001830152808660f81b16600383015250835161477a816004840160208801613d17565b0160040197965050505050505056fea164736f6c6343000816000a

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

0000000000000000000000001a44076050125825900e736c501f859c50fe728c0000000000000000000000007a6c9e8b7f0a9cf993ed8c6a4a42fd7fd3bb435a000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000034554480000000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _endpoint (address): 0x1a44076050125825900e736c501f859c50fE728c
Arg [1] : _owner (address): 0x7a6C9e8b7F0A9cf993eD8c6A4a42FD7fD3bb435A
Arg [2] : chainName (string): ETH

-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 0000000000000000000000001a44076050125825900e736c501f859c50fe728c
Arg [1] : 0000000000000000000000007a6c9e8b7f0a9cf993ed8c6a4a42fd7fd3bb435a
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000060
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [4] : 4554480000000000000000000000000000000000000000000000000000000000


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