S Price: $0.817263 (-3.90%)

Token

CIAN yield layer BTCLST (ylBTCLST)

Overview

Max Total Supply

0 ylBTCLST

Holders

0

Total Transfers

-

Market

Price

$0.00 @ 0.000000 S

Onchain Market Cap

$0.00

Circulating Supply Market Cap

-

Other Info

Token Contract (WITH 8 Decimals)

Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information

Contract Source Code Verified (Exact Match)

Contract Name:
CianOFT

Compiler Version
v0.8.25+commit.b61c2a91

Optimization Enabled:
Yes with 200 runs

Other Settings:
cancun EvmVersion, BSL 1.1 license
File 1 of 64 : CianOFT.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.25;

import { OFTCore } from "@layerzerolabs/oft-evm/contracts/OFTCore.sol";
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import {
    SendParam, MessagingFee, MessagingReceipt, OFTReceipt
} from "@layerzerolabs/oft-evm/contracts/interfaces/IOFT.sol";
import {ICianFlowControl} from "../interfaces/ICianFlowControl.sol";
import {EnforcedOptionParam} from "@layerzerolabs/oapp-evm/contracts/oapp/interfaces/IOAppOptionsType3.sol";
import {OptionsBuilder} from "@layerzerolabs/oapp-evm/contracts/oapp/libs/OptionsBuilder.sol";

contract CianOFT is OFTCore, ERC20 {
    using OptionsBuilder for bytes;

    uint8 internal immutable decimal;

    address public flowControl;

    constructor(
        string memory _name, // token name
        string memory _symbol, // token symbol
        address _endpoint, // LayerZero Endpoint address
        address _delegate, // token decimals
        address _flowControl, // flow control contract address
        uint8 _decimals // token decimals
    ) ERC20(_name, _symbol) OFTCore(_decimals, _endpoint, _delegate) Ownable(_delegate) {
        flowControl = _flowControl;
        decimal = _decimals;
    }

    function decimals() public view override returns (uint8) {
        return decimal;
    }

    modifier flowControlled(address _caller, uint256 _amount, uint256 _targetEid) {
        ICianFlowControl(flowControl).consume(_caller, _amount, _targetEid);
        _;
    }

    function updateFlowControl(address _flowControl) external onlyOwner {
        flowControl = _flowControl;
    }

    function setDefaultGasForSend(uint32 _eid, uint256 _gas) external onlyOwner {
        EnforcedOptionParam[] memory aEnforcedOptions = new EnforcedOptionParam[](1);
        aEnforcedOptions[0] = EnforcedOptionParam({
                eid: _eid,
                msgType: 1,
                options: OptionsBuilder.newOptions().addExecutorLzReceiveOption(uint128(_gas), 0)
            });
        _setEnforcedOptions(
            aEnforcedOptions
        );
    }

    function send(SendParam calldata _sendParam, MessagingFee calldata _fee, address _refundAddress)
        external
        payable
        virtual
        override
        flowControlled(msg.sender, _sendParam.amountLD, _sendParam.dstEid)
        returns (MessagingReceipt memory msgReceipt, OFTReceipt memory oftReceipt)
    {
        return _send(_sendParam, _fee, _refundAddress);
    }

    /**
     * @dev Retrieves the address of the underlying ERC20 implementation.
     * @return The address of the OFT token.
     *
     * @dev In the case of OFT, address(this) and erc20 are the same contract.
     */
    function token() public view returns (address) {
        return address(this);
    }

    /**
     * @notice Indicates whether the OFT contract requires approval of the 'token()' to send.
     * @return requiresApproval Needs approval of the underlying token implementation.
     *
     * @dev In the case of OFT where the contract IS the token, approval is NOT required.
     */
    function approvalRequired() external pure virtual returns (bool) {
        return false;
    }

    /**
     * @dev Burns tokens from the sender's specified balance.
     * @param _from The address to debit the tokens from.
     * @param _amountLD The amount of tokens to send in local decimals.
     * @param _minAmountLD The minimum amount to send in local decimals.
     * @param _dstEid The destination chain ID.
     * @return amountSentLD The amount sent in local decimals.
     * @return amountReceivedLD The amount received in local decimals on the remote.
     */
    function _debit(
        address _from,
        uint256 _amountLD,
        uint256 _minAmountLD,
        uint32 _dstEid
    ) internal virtual override returns (uint256 amountSentLD, uint256 amountReceivedLD) {
        (amountSentLD, amountReceivedLD) = _debitView(_amountLD, _minAmountLD, _dstEid);

        // @dev In NON-default OFT, amountSentLD could be 100, with a 10% fee, the amountReceivedLD amount is 90,
        // therefore amountSentLD CAN differ from amountReceivedLD.

        // @dev Default OFT burns on src.
        _burn(_from, amountSentLD);
    }

    /**
     * @dev Credits tokens to the specified address.
     * @param _to The address to credit the tokens to.
     * @param _amountLD The amount of tokens to credit in local decimals.
     * @dev _srcEid The source chain ID.
     * @return amountReceivedLD The amount of tokens ACTUALLY received in local decimals.
     */
    function _credit(
        address _to,
        uint256 _amountLD,
        uint32 /*_srcEid*/
    ) internal virtual override returns (uint256 amountReceivedLD) {
        if (_to == address(0x0)) _to = address(0xdead); // _mint(...) does not support address(0x0)
        // @dev Default OFT mints on dst.
        _mint(_to, _amountLD);
        // @dev In the case of NON-default OFT, the _amountLD MIGHT not be == amountReceivedLD.
        return _amountLD;
    }
}

File 2 of 64 : ExecutorOptions.sol
// SPDX-License-Identifier: LZBL-1.2

pragma solidity ^0.8.20;

import "@layerzerolabs/lz-evm-protocol-v2/contracts/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;
    uint8 internal constant OPTION_TYPE_LZREAD = 5;

    error Executor_InvalidLzReceiveOption();
    error Executor_InvalidNativeDropOption();
    error Executor_InvalidLzComposeOption();
    error Executor_InvalidLzReadOption();

    /// @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 Executor_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 Executor_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 Executor_InvalidLzComposeOption();
        index = _option.toU16(0);
        gas = _option.toU128(2);
        value = _option.length == 34 ? _option.toU128(18) : 0;
    }

    function decodeLzReadOption(
        bytes calldata _option
    ) internal pure returns (uint128 gas, uint32 calldataSize, uint128 value) {
        if (_option.length != 20 && _option.length != 36) revert Executor_InvalidLzReadOption();
        gas = _option.toU128(0);
        calldataSize = _option.toU32(16);
        value = _option.length == 36 ? _option.toU128(20) : 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);
    }

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

File 3 of 64 : DVNOptions.sol
// SPDX-License-Identifier: LZBL-1.2

pragma solidity ^0.8.20;

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 DVN_InvalidDVNIdx();
    error DVN_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 DVN_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 DVN_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 DVN_InvalidDVNIdx();
                if (!bitmap.get(dvnIdx)) {
                    ++numDVNs;
                    bitmap = bitmap.set(dvnIdx);
                }

                cursor += optionLength;
            }
        }
        if (cursor != _options.length) revert DVN_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 4 of 64 : 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;
}

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

    event DelegateSet(address sender, address delegate);

    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) external view returns (bool);

    function initializable(Origin calldata _origin, address _receiver) external view returns (bool);

    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 5 of 64 : 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);

    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 6 of 64 : IMessageLib.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.8.0;

import { IERC165 } from "@openzeppelin/contracts/utils/introspection/IERC165.sol";

import { SetConfigParam } from "./IMessageLibManager.sol";

enum MessageLibType {
    Send,
    Receive,
    SendAndReceive
}

interface IMessageLib is IERC165 {
    function setConfig(address _oapp, SetConfigParam[] calldata _config) external;

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

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

    // message libs of same major version are compatible
    function version() external view returns (uint64 major, uint8 minor, uint8 endpointVersion);

    function messageLibType() external view returns (MessageLibType);
}

File 7 of 64 : 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 newLib);
    event DefaultReceiveLibraryTimeoutSet(uint32 eid, address oldLib, uint256 expiry);
    event SendLibrarySet(address sender, uint32 eid, address newLib);
    event ReceiveLibrarySet(address receiver, uint32 eid, 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 _gracePeriod) 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);

    function isValidReceiveLibrary(address _receiver, uint32 _eid, address _lib) 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 _expiry) 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 8 of 64 : 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);

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

File 9 of 64 : 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 10 of 64 : 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 11 of 64 : ISendLib.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.8.0;

import { MessagingFee } from "./ILayerZeroEndpointV2.sol";
import { IMessageLib } from "./IMessageLib.sol";

struct Packet {
    uint64 nonce;
    uint32 srcEid;
    address sender;
    uint32 dstEid;
    bytes32 receiver;
    bytes32 guid;
    bytes message;
}

interface ISendLib is IMessageLib {
    function send(
        Packet calldata _packet,
        bytes calldata _options,
        bool _payInLzToken
    ) external returns (MessagingFee memory, bytes memory encodedPacket);

    function quote(
        Packet calldata _packet,
        bytes calldata _options,
        bool _payInLzToken
    ) external view returns (MessagingFee memory);

    function setTreasury(address _treasury) external;

    function withdrawFee(address _to, uint256 _amount) external;

    function withdrawLzTokenFee(address _lzToken, address _to, uint256 _amount) external;
}

File 12 of 64 : AddressCast.sol
// SPDX-License-Identifier: LZBL-1.2

pragma solidity ^0.8.20;

library AddressCast {
    error AddressCast_InvalidSizeForAddress();
    error AddressCast_InvalidAddress();

    function toBytes32(bytes calldata _addressBytes) internal pure returns (bytes32 result) {
        if (_addressBytes.length > 32) revert AddressCast_InvalidAddress();
        result = bytes32(_addressBytes);
        unchecked {
            uint256 offset = 32 - _addressBytes.length;
            result = result >> (offset * 8);
        }
    }

    function toBytes32(address _address) internal pure returns (bytes32 result) {
        result = bytes32(uint256(uint160(_address)));
    }

    function toBytes(bytes32 _addressBytes32, uint256 _size) internal pure returns (bytes memory result) {
        if (_size == 0 || _size > 32) revert AddressCast_InvalidSizeForAddress();
        result = new bytes(_size);
        unchecked {
            uint256 offset = 256 - _size * 8;
            assembly {
                mstore(add(result, 32), shl(offset, _addressBytes32))
            }
        }
    }

    function toAddress(bytes32 _addressBytes32) internal pure returns (address result) {
        result = address(uint160(uint256(_addressBytes32)));
    }

    function toAddress(bytes calldata _addressBytes) internal pure returns (address result) {
        if (_addressBytes.length != 20) revert AddressCast_InvalidAddress();
        result = address(bytes20(_addressBytes));
    }
}

File 13 of 64 : CalldataBytesLib.sol
// SPDX-License-Identifier: LZBL-1.2

pragma solidity ^0.8.20;

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 14 of 64 : 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.20;

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 15 of 64 : PacketV1Codec.sol
// SPDX-License-Identifier: LZBL-1.2

pragma solidity ^0.8.20;

import { Packet } from "../../interfaces/ISendLib.sol";
import { AddressCast } from "../../libs/AddressCast.sol";

library PacketV1Codec {
    using AddressCast for address;
    using AddressCast for bytes32;

    uint8 internal constant PACKET_VERSION = 1;

    // header (version + nonce + path)
    // version
    uint256 private constant PACKET_VERSION_OFFSET = 0;
    //    nonce
    uint256 private constant NONCE_OFFSET = 1;
    //    path
    uint256 private constant SRC_EID_OFFSET = 9;
    uint256 private constant SENDER_OFFSET = 13;
    uint256 private constant DST_EID_OFFSET = 45;
    uint256 private constant RECEIVER_OFFSET = 49;
    // payload (guid + message)
    uint256 private constant GUID_OFFSET = 81; // keccak256(nonce + path)
    uint256 private constant MESSAGE_OFFSET = 113;

    function encode(Packet memory _packet) internal pure returns (bytes memory encodedPacket) {
        encodedPacket = abi.encodePacked(
            PACKET_VERSION,
            _packet.nonce,
            _packet.srcEid,
            _packet.sender.toBytes32(),
            _packet.dstEid,
            _packet.receiver,
            _packet.guid,
            _packet.message
        );
    }

    function encodePacketHeader(Packet memory _packet) internal pure returns (bytes memory) {
        return
            abi.encodePacked(
                PACKET_VERSION,
                _packet.nonce,
                _packet.srcEid,
                _packet.sender.toBytes32(),
                _packet.dstEid,
                _packet.receiver
            );
    }

    function encodePayload(Packet memory _packet) internal pure returns (bytes memory) {
        return abi.encodePacked(_packet.guid, _packet.message);
    }

    function header(bytes calldata _packet) internal pure returns (bytes calldata) {
        return _packet[0:GUID_OFFSET];
    }

    function version(bytes calldata _packet) internal pure returns (uint8) {
        return uint8(bytes1(_packet[PACKET_VERSION_OFFSET:NONCE_OFFSET]));
    }

    function nonce(bytes calldata _packet) internal pure returns (uint64) {
        return uint64(bytes8(_packet[NONCE_OFFSET:SRC_EID_OFFSET]));
    }

    function srcEid(bytes calldata _packet) internal pure returns (uint32) {
        return uint32(bytes4(_packet[SRC_EID_OFFSET:SENDER_OFFSET]));
    }

    function sender(bytes calldata _packet) internal pure returns (bytes32) {
        return bytes32(_packet[SENDER_OFFSET:DST_EID_OFFSET]);
    }

    function senderAddressB20(bytes calldata _packet) internal pure returns (address) {
        return sender(_packet).toAddress();
    }

    function dstEid(bytes calldata _packet) internal pure returns (uint32) {
        return uint32(bytes4(_packet[DST_EID_OFFSET:RECEIVER_OFFSET]));
    }

    function receiver(bytes calldata _packet) internal pure returns (bytes32) {
        return bytes32(_packet[RECEIVER_OFFSET:GUID_OFFSET]);
    }

    function receiverB20(bytes calldata _packet) internal pure returns (address) {
        return receiver(_packet).toAddress();
    }

    function guid(bytes calldata _packet) internal pure returns (bytes32) {
        return bytes32(_packet[GUID_OFFSET:MESSAGE_OFFSET]);
    }

    function message(bytes calldata _packet) internal pure returns (bytes calldata) {
        return bytes(_packet[MESSAGE_OFFSET:]);
    }

    function payload(bytes calldata _packet) internal pure returns (bytes calldata) {
        return bytes(_packet[GUID_OFFSET:]);
    }

    function payloadHash(bytes calldata _packet) internal pure returns (bytes32) {
        return keccak256(payload(_packet));
    }
}

File 16 of 64 : IOAppCore.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

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();
    error InvalidDelegate();

    // 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 17 of 64 : IOAppMsgInspector.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

/**
 * @title IOAppMsgInspector
 * @dev Interface for the OApp Message Inspector, allowing examination of message and options contents.
 */
interface IOAppMsgInspector {
    // Custom error message for inspection failure
    error InspectionFailed(bytes message, bytes options);

    /**
     * @notice Allows the inspector to examine LayerZero message contents and optionally throw a revert if invalid.
     * @param _message The message payload to be inspected.
     * @param _options Additional options or parameters for inspection.
     * @return valid A boolean indicating whether the inspection passed (true) or failed (false).
     *
     * @dev Optionally done as a revert, OR use the boolean provided to handle the failure.
     */
    function inspect(bytes calldata _message, bytes calldata _options) external view returns (bool valid);
}

File 18 of 64 : IOAppOptionsType3.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

/**
 * @dev Struct representing enforced option parameters.
 */
struct EnforcedOptionParam {
    uint32 eid; // Endpoint ID
    uint16 msgType; // Message Type
    bytes options; // Additional options
}

/**
 * @title IOAppOptionsType3
 * @dev Interface for the OApp with Type 3 Options, allowing the setting and combining of enforced options.
 */
interface IOAppOptionsType3 {
    // Custom error message for invalid options
    error InvalidOptions(bytes options);

    // Event emitted when enforced options are set
    event EnforcedOptionSet(EnforcedOptionParam[] _enforcedOptions);

    /**
     * @notice Sets enforced options for specific endpoint and message type combinations.
     * @param _enforcedOptions An array of EnforcedOptionParam structures specifying enforced options.
     */
    function setEnforcedOptions(EnforcedOptionParam[] calldata _enforcedOptions) external;

    /**
     * @notice Combines options for a given endpoint and message type.
     * @param _eid The endpoint ID.
     * @param _msgType The OApp message type.
     * @param _extraOptions Additional options passed by the caller.
     * @return options The combination of caller specified options AND enforced options.
     */
    function combineOptions(
        uint32 _eid,
        uint16 _msgType,
        bytes calldata _extraOptions
    ) external view returns (bytes memory options);
}

File 19 of 64 : IOAppReceiver.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

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

interface IOAppReceiver is ILayerZeroReceiver {
    /**
     * @notice Indicates whether an address is an approved composeMsg sender to 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 _message The lzReceive payload.
     * @param _sender The sender address.
     * @return isSender Is a valid sender.
     *
     * @dev Applications can optionally choose to implement a separate composeMsg sender that is NOT the bridging layer.
     * @dev The default sender IS the OAppReceiver implementer.
     */
    function isComposeMsgSender(
        Origin calldata _origin,
        bytes calldata _message,
        address _sender
    ) external view returns (bool isSender);
}

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

pragma solidity ^0.8.20;

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

/**
 * @title OAppOptionsType3
 * @dev Abstract contract implementing the IOAppOptionsType3 interface with type 3 options.
 */
abstract contract OAppOptionsType3 is IOAppOptionsType3, Ownable {
    uint16 internal constant OPTION_TYPE_3 = 3;

    // @dev The "msgType" should be defined in the child contract.
    mapping(uint32 eid => mapping(uint16 msgType => bytes enforcedOption)) public enforcedOptions;

    /**
     * @dev Sets the enforced options for specific endpoint and message type combinations.
     * @param _enforcedOptions An array of EnforcedOptionParam structures specifying enforced options.
     *
     * @dev Only the owner/admin of the OApp can call this function.
     * @dev Provides a way for the OApp to enforce things like paying for PreCrime, AND/OR minimum dst lzReceive gas amounts etc.
     * @dev These enforced options can vary as the potential options/execution on the remote may differ as per the msgType.
     * eg. Amount of lzReceive() gas necessary to deliver a lzCompose() message adds overhead you dont want to pay
     * if you are only making a standard LayerZero message ie. lzReceive() WITHOUT sendCompose().
     */
    function setEnforcedOptions(EnforcedOptionParam[] calldata _enforcedOptions) public virtual onlyOwner {
        _setEnforcedOptions(_enforcedOptions);
    }

    /**
     * @dev Sets the enforced options for specific endpoint and message type combinations.
     * @param _enforcedOptions An array of EnforcedOptionParam structures specifying enforced options.
     *
     * @dev Provides a way for the OApp to enforce things like paying for PreCrime, AND/OR minimum dst lzReceive gas amounts etc.
     * @dev These enforced options can vary as the potential options/execution on the remote may differ as per the msgType.
     * eg. Amount of lzReceive() gas necessary to deliver a lzCompose() message adds overhead you dont want to pay
     * if you are only making a standard LayerZero message ie. lzReceive() WITHOUT sendCompose().
     */
    function _setEnforcedOptions(EnforcedOptionParam[] memory _enforcedOptions) internal virtual {
        for (uint256 i = 0; i < _enforcedOptions.length; i++) {
            // @dev Enforced options are only available for optionType 3, as type 1 and 2 dont support combining.
            _assertOptionsType3(_enforcedOptions[i].options);
            enforcedOptions[_enforcedOptions[i].eid][_enforcedOptions[i].msgType] = _enforcedOptions[i].options;
        }

        emit EnforcedOptionSet(_enforcedOptions);
    }

    /**
     * @notice Combines options for a given endpoint and message type.
     * @param _eid The endpoint ID.
     * @param _msgType The OAPP message type.
     * @param _extraOptions Additional options passed by the caller.
     * @return options The combination of caller specified options AND enforced options.
     *
     * @dev If there is an enforced lzReceive option:
     * - {gasLimit: 200k, msg.value: 1 ether} AND a caller supplies a lzReceive option: {gasLimit: 100k, msg.value: 0.5 ether}
     * - The resulting options will be {gasLimit: 300k, msg.value: 1.5 ether} when the message is executed on the remote lzReceive() function.
     * @dev This presence of duplicated options is handled off-chain in the verifier/executor.
     */
    function combineOptions(
        uint32 _eid,
        uint16 _msgType,
        bytes calldata _extraOptions
    ) public view virtual returns (bytes memory) {
        bytes memory enforced = enforcedOptions[_eid][_msgType];

        // No enforced options, pass whatever the caller supplied, even if it's empty or legacy type 1/2 options.
        if (enforced.length == 0) return _extraOptions;

        // No caller options, return enforced
        if (_extraOptions.length == 0) return enforced;

        // @dev If caller provided _extraOptions, must be type 3 as its the ONLY type that can be combined.
        if (_extraOptions.length >= 2) {
            _assertOptionsType3(_extraOptions);
            // @dev Remove the first 2 bytes containing the type from the _extraOptions and combine with enforced.
            return bytes.concat(enforced, _extraOptions[2:]);
        }

        // No valid set of options was found.
        revert InvalidOptions(_extraOptions);
    }

    /**
     * @dev Internal function to assert that options are of type 3.
     * @param _options The options to be checked.
     */
    function _assertOptionsType3(bytes memory _options) internal pure virtual {
        uint16 optionsType;
        assembly {
            optionsType := mload(add(_options, 2))
        }
        if (optionsType != OPTION_TYPE_3) revert InvalidOptions(_options);
    }
}

File 21 of 64 : OptionsBuilder.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

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

import { ExecutorOptions } from "@layerzerolabs/lz-evm-messagelib-v2/contracts/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 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 addExecutorLzReadOption(
        bytes memory _options,
        uint128 _gas,
        uint32 _size,
        uint128 _value
    ) internal pure onlyType3(_options) returns (bytes memory) {
        bytes memory option = ExecutorOptions.encodeLzReadOption(_gas, _size, _value);
        return addExecutorOption(_options, ExecutorOptions.OPTION_TYPE_LZREAD, 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 22 of 64 : OApp.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

// @dev Import the 'MessagingFee' and 'MessagingReceipt' so it's exposed to OApp implementers
// solhint-disable-next-line no-unused-import
import { OAppSender, MessagingFee, MessagingReceipt } 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 _delegate The delegate capable of making OApp configurations inside of the endpoint.
     */
    constructor(address _endpoint, address _delegate) OAppCore(_endpoint, _delegate) {}

    /**
     * @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 23 of 64 : OAppCore.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

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 delegate.
     * @param _endpoint The address of the LOCAL Layer Zero endpoint.
     * @param _delegate The delegate capable of making OApp configurations inside of the endpoint.
     *
     * @dev The delegate typically should be set as the owner of the contract.
     */
    constructor(address _endpoint, address _delegate) {
        endpoint = ILayerZeroEndpointV2(_endpoint);

        if (_delegate == address(0)) revert InvalidDelegate();
        endpoint.setDelegate(_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 {
        _setPeer(_eid, _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.
     *
     * @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) internal virtual {
        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.
     */
    function setDelegate(address _delegate) public onlyOwner {
        endpoint.setDelegate(_delegate);
    }
}

File 24 of 64 : OAppReceiver.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

import { IOAppReceiver, Origin } from "./interfaces/IOAppReceiver.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 IOAppReceiver, 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 = 2;

    /**
     * @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 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 (0, RECEIVER_VERSION);
    }

    /**
     * @notice Indicates whether an address is an approved composeMsg sender to the Endpoint.
     * @dev _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.
     * @dev _message The lzReceive payload.
     * @param _sender The sender address.
     * @return isSender Is a valid sender.
     *
     * @dev Applications can optionally choose to implement separate composeMsg senders that are NOT the bridging layer.
     * @dev The default sender IS the OAppReceiver implementer.
     */
    function isComposeMsgSender(
        Origin calldata /*_origin*/,
        bytes calldata /*_message*/,
        address _sender
    ) public view virtual returns (bool) {
        return _sender == address(this);
    }

    /**
     * @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 25 of 64 : OAppSender.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

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 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 (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 26 of 64 : IOAppPreCrimeSimulator.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

// @dev Import the Origin so it's exposed to OAppPreCrimeSimulator implementers.
// solhint-disable-next-line no-unused-import
import { InboundPacket, Origin } from "../libs/Packet.sol";

/**
 * @title IOAppPreCrimeSimulator Interface
 * @dev Interface for the preCrime simulation functionality in an OApp.
 */
interface IOAppPreCrimeSimulator {
    // @dev simulation result used in PreCrime implementation
    error SimulationResult(bytes result);
    error OnlySelf();

    /**
     * @dev Emitted when the preCrime contract address is set.
     * @param preCrimeAddress The address of the preCrime contract.
     */
    event PreCrimeSet(address preCrimeAddress);

    /**
     * @dev Retrieves the address of the preCrime contract implementation.
     * @return The address of the preCrime contract.
     */
    function preCrime() external view returns (address);

    /**
     * @dev Retrieves the address of the OApp contract.
     * @return The address of the OApp contract.
     */
    function oApp() external view returns (address);

    /**
     * @dev Sets the preCrime contract address.
     * @param _preCrime The address of the preCrime contract.
     */
    function setPreCrime(address _preCrime) external;

    /**
     * @dev Mocks receiving a packet, then reverts with a series of data to infer the state/result.
     * @param _packets An array of LayerZero InboundPacket objects representing received packets.
     */
    function lzReceiveAndRevert(InboundPacket[] calldata _packets) external payable;

    /**
     * @dev checks if the specified peer is considered 'trusted' by the OApp.
     * @param _eid The endpoint Id to check.
     * @param _peer The peer to check.
     * @return Whether the peer passed is considered 'trusted' by the OApp.
     */
    function isPeer(uint32 _eid, bytes32 _peer) external view returns (bool);
}

File 27 of 64 : IPreCrime.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;
struct PreCrimePeer {
    uint32 eid;
    bytes32 preCrime;
    bytes32 oApp;
}

// TODO not done yet
interface IPreCrime {
    error OnlyOffChain();

    // for simulate()
    error PacketOversize(uint256 max, uint256 actual);
    error PacketUnsorted();
    error SimulationFailed(bytes reason);

    // for preCrime()
    error SimulationResultNotFound(uint32 eid);
    error InvalidSimulationResult(uint32 eid, bytes reason);
    error CrimeFound(bytes crime);

    function getConfig(bytes[] calldata _packets, uint256[] calldata _packetMsgValues) external returns (bytes memory);

    function simulate(
        bytes[] calldata _packets,
        uint256[] calldata _packetMsgValues
    ) external payable returns (bytes memory);

    function buildSimulationResult() external view returns (bytes memory);

    function preCrime(
        bytes[] calldata _packets,
        uint256[] calldata _packetMsgValues,
        bytes[] calldata _simulations
    ) external;

    function version() external view returns (uint64 major, uint8 minor);
}

File 28 of 64 : Packet.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

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

/**
 * @title InboundPacket
 * @dev Structure representing an inbound packet received by the contract.
 */
struct InboundPacket {
    Origin origin; // Origin information of the packet.
    uint32 dstEid; // Destination endpointId of the packet.
    address receiver; // Receiver address for the packet.
    bytes32 guid; // Unique identifier of the packet.
    uint256 value; // msg.value of the packet.
    address executor; // Executor address for the packet.
    bytes message; // Message payload of the packet.
    bytes extraData; // Additional arbitrary data for the packet.
}

/**
 * @title PacketDecoder
 * @dev Library for decoding LayerZero packets.
 */
library PacketDecoder {
    using PacketV1Codec for bytes;

    /**
     * @dev Decode an inbound packet from the given packet data.
     * @param _packet The packet data to decode.
     * @return packet An InboundPacket struct representing the decoded packet.
     */
    function decode(bytes calldata _packet) internal pure returns (InboundPacket memory packet) {
        packet.origin = Origin(_packet.srcEid(), _packet.sender(), _packet.nonce());
        packet.dstEid = _packet.dstEid();
        packet.receiver = _packet.receiverB20();
        packet.guid = _packet.guid();
        packet.message = _packet.message();
    }

    /**
     * @dev Decode multiple inbound packets from the given packet data and associated message values.
     * @param _packets An array of packet data to decode.
     * @param _packetMsgValues An array of associated message values for each packet.
     * @return packets An array of InboundPacket structs representing the decoded packets.
     */
    function decode(
        bytes[] calldata _packets,
        uint256[] memory _packetMsgValues
    ) internal pure returns (InboundPacket[] memory packets) {
        packets = new InboundPacket[](_packets.length);
        for (uint256 i = 0; i < _packets.length; i++) {
            bytes calldata packet = _packets[i];
            packets[i] = PacketDecoder.decode(packet);
            // @dev Allows the verifier to specify the msg.value that gets passed in lzReceive.
            packets[i].value = _packetMsgValues[i];
        }
    }
}

File 29 of 64 : OAppPreCrimeSimulator.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { IPreCrime } from "./interfaces/IPreCrime.sol";
import { IOAppPreCrimeSimulator, InboundPacket, Origin } from "./interfaces/IOAppPreCrimeSimulator.sol";

/**
 * @title OAppPreCrimeSimulator
 * @dev Abstract contract serving as the base for preCrime simulation functionality in an OApp.
 */
abstract contract OAppPreCrimeSimulator is IOAppPreCrimeSimulator, Ownable {
    // The address of the preCrime implementation.
    address public preCrime;

    /**
     * @dev Retrieves the address of the OApp contract.
     * @return The address of the OApp contract.
     *
     * @dev The simulator contract is the base contract for the OApp by default.
     * @dev If the simulator is a separate contract, override this function.
     */
    function oApp() external view virtual returns (address) {
        return address(this);
    }

    /**
     * @dev Sets the preCrime contract address.
     * @param _preCrime The address of the preCrime contract.
     */
    function setPreCrime(address _preCrime) public virtual onlyOwner {
        preCrime = _preCrime;
        emit PreCrimeSet(_preCrime);
    }

    /**
     * @dev Interface for pre-crime simulations. Always reverts at the end with the simulation results.
     * @param _packets An array of InboundPacket objects representing received packets to be delivered.
     *
     * @dev WARNING: MUST revert at the end with the simulation results.
     * @dev Gives the preCrime implementation the ability to mock sending packets to the lzReceive function,
     * WITHOUT actually executing them.
     */
    function lzReceiveAndRevert(InboundPacket[] calldata _packets) public payable virtual {
        for (uint256 i = 0; i < _packets.length; i++) {
            InboundPacket calldata packet = _packets[i];

            // Ignore packets that are not from trusted peers.
            if (!isPeer(packet.origin.srcEid, packet.origin.sender)) continue;

            // @dev Because a verifier is calling this function, it doesnt have access to executor params:
            //  - address _executor
            //  - bytes calldata _extraData
            // preCrime will NOT work for OApps that rely on these two parameters inside of their _lzReceive().
            // They are instead stubbed to default values, address(0) and bytes("")
            // @dev Calling this.lzReceiveSimulate removes ability for assembly return 0 callstack exit,
            // which would cause the revert to be ignored.
            this.lzReceiveSimulate{ value: packet.value }(
                packet.origin,
                packet.guid,
                packet.message,
                packet.executor,
                packet.extraData
            );
        }

        // @dev Revert with the simulation results. msg.sender must implement IPreCrime.buildSimulationResult().
        revert SimulationResult(IPreCrime(msg.sender).buildSimulationResult());
    }

    /**
     * @dev Is effectively an internal function because msg.sender must be address(this).
     * Allows resetting the call stack for 'internal' calls.
     * @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 of the packet.
     * @param _message The message payload of the packet.
     * @param _executor The executor address for the packet.
     * @param _extraData Additional data for the packet.
     */
    function lzReceiveSimulate(
        Origin calldata _origin,
        bytes32 _guid,
        bytes calldata _message,
        address _executor,
        bytes calldata _extraData
    ) external payable virtual {
        // @dev Ensure ONLY can be called 'internally'.
        if (msg.sender != address(this)) revert OnlySelf();
        _lzReceiveSimulate(_origin, _guid, _message, _executor, _extraData);
    }

    /**
     * @dev Internal function to handle the OAppPreCrimeSimulator simulated receive.
     * @param _origin The origin information.
     *  - srcEid: The source chain endpoint ID.
     *  - sender: The sender address from the src chain.
     *  - nonce: The nonce of the LayerZero message.
     * @param _guid The GUID of the LayerZero message.
     * @param _message The LayerZero message.
     * @param _executor The address of the off-chain executor.
     * @param _extraData Arbitrary data passed by the msg executor.
     *
     * @dev Enables the preCrime simulator to mock sending lzReceive() messages,
     * routes the msg down from the OAppPreCrimeSimulator, and back up to the OAppReceiver.
     */
    function _lzReceiveSimulate(
        Origin calldata _origin,
        bytes32 _guid,
        bytes calldata _message,
        address _executor,
        bytes calldata _extraData
    ) internal virtual;

    /**
     * @dev checks if the specified peer is considered 'trusted' by the OApp.
     * @param _eid The endpoint Id to check.
     * @param _peer The peer to check.
     * @return Whether the peer passed is considered 'trusted' by the OApp.
     */
    function isPeer(uint32 _eid, bytes32 _peer) public view virtual returns (bool);
}

File 30 of 64 : IOFT.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

import { MessagingReceipt, MessagingFee } from "@layerzerolabs/oapp-evm/contracts/oapp/OAppSender.sol";

/**
 * @dev Struct representing token parameters for the OFT send() operation.
 */
struct SendParam {
    uint32 dstEid; // Destination endpoint ID.
    bytes32 to; // Recipient address.
    uint256 amountLD; // Amount to send in local decimals.
    uint256 minAmountLD; // Minimum amount to send in local decimals.
    bytes extraOptions; // Additional options supplied by the caller to be used in the LayerZero message.
    bytes composeMsg; // The composed message for the send() operation.
    bytes oftCmd; // The OFT command to be executed, unused in default OFT implementations.
}

/**
 * @dev Struct representing OFT limit information.
 * @dev These amounts can change dynamically and are up the specific oft implementation.
 */
struct OFTLimit {
    uint256 minAmountLD; // Minimum amount in local decimals that can be sent to the recipient.
    uint256 maxAmountLD; // Maximum amount in local decimals that can be sent to the recipient.
}

/**
 * @dev Struct representing OFT receipt information.
 */
struct OFTReceipt {
    uint256 amountSentLD; // Amount of tokens ACTUALLY debited from the sender in local decimals.
    // @dev In non-default implementations, the amountReceivedLD COULD differ from this value.
    uint256 amountReceivedLD; // Amount of tokens to be received on the remote side.
}

/**
 * @dev Struct representing OFT fee details.
 * @dev Future proof mechanism to provide a standardized way to communicate fees to things like a UI.
 */
struct OFTFeeDetail {
    int256 feeAmountLD; // Amount of the fee in local decimals.
    string description; // Description of the fee.
}

/**
 * @title IOFT
 * @dev Interface for the OftChain (OFT) token.
 * @dev Does not inherit ERC20 to accommodate usage by OFTAdapter as well.
 * @dev This specific interface ID is '0x02e49c2c'.
 */
interface IOFT {
    // Custom error messages
    error InvalidLocalDecimals();
    error SlippageExceeded(uint256 amountLD, uint256 minAmountLD);

    // Events
    event OFTSent(
        bytes32 indexed guid, // GUID of the OFT message.
        uint32 dstEid, // Destination Endpoint ID.
        address indexed fromAddress, // Address of the sender on the src chain.
        uint256 amountSentLD, // Amount of tokens sent in local decimals.
        uint256 amountReceivedLD // Amount of tokens received in local decimals.
    );
    event OFTReceived(
        bytes32 indexed guid, // GUID of the OFT message.
        uint32 srcEid, // Source Endpoint ID.
        address indexed toAddress, // Address of the recipient on the dst chain.
        uint256 amountReceivedLD // Amount of tokens received in local decimals.
    );

    /**
     * @notice Retrieves interfaceID and the version of the OFT.
     * @return interfaceId The interface ID.
     * @return version The version.
     *
     * @dev interfaceId: This specific interface ID is '0x02e49c2c'.
     * @dev version: Indicates a cross-chain compatible msg encoding with other OFTs.
     * @dev If a new feature is added to the OFT cross-chain msg encoding, the version will be incremented.
     * ie. localOFT version(x,1) CAN send messages to remoteOFT version(x,1)
     */
    function oftVersion() external view returns (bytes4 interfaceId, uint64 version);

    /**
     * @notice Retrieves the address of the token associated with the OFT.
     * @return token The address of the ERC20 token implementation.
     */
    function token() external view returns (address);

    /**
     * @notice Indicates whether the OFT contract requires approval of the 'token()' to send.
     * @return requiresApproval Needs approval of the underlying token implementation.
     *
     * @dev Allows things like wallet implementers to determine integration requirements,
     * without understanding the underlying token implementation.
     */
    function approvalRequired() external view returns (bool);

    /**
     * @notice Retrieves the shared decimals of the OFT.
     * @return sharedDecimals The shared decimals of the OFT.
     */
    function sharedDecimals() external view returns (uint8);

    /**
     * @notice Provides a quote for OFT-related operations.
     * @param _sendParam The parameters for the send operation.
     * @return limit The OFT limit information.
     * @return oftFeeDetails The details of OFT fees.
     * @return receipt The OFT receipt information.
     */
    function quoteOFT(
        SendParam calldata _sendParam
    ) external view returns (OFTLimit memory, OFTFeeDetail[] memory oftFeeDetails, OFTReceipt memory);

    /**
     * @notice Provides a quote for the send() operation.
     * @param _sendParam The parameters for the send() operation.
     * @param _payInLzToken Flag indicating whether the caller is paying in the LZ token.
     * @return fee The calculated LayerZero messaging fee from the send() operation.
     *
     * @dev MessagingFee: LayerZero msg fee
     *  - nativeFee: The native fee.
     *  - lzTokenFee: The lzToken fee.
     */
    function quoteSend(SendParam calldata _sendParam, bool _payInLzToken) external view returns (MessagingFee memory);

    /**
     * @notice Executes the send() operation.
     * @param _sendParam The parameters for the send operation.
     * @param _fee The fee information supplied by the caller.
     *      - nativeFee: The native fee.
     *      - lzTokenFee: The lzToken fee.
     * @param _refundAddress The address to receive any excess funds from fees etc. on the src.
     * @return receipt The LayerZero messaging receipt from the send() operation.
     * @return oftReceipt The OFT receipt information.
     *
     * @dev MessagingReceipt: LayerZero msg receipt
     *  - guid: The unique identifier for the sent message.
     *  - nonce: The nonce of the sent message.
     *  - fee: The LayerZero fee incurred for the message.
     */
    function send(
        SendParam calldata _sendParam,
        MessagingFee calldata _fee,
        address _refundAddress
    ) external payable returns (MessagingReceipt memory, OFTReceipt memory);
}

File 31 of 64 : OFTComposeMsgCodec.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

library OFTComposeMsgCodec {
    // Offset constants for decoding composed messages
    uint8 private constant NONCE_OFFSET = 8;
    uint8 private constant SRC_EID_OFFSET = 12;
    uint8 private constant AMOUNT_LD_OFFSET = 44;
    uint8 private constant COMPOSE_FROM_OFFSET = 76;

    /**
     * @dev Encodes a OFT composed message.
     * @param _nonce The nonce value.
     * @param _srcEid The source endpoint ID.
     * @param _amountLD The amount in local decimals.
     * @param _composeMsg The composed message.
     * @return _msg The encoded Composed message.
     */
    function encode(
        uint64 _nonce,
        uint32 _srcEid,
        uint256 _amountLD,
        bytes memory _composeMsg // 0x[composeFrom][composeMsg]
    ) internal pure returns (bytes memory _msg) {
        _msg = abi.encodePacked(_nonce, _srcEid, _amountLD, _composeMsg);
    }

    /**
     * @dev Retrieves the nonce for the composed message.
     * @param _msg The message.
     * @return The nonce value.
     */
    function nonce(bytes calldata _msg) internal pure returns (uint64) {
        return uint64(bytes8(_msg[:NONCE_OFFSET]));
    }

    /**
     * @dev Retrieves the source endpoint ID for the composed message.
     * @param _msg The message.
     * @return The source endpoint ID.
     */
    function srcEid(bytes calldata _msg) internal pure returns (uint32) {
        return uint32(bytes4(_msg[NONCE_OFFSET:SRC_EID_OFFSET]));
    }

    /**
     * @dev Retrieves the amount in local decimals from the composed message.
     * @param _msg The message.
     * @return The amount in local decimals.
     */
    function amountLD(bytes calldata _msg) internal pure returns (uint256) {
        return uint256(bytes32(_msg[SRC_EID_OFFSET:AMOUNT_LD_OFFSET]));
    }

    /**
     * @dev Retrieves the composeFrom value from the composed message.
     * @param _msg The message.
     * @return The composeFrom value.
     */
    function composeFrom(bytes calldata _msg) internal pure returns (bytes32) {
        return bytes32(_msg[AMOUNT_LD_OFFSET:COMPOSE_FROM_OFFSET]);
    }

    /**
     * @dev Retrieves the composed message.
     * @param _msg The message.
     * @return The composed message.
     */
    function composeMsg(bytes calldata _msg) internal pure returns (bytes memory) {
        return _msg[COMPOSE_FROM_OFFSET:];
    }

    /**
     * @dev Converts an address to bytes32.
     * @param _addr The address to convert.
     * @return The bytes32 representation of the address.
     */
    function addressToBytes32(address _addr) internal pure returns (bytes32) {
        return bytes32(uint256(uint160(_addr)));
    }

    /**
     * @dev Converts bytes32 to an address.
     * @param _b The bytes32 value to convert.
     * @return The address representation of bytes32.
     */
    function bytes32ToAddress(bytes32 _b) internal pure returns (address) {
        return address(uint160(uint256(_b)));
    }
}

File 32 of 64 : OFTMsgCodec.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

library OFTMsgCodec {
    // Offset constants for encoding and decoding OFT messages
    uint8 private constant SEND_TO_OFFSET = 32;
    uint8 private constant SEND_AMOUNT_SD_OFFSET = 40;

    /**
     * @dev Encodes an OFT LayerZero message.
     * @param _sendTo The recipient address.
     * @param _amountShared The amount in shared decimals.
     * @param _composeMsg The composed message.
     * @return _msg The encoded message.
     * @return hasCompose A boolean indicating whether the message has a composed payload.
     */
    function encode(
        bytes32 _sendTo,
        uint64 _amountShared,
        bytes memory _composeMsg
    ) internal view returns (bytes memory _msg, bool hasCompose) {
        hasCompose = _composeMsg.length > 0;
        // @dev Remote chains will want to know the composed function caller ie. msg.sender on the src.
        _msg = hasCompose
            ? abi.encodePacked(_sendTo, _amountShared, addressToBytes32(msg.sender), _composeMsg)
            : abi.encodePacked(_sendTo, _amountShared);
    }

    /**
     * @dev Checks if the OFT message is composed.
     * @param _msg The OFT message.
     * @return A boolean indicating whether the message is composed.
     */
    function isComposed(bytes calldata _msg) internal pure returns (bool) {
        return _msg.length > SEND_AMOUNT_SD_OFFSET;
    }

    /**
     * @dev Retrieves the recipient address from the OFT message.
     * @param _msg The OFT message.
     * @return The recipient address.
     */
    function sendTo(bytes calldata _msg) internal pure returns (bytes32) {
        return bytes32(_msg[:SEND_TO_OFFSET]);
    }

    /**
     * @dev Retrieves the amount in shared decimals from the OFT message.
     * @param _msg The OFT message.
     * @return The amount in shared decimals.
     */
    function amountSD(bytes calldata _msg) internal pure returns (uint64) {
        return uint64(bytes8(_msg[SEND_TO_OFFSET:SEND_AMOUNT_SD_OFFSET]));
    }

    /**
     * @dev Retrieves the composed message from the OFT message.
     * @param _msg The OFT message.
     * @return The composed message.
     */
    function composeMsg(bytes calldata _msg) internal pure returns (bytes memory) {
        return _msg[SEND_AMOUNT_SD_OFFSET:];
    }

    /**
     * @dev Converts an address to bytes32.
     * @param _addr The address to convert.
     * @return The bytes32 representation of the address.
     */
    function addressToBytes32(address _addr) internal pure returns (bytes32) {
        return bytes32(uint256(uint160(_addr)));
    }

    /**
     * @dev Converts bytes32 to an address.
     * @param _b The bytes32 value to convert.
     * @return The address representation of bytes32.
     */
    function bytes32ToAddress(bytes32 _b) internal pure returns (address) {
        return address(uint160(uint256(_b)));
    }
}

File 33 of 64 : OFTAdapter.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

import { IERC20Metadata, IERC20 } from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { IOFT, OFTCore } from "./OFTCore.sol";

/**
 * @title OFTAdapter Contract
 * @dev OFTAdapter is a contract that adapts an ERC-20 token to the OFT functionality.
 *
 * @dev For existing ERC20 tokens, this can be used to convert the token to crosschain compatibility.
 * @dev WARNING: ONLY 1 of these should exist for a given global mesh,
 * unless you make a NON-default implementation of OFT and needs to be done very carefully.
 * @dev WARNING: The default OFTAdapter implementation assumes LOSSLESS transfers, ie. 1 token in, 1 token out.
 * IF the 'innerToken' applies something like a transfer fee, the default will NOT work...
 * a pre/post balance check will need to be done to calculate the amountSentLD/amountReceivedLD.
 */
abstract contract OFTAdapter is OFTCore {
    using SafeERC20 for IERC20;

    IERC20 internal immutable innerToken;

    /**
     * @dev Constructor for the OFTAdapter contract.
     * @param _token The address of the ERC-20 token to be adapted.
     * @param _lzEndpoint The LayerZero endpoint address.
     * @param _delegate The delegate capable of making OApp configurations inside of the endpoint.
     */
    constructor(
        address _token,
        address _lzEndpoint,
        address _delegate
    ) OFTCore(IERC20Metadata(_token).decimals(), _lzEndpoint, _delegate) {
        innerToken = IERC20(_token);
    }

    /**
     * @dev Retrieves the address of the underlying ERC20 implementation.
     * @return The address of the adapted ERC-20 token.
     *
     * @dev In the case of OFTAdapter, address(this) and erc20 are NOT the same contract.
     */
    function token() public view returns (address) {
        return address(innerToken);
    }

    /**
     * @notice Indicates whether the OFT contract requires approval of the 'token()' to send.
     * @return requiresApproval Needs approval of the underlying token implementation.
     *
     * @dev In the case of default OFTAdapter, approval is required.
     * @dev In non-default OFTAdapter contracts with something like mint and burn privileges, it would NOT need approval.
     */
    function approvalRequired() external pure virtual returns (bool) {
        return true;
    }

    /**
     * @dev Locks tokens from the sender's specified balance in this contract.
     * @param _from The address to debit from.
     * @param _amountLD The amount of tokens to send in local decimals.
     * @param _minAmountLD The minimum amount to send in local decimals.
     * @param _dstEid The destination chain ID.
     * @return amountSentLD The amount sent in local decimals.
     * @return amountReceivedLD The amount received in local decimals on the remote.
     *
     * @dev msg.sender will need to approve this _amountLD of tokens to be locked inside of the contract.
     * @dev WARNING: The default OFTAdapter implementation assumes LOSSLESS transfers, ie. 1 token in, 1 token out.
     * IF the 'innerToken' applies something like a transfer fee, the default will NOT work...
     * a pre/post balance check will need to be done to calculate the amountReceivedLD.
     */
    function _debit(
        address _from,
        uint256 _amountLD,
        uint256 _minAmountLD,
        uint32 _dstEid
    ) internal virtual override returns (uint256 amountSentLD, uint256 amountReceivedLD) {
        (amountSentLD, amountReceivedLD) = _debitView(_amountLD, _minAmountLD, _dstEid);
        // @dev Lock tokens by moving them into this contract from the caller.
        innerToken.safeTransferFrom(_from, address(this), amountSentLD);
    }

    /**
     * @dev Credits tokens to the specified address.
     * @param _to The address to credit the tokens to.
     * @param _amountLD The amount of tokens to credit in local decimals.
     * @dev _srcEid The source chain ID.
     * @return amountReceivedLD The amount of tokens ACTUALLY received in local decimals.
     *
     * @dev WARNING: The default OFTAdapter implementation assumes LOSSLESS transfers, ie. 1 token in, 1 token out.
     * IF the 'innerToken' applies something like a transfer fee, the default will NOT work...
     * a pre/post balance check will need to be done to calculate the amountReceivedLD.
     */
    function _credit(
        address _to,
        uint256 _amountLD,
        uint32 /*_srcEid*/
    ) internal virtual override returns (uint256 amountReceivedLD) {
        // @dev Unlock the tokens and transfer to the recipient.
        innerToken.safeTransfer(_to, _amountLD);
        // @dev In the case of NON-default OFTAdapter, the amountLD MIGHT not be == amountReceivedLD.
        return _amountLD;
    }
}

File 34 of 64 : OFTCore.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

import { OApp, Origin } from "@layerzerolabs/oapp-evm/contracts/oapp/OApp.sol";
import { OAppOptionsType3 } from "@layerzerolabs/oapp-evm/contracts/oapp/libs/OAppOptionsType3.sol";
import { IOAppMsgInspector } from "@layerzerolabs/oapp-evm/contracts/oapp/interfaces/IOAppMsgInspector.sol";

import { OAppPreCrimeSimulator } from "@layerzerolabs/oapp-evm/contracts/precrime/OAppPreCrimeSimulator.sol";

import { IOFT, SendParam, OFTLimit, OFTReceipt, OFTFeeDetail, MessagingReceipt, MessagingFee } from "./interfaces/IOFT.sol";
import { OFTMsgCodec } from "./libs/OFTMsgCodec.sol";
import { OFTComposeMsgCodec } from "./libs/OFTComposeMsgCodec.sol";

/**
 * @title OFTCore
 * @dev Abstract contract for the OftChain (OFT) token.
 */
abstract contract OFTCore is IOFT, OApp, OAppPreCrimeSimulator, OAppOptionsType3 {
    using OFTMsgCodec for bytes;
    using OFTMsgCodec for bytes32;

    // @notice Provides a conversion rate when swapping between denominations of SD and LD
    //      - shareDecimals == SD == shared Decimals
    //      - localDecimals == LD == local decimals
    // @dev Considers that tokens have different decimal amounts on various chains.
    // @dev eg.
    //  For a token
    //      - locally with 4 decimals --> 1.2345 => uint(12345)
    //      - remotely with 2 decimals --> 1.23 => uint(123)
    //      - The conversion rate would be 10 ** (4 - 2) = 100
    //  @dev If you want to send 1.2345 -> (uint 12345), you CANNOT represent that value on the remote,
    //  you can only display 1.23 -> uint(123).
    //  @dev To preserve the dust that would otherwise be lost on that conversion,
    //  we need to unify a denomination that can be represented on ALL chains inside of the OFT mesh
    uint256 public immutable decimalConversionRate;

    // @notice Msg types that are used to identify the various OFT operations.
    // @dev This can be extended in child contracts for non-default oft operations
    // @dev These values are used in things like combineOptions() in OAppOptionsType3.sol.
    uint16 public constant SEND = 1;
    uint16 public constant SEND_AND_CALL = 2;

    // Address of an optional contract to inspect both 'message' and 'options'
    address public msgInspector;
    event MsgInspectorSet(address inspector);

    /**
     * @dev Constructor.
     * @param _localDecimals The decimals of the token on the local chain (this chain).
     * @param _endpoint The address of the LayerZero endpoint.
     * @param _delegate The delegate capable of making OApp configurations inside of the endpoint.
     */
    constructor(uint8 _localDecimals, address _endpoint, address _delegate) OApp(_endpoint, _delegate) {
        if (_localDecimals < sharedDecimals()) revert InvalidLocalDecimals();
        decimalConversionRate = 10 ** (_localDecimals - sharedDecimals());
    }

    /**
     * @notice Retrieves interfaceID and the version of the OFT.
     * @return interfaceId The interface ID.
     * @return version The version.
     *
     * @dev interfaceId: This specific interface ID is '0x02e49c2c'.
     * @dev version: Indicates a cross-chain compatible msg encoding with other OFTs.
     * @dev If a new feature is added to the OFT cross-chain msg encoding, the version will be incremented.
     * ie. localOFT version(x,1) CAN send messages to remoteOFT version(x,1)
     */
    function oftVersion() external pure virtual returns (bytes4 interfaceId, uint64 version) {
        return (type(IOFT).interfaceId, 1);
    }

    /**
     * @dev Retrieves the shared decimals of the OFT.
     * @return The shared decimals of the OFT.
     *
     * @dev Sets an implicit cap on the amount of tokens, over uint64.max() will need some sort of outbound cap / totalSupply cap
     * Lowest common decimal denominator between chains.
     * Defaults to 6 decimal places to provide up to 18,446,744,073,709.551615 units (max uint64).
     * For tokens exceeding this totalSupply(), they will need to override the sharedDecimals function with something smaller.
     * ie. 4 sharedDecimals would be 1,844,674,407,370,955.1615
     */
    function sharedDecimals() public view virtual returns (uint8) {
        return 6;
    }

    /**
     * @dev Sets the message inspector address for the OFT.
     * @param _msgInspector The address of the message inspector.
     *
     * @dev This is an optional contract that can be used to inspect both 'message' and 'options'.
     * @dev Set it to address(0) to disable it, or set it to a contract address to enable it.
     */
    function setMsgInspector(address _msgInspector) public virtual onlyOwner {
        msgInspector = _msgInspector;
        emit MsgInspectorSet(_msgInspector);
    }

    /**
     * @notice Provides a quote for OFT-related operations.
     * @param _sendParam The parameters for the send operation.
     * @return oftLimit The OFT limit information.
     * @return oftFeeDetails The details of OFT fees.
     * @return oftReceipt The OFT receipt information.
     */
    function quoteOFT(
        SendParam calldata _sendParam
    )
        external
        view
        virtual
        returns (OFTLimit memory oftLimit, OFTFeeDetail[] memory oftFeeDetails, OFTReceipt memory oftReceipt)
    {
        uint256 minAmountLD = 0; // Unused in the default implementation.
        uint256 maxAmountLD = type(uint64).max; // Unused in the default implementation.
        oftLimit = OFTLimit(minAmountLD, maxAmountLD);

        // Unused in the default implementation; reserved for future complex fee details.
        oftFeeDetails = new OFTFeeDetail[](0);

        // @dev This is the same as the send() operation, but without the actual send.
        // - amountSentLD is the amount in local decimals that would be sent from the sender.
        // - amountReceivedLD is the amount in local decimals that will be credited to the recipient on the remote OFT instance.
        // @dev The amountSentLD MIGHT not equal the amount the user actually receives. HOWEVER, the default does.
        (uint256 amountSentLD, uint256 amountReceivedLD) = _debitView(
            _sendParam.amountLD,
            _sendParam.minAmountLD,
            _sendParam.dstEid
        );
        oftReceipt = OFTReceipt(amountSentLD, amountReceivedLD);
    }

    /**
     * @notice Provides a quote for the send() operation.
     * @param _sendParam The parameters for the send() operation.
     * @param _payInLzToken Flag indicating whether the caller is paying in the LZ token.
     * @return msgFee The calculated LayerZero messaging fee from the send() operation.
     *
     * @dev MessagingFee: LayerZero msg fee
     *  - nativeFee: The native fee.
     *  - lzTokenFee: The lzToken fee.
     */
    function quoteSend(
        SendParam calldata _sendParam,
        bool _payInLzToken
    ) external view virtual returns (MessagingFee memory msgFee) {
        // @dev mock the amount to receive, this is the same operation used in the send().
        // The quote is as similar as possible to the actual send() operation.
        (, uint256 amountReceivedLD) = _debitView(_sendParam.amountLD, _sendParam.minAmountLD, _sendParam.dstEid);

        // @dev Builds the options and OFT message to quote in the endpoint.
        (bytes memory message, bytes memory options) = _buildMsgAndOptions(_sendParam, amountReceivedLD);

        // @dev Calculates the LayerZero fee for the send() operation.
        return _quote(_sendParam.dstEid, message, options, _payInLzToken);
    }

    /**
     * @dev Executes the send operation.
     * @param _sendParam The parameters for the send operation.
     * @param _fee The calculated fee for the send() operation.
     *      - nativeFee: The native fee.
     *      - lzTokenFee: The lzToken fee.
     * @param _refundAddress The address to receive any excess funds.
     * @return msgReceipt The receipt for the send operation.
     * @return oftReceipt The OFT receipt information.
     *
     * @dev MessagingReceipt: LayerZero msg receipt
     *  - guid: The unique identifier for the sent message.
     *  - nonce: The nonce of the sent message.
     *  - fee: The LayerZero fee incurred for the message.
     */
    function send(
        SendParam calldata _sendParam,
        MessagingFee calldata _fee,
        address _refundAddress
    ) external payable virtual returns (MessagingReceipt memory msgReceipt, OFTReceipt memory oftReceipt) {
        return _send(_sendParam, _fee, _refundAddress);
    }

    /**
     * @dev Internal function to execute the send operation.
     * @param _sendParam The parameters for the send operation.
     * @param _fee The calculated fee for the send() operation.
     *      - nativeFee: The native fee.
     *      - lzTokenFee: The lzToken fee.
     * @param _refundAddress The address to receive any excess funds.
     * @return msgReceipt The receipt for the send operation.
     * @return oftReceipt The OFT receipt information.
     *
     * @dev MessagingReceipt: LayerZero msg receipt
     *  - guid: The unique identifier for the sent message.
     *  - nonce: The nonce of the sent message.
     *  - fee: The LayerZero fee incurred for the message.
     */
    function _send(
        SendParam calldata _sendParam,
        MessagingFee calldata _fee,
        address _refundAddress
    ) internal virtual returns (MessagingReceipt memory msgReceipt, OFTReceipt memory oftReceipt) {
        // @dev Applies the token transfers regarding this send() operation.
        // - amountSentLD is the amount in local decimals that was ACTUALLY sent/debited from the sender.
        // - amountReceivedLD is the amount in local decimals that will be received/credited to the recipient on the remote OFT instance.
        (uint256 amountSentLD, uint256 amountReceivedLD) = _debit(
            msg.sender,
            _sendParam.amountLD,
            _sendParam.minAmountLD,
            _sendParam.dstEid
        );

        // @dev Builds the options and OFT message to quote in the endpoint.
        (bytes memory message, bytes memory options) = _buildMsgAndOptions(_sendParam, amountReceivedLD);

        // @dev Sends the message to the LayerZero endpoint and returns the LayerZero msg receipt.
        msgReceipt = _lzSend(_sendParam.dstEid, message, options, _fee, _refundAddress);
        // @dev Formulate the OFT receipt.
        oftReceipt = OFTReceipt(amountSentLD, amountReceivedLD);

        emit OFTSent(msgReceipt.guid, _sendParam.dstEid, msg.sender, amountSentLD, amountReceivedLD);
    }

    /**
     * @dev Internal function to build the message and options.
     * @param _sendParam The parameters for the send() operation.
     * @param _amountLD The amount in local decimals.
     * @return message The encoded message.
     * @return options The encoded options.
     */
    function _buildMsgAndOptions(
        SendParam calldata _sendParam,
        uint256 _amountLD
    ) internal view virtual returns (bytes memory message, bytes memory options) {
        bool hasCompose;
        // @dev This generated message has the msg.sender encoded into the payload so the remote knows who the caller is.
        (message, hasCompose) = OFTMsgCodec.encode(
            _sendParam.to,
            _toSD(_amountLD),
            // @dev Must be include a non empty bytes if you want to compose, EVEN if you dont need it on the remote.
            // EVEN if you dont require an arbitrary payload to be sent... eg. '0x01'
            _sendParam.composeMsg
        );
        // @dev Change the msg type depending if its composed or not.
        uint16 msgType = hasCompose ? SEND_AND_CALL : SEND;
        // @dev Combine the callers _extraOptions with the enforced options via the OAppOptionsType3.
        options = combineOptions(_sendParam.dstEid, msgType, _sendParam.extraOptions);

        // @dev Optionally inspect the message and options depending if the OApp owner has set a msg inspector.
        // @dev If it fails inspection, needs to revert in the implementation. ie. does not rely on return boolean
        address inspector = msgInspector; // caches the msgInspector to avoid potential double storage read
        if (inspector != address(0)) IOAppMsgInspector(inspector).inspect(message, options);
    }

    /**
     * @dev Internal function to handle the receive on the LayerZero endpoint.
     * @param _origin The origin information.
     *  - srcEid: The source chain endpoint ID.
     *  - sender: The sender address from the src chain.
     *  - nonce: The nonce of the LayerZero message.
     * @param _guid The unique identifier for the received LayerZero message.
     * @param _message The encoded message.
     * @dev _executor The address of the executor.
     * @dev _extraData Additional data.
     */
    function _lzReceive(
        Origin calldata _origin,
        bytes32 _guid,
        bytes calldata _message,
        address /*_executor*/, // @dev unused in the default implementation.
        bytes calldata /*_extraData*/ // @dev unused in the default implementation.
    ) internal virtual override {
        // @dev The src sending chain doesnt know the address length on this chain (potentially non-evm)
        // Thus everything is bytes32() encoded in flight.
        address toAddress = _message.sendTo().bytes32ToAddress();
        // @dev Credit the amountLD to the recipient and return the ACTUAL amount the recipient received in local decimals
        uint256 amountReceivedLD = _credit(toAddress, _toLD(_message.amountSD()), _origin.srcEid);

        if (_message.isComposed()) {
            // @dev Proprietary composeMsg format for the OFT.
            bytes memory composeMsg = OFTComposeMsgCodec.encode(
                _origin.nonce,
                _origin.srcEid,
                amountReceivedLD,
                _message.composeMsg()
            );

            // @dev Stores the lzCompose payload that will be executed in a separate tx.
            // Standardizes functionality for executing arbitrary contract invocation on some non-evm chains.
            // @dev The off-chain executor will listen and process the msg based on the src-chain-callers compose options passed.
            // @dev The index is used when a OApp needs to compose multiple msgs on lzReceive.
            // For default OFT implementation there is only 1 compose msg per lzReceive, thus its always 0.
            endpoint.sendCompose(toAddress, _guid, 0 /* the index of the composed message*/, composeMsg);
        }

        emit OFTReceived(_guid, _origin.srcEid, toAddress, amountReceivedLD);
    }

    /**
     * @dev Internal function to handle the OAppPreCrimeSimulator simulated receive.
     * @param _origin The origin information.
     *  - srcEid: The source chain endpoint ID.
     *  - sender: The sender address from the src chain.
     *  - nonce: The nonce of the LayerZero message.
     * @param _guid The unique identifier for the received LayerZero message.
     * @param _message The LayerZero message.
     * @param _executor The address of the off-chain executor.
     * @param _extraData Arbitrary data passed by the msg executor.
     *
     * @dev Enables the preCrime simulator to mock sending lzReceive() messages,
     * routes the msg down from the OAppPreCrimeSimulator, and back up to the OAppReceiver.
     */
    function _lzReceiveSimulate(
        Origin calldata _origin,
        bytes32 _guid,
        bytes calldata _message,
        address _executor,
        bytes calldata _extraData
    ) internal virtual override {
        _lzReceive(_origin, _guid, _message, _executor, _extraData);
    }

    /**
     * @dev Check if the peer is considered 'trusted' by the OApp.
     * @param _eid The endpoint ID to check.
     * @param _peer The peer to check.
     * @return Whether the peer passed is considered 'trusted' by the OApp.
     *
     * @dev Enables OAppPreCrimeSimulator to check whether a potential Inbound Packet is from a trusted source.
     */
    function isPeer(uint32 _eid, bytes32 _peer) public view virtual override returns (bool) {
        return peers[_eid] == _peer;
    }

    /**
     * @dev Internal function to remove dust from the given local decimal amount.
     * @param _amountLD The amount in local decimals.
     * @return amountLD The amount after removing dust.
     *
     * @dev Prevents the loss of dust when moving amounts between chains with different decimals.
     * @dev eg. uint(123) with a conversion rate of 100 becomes uint(100).
     */
    function _removeDust(uint256 _amountLD) internal view virtual returns (uint256 amountLD) {
        return (_amountLD / decimalConversionRate) * decimalConversionRate;
    }

    /**
     * @dev Internal function to convert an amount from shared decimals into local decimals.
     * @param _amountSD The amount in shared decimals.
     * @return amountLD The amount in local decimals.
     */
    function _toLD(uint64 _amountSD) internal view virtual returns (uint256 amountLD) {
        return _amountSD * decimalConversionRate;
    }

    /**
     * @dev Internal function to convert an amount from local decimals into shared decimals.
     * @param _amountLD The amount in local decimals.
     * @return amountSD The amount in shared decimals.
     */
    function _toSD(uint256 _amountLD) internal view virtual returns (uint64 amountSD) {
        return uint64(_amountLD / decimalConversionRate);
    }

    /**
     * @dev Internal function to mock the amount mutation from a OFT debit() operation.
     * @param _amountLD The amount to send in local decimals.
     * @param _minAmountLD The minimum amount to send in local decimals.
     * @dev _dstEid The destination endpoint ID.
     * @return amountSentLD The amount sent, in local decimals.
     * @return amountReceivedLD The amount to be received on the remote chain, in local decimals.
     *
     * @dev This is where things like fees would be calculated and deducted from the amount to be received on the remote.
     */
    function _debitView(
        uint256 _amountLD,
        uint256 _minAmountLD,
        uint32 /*_dstEid*/
    ) internal view virtual returns (uint256 amountSentLD, uint256 amountReceivedLD) {
        // @dev Remove the dust so nothing is lost on the conversion between chains with different decimals for the token.
        amountSentLD = _removeDust(_amountLD);
        // @dev The amount to send is the same as amount received in the default implementation.
        amountReceivedLD = amountSentLD;

        // @dev Check for slippage.
        if (amountReceivedLD < _minAmountLD) {
            revert SlippageExceeded(amountReceivedLD, _minAmountLD);
        }
    }

    /**
     * @dev Internal function to perform a debit operation.
     * @param _from The address to debit.
     * @param _amountLD The amount to send in local decimals.
     * @param _minAmountLD The minimum amount to send in local decimals.
     * @param _dstEid The destination endpoint ID.
     * @return amountSentLD The amount sent in local decimals.
     * @return amountReceivedLD The amount received in local decimals on the remote.
     *
     * @dev Defined here but are intended to be overriden depending on the OFT implementation.
     * @dev Depending on OFT implementation the _amountLD could differ from the amountReceivedLD.
     */
    function _debit(
        address _from,
        uint256 _amountLD,
        uint256 _minAmountLD,
        uint32 _dstEid
    ) internal virtual returns (uint256 amountSentLD, uint256 amountReceivedLD);

    /**
     * @dev Internal function to perform a credit operation.
     * @param _to The address to credit.
     * @param _amountLD The amount to credit in local decimals.
     * @param _srcEid The source endpoint ID.
     * @return amountReceivedLD The amount ACTUALLY received in local decimals.
     *
     * @dev Defined here but are intended to be overriden depending on the OFT implementation.
     * @dev Depending on OFT implementation the _amountLD could differ from the amountReceivedLD.
     */
    function _credit(
        address _to,
        uint256 _amountLD,
        uint32 _srcEid
    ) internal virtual returns (uint256 amountReceivedLD);
}

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

pragma solidity ^0.8.20;

import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * 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 OwnableUpgradeable is Initializable, ContextUpgradeable {
    /// @custom:storage-location erc7201:openzeppelin.storage.Ownable
    struct OwnableStorage {
        address _owner;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Ownable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant OwnableStorageLocation = 0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300;

    function _getOwnableStorage() private pure returns (OwnableStorage storage $) {
        assembly {
            $.slot := OwnableStorageLocation
        }
    }

    /**
     * @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.
     */
    function __Ownable_init(address initialOwner) internal onlyInitializing {
        __Ownable_init_unchained(initialOwner);
    }

    function __Ownable_init_unchained(address initialOwner) internal onlyInitializing {
        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) {
        OwnableStorage storage $ = _getOwnableStorage();
        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 {
        OwnableStorage storage $ = _getOwnableStorage();
        address oldOwner = $._owner;
        $._owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 36 of 64 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.20;

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

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;

    /**
     * @dev The contract is already initialized.
     */
    error InvalidInitialization();

    /**
     * @dev The contract is not initializing.
     */
    error NotInitializing();

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

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any
     * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
     * production.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        // Cache values to avoid duplicated sloads
        bool isTopLevelCall = !$._initializing;
        uint64 initialized = $._initialized;

        // Allowed calls:
        // - initialSetup: the contract is not in the initializing state and no previous version was
        //                 initialized
        // - construction: the contract is initialized at version 1 (no reininitialization) and the
        //                 current contract is just being deployed
        bool initialSetup = initialized == 0 && isTopLevelCall;
        bool construction = initialized == 1 && address(this).code.length == 0;

        if (!initialSetup && !construction) {
            revert InvalidInitialization();
        }
        $._initialized = 1;
        if (isTopLevelCall) {
            $._initializing = true;
        }
        _;
        if (isTopLevelCall) {
            $._initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint64 version) {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing || $._initialized >= version) {
            revert InvalidInitialization();
        }
        $._initialized = version;
        $._initializing = true;
        _;
        $._initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        _checkInitializing();
        _;
    }

    /**
     * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
     */
    function _checkInitializing() internal view virtual {
        if (!_isInitializing()) {
            revert NotInitializing();
        }
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing) {
            revert InvalidInitialization();
        }
        if ($._initialized != type(uint64).max) {
            $._initialized = type(uint64).max;
            emit Initialized(type(uint64).max);
        }
    }

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

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

    /**
     * @dev Returns a pointer to the storage namespace.
     */
    // solhint-disable-next-line var-name-mixedcase
    function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
        assembly {
            $.slot := INITIALIZABLE_STORAGE
        }
    }
}

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

pragma solidity ^0.8.20;
import {Initializable} from "../proxy/utils/Initializable.sol";

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

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

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

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

File 38 of 64 : PausableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol)

pragma solidity ^0.8.20;

import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
    /// @custom:storage-location erc7201:openzeppelin.storage.Pausable
    struct PausableStorage {
        bool _paused;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Pausable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant PausableStorageLocation = 0xcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300;

    function _getPausableStorage() private pure returns (PausableStorage storage $) {
        assembly {
            $.slot := PausableStorageLocation
        }
    }

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

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

    /**
     * @dev The operation failed because the contract is paused.
     */
    error EnforcedPause();

    /**
     * @dev The operation failed because the contract is not paused.
     */
    error ExpectedPause();

    /**
     * @dev Initializes the contract in unpaused state.
     */
    function __Pausable_init() internal onlyInitializing {
        __Pausable_init_unchained();
    }

    function __Pausable_init_unchained() internal onlyInitializing {
        PausableStorage storage $ = _getPausableStorage();
        $._paused = false;
    }

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

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

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

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        if (paused()) {
            revert EnforcedPause();
        }
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        if (!paused()) {
            revert ExpectedPause();
        }
    }

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

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

File 39 of 64 : 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 40 of 64 : draft-IERC6093.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;

/**
 * @dev Standard ERC20 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.
 */
interface IERC20Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC20InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC20InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     * @param allowance Amount of tokens a `spender` is allowed to operate with.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC20InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `spender` to be approved. Used in approvals.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC20InvalidSpender(address spender);
}

/**
 * @dev Standard ERC721 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.
 */
interface IERC721Errors {
    /**
     * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.
     * Used in balance queries.
     * @param owner Address of the current owner of a token.
     */
    error ERC721InvalidOwner(address owner);

    /**
     * @dev Indicates a `tokenId` whose `owner` is the zero address.
     * @param tokenId Identifier number of a token.
     */
    error ERC721NonexistentToken(uint256 tokenId);

    /**
     * @dev Indicates an error related to the ownership over a particular token. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param tokenId Identifier number of a token.
     * @param owner Address of the current owner of a token.
     */
    error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC721InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC721InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param tokenId Identifier number of a token.
     */
    error ERC721InsufficientApproval(address operator, uint256 tokenId);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC721InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC721InvalidOperator(address operator);
}

/**
 * @dev Standard ERC1155 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.
 */
interface IERC1155Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     * @param tokenId Identifier number of a token.
     */
    error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC1155InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC1155InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param owner Address of the current owner of a token.
     */
    error ERC1155MissingApprovalForAll(address operator, address owner);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC1155InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC1155InvalidOperator(address operator);

    /**
     * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
     * Used in batch transfers.
     * @param idsLength Length of the array of token identifiers
     * @param valuesLength Length of the array of token amounts
     */
    error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}

File 41 of 64 : IERC1967.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC1967.sol)

pragma solidity ^0.8.20;

/**
 * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.
 */
interface IERC1967 {
    /**
     * @dev Emitted when the implementation is upgraded.
     */
    event Upgraded(address indexed implementation);

    /**
     * @dev Emitted when the admin account has changed.
     */
    event AdminChanged(address previousAdmin, address newAdmin);

    /**
     * @dev Emitted when the beacon is changed.
     */
    event BeaconUpgraded(address indexed beacon);
}

File 42 of 64 : IBeacon.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/IBeacon.sol)

pragma solidity ^0.8.20;

/**
 * @dev This is the interface that {BeaconProxy} expects of its beacon.
 */
interface IBeacon {
    /**
     * @dev Must return an address that can be used as a delegate call target.
     *
     * {UpgradeableBeacon} will check that this address is a contract.
     */
    function implementation() external view returns (address);
}

File 43 of 64 : ERC1967Proxy.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/ERC1967/ERC1967Proxy.sol)

pragma solidity ^0.8.20;

import {Proxy} from "../Proxy.sol";
import {ERC1967Utils} from "./ERC1967Utils.sol";

/**
 * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an
 * implementation address that can be changed. This address is stored in storage in the location specified by
 * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the
 * implementation behind the proxy.
 */
contract ERC1967Proxy is Proxy {
    /**
     * @dev Initializes the upgradeable proxy with an initial implementation specified by `implementation`.
     *
     * If `_data` is nonempty, it's used as data in a delegate call to `implementation`. This will typically be an
     * encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.
     *
     * Requirements:
     *
     * - If `data` is empty, `msg.value` must be zero.
     */
    constructor(address implementation, bytes memory _data) payable {
        ERC1967Utils.upgradeToAndCall(implementation, _data);
    }

    /**
     * @dev Returns the current implementation address.
     *
     * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using
     * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
     * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`
     */
    function _implementation() internal view virtual override returns (address) {
        return ERC1967Utils.getImplementation();
    }
}

File 44 of 64 : ERC1967Utils.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/ERC1967/ERC1967Utils.sol)

pragma solidity ^0.8.20;

import {IBeacon} from "../beacon/IBeacon.sol";
import {Address} from "../../utils/Address.sol";
import {StorageSlot} from "../../utils/StorageSlot.sol";

/**
 * @dev This abstract contract provides getters and event emitting update functions for
 * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
 */
library ERC1967Utils {
    // We re-declare ERC-1967 events here because they can't be used directly from IERC1967.
    // This will be fixed in Solidity 0.8.21. At that point we should remove these events.
    /**
     * @dev Emitted when the implementation is upgraded.
     */
    event Upgraded(address indexed implementation);

    /**
     * @dev Emitted when the admin account has changed.
     */
    event AdminChanged(address previousAdmin, address newAdmin);

    /**
     * @dev Emitted when the beacon is changed.
     */
    event BeaconUpgraded(address indexed beacon);

    /**
     * @dev Storage slot with the address of the current implementation.
     * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1.
     */
    // solhint-disable-next-line private-vars-leading-underscore
    bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

    /**
     * @dev The `implementation` of the proxy is invalid.
     */
    error ERC1967InvalidImplementation(address implementation);

    /**
     * @dev The `admin` of the proxy is invalid.
     */
    error ERC1967InvalidAdmin(address admin);

    /**
     * @dev The `beacon` of the proxy is invalid.
     */
    error ERC1967InvalidBeacon(address beacon);

    /**
     * @dev An upgrade function sees `msg.value > 0` that may be lost.
     */
    error ERC1967NonPayable();

    /**
     * @dev Returns the current implementation address.
     */
    function getImplementation() internal view returns (address) {
        return StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 implementation slot.
     */
    function _setImplementation(address newImplementation) private {
        if (newImplementation.code.length == 0) {
            revert ERC1967InvalidImplementation(newImplementation);
        }
        StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation;
    }

    /**
     * @dev Performs implementation upgrade with additional setup call if data is nonempty.
     * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected
     * to avoid stuck value in the contract.
     *
     * Emits an {IERC1967-Upgraded} event.
     */
    function upgradeToAndCall(address newImplementation, bytes memory data) internal {
        _setImplementation(newImplementation);
        emit Upgraded(newImplementation);

        if (data.length > 0) {
            Address.functionDelegateCall(newImplementation, data);
        } else {
            _checkNonPayable();
        }
    }

    /**
     * @dev Storage slot with the admin of the contract.
     * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1.
     */
    // solhint-disable-next-line private-vars-leading-underscore
    bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;

    /**
     * @dev Returns the current admin.
     *
     * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using
     * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
     * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
     */
    function getAdmin() internal view returns (address) {
        return StorageSlot.getAddressSlot(ADMIN_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 admin slot.
     */
    function _setAdmin(address newAdmin) private {
        if (newAdmin == address(0)) {
            revert ERC1967InvalidAdmin(address(0));
        }
        StorageSlot.getAddressSlot(ADMIN_SLOT).value = newAdmin;
    }

    /**
     * @dev Changes the admin of the proxy.
     *
     * Emits an {IERC1967-AdminChanged} event.
     */
    function changeAdmin(address newAdmin) internal {
        emit AdminChanged(getAdmin(), newAdmin);
        _setAdmin(newAdmin);
    }

    /**
     * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
     * This is the keccak-256 hash of "eip1967.proxy.beacon" subtracted by 1.
     */
    // solhint-disable-next-line private-vars-leading-underscore
    bytes32 internal constant BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;

    /**
     * @dev Returns the current beacon.
     */
    function getBeacon() internal view returns (address) {
        return StorageSlot.getAddressSlot(BEACON_SLOT).value;
    }

    /**
     * @dev Stores a new beacon in the EIP1967 beacon slot.
     */
    function _setBeacon(address newBeacon) private {
        if (newBeacon.code.length == 0) {
            revert ERC1967InvalidBeacon(newBeacon);
        }

        StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon;

        address beaconImplementation = IBeacon(newBeacon).implementation();
        if (beaconImplementation.code.length == 0) {
            revert ERC1967InvalidImplementation(beaconImplementation);
        }
    }

    /**
     * @dev Change the beacon and trigger a setup call if data is nonempty.
     * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected
     * to avoid stuck value in the contract.
     *
     * Emits an {IERC1967-BeaconUpgraded} event.
     *
     * CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since
     * it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for
     * efficiency.
     */
    function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal {
        _setBeacon(newBeacon);
        emit BeaconUpgraded(newBeacon);

        if (data.length > 0) {
            Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);
        } else {
            _checkNonPayable();
        }
    }

    /**
     * @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract
     * if an upgrade doesn't perform an initialization call.
     */
    function _checkNonPayable() private {
        if (msg.value > 0) {
            revert ERC1967NonPayable();
        }
    }
}

File 45 of 64 : Proxy.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/Proxy.sol)

pragma solidity ^0.8.20;

/**
 * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
 * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to
 * be specified by overriding the virtual {_implementation} function.
 *
 * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
 * different contract through the {_delegate} function.
 *
 * The success and return data of the delegated call will be returned back to the caller of the proxy.
 */
abstract contract Proxy {
    /**
     * @dev Delegates the current call to `implementation`.
     *
     * This function does not return to its internal call site, it will return directly to the external caller.
     */
    function _delegate(address implementation) internal virtual {
        assembly {
            // Copy msg.data. We take full control of memory in this inline assembly
            // block because it will not return to Solidity code. We overwrite the
            // Solidity scratch pad at memory position 0.
            calldatacopy(0, 0, calldatasize())

            // Call the implementation.
            // out and outsize are 0 because we don't know the size yet.
            let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)

            // Copy the returned data.
            returndatacopy(0, 0, returndatasize())

            switch result
            // delegatecall returns 0 on error.
            case 0 {
                revert(0, returndatasize())
            }
            default {
                return(0, returndatasize())
            }
        }
    }

    /**
     * @dev This is a virtual function that should be overridden so it returns the address to which the fallback
     * function and {_fallback} should delegate.
     */
    function _implementation() internal view virtual returns (address);

    /**
     * @dev Delegates the current call to the address returned by `_implementation()`.
     *
     * This function does not return to its internal call site, it will return directly to the external caller.
     */
    function _fallback() internal virtual {
        _delegate(_implementation());
    }

    /**
     * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
     * function in the contract matches the call data.
     */
    fallback() external payable virtual {
        _fallback();
    }
}

File 46 of 64 : ProxyAdmin.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/transparent/ProxyAdmin.sol)

pragma solidity ^0.8.20;

import {ITransparentUpgradeableProxy} from "./TransparentUpgradeableProxy.sol";
import {Ownable} from "../../access/Ownable.sol";

/**
 * @dev This is an auxiliary contract meant to be assigned as the admin of a {TransparentUpgradeableProxy}. For an
 * explanation of why you would want to use this see the documentation for {TransparentUpgradeableProxy}.
 */
contract ProxyAdmin is Ownable {
    /**
     * @dev The version of the upgrade interface of the contract. If this getter is missing, both `upgrade(address)`
     * and `upgradeAndCall(address,bytes)` are present, and `upgradeTo` must be used if no function should be called,
     * while `upgradeAndCall` will invoke the `receive` function if the second argument is the empty byte string.
     * If the getter returns `"5.0.0"`, only `upgradeAndCall(address,bytes)` is present, and the second argument must
     * be the empty byte string if no function should be called, making it impossible to invoke the `receive` function
     * during an upgrade.
     */
    string public constant UPGRADE_INTERFACE_VERSION = "5.0.0";

    /**
     * @dev Sets the initial owner who can perform upgrades.
     */
    constructor(address initialOwner) Ownable(initialOwner) {}

    /**
     * @dev Upgrades `proxy` to `implementation` and calls a function on the new implementation.
     * See {TransparentUpgradeableProxy-_dispatchUpgradeToAndCall}.
     *
     * Requirements:
     *
     * - This contract must be the admin of `proxy`.
     * - If `data` is empty, `msg.value` must be zero.
     */
    function upgradeAndCall(
        ITransparentUpgradeableProxy proxy,
        address implementation,
        bytes memory data
    ) public payable virtual onlyOwner {
        proxy.upgradeToAndCall{value: msg.value}(implementation, data);
    }
}

File 47 of 64 : TransparentUpgradeableProxy.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/transparent/TransparentUpgradeableProxy.sol)

pragma solidity ^0.8.20;

import {ERC1967Utils} from "../ERC1967/ERC1967Utils.sol";
import {ERC1967Proxy} from "../ERC1967/ERC1967Proxy.sol";
import {IERC1967} from "../../interfaces/IERC1967.sol";
import {ProxyAdmin} from "./ProxyAdmin.sol";

/**
 * @dev Interface for {TransparentUpgradeableProxy}. In order to implement transparency, {TransparentUpgradeableProxy}
 * does not implement this interface directly, and its upgradeability mechanism is implemented by an internal dispatch
 * mechanism. The compiler is unaware that these functions are implemented by {TransparentUpgradeableProxy} and will not
 * include them in the ABI so this interface must be used to interact with it.
 */
interface ITransparentUpgradeableProxy is IERC1967 {
    function upgradeToAndCall(address, bytes calldata) external payable;
}

/**
 * @dev This contract implements a proxy that is upgradeable through an associated {ProxyAdmin} instance.
 *
 * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector
 * clashing], which can potentially be used in an attack, this contract uses the
 * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two
 * things that go hand in hand:
 *
 * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if
 * that call matches the {ITransparentUpgradeableProxy-upgradeToAndCall} function exposed by the proxy itself.
 * 2. If the admin calls the proxy, it can call the `upgradeToAndCall` function but any other call won't be forwarded to
 * the implementation. If the admin tries to call a function on the implementation it will fail with an error indicating
 * the proxy admin cannot fallback to the target implementation.
 *
 * These properties mean that the admin account can only be used for upgrading the proxy, so it's best if it's a
 * dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to
 * call a function from the proxy implementation. For this reason, the proxy deploys an instance of {ProxyAdmin} and
 * allows upgrades only if they come through it. You should think of the `ProxyAdmin` instance as the administrative
 * interface of the proxy, including the ability to change who can trigger upgrades by transferring ownership.
 *
 * NOTE: The real interface of this proxy is that defined in `ITransparentUpgradeableProxy`. This contract does not
 * inherit from that interface, and instead `upgradeToAndCall` is implicitly implemented using a custom dispatch
 * mechanism in `_fallback`. Consequently, the compiler will not produce an ABI for this contract. This is necessary to
 * fully implement transparency without decoding reverts caused by selector clashes between the proxy and the
 * implementation.
 *
 * NOTE: This proxy does not inherit from {Context} deliberately. The {ProxyAdmin} of this contract won't send a
 * meta-transaction in any way, and any other meta-transaction setup should be made in the implementation contract.
 *
 * IMPORTANT: This contract avoids unnecessary storage reads by setting the admin only during construction as an
 * immutable variable, preventing any changes thereafter. However, the admin slot defined in ERC-1967 can still be
 * overwritten by the implementation logic pointed to by this proxy. In such cases, the contract may end up in an
 * undesirable state where the admin slot is different from the actual admin.
 *
 * WARNING: It is not recommended to extend this contract to add additional external functions. If you do so, the
 * compiler will not check that there are no selector conflicts, due to the note above. A selector clash between any new
 * function and the functions declared in {ITransparentUpgradeableProxy} will be resolved in favor of the new one. This
 * could render the `upgradeToAndCall` function inaccessible, preventing upgradeability and compromising transparency.
 */
contract TransparentUpgradeableProxy is ERC1967Proxy {
    // An immutable address for the admin to avoid unnecessary SLOADs before each call
    // at the expense of removing the ability to change the admin once it's set.
    // This is acceptable if the admin is always a ProxyAdmin instance or similar contract
    // with its own ability to transfer the permissions to another account.
    address private immutable _admin;

    /**
     * @dev The proxy caller is the current admin, and can't fallback to the proxy target.
     */
    error ProxyDeniedAdminAccess();

    /**
     * @dev Initializes an upgradeable proxy managed by an instance of a {ProxyAdmin} with an `initialOwner`,
     * backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in
     * {ERC1967Proxy-constructor}.
     */
    constructor(address _logic, address initialOwner, bytes memory _data) payable ERC1967Proxy(_logic, _data) {
        _admin = address(new ProxyAdmin(initialOwner));
        // Set the storage value and emit an event for ERC-1967 compatibility
        ERC1967Utils.changeAdmin(_proxyAdmin());
    }

    /**
     * @dev Returns the admin of this proxy.
     */
    function _proxyAdmin() internal virtual returns (address) {
        return _admin;
    }

    /**
     * @dev If caller is the admin process the call internally, otherwise transparently fallback to the proxy behavior.
     */
    function _fallback() internal virtual override {
        if (msg.sender == _proxyAdmin()) {
            if (msg.sig != ITransparentUpgradeableProxy.upgradeToAndCall.selector) {
                revert ProxyDeniedAdminAccess();
            } else {
                _dispatchUpgradeToAndCall();
            }
        } else {
            super._fallback();
        }
    }

    /**
     * @dev Upgrade the implementation of the proxy. See {ERC1967Utils-upgradeToAndCall}.
     *
     * Requirements:
     *
     * - If `data` is empty, `msg.value` must be zero.
     */
    function _dispatchUpgradeToAndCall() private {
        (address newImplementation, bytes memory data) = abi.decode(msg.data[4:], (address, bytes));
        ERC1967Utils.upgradeToAndCall(newImplementation, data);
    }
}

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

pragma solidity ^0.8.20;

import {IERC20} from "./IERC20.sol";
import {IERC20Metadata} from "./extensions/IERC20Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * The default value of {decimals} is 18. To change this, you should override
 * this function so it returns a different value.
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 */
abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {
    mapping(address account => uint256) private _balances;

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

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

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

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

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

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

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

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

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

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

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _transfer(address from, address to, uint256 value) internal {
        if (from == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        if (to == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(from, to, value);
    }

    /**
     * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
     * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
     * this function.
     *
     * Emits a {Transfer} event.
     */
    function _update(address from, address to, uint256 value) internal virtual {
        if (from == address(0)) {
            // Overflow check required: The rest of the code assumes that totalSupply never overflows
            _totalSupply += value;
        } else {
            uint256 fromBalance = _balances[from];
            if (fromBalance < value) {
                revert ERC20InsufficientBalance(from, fromBalance, value);
            }
            unchecked {
                // Overflow not possible: value <= fromBalance <= totalSupply.
                _balances[from] = fromBalance - value;
            }
        }

        if (to == address(0)) {
            unchecked {
                // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
                _totalSupply -= value;
            }
        } else {
            unchecked {
                // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
                _balances[to] += value;
            }
        }

        emit Transfer(from, to, value);
    }

    /**
     * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
     * Relies on the `_update` mechanism
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _mint(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(address(0), account, value);
    }

    /**
     * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.
     * Relies on the `_update` mechanism.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead
     */
    function _burn(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        _update(account, address(0), value);
    }

    /**
     * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     *
     * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
     */
    function _approve(address owner, address spender, uint256 value) internal {
        _approve(owner, spender, value, true);
    }

    /**
     * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.
     *
     * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by
     * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any
     * `Approval` event during `transferFrom` operations.
     *
     * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to
     * true using the following override:
     * ```
     * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {
     *     super._approve(owner, spender, value, true);
     * }
     * ```
     *
     * Requirements are the same as {_approve}.
     */
    function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
        if (owner == address(0)) {
            revert ERC20InvalidApprover(address(0));
        }
        if (spender == address(0)) {
            revert ERC20InvalidSpender(address(0));
        }
        _allowances[owner][spender] = value;
        if (emitEvent) {
            emit Approval(owner, spender, value);
        }
    }

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

File 49 of 64 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.20;

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

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

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

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

File 50 of 64 : 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 51 of 64 : 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 52 of 64 : 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 53 of 64 : 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 54 of 64 : 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 55 of 64 : 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 56 of 64 : 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 57 of 64 : StorageSlot.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.

pragma solidity ^0.8.20;

/**
 * @dev Library for reading and writing primitive types to specific storage slots.
 *
 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
 * This library helps with reading and writing to such slots without the need for inline assembly.
 *
 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
 *
 * Example usage to set ERC1967 implementation slot:
 * ```solidity
 * contract ERC1967 {
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(newImplementation.code.length > 0);
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 */
library StorageSlot {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    struct StringSlot {
        string value;
    }

    struct BytesSlot {
        bytes value;
    }

    /**
     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
     */
    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.
     */
    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
     */
    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.
     */
    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` with member `value` located at `slot`.
     */
    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` representation of the string storage pointer `store`.
     */
    function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` with member `value` located at `slot`.
     */
    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
     */
    function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }
}

File 58 of 64 : EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.

pragma solidity ^0.8.20;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```solidity
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 *
 * [WARNING]
 * ====
 * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
 * unusable.
 * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
 * array of EnumerableSet.
 * ====
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position is the index of the value in the `values` array plus 1.
        // Position 0 is used to mean a value is not in the set.
        mapping(bytes32 value => uint256) _positions;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._positions[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We cache the value's position to prevent multiple reads from the same storage slot
        uint256 position = set._positions[value];

        if (position != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 valueIndex = position - 1;
            uint256 lastIndex = set._values.length - 1;

            if (valueIndex != lastIndex) {
                bytes32 lastValue = set._values[lastIndex];

                // Move the lastValue to the index where the value to delete is
                set._values[valueIndex] = lastValue;
                // Update the tracked position of the lastValue (that was just moved)
                set._positions[lastValue] = position;
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the tracked position for the deleted slot
            delete set._positions[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._positions[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        bytes32[] memory store = _values(set._inner);
        bytes32[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }
}

File 59 of 64 : ICianFlowControl.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.25;

interface ICianFlowControl {
    function consume(address _caller, uint256 _amount, uint256 _targetEid) external;
}

File 60 of 64 : CianFlowControl.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.25;

import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "./FlowControlLib.sol";

import "../interfaces/ICianFlowControl.sol";

contract CianFlowControl is OwnableUpgradeable, PausableUpgradeable, ICianFlowControl {
    using EnumerableSet for EnumerableSet.AddressSet;

    event AddMeltdownManager(address indexed manager);
    event RemoveMeltdownManager(address indexed manager);
    event AddWhiteListedSender(address indexed sender);
    event RemoveWhiteListedSender(address indexed sender);
    event AddToken(address indexed token, uint256 eid, uint256 dripPerSecond, uint256 binCap);
    event UpdateDripPerSecond(address indexed token, uint256 eid, uint256 dripPerSecond);
    event UpdateBinCap(address indexed token, uint256 eid, uint256 binCap);
    event RefillCap(address indexed token, uint256 eid);
    event EmptyCap(address indexed token, uint256 eid);
    event PauseToken(address indexed token, uint256 eid);
    event UnpauseToken(address indexed token, uint256 eid);

    struct FlowControlStorage {
        address owner;
        EnumerableSet.AddressSet meltdownManagers;
        EnumerableSet.AddressSet whiteListedSenders;
        mapping(address => mapping(uint256 => FlowControlLib.FlowControlConfig)) config;
        mapping(address => mapping(uint256 => FlowControlLib.FlowControlState)) state;
    }

    bytes32 internal constant FLOW_CONTROL_STORAGE_POSITION = keccak256("cian.flowControl.storage");
    // =================== Storage & initializers ===================

    function s() internal pure returns (FlowControlStorage storage state) {
        bytes32 position = FLOW_CONTROL_STORAGE_POSITION;
        // solhint-disable-next-line no-inline-assembly
        assembly {
            state.slot := position
        }
    }

    constructor() {
        _disableInitializers();
    }

    function initialize(address _initialOwner) public initializer {
        __Ownable_init(_initialOwner);
        __Pausable_init();
    }

    // =================== Modifiers ===================
    modifier checkCap(address _caller, uint256 _eid, address _token, uint256 _amount) {
        if (s().whiteListedSenders.contains(_caller)) {
            _;
            return;
        }
        FlowControlLib.consumeCap(s().config[_token][_eid], s().state[_token][_eid], _amount);
        _;
    }

    modifier onlyMeltDownManager() {
        require(
            s().meltdownManagers.contains(msg.sender) || owner() == msg.sender,
            "CianFlowControl: Not a meltdown manager"
        );
        _;
    }

    // =================== Public methods ===================
    // =================== Owner methods ===================
    function addMeltdownManager(address _manager) external onlyOwner {
        s().meltdownManagers.add(_manager);
        emit AddMeltdownManager(_manager);
    }

    function removeMeltdownManager(address _manager) external onlyOwner {
        s().meltdownManagers.remove(_manager);
        emit RemoveMeltdownManager(_manager);
    }

    function addWhiteListedSender(address _sender) external onlyOwner {
        s().whiteListedSenders.add(_sender);
        emit AddWhiteListedSender(_sender);
    }

    function removeWhiteListedSender(address _sender) external onlyOwner {
        s().whiteListedSenders.remove(_sender);
        emit RemoveWhiteListedSender(_sender);
    }

    function addToken(address _token, uint256 _eid, uint256 _dripPerSecond, uint256 _binCap) external onlyOwner {
        FlowControlLib.FlowControlConfig storage config_ = s().config[_token][_eid];
        config_.dripPerSecond = _dripPerSecond;
        config_.binCap = _binCap;
        config_.isPaused = false;
        FlowControlLib.refreshState(config_, s().state[_token][_eid]);
        emit AddToken(_token, _eid, _dripPerSecond, _binCap);
    }

    function updateDripPerSecond(address _token, uint256 _eid, uint256 _dripPerSecond) external onlyOwner {
        FlowControlLib.updateDripPerSecond(s().config[_token][_eid], _dripPerSecond);
        emit UpdateDripPerSecond(_token, _eid, _dripPerSecond);
    }

    function updateBinCap(address _token, uint256 _eid, uint256 _binCap) external onlyOwner {
        FlowControlLib.updateBinCap(s().config[_token][_eid], _binCap);
        emit UpdateBinCap(_token, _eid, _binCap);
    }

    function refillCap(address _token, uint256 _eid) external onlyOwner {
        s().state[_token][_eid].remainingCap = s().config[_token][_eid].binCap;
        emit RefillCap(_token, _eid);
    }

    function emptyCap(address _token, uint256 _eid) external onlyOwner {
        s().state[_token][_eid].remainingCap = 0;
        emit EmptyCap(_token, _eid);
    }

    function pauseToken(address _token, uint256 _eid) external onlyMeltDownManager {
        FlowControlLib.pause(s().config[_token][_eid]);
        emit PauseToken(_token, _eid);
    }

    function unpauseToken(address _token, uint256 _eid) external onlyOwner {
        FlowControlLib.unpause(s().config[_token][_eid]);
        emit UnpauseToken(_token, _eid);
    }

    function pause() external onlyMeltDownManager {
        _pause();
    }

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

    // =================== View methods ===================
    function previewCap(address _token, uint256 _eid) external view returns (uint256) {
        return FlowControlLib.previewCap(s().config[_token][_eid], s().state[_token][_eid]);
    }

    function meltdownManager(address _manager) external view returns (bool) {
        return s().meltdownManagers.contains(_manager);
    }

    function meltdownManagers() external view returns (address[] memory) {
        address[] memory managers_ = new address[](s().meltdownManagers.length());
        for (uint256 i = 0; i < s().meltdownManagers.length(); i++) {
            managers_[i] = s().meltdownManagers.at(i);
        }
        return managers_;
    }

    function tokenConfig(address _token, uint256 _eid) external view returns (FlowControlLib.FlowControlConfig memory) {
        return s().config[_token][_eid];
    }

    function tokenState(address _token, uint256 _eid) external view returns (FlowControlLib.FlowControlState memory) {
        return s().state[_token][_eid];
    }

    function isWhiteListedSender(address _sender) external view returns (bool) {
        return s().whiteListedSenders.contains(_sender);
    }
    // =================== Flow Control User Methods ===================

    function consume(address _caller, uint256 _amount, uint256 _targetEid) public checkCap(_caller, _targetEid, msg.sender,  _amount) whenNotPaused {
        // solhint-disable-next-line no-empty-blocks
        // Nothing required here
    }
}

File 61 of 64 : CianOFTWrapper.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.25;

import {OFTAdapter} from "@layerzerolabs/oft-evm/contracts/OFTAdapter.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {
    SendParam, MessagingFee, MessagingReceipt, OFTReceipt
} from "@layerzerolabs/oft-evm/contracts/interfaces/IOFT.sol";
import {EnforcedOptionParam} from "@layerzerolabs/oapp-evm/contracts/oapp/interfaces/IOAppOptionsType3.sol";
import {OptionsBuilder} from "@layerzerolabs/oapp-evm/contracts/oapp/libs/OptionsBuilder.sol";
import {ICianFlowControl} from "../interfaces/ICianFlowControl.sol";

/// @notice OFTAdapter uses a deployed ERC-20 token and safeERC20 to interact with the OFTCore contract.
contract CianOFTWrapper is OFTAdapter {
    using OptionsBuilder for bytes;

    address public flowControl;

    event FlowControlUpdated(address indexed flowControl);

    constructor(address _token, address _lzEndpoint, address _owner, address _flowControl)
        OFTAdapter(_token, _lzEndpoint, _owner)
        Ownable(_owner)
    {
        flowControl = _flowControl;
    }

    modifier flowControlled(address _caller, uint256 _amount, uint256 _targetEid) {
        ICianFlowControl(flowControl).consume(_caller, _amount, _targetEid);
        _;
    }

    function updateFlowControl(address _flowControl) external onlyOwner {
        flowControl = _flowControl;
        emit FlowControlUpdated(_flowControl);
    }

    function setDefaultGasForSend(uint32 _eid, uint256 _gas) external onlyOwner {
        EnforcedOptionParam[] memory aEnforcedOptions = new EnforcedOptionParam[](1);
        aEnforcedOptions[0] = EnforcedOptionParam({
                eid: _eid,
                msgType: 1,
                options: OptionsBuilder.newOptions().addExecutorLzReceiveOption(uint128(_gas), 0)
            });
        _setEnforcedOptions(
            aEnforcedOptions
        );
    }

    function send(SendParam calldata _sendParam, MessagingFee calldata _fee, address _refundAddress)
        external
        payable
        virtual
        override
        flowControlled(msg.sender, _sendParam.amountLD, _sendParam.dstEid)
        returns (MessagingReceipt memory msgReceipt, OFTReceipt memory oftReceipt)
    {
        return _send(_sendParam, _fee, _refundAddress);
    }
}

File 62 of 64 : FlowControlLib.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.25;

library FlowControlLib {
    struct FlowControlConfig {
        // Configurations
        uint256 dripPerSecond;
        uint256 binCap;
        bool isPaused;
    }

    struct FlowControlState {
        // State
        uint256 lastOperationTime;
        uint256 remainingCap;
    }

    function pause(FlowControlConfig storage _config) internal {
        _config.isPaused = true;
    }

    function unpause(FlowControlConfig storage _config) internal {
        _config.isPaused = false;
    }

    function updateDripPerSecond(FlowControlConfig storage _config, uint256 _dripPerSecond) internal {
        _config.dripPerSecond = _dripPerSecond;
    }

    function updateBinCap(FlowControlConfig storage _config, uint256 _binCap) internal {
        _config.binCap = _binCap;
    }

    function refreshState(FlowControlConfig storage _config, FlowControlState storage _state) internal {
        if (_config.isPaused) revert("FlowControl: Paused");
        if (_config.binCap == 0) return; // Rate limit not set
        if (_state.lastOperationTime == 0) {
            _state.lastOperationTime = block.timestamp;
            _state.remainingCap = _config.binCap;
            return;
        }
        // First calculate the time elapsed since the last operation
        uint256 timeElapsed_ = block.timestamp - _state.lastOperationTime;
        // Then calculate the amount of tokens that should have been dripped
        uint256 dripAmount_ = timeElapsed_ * _config.dripPerSecond;
        if (dripAmount_ + _state.remainingCap > _config.binCap) {
            _state.remainingCap = _config.binCap;
        } else {
            _state.remainingCap += dripAmount_;
        }
    }

    function previewCap(FlowControlConfig storage _config, FlowControlState storage _state)
        internal
        view
        returns (uint256)
    {
        uint256 timeElapsed_ = block.timestamp - _state.lastOperationTime;
        // Then calculate the amount of tokens that should have been dripped
        uint256 dripAmount_ = timeElapsed_ * _config.dripPerSecond;
        if (dripAmount_ + _state.remainingCap > _config.binCap) {
            return _config.binCap;
        } else {
            return dripAmount_;
        }
    }

    function consumeCap(FlowControlConfig storage _config, FlowControlState storage _state, uint256 _amount) internal {
        refreshState(_config, _state);
        // If cap is 0, then no rate limiting is applied
        if (_config.binCap == 0) return;
        if (_config.isPaused) revert("FlowControl: Paused");
        if (_state.remainingCap < _amount) revert("FlowControl: Insufficient cap");
        _state.remainingCap -= _amount;
        _state.lastOperationTime = block.timestamp;
    }
}

File 63 of 64 : ImportHelper.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.25;

import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";

File 64 of 64 : 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": 200
  },
  "evmVersion": "cancun",
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"address","name":"_endpoint","type":"address"},{"internalType":"address","name":"_delegate","type":"address"},{"internalType":"address","name":"_flowControl","type":"address"},{"internalType":"uint8","name":"_decimals","type":"uint8"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"allowance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientAllowance","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC20InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC20InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC20InvalidSender","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"}],"name":"ERC20InvalidSpender","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"InvalidDelegate","type":"error"},{"inputs":[],"name":"InvalidEndpointCall","type":"error"},{"inputs":[],"name":"InvalidLocalDecimals","type":"error"},{"inputs":[{"internalType":"uint16","name":"optionType","type":"uint16"}],"name":"InvalidOptionType","type":"error"},{"inputs":[{"internalType":"bytes","name":"options","type":"bytes"}],"name":"InvalidOptions","type":"error"},{"inputs":[],"name":"LzTokenUnavailable","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":[],"name":"OnlySelf","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":"bytes","name":"result","type":"bytes"}],"name":"SimulationResult","type":"error"},{"inputs":[{"internalType":"uint256","name":"amountLD","type":"uint256"},{"internalType":"uint256","name":"minAmountLD","type":"uint256"}],"name":"SlippageExceeded","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"uint32","name":"eid","type":"uint32"},{"internalType":"uint16","name":"msgType","type":"uint16"},{"internalType":"bytes","name":"options","type":"bytes"}],"indexed":false,"internalType":"struct EnforcedOptionParam[]","name":"_enforcedOptions","type":"tuple[]"}],"name":"EnforcedOptionSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"inspector","type":"address"}],"name":"MsgInspectorSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"guid","type":"bytes32"},{"indexed":false,"internalType":"uint32","name":"srcEid","type":"uint32"},{"indexed":true,"internalType":"address","name":"toAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountReceivedLD","type":"uint256"}],"name":"OFTReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"guid","type":"bytes32"},{"indexed":false,"internalType":"uint32","name":"dstEid","type":"uint32"},{"indexed":true,"internalType":"address","name":"fromAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountSentLD","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountReceivedLD","type":"uint256"}],"name":"OFTSent","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":false,"internalType":"address","name":"preCrimeAddress","type":"address"}],"name":"PreCrimeSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"SEND","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SEND_AND_CALL","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"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"}],"name":"allowInitializePath","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"approvalRequired","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"_eid","type":"uint32"},{"internalType":"uint16","name":"_msgType","type":"uint16"},{"internalType":"bytes","name":"_extraOptions","type":"bytes"}],"name":"combineOptions","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimalConversionRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"endpoint","outputs":[{"internalType":"contract ILayerZeroEndpointV2","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"eid","type":"uint32"},{"internalType":"uint16","name":"msgType","type":"uint16"}],"name":"enforcedOptions","outputs":[{"internalType":"bytes","name":"enforcedOption","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"flowControl","outputs":[{"internalType":"address","name":"","type":"address"}],"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":"","type":"tuple"},{"internalType":"bytes","name":"","type":"bytes"},{"internalType":"address","name":"_sender","type":"address"}],"name":"isComposeMsgSender","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"_eid","type":"uint32"},{"internalType":"bytes32","name":"_peer","type":"bytes32"}],"name":"isPeer","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":[{"components":[{"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":"uint32","name":"dstEid","type":"uint32"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"bytes32","name":"guid","type":"bytes32"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"address","name":"executor","type":"address"},{"internalType":"bytes","name":"message","type":"bytes"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct InboundPacket[]","name":"_packets","type":"tuple[]"}],"name":"lzReceiveAndRevert","outputs":[],"stateMutability":"payable","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":"lzReceiveSimulate","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"msgInspector","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"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":"oApp","outputs":[{"internalType":"address","name":"","type":"address"}],"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":"oftVersion","outputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"},{"internalType":"uint64","name":"version","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":[],"name":"preCrime","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"dstEid","type":"uint32"},{"internalType":"bytes32","name":"to","type":"bytes32"},{"internalType":"uint256","name":"amountLD","type":"uint256"},{"internalType":"uint256","name":"minAmountLD","type":"uint256"},{"internalType":"bytes","name":"extraOptions","type":"bytes"},{"internalType":"bytes","name":"composeMsg","type":"bytes"},{"internalType":"bytes","name":"oftCmd","type":"bytes"}],"internalType":"struct SendParam","name":"_sendParam","type":"tuple"}],"name":"quoteOFT","outputs":[{"components":[{"internalType":"uint256","name":"minAmountLD","type":"uint256"},{"internalType":"uint256","name":"maxAmountLD","type":"uint256"}],"internalType":"struct OFTLimit","name":"oftLimit","type":"tuple"},{"components":[{"internalType":"int256","name":"feeAmountLD","type":"int256"},{"internalType":"string","name":"description","type":"string"}],"internalType":"struct OFTFeeDetail[]","name":"oftFeeDetails","type":"tuple[]"},{"components":[{"internalType":"uint256","name":"amountSentLD","type":"uint256"},{"internalType":"uint256","name":"amountReceivedLD","type":"uint256"}],"internalType":"struct OFTReceipt","name":"oftReceipt","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"dstEid","type":"uint32"},{"internalType":"bytes32","name":"to","type":"bytes32"},{"internalType":"uint256","name":"amountLD","type":"uint256"},{"internalType":"uint256","name":"minAmountLD","type":"uint256"},{"internalType":"bytes","name":"extraOptions","type":"bytes"},{"internalType":"bytes","name":"composeMsg","type":"bytes"},{"internalType":"bytes","name":"oftCmd","type":"bytes"}],"internalType":"struct SendParam","name":"_sendParam","type":"tuple"},{"internalType":"bool","name":"_payInLzToken","type":"bool"}],"name":"quoteSend","outputs":[{"components":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"lzTokenFee","type":"uint256"}],"internalType":"struct MessagingFee","name":"msgFee","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"dstEid","type":"uint32"},{"internalType":"bytes32","name":"to","type":"bytes32"},{"internalType":"uint256","name":"amountLD","type":"uint256"},{"internalType":"uint256","name":"minAmountLD","type":"uint256"},{"internalType":"bytes","name":"extraOptions","type":"bytes"},{"internalType":"bytes","name":"composeMsg","type":"bytes"},{"internalType":"bytes","name":"oftCmd","type":"bytes"}],"internalType":"struct SendParam","name":"_sendParam","type":"tuple"},{"components":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"lzTokenFee","type":"uint256"}],"internalType":"struct MessagingFee","name":"_fee","type":"tuple"},{"internalType":"address","name":"_refundAddress","type":"address"}],"name":"send","outputs":[{"components":[{"internalType":"bytes32","name":"guid","type":"bytes32"},{"internalType":"uint64","name":"nonce","type":"uint64"},{"components":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"lzTokenFee","type":"uint256"}],"internalType":"struct MessagingFee","name":"fee","type":"tuple"}],"internalType":"struct MessagingReceipt","name":"msgReceipt","type":"tuple"},{"components":[{"internalType":"uint256","name":"amountSentLD","type":"uint256"},{"internalType":"uint256","name":"amountReceivedLD","type":"uint256"}],"internalType":"struct OFTReceipt","name":"oftReceipt","type":"tuple"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_eid","type":"uint32"},{"internalType":"uint256","name":"_gas","type":"uint256"}],"name":"setDefaultGasForSend","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_delegate","type":"address"}],"name":"setDelegate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"eid","type":"uint32"},{"internalType":"uint16","name":"msgType","type":"uint16"},{"internalType":"bytes","name":"options","type":"bytes"}],"internalType":"struct EnforcedOptionParam[]","name":"_enforcedOptions","type":"tuple[]"}],"name":"setEnforcedOptions","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_msgInspector","type":"address"}],"name":"setMsgInspector","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":"address","name":"_preCrime","type":"address"}],"name":"setPreCrime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sharedDecimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_flowControl","type":"address"}],"name":"updateFlowControl","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60e060405234801561000f575f80fd5b506040516139f93803806139f983398101604081905261002e916102a4565b858582868681818181806001600160a01b03811661006557604051631e4fbdf760e01b81525f600482015260240160405180910390fd5b61006e81610199565b506001600160a01b03808316608052811661009c57604051632d618d8160e21b815260040160405180910390fd5b60805160405163ca5eb5e160e01b81526001600160a01b0383811660048301529091169063ca5eb5e1906024015f604051808303815f87803b1580156100e0575f80fd5b505af11580156100f2573d5f803e3d5ffd5b50505050505050506101086101e860201b60201c565b60ff168360ff16101561012e576040516301e9714b60e41b815260040160405180910390fd5b61013960068461035f565b61014490600a61045e565b60a0525060089150610158905083826104f7565b50600961016582826104f7565b5050600a80546001600160a01b0319166001600160a01b03949094169390931790925560ff1660c052506105b69350505050565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600690565b634e487b7160e01b5f52604160045260245ffd5b5f82601f830112610210575f80fd5b81516001600160401b038082111561022a5761022a6101ed565b604051601f8301601f19908116603f01168101908282118183101715610252576102526101ed565b8160405283815286602085880101111561026a575f80fd5b8360208701602083015e5f602085830101528094505050505092915050565b80516001600160a01b038116811461029f575f80fd5b919050565b5f805f805f8060c087890312156102b9575f80fd5b86516001600160401b03808211156102cf575f80fd5b6102db8a838b01610201565b975060208901519150808211156102f0575f80fd5b506102fd89828a01610201565b95505061030c60408801610289565b935061031a60608801610289565b925061032860808801610289565b915060a087015160ff8116811461033d575f80fd5b809150509295509295509295565b634e487b7160e01b5f52601160045260245ffd5b60ff82811682821603908111156103785761037861034b565b92915050565b600181815b808511156103b857815f190482111561039e5761039e61034b565b808516156103ab57918102915b93841c9390800290610383565b509250929050565b5f826103ce57506001610378565b816103da57505f610378565b81600181146103f057600281146103fa57610416565b6001915050610378565b60ff84111561040b5761040b61034b565b50506001821b610378565b5060208310610133831016604e8410600b8410161715610439575081810a610378565b610443838361037e565b805f19048211156104565761045661034b565b029392505050565b5f61046c60ff8416836103c0565b9392505050565b600181811c9082168061048757607f821691505b6020821081036104a557634e487b7160e01b5f52602260045260245ffd5b50919050565b601f8211156104f257805f5260205f20601f840160051c810160208510156104d05750805b601f840160051c820191505b818110156104ef575f81556001016104dc565b50505b505050565b81516001600160401b03811115610510576105106101ed565b6105248161051e8454610473565b846104ab565b602080601f831160018114610557575f84156105405750858301515b5f19600386901b1c1916600185901b1785556105ae565b5f85815260208120601f198616915b8281101561058557888601518255948401946001909101908401610566565b50858210156105a257878501515f19600388901b60f8161c191681555b505060018460011b0185555b505050505050565b60805160a05160c0516133d36106265f395f61040e01525f818161063701528181611bcd01528181611c3f0152611e3c01525f8181610502015281816109ec015281816111720152818161140901528181611760015281816120780152818161220d01526122c201526133d35ff3fe60806040526004361061026a575f3560e01c806382413eac1161014a578063bb0b6a53116100be578063d424388511610078578063d4243885146107b6578063dd62ed3e146107d5578063f2fde38b14610819578063fab8549b14610838578063fc0c546a1461048b578063ff7bd03d14610857575f80fd5b8063bb0b6a5314610706578063bc70b35414610731578063bd815db014610750578063c7c7f5b314610763578063ca5eb5e114610784578063d045a0dc146107a3575f80fd5b80639f68b9641161010f5780639f68b96414610659578063a70658f21461066b578063a9059cbb1461068a578063a98b165f146106a9578063b731ea0a146106c8578063b98bd070146106e7575f80fd5b806382413eac146105c4578063857749b0146105e35780638da5cb5b146105f657806395d89b4114610612578063963efcaa14610626575f80fd5b8063313ce567116101e15780635a0dfe4d116101a65780635a0dfe4d146104bc5780635e280f11146104f15780636fc1b31e1461052457806370a0823114610543578063715018a6146105775780637d25a05e1461058b575f80fd5b8063313ce567146104005780633400288b146104405780633b6f743b1461045f57806352ae28791461048b5780635535d4611461049d575f80fd5b8063134d4f2511610232578063134d4f2514610341578063156a0d0f1461036857806317442b701461038e57806318160ddd146103af5780631f5e1334146103cd57806323b872dd146103e1575f80fd5b806306fdde031461026e578063095ea7b3146102985780630d35b415146102c7578063111ecdad146102f557806313137d651461032c575b5f80fd5b348015610279575f80fd5b50610282610876565b60405161028f91906124f0565b60405180910390f35b3480156102a3575f80fd5b506102b76102b2366004612516565b610906565b604051901515815260200161028f565b3480156102d2575f80fd5b506102e66102e1366004612556565b61091f565b60405161028f93929190612587565b348015610300575f80fd5b50600454610314906001600160a01b031681565b6040516001600160a01b03909116815260200161028f565b61033f61033a366004612672565b6109ea565b005b34801561034c575f80fd5b50610355600281565b60405161ffff909116815260200161028f565b348015610373575f80fd5b506040805162b9270b60e21b8152600160208201520161028f565b348015610399575f80fd5b506040805160018152600260208201520161028f565b3480156103ba575f80fd5b506007545b60405190815260200161028f565b3480156103d8575f80fd5b50610355600181565b3480156103ec575f80fd5b506102b76103fb36600461270a565b610aaa565b34801561040b575f80fd5b507f00000000000000000000000000000000000000000000000000000000000000005b60405160ff909116815260200161028f565b34801561044b575f80fd5b5061033f61045a366004612760565b610acf565b34801561046a575f80fd5b5061047e610479366004612787565b610ae5565b60405161028f91906127d5565b348015610496575f80fd5b5030610314565b3480156104a8575f80fd5b506102826104b73660046127fd565b610b49565b3480156104c7575f80fd5b506102b76104d6366004612760565b63ffffffff919091165f908152600160205260409020541490565b3480156104fc575f80fd5b506103147f000000000000000000000000000000000000000000000000000000000000000081565b34801561052f575f80fd5b5061033f61053e36600461282e565b610beb565b34801561054e575f80fd5b506103bf61055d36600461282e565b6001600160a01b03165f9081526005602052604090205490565b348015610582575f80fd5b5061033f610c48565b348015610596575f80fd5b506105ac6105a5366004612760565b5f92915050565b6040516001600160401b03909116815260200161028f565b3480156105cf575f80fd5b506102b76105de366004612849565b610c5b565b3480156105ee575f80fd5b50600661042e565b348015610601575f80fd5b505f546001600160a01b0316610314565b34801561061d575f80fd5b50610282610c70565b348015610631575f80fd5b506103bf7f000000000000000000000000000000000000000000000000000000000000000081565b348015610664575f80fd5b505f6102b7565b348015610676575f80fd5b5061033f610685366004612760565b610c7f565b348015610695575f80fd5b506102b76106a4366004612516565b610d49565b3480156106b4575f80fd5b50600a54610314906001600160a01b031681565b3480156106d3575f80fd5b50600254610314906001600160a01b031681565b3480156106f2575f80fd5b5061033f6107013660046128eb565b610d56565b348015610711575f80fd5b506103bf610720366004612929565b60016020525f908152604090205481565b34801561073c575f80fd5b5061028261074b366004612942565b610d70565b61033f61075e3660046128eb565b610f11565b61077661077136600461299e565b611091565b60405161028f929190612a06565b34801561078f575f80fd5b5061033f61079e36600461282e565b61114b565b61033f6107b1366004612672565b6111cc565b3480156107c1575f80fd5b5061033f6107d036600461282e565b6111fb565b3480156107e0575f80fd5b506103bf6107ef366004612a57565b6001600160a01b039182165f90815260066020908152604080832093909416825291909152205490565b348015610824575f80fd5b5061033f61083336600461282e565b611251565b348015610843575f80fd5b5061033f61085236600461282e565b61128e565b348015610862575f80fd5b506102b7610871366004612a83565b6112b8565b60606008805461088590612a9d565b80601f01602080910402602001604051908101604052809291908181526020018280546108b190612a9d565b80156108fc5780601f106108d3576101008083540402835291602001916108fc565b820191905f5260205f20905b8154815290600101906020018083116108df57829003601f168201915b5050505050905090565b5f336109138185856112ec565b60019150505b92915050565b604080518082019091525f8082526020820152606061094f60405180604001604052805f81526020015f81525090565b6040805180820182525f8082526001600160401b036020808401829052845183815290810190945291955091826109a8565b604080518082019091525f8152606060208201528152602001906001900390816109815790505b5093505f806109cc604089013560608a01356109c760208c018c612929565b6112f9565b60408051808201909152918252602082015296989597505050505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03163314610a3a576040516391ac5e4f60e01b81523360048201526024015b60405180910390fd5b60208701803590610a5490610a4f908a612929565b61133c565b14610a9257610a666020880188612929565b60405163309afaf360e21b815263ffffffff909116600482015260208801356024820152604401610a31565b610aa187878787878787611377565b50505050505050565b5f33610ab78582856114d5565b610ac2858585611550565b60019150505b9392505050565b610ad76115ad565b610ae182826115d9565b5050565b604080518082019091525f80825260208201525f610b13604085013560608601356109c76020880188612929565b9150505f80610b22868461162d565b9092509050610b3f610b376020880188612929565b83838861174b565b9695505050505050565b600360209081525f928352604080842090915290825290208054610b6c90612a9d565b80601f0160208091040260200160405190810160405280929190818152602001828054610b9890612a9d565b8015610be35780601f10610bba57610100808354040283529160200191610be3565b820191905f5260205f20905b815481529060010190602001808311610bc657829003601f168201915b505050505081565b610bf36115ad565b600480546001600160a01b0319166001600160a01b0383169081179091556040519081527ff0be4f1e87349231d80c36b33f9e8639658eeaf474014dee15a3e6a4d4414197906020015b60405180910390a150565b610c506115ad565b610c595f611829565b565b6001600160a01b03811630145b949350505050565b60606009805461088590612a9d565b610c876115ad565b6040805160018082528183019092525f91816020015b60408051606080820183525f808352602083015291810191909152815260200190600190039081610c9d5750506040805160608101825263ffffffff86168152600160208201529192508101610d1b845f610d1460408051600360f01b602082015281516002818303018152602290910190915290565b9190611878565b815250815f81518110610d3057610d30612ae3565b6020026020010181905250610d44816118d3565b505050565b5f33610913818585611550565b610d5e6115ad565b610ae1610d6b8284612b97565b6118d3565b63ffffffff84165f90815260036020908152604080832061ffff87168452909152812080546060929190610da390612a9d565b80601f0160208091040260200160405190810160405280929190818152602001828054610dcf90612a9d565b8015610e1a5780601f10610df157610100808354040283529160200191610e1a565b820191905f5260205f20905b815481529060010190602001808311610dfd57829003601f168201915b5050505050905080515f03610e685783838080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250929450610c689350505050565b5f839003610e77579050610c68565b60028310610ef457610ebd84848080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152506119d492505050565b80610ecb8460028188612c9f565b604051602001610edd93929190612cdd565b604051602081830303815290604052915050610c68565b8383604051639a6d49cd60e01b8152600401610a31929190612d23565b5f5b818110156110145736838383818110610f2e57610f2e612ae3565b9050602002810190610f409190612d36565b9050610f72610f526020830183612929565b602083013563ffffffff919091165f908152600160205260409020541490565b610f7c575061100c565b3063d045a0dc60c08301358360a0810135610f9b610100830183612d55565b610fac610100890160e08a0161282e565b610fba6101208a018a612d55565b6040518963ffffffff1660e01b8152600401610fdc9796959493929190612dab565b5f604051808303818588803b158015610ff3575f80fd5b505af1158015611005573d5f803e3d5ffd5b5050505050505b600101610f13565b50336001600160a01b0316638e9e70996040518163ffffffff1660e01b81526004015f60405180830381865afa158015611050573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526110779190810190612e30565b604051638351eea760e01b8152600401610a3191906124f0565b61109961247f565b604080518082019091525f80825260208201523360408601356110bf6020880188612929565b600a54604051633f6d5c5360e11b81526001600160a01b0385811660048301526024820185905263ffffffff93909316604482018190529290911690637edab8a6906064015f604051808303815f87803b15801561111b575f80fd5b505af115801561112d573d5f803e3d5ffd5b5050505061113c888888611a00565b94509450505050935093915050565b6111536115ad565b60405163ca5eb5e160e01b81526001600160a01b0382811660048301527f0000000000000000000000000000000000000000000000000000000000000000169063ca5eb5e1906024015f604051808303815f87803b1580156111b3575f80fd5b505af11580156111c5573d5f803e3d5ffd5b5050505050565b3330146111ec5760405163029a949d60e31b815260040160405180910390fd5b610aa187878787878787610a92565b6112036115ad565b600280546001600160a01b0319166001600160a01b0383169081179091556040519081527fd48d879cef83a1c0bdda516f27b13ddb1b3f8bbac1c9e1511bb2a659c242776090602001610c3d565b6112596115ad565b6001600160a01b03811661128257604051631e4fbdf760e01b81525f6004820152602401610a31565b61128b81611829565b50565b6112966115ad565b600a80546001600160a01b0319166001600160a01b0392909216919091179055565b5f6020820180359060019083906112cf9086612929565b63ffffffff16815260208101919091526040015f20541492915050565b610d448383836001611af8565b5f8061130485611bca565b915081905083811015611334576040516371c4efed60e01b81526004810182905260248101859052604401610a31565b935093915050565b63ffffffff81165f90815260016020526040812054806109195760405163f6ff4fb760e01b815263ffffffff84166004820152602401610a31565b5f6113886113858787611c00565b90565b90505f6113b3826113a161139c8a8a611c17565b611c39565b6113ae60208d018d612929565b611c6d565b90506028861115611473575f6113ef6113d260608c0160408d01612ea4565b6113df60208d018d612929565b846113ea8c8c611c94565b611cde565b604051633e5ac80960e11b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690637cb59012906114449086908d905f908790600401612ebf565b5f604051808303815f87803b15801561145b575f80fd5b505af115801561146d573d5f803e3d5ffd5b50505050505b6001600160a01b038216887fefed6d3500546b29533b128a29e3a94d70788727f0507505ac12eaf2e578fd9c6114ac60208d018d612929565b6040805163ffffffff9092168252602082018690520160405180910390a3505050505050505050565b6001600160a01b038381165f908152600660209081526040808320938616835292905220545f19811461154a578181101561153c57604051637dc7a0d960e11b81526001600160a01b03841660048201526024810182905260448101839052606401610a31565b61154a84848484035f611af8565b50505050565b6001600160a01b03831661157957604051634b637e8f60e11b81525f6004820152602401610a31565b6001600160a01b0382166115a25760405163ec442f0560e01b81525f6004820152602401610a31565b610d44838383611d10565b5f546001600160a01b03163314610c595760405163118cdaa760e01b8152336004820152602401610a31565b63ffffffff82165f81815260016020908152604091829020849055815192835282018390527f238399d427b947898edb290f5ff0f9109849b1c3ba196a42e35f00c50a54b98b910160405180910390a15050565b6060805f611688856020013561164286611e36565b61164f60a0890189612d55565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250611e6192505050565b90935090505f8161169a57600161169d565b60025b90506116bd6116af6020880188612929565b8261074b60808a018a612d55565b6004549093506001600160a01b031680156117415760405163043a78eb60e01b81526001600160a01b0382169063043a78eb906117009088908890600401612eef565b602060405180830381865afa15801561171b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061173f9190612f13565b505b5050509250929050565b604080518082019091525f80825260208201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663ddc28c586040518060a001604052808863ffffffff1681526020016117ad8961133c565b8152602001878152602001868152602001851515815250306040518363ffffffff1660e01b81526004016117e2929190612f2e565b6040805180830381865afa1580156117fc573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906118209190612fd4565b95945050505050565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060836003611887825f611edb565b61ffff16146118ba5761189a815f611edb565b604051633a51740d60e01b815261ffff9091166004820152602401610a31565b5f6118c58585611f37565b9050610b3f86600183611fb9565b5f5b81518110156119a4576119048282815181106118f3576118f3612ae3565b6020026020010151604001516119d4565b81818151811061191657611916612ae3565b60200260200101516040015160035f84848151811061193757611937612ae3565b60200260200101515f015163ffffffff1663ffffffff1681526020019081526020015f205f84848151811061196e5761196e612ae3565b60200260200101516020015161ffff1661ffff1681526020019081526020015f20908161199b9190613032565b506001016118d5565b507fbe4864a8e820971c0247f5992e2da559595f7bf076a21cb5928d443d2a13b67481604051610c3d91906130f1565b600281015161ffff8116600314610ae15781604051639a6d49cd60e01b8152600401610a3191906124f0565b611a0861247f565b604080518082019091525f80825260208201525f80611a3d33604089013560608a0135611a3860208c018c612929565b612022565b915091505f80611a4d898461162d565b9092509050611a79611a6260208b018b612929565b8383611a73368d90038d018d61317a565b8b612047565b60408051808201909152858152602080820186905282519298509096503391907f85496b760a4b7f8d66384b9df21b381f5d1b1e79f229a47aaf4c232edc2fe59a90611ac7908d018d612929565b6040805163ffffffff909216825260208201899052810187905260600160405180910390a350505050935093915050565b6001600160a01b038416611b215760405163e602df0560e01b81525f6004820152602401610a31565b6001600160a01b038316611b4a57604051634a1406b160e11b81525f6004820152602401610a31565b6001600160a01b038085165f908152600660209081526040808320938716835292905220829055801561154a57826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051611bbc91815260200190565b60405180910390a350505050565b5f7f0000000000000000000000000000000000000000000000000000000000000000611bf681846131be565b61091991906131dd565b5f611c0e6020828486612c9f565b610ac8916131f4565b5f611c26602860208486612c9f565b611c2f91613211565b60c01c9392505050565b5f6109197f00000000000000000000000000000000000000000000000000000000000000006001600160401b0384166131dd565b5f6001600160a01b038416611c825761dead93505b611c8c848461214d565b509092915050565b6060611ca38260288186612c9f565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250929695505050505050565b606084848484604051602001611cf79493929190613241565b6040516020818303038152906040529050949350505050565b6001600160a01b038316611d3a578060075f828254611d2f919061327b565b90915550611daa9050565b6001600160a01b0383165f9081526005602052604090205481811015611d8c5760405163391434e360e21b81526001600160a01b03851660048201526024810182905260448101839052606401610a31565b6001600160a01b0384165f9081526005602052604090209082900390555b6001600160a01b038216611dc657600780548290039055611de4565b6001600160a01b0382165f9081526005602052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051611e2991815260200190565b60405180910390a3505050565b5f6109197f0000000000000000000000000000000000000000000000000000000000000000836131be565b8051606090151580611eaa578484604051602001611e9692919091825260c01b6001600160c01b031916602082015260280190565b604051602081830303815290604052611ed1565b84843385604051602001611ec1949392919061328e565b6040516020818303038152906040525b9150935093915050565b5f611ee782600261327b565b83511015611f2e5760405162461bcd60e51b8152602060048201526014602482015273746f55696e7431365f6f75744f66426f756e647360601b6044820152606401610a31565b50016002015190565b60606fffffffffffffffffffffffffffffffff821615611f8857604080516001600160801b0319608086811b8216602084015285901b16603082015201604051602081830303815290604052610ac8565b6040516001600160801b0319608085901b166020820152603001604051602081830303815290604052905092915050565b6060836003611fc8825f611edb565b61ffff1614611fdb5761189a815f611edb565b846001611fe88551612181565b611ff39060016132ba565b86866040516020016120099594939291906132dc565b6040516020818303038152906040529150509392505050565b5f8061202f8585856112f9565b909250905061203e86836121b3565b94509492505050565b61204f61247f565b5f61205c845f01516121e7565b60208501519091501561207657612076846020015161220a565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316632637a450826040518060a001604052808b63ffffffff1681526020016120c68c61133c565b81526020018a81526020018981526020015f8960200151111515815250866040518463ffffffff1660e01b8152600401612101929190612f2e565b60806040518083038185885af115801561211d573d5f803e3d5ffd5b50505050506040513d601f19601f82011682018060405250810190612142919061332f565b979650505050505050565b6001600160a01b0382166121765760405163ec442f0560e01b81525f6004820152602401610a31565b610ae15f8383611d10565b5f61ffff8211156121af576040516306dfcc6560e41b81526010600482015260248101839052604401610a31565b5090565b6001600160a01b0382166121dc57604051634b637e8f60e11b81525f6004820152602401610a31565b610ae1825f83611d10565b5f8134146121af576040516304fb820960e51b8152346004820152602401610a31565b5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663e4fe1d946040518163ffffffff1660e01b8152600401602060405180830381865afa158015612267573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061228b9190613377565b90506001600160a01b0381166122b4576040516329b99a9560e11b815260040160405180910390fd5b6040805133602482018190527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03818116604485015260648085018890528551808603909101815260849094019094526020830180516001600160e01b03166323b872dd60e01b179052610ae193851692869061154a9085905f61233f838361238c565b905080515f141580156123635750808060200190518101906123619190612f13565b155b15610d4457604051635274afe760e01b81526001600160a01b0384166004820152602401610a31565b6060610ac883835f845f80856001600160a01b031684866040516123b09190613392565b5f6040518083038185875af1925050503d805f81146123ea576040519150601f19603f3d011682016040523d82523d5f602084013e6123ef565b606091505b5091509150610b3f86838360608261240f5761240a82612456565b610ac8565b815115801561242657506001600160a01b0384163b155b1561244f57604051639996b31560e01b81526001600160a01b0385166004820152602401610a31565b5080610ac8565b8051156124665780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b60405180606001604052805f80191681526020015f6001600160401b031681526020016124bd60405180604001604052805f81526020015f81525090565b905290565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f610ac860208301846124c2565b6001600160a01b038116811461128b575f80fd5b5f8060408385031215612527575f80fd5b823561253281612502565b946020939093013593505050565b5f60e08284031215612550575f80fd5b50919050565b5f60208284031215612566575f80fd5b81356001600160401b0381111561257b575f80fd5b610c6884828501612540565b83518152602080850151908201525f60a08201604060a0604085015281865180845260c08601915060c08160051b870101935060208089015f5b838110156126005788870360bf190185528151805188528301518388018790526125ed878901826124c2565b97505093820193908201906001016125c1565b50508751606088015250505060208501516080850152509050610c68565b5f60608284031215612550575f80fd5b5f8083601f84011261263e575f80fd5b5081356001600160401b03811115612654575f80fd5b60208301915083602082850101111561266b575f80fd5b9250929050565b5f805f805f805f60e0888a031215612688575f80fd5b612692898961261e565b96506060880135955060808801356001600160401b03808211156126b4575f80fd5b6126c08b838c0161262e565b909750955060a08a013591506126d582612502565b90935060c089013590808211156126ea575f80fd5b506126f78a828b0161262e565b989b979a50959850939692959293505050565b5f805f6060848603121561271c575f80fd5b833561272781612502565b9250602084013561273781612502565b929592945050506040919091013590565b803563ffffffff8116811461275b575f80fd5b919050565b5f8060408385031215612771575f80fd5b61253283612748565b801515811461128b575f80fd5b5f8060408385031215612798575f80fd5b82356001600160401b038111156127ad575f80fd5b6127b985828601612540565b92505060208301356127ca8161277a565b809150509250929050565b815181526020808301519082015260408101610919565b803561ffff8116811461275b575f80fd5b5f806040838503121561280e575f80fd5b61281783612748565b9150612825602084016127ec565b90509250929050565b5f6020828403121561283e575f80fd5b8135610ac881612502565b5f805f8060a0858703121561285c575f80fd5b612866868661261e565b935060608501356001600160401b03811115612880575f80fd5b61288c8782880161262e565b90945092505060808501356128a081612502565b939692955090935050565b5f8083601f8401126128bb575f80fd5b5081356001600160401b038111156128d1575f80fd5b6020830191508360208260051b850101111561266b575f80fd5b5f80602083850312156128fc575f80fd5b82356001600160401b03811115612911575f80fd5b61291d858286016128ab565b90969095509350505050565b5f60208284031215612939575f80fd5b610ac882612748565b5f805f8060608587031215612955575f80fd5b61295e85612748565b935061296c602086016127ec565b925060408501356001600160401b03811115612986575f80fd5b6129928782880161262e565b95989497509550505050565b5f805f83850360808112156129b1575f80fd5b84356001600160401b038111156129c6575f80fd5b6129d287828801612540565b9450506040601f19820112156129e6575f80fd5b5060208401915060608401356129fb81612502565b809150509250925092565b5f60c082019050835182526001600160401b0360208501511660208301526040840151612a40604084018280518252602090810151910152565b5082516080830152602083015160a0830152610ac8565b5f8060408385031215612a68575f80fd5b8235612a7381612502565b915060208301356127ca81612502565b5f60608284031215612a93575f80fd5b610ac8838361261e565b600181811c90821680612ab157607f821691505b60208210810361255057634e487b7160e01b5f52602260045260245ffd5b634e487b7160e01b5f52604160045260245ffd5b634e487b7160e01b5f52603260045260245ffd5b604051606081016001600160401b0381118282101715612b1957612b19612acf565b60405290565b604080519081016001600160401b0381118282101715612b1957612b19612acf565b604051601f8201601f191681016001600160401b0381118282101715612b6957612b69612acf565b604052919050565b5f6001600160401b03821115612b8957612b89612acf565b50601f01601f191660200190565b5f6001600160401b0380841115612bb057612bb0612acf565b8360051b6020612bc1818301612b41565b868152918501918181019036841115612bd8575f80fd5b865b84811015612c9357803586811115612bf0575f80fd5b88016060368290031215612c02575f80fd5b612c0a612af7565b612c1382612748565b8152612c208683016127ec565b8682015260408083013589811115612c36575f80fd5b929092019136601f840112612c49575f80fd5b8235612c5c612c5782612b71565b612b41565b8181523689838701011115612c6f575f80fd5b818986018a8301375f91810189019190915290820152845250918301918301612bda565b50979650505050505050565b5f8085851115612cad575f80fd5b83861115612cb9575f80fd5b5050820193919092039150565b5f81518060208401855e5f93019283525090919050565b5f612ce88286612cc6565b838582375f930192835250909392505050565b81835281816020850137505f828201602090810191909152601f909101601f19169091010190565b602081525f610c68602083018486612cfb565b5f823561013e19833603018112612d4b575f80fd5b9190910192915050565b5f808335601e19843603018112612d6a575f80fd5b8301803591506001600160401b03821115612d83575f80fd5b60200191503681900382131561266b575f80fd5b6001600160401b038116811461128b575f80fd5b63ffffffff612db989612748565b168152602088013560208201525f6040890135612dd581612d97565b6001600160401b03811660408401525087606083015260e06080830152612e0060e083018789612cfb565b6001600160a01b03861660a084015282810360c0840152612e22818587612cfb565b9a9950505050505050505050565b5f60208284031215612e40575f80fd5b81516001600160401b03811115612e55575f80fd5b8201601f81018413612e65575f80fd5b8051612e73612c5782612b71565b818152856020838501011115612e87575f80fd5b8160208401602083015e5f91810160200191909152949350505050565b5f60208284031215612eb4575f80fd5b8135610ac881612d97565b60018060a01b038516815283602082015261ffff83166040820152608060608201525f610b3f60808301846124c2565b604081525f612f0160408301856124c2565b828103602084015261182081856124c2565b5f60208284031215612f23575f80fd5b8151610ac88161277a565b6040815263ffffffff8351166040820152602083015160608201525f604084015160a06080840152612f6360e08401826124c2565b90506060850151603f198483030160a0850152612f8082826124c2565b60809690960151151560c08501525050506001600160a01b039190911660209091015290565b5f60408284031215612fb6575f80fd5b612fbe612b1f565b9050815181526020820151602082015292915050565b5f60408284031215612fe4575f80fd5b610ac88383612fa6565b601f821115610d4457805f5260205f20601f840160051c810160208510156130135750805b601f840160051c820191505b818110156111c5575f815560010161301f565b81516001600160401b0381111561304b5761304b612acf565b61305f816130598454612a9d565b84612fee565b602080601f831160018114613092575f841561307b5750858301515b5f19600386901b1c1916600185901b1785556130e9565b5f85815260208120601f198616915b828110156130c0578886015182559484019460019091019084016130a1565b50858210156130dd57878501515f19600388901b60f8161c191681555b505060018460011b0185555b505050505050565b5f60208083018184528085518083526040925060408601915060408160051b8701018488015f5b8381101561316c57888303603f190185528151805163ffffffff1684528781015161ffff16888501528601516060878501819052613158818601836124c2565b968901969450505090860190600101613118565b509098975050505050505050565b5f6040828403121561318a575f80fd5b613192612b1f565b82358152602083013560208201528091505092915050565b634e487b7160e01b5f52601160045260245ffd5b5f826131d857634e487b7160e01b5f52601260045260245ffd5b500490565b8082028115828204841417610919576109196131aa565b80356020831015610919575f19602084900360031b1b1692915050565b6001600160c01b031981358181169160088510156132395780818660080360031b1b83161692505b505092915050565b60c085901b6001600160c01b031916815260e084901b6001600160e01b0319166008820152600c81018390525f610b3f602c830184612cc6565b80820180821115610919576109196131aa565b8481526001600160401b0360c01b8460c01b1660208201528260288201525f610b3f6048830184612cc6565b61ffff8181168382160190808211156132d5576132d56131aa565b5092915050565b5f6132e78288612cc6565b6001600160f81b031960f888811b821683526001600160f01b031960f089901b16600184015286901b1660038201526133236004820185612cc6565b98975050505050505050565b5f6080828403121561333f575f80fd5b613347612af7565b82518152602083015161335981612d97565b602082015261336b8460408501612fa6565b60408201529392505050565b5f60208284031215613387575f80fd5b8151610ac881612502565b5f610ac88284612cc656fea26469706673582212209f446328d24683dd170fe48c27426571a6db9bb6c23d1c50f2bdebc79956ffd364736f6c6343000819003300000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000006f475642a6e85809b1c36fa62763669b1b48dd5b0000000000000000000000008fa9aa69a6e94c1cd49fbf214c833b2911d02553000000000000000000000000ce672de0d2d38944716c21bca7db1164685af2ac000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000174349414e207969656c64206c61796572204254434c53540000000000000000000000000000000000000000000000000000000000000000000000000000000008796c4254434c5354000000000000000000000000000000000000000000000000

Deployed Bytecode

0x60806040526004361061026a575f3560e01c806382413eac1161014a578063bb0b6a53116100be578063d424388511610078578063d4243885146107b6578063dd62ed3e146107d5578063f2fde38b14610819578063fab8549b14610838578063fc0c546a1461048b578063ff7bd03d14610857575f80fd5b8063bb0b6a5314610706578063bc70b35414610731578063bd815db014610750578063c7c7f5b314610763578063ca5eb5e114610784578063d045a0dc146107a3575f80fd5b80639f68b9641161010f5780639f68b96414610659578063a70658f21461066b578063a9059cbb1461068a578063a98b165f146106a9578063b731ea0a146106c8578063b98bd070146106e7575f80fd5b806382413eac146105c4578063857749b0146105e35780638da5cb5b146105f657806395d89b4114610612578063963efcaa14610626575f80fd5b8063313ce567116101e15780635a0dfe4d116101a65780635a0dfe4d146104bc5780635e280f11146104f15780636fc1b31e1461052457806370a0823114610543578063715018a6146105775780637d25a05e1461058b575f80fd5b8063313ce567146104005780633400288b146104405780633b6f743b1461045f57806352ae28791461048b5780635535d4611461049d575f80fd5b8063134d4f2511610232578063134d4f2514610341578063156a0d0f1461036857806317442b701461038e57806318160ddd146103af5780631f5e1334146103cd57806323b872dd146103e1575f80fd5b806306fdde031461026e578063095ea7b3146102985780630d35b415146102c7578063111ecdad146102f557806313137d651461032c575b5f80fd5b348015610279575f80fd5b50610282610876565b60405161028f91906124f0565b60405180910390f35b3480156102a3575f80fd5b506102b76102b2366004612516565b610906565b604051901515815260200161028f565b3480156102d2575f80fd5b506102e66102e1366004612556565b61091f565b60405161028f93929190612587565b348015610300575f80fd5b50600454610314906001600160a01b031681565b6040516001600160a01b03909116815260200161028f565b61033f61033a366004612672565b6109ea565b005b34801561034c575f80fd5b50610355600281565b60405161ffff909116815260200161028f565b348015610373575f80fd5b506040805162b9270b60e21b8152600160208201520161028f565b348015610399575f80fd5b506040805160018152600260208201520161028f565b3480156103ba575f80fd5b506007545b60405190815260200161028f565b3480156103d8575f80fd5b50610355600181565b3480156103ec575f80fd5b506102b76103fb36600461270a565b610aaa565b34801561040b575f80fd5b507f00000000000000000000000000000000000000000000000000000000000000085b60405160ff909116815260200161028f565b34801561044b575f80fd5b5061033f61045a366004612760565b610acf565b34801561046a575f80fd5b5061047e610479366004612787565b610ae5565b60405161028f91906127d5565b348015610496575f80fd5b5030610314565b3480156104a8575f80fd5b506102826104b73660046127fd565b610b49565b3480156104c7575f80fd5b506102b76104d6366004612760565b63ffffffff919091165f908152600160205260409020541490565b3480156104fc575f80fd5b506103147f0000000000000000000000006f475642a6e85809b1c36fa62763669b1b48dd5b81565b34801561052f575f80fd5b5061033f61053e36600461282e565b610beb565b34801561054e575f80fd5b506103bf61055d36600461282e565b6001600160a01b03165f9081526005602052604090205490565b348015610582575f80fd5b5061033f610c48565b348015610596575f80fd5b506105ac6105a5366004612760565b5f92915050565b6040516001600160401b03909116815260200161028f565b3480156105cf575f80fd5b506102b76105de366004612849565b610c5b565b3480156105ee575f80fd5b50600661042e565b348015610601575f80fd5b505f546001600160a01b0316610314565b34801561061d575f80fd5b50610282610c70565b348015610631575f80fd5b506103bf7f000000000000000000000000000000000000000000000000000000000000006481565b348015610664575f80fd5b505f6102b7565b348015610676575f80fd5b5061033f610685366004612760565b610c7f565b348015610695575f80fd5b506102b76106a4366004612516565b610d49565b3480156106b4575f80fd5b50600a54610314906001600160a01b031681565b3480156106d3575f80fd5b50600254610314906001600160a01b031681565b3480156106f2575f80fd5b5061033f6107013660046128eb565b610d56565b348015610711575f80fd5b506103bf610720366004612929565b60016020525f908152604090205481565b34801561073c575f80fd5b5061028261074b366004612942565b610d70565b61033f61075e3660046128eb565b610f11565b61077661077136600461299e565b611091565b60405161028f929190612a06565b34801561078f575f80fd5b5061033f61079e36600461282e565b61114b565b61033f6107b1366004612672565b6111cc565b3480156107c1575f80fd5b5061033f6107d036600461282e565b6111fb565b3480156107e0575f80fd5b506103bf6107ef366004612a57565b6001600160a01b039182165f90815260066020908152604080832093909416825291909152205490565b348015610824575f80fd5b5061033f61083336600461282e565b611251565b348015610843575f80fd5b5061033f61085236600461282e565b61128e565b348015610862575f80fd5b506102b7610871366004612a83565b6112b8565b60606008805461088590612a9d565b80601f01602080910402602001604051908101604052809291908181526020018280546108b190612a9d565b80156108fc5780601f106108d3576101008083540402835291602001916108fc565b820191905f5260205f20905b8154815290600101906020018083116108df57829003601f168201915b5050505050905090565b5f336109138185856112ec565b60019150505b92915050565b604080518082019091525f8082526020820152606061094f60405180604001604052805f81526020015f81525090565b6040805180820182525f8082526001600160401b036020808401829052845183815290810190945291955091826109a8565b604080518082019091525f8152606060208201528152602001906001900390816109815790505b5093505f806109cc604089013560608a01356109c760208c018c612929565b6112f9565b60408051808201909152918252602082015296989597505050505050565b7f0000000000000000000000006f475642a6e85809b1c36fa62763669b1b48dd5b6001600160a01b03163314610a3a576040516391ac5e4f60e01b81523360048201526024015b60405180910390fd5b60208701803590610a5490610a4f908a612929565b61133c565b14610a9257610a666020880188612929565b60405163309afaf360e21b815263ffffffff909116600482015260208801356024820152604401610a31565b610aa187878787878787611377565b50505050505050565b5f33610ab78582856114d5565b610ac2858585611550565b60019150505b9392505050565b610ad76115ad565b610ae182826115d9565b5050565b604080518082019091525f80825260208201525f610b13604085013560608601356109c76020880188612929565b9150505f80610b22868461162d565b9092509050610b3f610b376020880188612929565b83838861174b565b9695505050505050565b600360209081525f928352604080842090915290825290208054610b6c90612a9d565b80601f0160208091040260200160405190810160405280929190818152602001828054610b9890612a9d565b8015610be35780601f10610bba57610100808354040283529160200191610be3565b820191905f5260205f20905b815481529060010190602001808311610bc657829003601f168201915b505050505081565b610bf36115ad565b600480546001600160a01b0319166001600160a01b0383169081179091556040519081527ff0be4f1e87349231d80c36b33f9e8639658eeaf474014dee15a3e6a4d4414197906020015b60405180910390a150565b610c506115ad565b610c595f611829565b565b6001600160a01b03811630145b949350505050565b60606009805461088590612a9d565b610c876115ad565b6040805160018082528183019092525f91816020015b60408051606080820183525f808352602083015291810191909152815260200190600190039081610c9d5750506040805160608101825263ffffffff86168152600160208201529192508101610d1b845f610d1460408051600360f01b602082015281516002818303018152602290910190915290565b9190611878565b815250815f81518110610d3057610d30612ae3565b6020026020010181905250610d44816118d3565b505050565b5f33610913818585611550565b610d5e6115ad565b610ae1610d6b8284612b97565b6118d3565b63ffffffff84165f90815260036020908152604080832061ffff87168452909152812080546060929190610da390612a9d565b80601f0160208091040260200160405190810160405280929190818152602001828054610dcf90612a9d565b8015610e1a5780601f10610df157610100808354040283529160200191610e1a565b820191905f5260205f20905b815481529060010190602001808311610dfd57829003601f168201915b5050505050905080515f03610e685783838080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250929450610c689350505050565b5f839003610e77579050610c68565b60028310610ef457610ebd84848080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152506119d492505050565b80610ecb8460028188612c9f565b604051602001610edd93929190612cdd565b604051602081830303815290604052915050610c68565b8383604051639a6d49cd60e01b8152600401610a31929190612d23565b5f5b818110156110145736838383818110610f2e57610f2e612ae3565b9050602002810190610f409190612d36565b9050610f72610f526020830183612929565b602083013563ffffffff919091165f908152600160205260409020541490565b610f7c575061100c565b3063d045a0dc60c08301358360a0810135610f9b610100830183612d55565b610fac610100890160e08a0161282e565b610fba6101208a018a612d55565b6040518963ffffffff1660e01b8152600401610fdc9796959493929190612dab565b5f604051808303818588803b158015610ff3575f80fd5b505af1158015611005573d5f803e3d5ffd5b5050505050505b600101610f13565b50336001600160a01b0316638e9e70996040518163ffffffff1660e01b81526004015f60405180830381865afa158015611050573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526110779190810190612e30565b604051638351eea760e01b8152600401610a3191906124f0565b61109961247f565b604080518082019091525f80825260208201523360408601356110bf6020880188612929565b600a54604051633f6d5c5360e11b81526001600160a01b0385811660048301526024820185905263ffffffff93909316604482018190529290911690637edab8a6906064015f604051808303815f87803b15801561111b575f80fd5b505af115801561112d573d5f803e3d5ffd5b5050505061113c888888611a00565b94509450505050935093915050565b6111536115ad565b60405163ca5eb5e160e01b81526001600160a01b0382811660048301527f0000000000000000000000006f475642a6e85809b1c36fa62763669b1b48dd5b169063ca5eb5e1906024015f604051808303815f87803b1580156111b3575f80fd5b505af11580156111c5573d5f803e3d5ffd5b5050505050565b3330146111ec5760405163029a949d60e31b815260040160405180910390fd5b610aa187878787878787610a92565b6112036115ad565b600280546001600160a01b0319166001600160a01b0383169081179091556040519081527fd48d879cef83a1c0bdda516f27b13ddb1b3f8bbac1c9e1511bb2a659c242776090602001610c3d565b6112596115ad565b6001600160a01b03811661128257604051631e4fbdf760e01b81525f6004820152602401610a31565b61128b81611829565b50565b6112966115ad565b600a80546001600160a01b0319166001600160a01b0392909216919091179055565b5f6020820180359060019083906112cf9086612929565b63ffffffff16815260208101919091526040015f20541492915050565b610d448383836001611af8565b5f8061130485611bca565b915081905083811015611334576040516371c4efed60e01b81526004810182905260248101859052604401610a31565b935093915050565b63ffffffff81165f90815260016020526040812054806109195760405163f6ff4fb760e01b815263ffffffff84166004820152602401610a31565b5f6113886113858787611c00565b90565b90505f6113b3826113a161139c8a8a611c17565b611c39565b6113ae60208d018d612929565b611c6d565b90506028861115611473575f6113ef6113d260608c0160408d01612ea4565b6113df60208d018d612929565b846113ea8c8c611c94565b611cde565b604051633e5ac80960e11b81529091506001600160a01b037f0000000000000000000000006f475642a6e85809b1c36fa62763669b1b48dd5b1690637cb59012906114449086908d905f908790600401612ebf565b5f604051808303815f87803b15801561145b575f80fd5b505af115801561146d573d5f803e3d5ffd5b50505050505b6001600160a01b038216887fefed6d3500546b29533b128a29e3a94d70788727f0507505ac12eaf2e578fd9c6114ac60208d018d612929565b6040805163ffffffff9092168252602082018690520160405180910390a3505050505050505050565b6001600160a01b038381165f908152600660209081526040808320938616835292905220545f19811461154a578181101561153c57604051637dc7a0d960e11b81526001600160a01b03841660048201526024810182905260448101839052606401610a31565b61154a84848484035f611af8565b50505050565b6001600160a01b03831661157957604051634b637e8f60e11b81525f6004820152602401610a31565b6001600160a01b0382166115a25760405163ec442f0560e01b81525f6004820152602401610a31565b610d44838383611d10565b5f546001600160a01b03163314610c595760405163118cdaa760e01b8152336004820152602401610a31565b63ffffffff82165f81815260016020908152604091829020849055815192835282018390527f238399d427b947898edb290f5ff0f9109849b1c3ba196a42e35f00c50a54b98b910160405180910390a15050565b6060805f611688856020013561164286611e36565b61164f60a0890189612d55565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250611e6192505050565b90935090505f8161169a57600161169d565b60025b90506116bd6116af6020880188612929565b8261074b60808a018a612d55565b6004549093506001600160a01b031680156117415760405163043a78eb60e01b81526001600160a01b0382169063043a78eb906117009088908890600401612eef565b602060405180830381865afa15801561171b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061173f9190612f13565b505b5050509250929050565b604080518082019091525f80825260208201527f0000000000000000000000006f475642a6e85809b1c36fa62763669b1b48dd5b6001600160a01b031663ddc28c586040518060a001604052808863ffffffff1681526020016117ad8961133c565b8152602001878152602001868152602001851515815250306040518363ffffffff1660e01b81526004016117e2929190612f2e565b6040805180830381865afa1580156117fc573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906118209190612fd4565b95945050505050565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060836003611887825f611edb565b61ffff16146118ba5761189a815f611edb565b604051633a51740d60e01b815261ffff9091166004820152602401610a31565b5f6118c58585611f37565b9050610b3f86600183611fb9565b5f5b81518110156119a4576119048282815181106118f3576118f3612ae3565b6020026020010151604001516119d4565b81818151811061191657611916612ae3565b60200260200101516040015160035f84848151811061193757611937612ae3565b60200260200101515f015163ffffffff1663ffffffff1681526020019081526020015f205f84848151811061196e5761196e612ae3565b60200260200101516020015161ffff1661ffff1681526020019081526020015f20908161199b9190613032565b506001016118d5565b507fbe4864a8e820971c0247f5992e2da559595f7bf076a21cb5928d443d2a13b67481604051610c3d91906130f1565b600281015161ffff8116600314610ae15781604051639a6d49cd60e01b8152600401610a3191906124f0565b611a0861247f565b604080518082019091525f80825260208201525f80611a3d33604089013560608a0135611a3860208c018c612929565b612022565b915091505f80611a4d898461162d565b9092509050611a79611a6260208b018b612929565b8383611a73368d90038d018d61317a565b8b612047565b60408051808201909152858152602080820186905282519298509096503391907f85496b760a4b7f8d66384b9df21b381f5d1b1e79f229a47aaf4c232edc2fe59a90611ac7908d018d612929565b6040805163ffffffff909216825260208201899052810187905260600160405180910390a350505050935093915050565b6001600160a01b038416611b215760405163e602df0560e01b81525f6004820152602401610a31565b6001600160a01b038316611b4a57604051634a1406b160e11b81525f6004820152602401610a31565b6001600160a01b038085165f908152600660209081526040808320938716835292905220829055801561154a57826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051611bbc91815260200190565b60405180910390a350505050565b5f7f0000000000000000000000000000000000000000000000000000000000000064611bf681846131be565b61091991906131dd565b5f611c0e6020828486612c9f565b610ac8916131f4565b5f611c26602860208486612c9f565b611c2f91613211565b60c01c9392505050565b5f6109197f00000000000000000000000000000000000000000000000000000000000000646001600160401b0384166131dd565b5f6001600160a01b038416611c825761dead93505b611c8c848461214d565b509092915050565b6060611ca38260288186612c9f565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250929695505050505050565b606084848484604051602001611cf79493929190613241565b6040516020818303038152906040529050949350505050565b6001600160a01b038316611d3a578060075f828254611d2f919061327b565b90915550611daa9050565b6001600160a01b0383165f9081526005602052604090205481811015611d8c5760405163391434e360e21b81526001600160a01b03851660048201526024810182905260448101839052606401610a31565b6001600160a01b0384165f9081526005602052604090209082900390555b6001600160a01b038216611dc657600780548290039055611de4565b6001600160a01b0382165f9081526005602052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051611e2991815260200190565b60405180910390a3505050565b5f6109197f0000000000000000000000000000000000000000000000000000000000000064836131be565b8051606090151580611eaa578484604051602001611e9692919091825260c01b6001600160c01b031916602082015260280190565b604051602081830303815290604052611ed1565b84843385604051602001611ec1949392919061328e565b6040516020818303038152906040525b9150935093915050565b5f611ee782600261327b565b83511015611f2e5760405162461bcd60e51b8152602060048201526014602482015273746f55696e7431365f6f75744f66426f756e647360601b6044820152606401610a31565b50016002015190565b60606fffffffffffffffffffffffffffffffff821615611f8857604080516001600160801b0319608086811b8216602084015285901b16603082015201604051602081830303815290604052610ac8565b6040516001600160801b0319608085901b166020820152603001604051602081830303815290604052905092915050565b6060836003611fc8825f611edb565b61ffff1614611fdb5761189a815f611edb565b846001611fe88551612181565b611ff39060016132ba565b86866040516020016120099594939291906132dc565b6040516020818303038152906040529150509392505050565b5f8061202f8585856112f9565b909250905061203e86836121b3565b94509492505050565b61204f61247f565b5f61205c845f01516121e7565b60208501519091501561207657612076846020015161220a565b7f0000000000000000000000006f475642a6e85809b1c36fa62763669b1b48dd5b6001600160a01b0316632637a450826040518060a001604052808b63ffffffff1681526020016120c68c61133c565b81526020018a81526020018981526020015f8960200151111515815250866040518463ffffffff1660e01b8152600401612101929190612f2e565b60806040518083038185885af115801561211d573d5f803e3d5ffd5b50505050506040513d601f19601f82011682018060405250810190612142919061332f565b979650505050505050565b6001600160a01b0382166121765760405163ec442f0560e01b81525f6004820152602401610a31565b610ae15f8383611d10565b5f61ffff8211156121af576040516306dfcc6560e41b81526010600482015260248101839052604401610a31565b5090565b6001600160a01b0382166121dc57604051634b637e8f60e11b81525f6004820152602401610a31565b610ae1825f83611d10565b5f8134146121af576040516304fb820960e51b8152346004820152602401610a31565b5f7f0000000000000000000000006f475642a6e85809b1c36fa62763669b1b48dd5b6001600160a01b031663e4fe1d946040518163ffffffff1660e01b8152600401602060405180830381865afa158015612267573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061228b9190613377565b90506001600160a01b0381166122b4576040516329b99a9560e11b815260040160405180910390fd5b6040805133602482018190527f0000000000000000000000006f475642a6e85809b1c36fa62763669b1b48dd5b6001600160a01b03818116604485015260648085018890528551808603909101815260849094019094526020830180516001600160e01b03166323b872dd60e01b179052610ae193851692869061154a9085905f61233f838361238c565b905080515f141580156123635750808060200190518101906123619190612f13565b155b15610d4457604051635274afe760e01b81526001600160a01b0384166004820152602401610a31565b6060610ac883835f845f80856001600160a01b031684866040516123b09190613392565b5f6040518083038185875af1925050503d805f81146123ea576040519150601f19603f3d011682016040523d82523d5f602084013e6123ef565b606091505b5091509150610b3f86838360608261240f5761240a82612456565b610ac8565b815115801561242657506001600160a01b0384163b155b1561244f57604051639996b31560e01b81526001600160a01b0385166004820152602401610a31565b5080610ac8565b8051156124665780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b60405180606001604052805f80191681526020015f6001600160401b031681526020016124bd60405180604001604052805f81526020015f81525090565b905290565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f610ac860208301846124c2565b6001600160a01b038116811461128b575f80fd5b5f8060408385031215612527575f80fd5b823561253281612502565b946020939093013593505050565b5f60e08284031215612550575f80fd5b50919050565b5f60208284031215612566575f80fd5b81356001600160401b0381111561257b575f80fd5b610c6884828501612540565b83518152602080850151908201525f60a08201604060a0604085015281865180845260c08601915060c08160051b870101935060208089015f5b838110156126005788870360bf190185528151805188528301518388018790526125ed878901826124c2565b97505093820193908201906001016125c1565b50508751606088015250505060208501516080850152509050610c68565b5f60608284031215612550575f80fd5b5f8083601f84011261263e575f80fd5b5081356001600160401b03811115612654575f80fd5b60208301915083602082850101111561266b575f80fd5b9250929050565b5f805f805f805f60e0888a031215612688575f80fd5b612692898961261e565b96506060880135955060808801356001600160401b03808211156126b4575f80fd5b6126c08b838c0161262e565b909750955060a08a013591506126d582612502565b90935060c089013590808211156126ea575f80fd5b506126f78a828b0161262e565b989b979a50959850939692959293505050565b5f805f6060848603121561271c575f80fd5b833561272781612502565b9250602084013561273781612502565b929592945050506040919091013590565b803563ffffffff8116811461275b575f80fd5b919050565b5f8060408385031215612771575f80fd5b61253283612748565b801515811461128b575f80fd5b5f8060408385031215612798575f80fd5b82356001600160401b038111156127ad575f80fd5b6127b985828601612540565b92505060208301356127ca8161277a565b809150509250929050565b815181526020808301519082015260408101610919565b803561ffff8116811461275b575f80fd5b5f806040838503121561280e575f80fd5b61281783612748565b9150612825602084016127ec565b90509250929050565b5f6020828403121561283e575f80fd5b8135610ac881612502565b5f805f8060a0858703121561285c575f80fd5b612866868661261e565b935060608501356001600160401b03811115612880575f80fd5b61288c8782880161262e565b90945092505060808501356128a081612502565b939692955090935050565b5f8083601f8401126128bb575f80fd5b5081356001600160401b038111156128d1575f80fd5b6020830191508360208260051b850101111561266b575f80fd5b5f80602083850312156128fc575f80fd5b82356001600160401b03811115612911575f80fd5b61291d858286016128ab565b90969095509350505050565b5f60208284031215612939575f80fd5b610ac882612748565b5f805f8060608587031215612955575f80fd5b61295e85612748565b935061296c602086016127ec565b925060408501356001600160401b03811115612986575f80fd5b6129928782880161262e565b95989497509550505050565b5f805f83850360808112156129b1575f80fd5b84356001600160401b038111156129c6575f80fd5b6129d287828801612540565b9450506040601f19820112156129e6575f80fd5b5060208401915060608401356129fb81612502565b809150509250925092565b5f60c082019050835182526001600160401b0360208501511660208301526040840151612a40604084018280518252602090810151910152565b5082516080830152602083015160a0830152610ac8565b5f8060408385031215612a68575f80fd5b8235612a7381612502565b915060208301356127ca81612502565b5f60608284031215612a93575f80fd5b610ac8838361261e565b600181811c90821680612ab157607f821691505b60208210810361255057634e487b7160e01b5f52602260045260245ffd5b634e487b7160e01b5f52604160045260245ffd5b634e487b7160e01b5f52603260045260245ffd5b604051606081016001600160401b0381118282101715612b1957612b19612acf565b60405290565b604080519081016001600160401b0381118282101715612b1957612b19612acf565b604051601f8201601f191681016001600160401b0381118282101715612b6957612b69612acf565b604052919050565b5f6001600160401b03821115612b8957612b89612acf565b50601f01601f191660200190565b5f6001600160401b0380841115612bb057612bb0612acf565b8360051b6020612bc1818301612b41565b868152918501918181019036841115612bd8575f80fd5b865b84811015612c9357803586811115612bf0575f80fd5b88016060368290031215612c02575f80fd5b612c0a612af7565b612c1382612748565b8152612c208683016127ec565b8682015260408083013589811115612c36575f80fd5b929092019136601f840112612c49575f80fd5b8235612c5c612c5782612b71565b612b41565b8181523689838701011115612c6f575f80fd5b818986018a8301375f91810189019190915290820152845250918301918301612bda565b50979650505050505050565b5f8085851115612cad575f80fd5b83861115612cb9575f80fd5b5050820193919092039150565b5f81518060208401855e5f93019283525090919050565b5f612ce88286612cc6565b838582375f930192835250909392505050565b81835281816020850137505f828201602090810191909152601f909101601f19169091010190565b602081525f610c68602083018486612cfb565b5f823561013e19833603018112612d4b575f80fd5b9190910192915050565b5f808335601e19843603018112612d6a575f80fd5b8301803591506001600160401b03821115612d83575f80fd5b60200191503681900382131561266b575f80fd5b6001600160401b038116811461128b575f80fd5b63ffffffff612db989612748565b168152602088013560208201525f6040890135612dd581612d97565b6001600160401b03811660408401525087606083015260e06080830152612e0060e083018789612cfb565b6001600160a01b03861660a084015282810360c0840152612e22818587612cfb565b9a9950505050505050505050565b5f60208284031215612e40575f80fd5b81516001600160401b03811115612e55575f80fd5b8201601f81018413612e65575f80fd5b8051612e73612c5782612b71565b818152856020838501011115612e87575f80fd5b8160208401602083015e5f91810160200191909152949350505050565b5f60208284031215612eb4575f80fd5b8135610ac881612d97565b60018060a01b038516815283602082015261ffff83166040820152608060608201525f610b3f60808301846124c2565b604081525f612f0160408301856124c2565b828103602084015261182081856124c2565b5f60208284031215612f23575f80fd5b8151610ac88161277a565b6040815263ffffffff8351166040820152602083015160608201525f604084015160a06080840152612f6360e08401826124c2565b90506060850151603f198483030160a0850152612f8082826124c2565b60809690960151151560c08501525050506001600160a01b039190911660209091015290565b5f60408284031215612fb6575f80fd5b612fbe612b1f565b9050815181526020820151602082015292915050565b5f60408284031215612fe4575f80fd5b610ac88383612fa6565b601f821115610d4457805f5260205f20601f840160051c810160208510156130135750805b601f840160051c820191505b818110156111c5575f815560010161301f565b81516001600160401b0381111561304b5761304b612acf565b61305f816130598454612a9d565b84612fee565b602080601f831160018114613092575f841561307b5750858301515b5f19600386901b1c1916600185901b1785556130e9565b5f85815260208120601f198616915b828110156130c0578886015182559484019460019091019084016130a1565b50858210156130dd57878501515f19600388901b60f8161c191681555b505060018460011b0185555b505050505050565b5f60208083018184528085518083526040925060408601915060408160051b8701018488015f5b8381101561316c57888303603f190185528151805163ffffffff1684528781015161ffff16888501528601516060878501819052613158818601836124c2565b968901969450505090860190600101613118565b509098975050505050505050565b5f6040828403121561318a575f80fd5b613192612b1f565b82358152602083013560208201528091505092915050565b634e487b7160e01b5f52601160045260245ffd5b5f826131d857634e487b7160e01b5f52601260045260245ffd5b500490565b8082028115828204841417610919576109196131aa565b80356020831015610919575f19602084900360031b1b1692915050565b6001600160c01b031981358181169160088510156132395780818660080360031b1b83161692505b505092915050565b60c085901b6001600160c01b031916815260e084901b6001600160e01b0319166008820152600c81018390525f610b3f602c830184612cc6565b80820180821115610919576109196131aa565b8481526001600160401b0360c01b8460c01b1660208201528260288201525f610b3f6048830184612cc6565b61ffff8181168382160190808211156132d5576132d56131aa565b5092915050565b5f6132e78288612cc6565b6001600160f81b031960f888811b821683526001600160f01b031960f089901b16600184015286901b1660038201526133236004820185612cc6565b98975050505050505050565b5f6080828403121561333f575f80fd5b613347612af7565b82518152602083015161335981612d97565b602082015261336b8460408501612fa6565b60408201529392505050565b5f60208284031215613387575f80fd5b8151610ac881612502565b5f610ac88284612cc656fea26469706673582212209f446328d24683dd170fe48c27426571a6db9bb6c23d1c50f2bdebc79956ffd364736f6c63430008190033

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

00000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000006f475642a6e85809b1c36fa62763669b1b48dd5b0000000000000000000000008fa9aa69a6e94c1cd49fbf214c833b2911d02553000000000000000000000000ce672de0d2d38944716c21bca7db1164685af2ac000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000174349414e207969656c64206c61796572204254434c53540000000000000000000000000000000000000000000000000000000000000000000000000000000008796c4254434c5354000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _name (string): CIAN yield layer BTCLST
Arg [1] : _symbol (string): ylBTCLST
Arg [2] : _endpoint (address): 0x6F475642a6e85809B1c36Fa62763669b1b48DD5B
Arg [3] : _delegate (address): 0x8FA9aa69a6e94c1cd49FbF214C833B2911D02553
Arg [4] : _flowControl (address): 0xCe672de0D2d38944716c21BCA7DB1164685Af2aC
Arg [5] : _decimals (uint8): 8

-----Encoded View---------------
10 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000100
Arg [2] : 0000000000000000000000006f475642a6e85809b1c36fa62763669b1b48dd5b
Arg [3] : 0000000000000000000000008fa9aa69a6e94c1cd49fbf214c833b2911d02553
Arg [4] : 000000000000000000000000ce672de0d2d38944716c21bca7db1164685af2ac
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000008
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000017
Arg [7] : 4349414e207969656c64206c61796572204254434c5354000000000000000000
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000008
Arg [9] : 796c4254434c5354000000000000000000000000000000000000000000000000


Deployed Bytecode Sourcemap

663:4423:59:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2074:89:46;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;4293:186;;;;;;;;;;-1:-1:-1;4293:186:46;;;;;:::i;:::-;;:::i;:::-;;;1154:14:64;;1147:22;1129:41;;1117:2;1102:18;4293:186:46;989:187:64;5052:1258:29;;;;;;;;;;-1:-1:-1;5052:1258:29;;;;;:::i;:::-;;:::i;:::-;;;;;;;;;:::i;2256:27::-;;;;;;;;;;-1:-1:-1;2256:27:29;;;;-1:-1:-1;;;;;2256:27:29;;;;;;-1:-1:-1;;;;;3368:32:64;;;3350:51;;3338:2;3323:18;2256:27:29;3204:203:64;4368:708:16;;;;;;:::i;:::-;;:::i;:::-;;2130:40:29;;;;;;;;;;;;2169:1;2130:40;;;;;5149:6:64;5137:19;;;5119:38;;5107:2;5092:18;2130:40:29;4975:188:64;3401:140:29;;;;;;;;;;-1:-1:-1;3401:140:29;;;-1:-1:-1;;;5338:52:64;;3532:1:29;5421:2:64;5406:18;;5399:59;5311:18;3401:140:29;5168:296:64;1287:235:14;;;;;;;;;;-1:-1:-1;1287:235:14;;;843:1:17;5676:34:64;;678:1:16;5741:2:64;5726:18;;5719:43;5612:18;1287:235:14;5469:299:64;3144:97:46;;;;;;;;;;-1:-1:-1;3222:12:46;;3144:97;;;5919:25:64;;;5907:2;5892:18;3144:97:46;5773:177:64;2093:31:29;;;;;;;;;;;;2123:1;2093:31;;5039:244:46;;;;;;;;;;-1:-1:-1;5039:244:46;;;;;:::i;:::-;;:::i;1289:88:59:-;;;;;;;;;;-1:-1:-1;1363:7:59;1289:88;;;6588:4:64;6576:17;;;6558:36;;6546:2;6531:18;1289:88:59;6416:184:64;1724:108:15;;;;;;;;;;-1:-1:-1;1724:108:15;;;;;:::i;:::-;;:::i;6761:774:29:-;;;;;;;;;;-1:-1:-1;6761:774:29;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;875:93:24:-;;;;;;;;;;-1:-1:-1;956:4:24;875:93;;538::22;;;;;;;;;;-1:-1:-1;538:93:22;;;;;:::i;:::-;;:::i;16009:132:29:-;;;;;;;;;;-1:-1:-1;16009:132:29;;;;;:::i;:::-;16114:11;;;;;16091:4;16114:11;;;:5;:11;;;;;;:20;;16009:132;446:46:15;;;;;;;;;;;;;;;4583:163:29;;;;;;;;;;-1:-1:-1;4583:163:29;;;;;:::i;:::-;;:::i;3299:116:46:-;;;;;;;;;;-1:-1:-1;3299:116:46;;;;;:::i;:::-;-1:-1:-1;;;;;3390:18:46;3364:7;3390:18;;;:9;:18;;;;;;;3299:116;2293:101:37;;;;;;;;;;;;;:::i;3507:128:16:-;;;;;;;;;;-1:-1:-1;3507:128:16;;;;;:::i;:::-;3596:12;3507:128;;;;;;;;-1:-1:-1;;;;;9206:31:64;;;9188:50;;9176:2;9161:18;3507:128:16;9044:200:64;2013:216:16;;;;;;;;;;-1:-1:-1;2013:216:16;;;;;:::i;:::-;;:::i;4148:87:29:-;;;;;;;;;;-1:-1:-1;4227:1:29;4148:87;;1638:85:37;;;;;;;;;;-1:-1:-1;1684:7:37;1710:6;-1:-1:-1;;;;;1710:6:37;1638:85;;2276:93:46;;;;;;;;;;;;;:::i;1787:46:29:-;;;;;;;;;;;;;;;3143:94:59;;;;;;;;;;-1:-1:-1;3202:4:59;3143:94;;1679:459;;;;;;;;;;-1:-1:-1;1679:459:59;;;;;:::i;:::-;;:::i;3610:178:46:-;;;;;;;;;;-1:-1:-1;3610:178:46;;;;;:::i;:::-;;:::i;780:26:59:-;;;;;;;;;;-1:-1:-1;780:26:59;;;;-1:-1:-1;;;;;780:26:59;;;559:23:24;;;;;;;;;;-1:-1:-1;559:23:24;;;;-1:-1:-1;;;;;559:23:24;;;1391:156:22;;;;;;;;;;-1:-1:-1;1391:156:22;;;;;:::i;:::-;;:::i;569:48:15:-;;;;;;;;;;-1:-1:-1;569:48:15;;;;;:::i;:::-;;;;;;;;;;;;;;3510:981:22;;;;;;;;;;-1:-1:-1;3510:981:22;;;;;:::i;:::-;;:::i;1698:1333:24:-;;;;;;:::i;:::-;;:::i;2144:388:59:-;;;;;;:::i;:::-;;:::i;:::-;;;;;;;;:::i;3252:105:15:-;;;;;;;;;;-1:-1:-1;3252:105:15;;;;;:::i;:::-;;:::i;3679:409:24:-;;;;;;:::i;:::-;;:::i;1100:139::-;;;;;;;;;;-1:-1:-1;1100:139:24;;;;;:::i;:::-;;:::i;3846:140:46:-;;;;;;;;;;-1:-1:-1;3846:140:46;;;;;:::i;:::-;-1:-1:-1;;;;;3952:18:46;;;3926:7;3952:18;;;:11;:18;;;;;;;;:27;;;;;;;;;;;;;3846:140;2543:215:37;;;;;;;;;;-1:-1:-1;2543:215:37;;;;;:::i;:::-;;:::i;1562:111:59:-;;;;;;;;;;-1:-1:-1;1562:111:59;;;;;:::i;:::-;;:::i;2771:149:16:-;;;;;;;;;;-1:-1:-1;2771:149:16;;;;;:::i;:::-;;:::i;2074:89:46:-;2119:13;2151:5;2144:12;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2074:89;:::o;4293:186::-;4366:4;735:10:52;4420:31:46;735:10:52;4436:7:46;4445:5;4420:8;:31::i;:::-;4468:4;4461:11;;;4293:186;;;;;:::o;5052:1258:29:-;-1:-1:-1;;;;;;;;;;;;;;;;;5204:35:29;5241:28;-1:-1:-1;;;;;;;;;;;;;;;;;;;5241:28:29;5459:34;;;;;;;;-1:-1:-1;5459:34:29;;;-1:-1:-1;;;;;5459:34:29;;;;;;;5610:21;;;;;;;;;;;5459:34;;-1:-1:-1;;;5610:21:29;;;-1:-1:-1;;;;;;;;;;;;;;;;;5610:21:29;;;;;;;;;;;;;;;-1:-1:-1;5594:37:29;-1:-1:-1;6068:20:29;;6118:120;6142:19;;;;6175:22;;;;6211:17;;;;6142:10;6211:17;:::i;:::-;6118:10;:120::i;:::-;6261:42;;;;;;;;;;;;;;;;5052:1258;;;;-1:-1:-1;;;;;;5052:1258:29:o;4368:708:16:-;4681:8;-1:-1:-1;;;;;4673:31:16;4694:10;4673:31;4669:68;;4713:24;;-1:-1:-1;;;4713:24:16;;4726:10;4713:24;;;3350:51:64;3323:18;;4713:24:16;;;;;;;;4669:68;4873:14;;;;;;4837:32;;4854:14;;4873:7;4854:14;:::i;:::-;4837:16;:32::i;:::-;:50;4833:103;;4905:14;;;;:7;:14;:::i;:::-;4896:40;;-1:-1:-1;;;4896:40:16;;15150:10:64;15138:23;;;4896:40:16;;;15120:42:64;4921:14:16;;;;15178:18:64;;;15171:34;15093:18;;4896:40:16;14948:263:64;4833:103:16;5010:59;5021:7;5030:5;5037:8;;5047:9;5058:10;;5010;:59::i;:::-;4368:708;;;;;;;:::o;5039:244:46:-;5126:4;735:10:52;5182:37:46;5198:4;735:10:52;5213:5:46;5182:15;:37::i;:::-;5229:26;5239:4;5245:2;5249:5;5229:9;:26::i;:::-;5272:4;5265:11;;;5039:244;;;;;;:::o;1724:108:15:-;1531:13:37;:11;:13::i;:::-;1804:21:15::1;1813:4;1819:5;1804:8;:21::i;:::-;1724:108:::0;;:::o;6761:774:29:-;-1:-1:-1;;;;;;;;;;;;;;;;;7095:24:29;7123:74;7134:19;;;;7155:22;;;;7179:17;;;;7134:10;7179:17;:::i;7123:74::-;7092:105;;;7286:20;7308;7332:49;7352:10;7364:16;7332:19;:49::i;:::-;7285:96;;-1:-1:-1;7285:96:29;-1:-1:-1;7470:58:29;7477:17;;;;:10;:17;:::i;:::-;7496:7;7505;7514:13;7470:6;:58::i;:::-;7463:65;6761:774;-1:-1:-1;;;;;;6761:774:29:o;538:93:22:-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;4583:163:29:-;1531:13:37;:11;:13::i;:::-;4666:12:29::1;:28:::0;;-1:-1:-1;;;;;;4666:28:29::1;-1:-1:-1::0;;;;;4666:28:29;::::1;::::0;;::::1;::::0;;;4709:30:::1;::::0;3350:51:64;;;4709:30:29::1;::::0;3338:2:64;3323:18;4709:30:29::1;;;;;;;;4583:163:::0;:::o;2293:101:37:-;1531:13;:11;:13::i;:::-;2357:30:::1;2384:1;2357:18;:30::i;:::-;2293:101::o:0;2013:216:16:-;-1:-1:-1;;;;;2198:24:16;;2217:4;2198:24;2013:216;;;;;;;:::o;2276:93:46:-;2323:13;2355:7;2348:14;;;;;:::i;1679:459:59:-;1531:13:37;:11;:13::i;:::-;1813:28:59::1;::::0;;1839:1:::1;1813:28:::0;;;;;::::1;::::0;;;1765:45:::1;::::0;1813:28:::1;;;;-1:-1:-1::0;;;;;;;;;;;;;;;;;;;;;;;;1813:28:59::1;;;;;;;;;;;;-1:-1:-1::0;;1873:189:59::1;::::0;;::::1;::::0;::::1;::::0;;::::1;::::0;::::1;::::0;;1947:1:::1;1873:189;::::0;::::1;::::0;1765:76;;-1:-1:-1;1873:189:59;;1975:72:::1;2038:4:::0;-1:-1:-1;1975:27:59::1;1370:24:23::0;;;-1:-1:-1;;;1370:24:23;;;26211:51:64;1370:24:23;;;;;;;;;26278:11:64;;;;1370:24:23;;;;1294:107;1975:27:59::1;:54:::0;:72;:54:::1;:72::i;:::-;1873:189;;::::0;1851:16:::1;1868:1;1851:19;;;;;;;;:::i;:::-;;;;;;:211;;;;2072:59;2105:16;2072:19;:59::i;:::-;1755:383;1679:459:::0;;:::o;3610:178:46:-;3679:4;735:10:52;3733:27:46;735:10:52;3750:2:46;3754:5;3733:9;:27::i;1391:156:22:-;1531:13:37;:11;:13::i;:::-;1503:37:22::1;;1523:16:::0;;1503:37:::1;:::i;:::-;:19;:37::i;3510:981::-:0;3701:21;;;3677;3701;;;:15;:21;;;;;;;;:31;;;;;;;;;;3677:55;;3653:12;;3677:21;3701:31;3677:55;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3861:8;:15;3880:1;3861:20;3857:46;;3890:13;;3883:20;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;3883:20:22;;-1:-1:-1;3883:20:22;;-1:-1:-1;;;;3883:20:22;3857:46;3988:1;3964:25;;;3960:46;;3998:8;-1:-1:-1;3991:15:22;;3960:46;4153:1;4129:25;;4125:267;;4170:34;4190:13;;4170:34;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;4170:19:22;;-1:-1:-1;;;4170:34:22:i;:::-;4353:8;4363:17;:13;4377:1;4363:13;;:17;:::i;:::-;4340:41;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;4333:48;;;;;4125:267;4470:13;;4455:29;;-1:-1:-1;;;4455:29:22;;;;;;;;;:::i;1698:1333:24:-;1799:9;1794:1037;1814:19;;;1794:1037;;;1854:29;1886:8;;1895:1;1886:11;;;;;;;:::i;:::-;;;;;;;;;;;;:::i;:::-;1854:43;-1:-1:-1;1980:50:24;1987:20;;;;1854:43;1987:20;:::i;:::-;2009;;;;16114:11:29;;;;;16091:4;16114:11;;;:5;:11;;;;;;:20;;16009:132;1980:50:24;1975:65;;2032:8;;;1975:65;2602:4;:22;2633:12;;;;:6;2696:11;;;;2725:14;;;;2633:6;2725:14;:::i;:::-;2757:15;;;;;;;;:::i;:::-;2790:16;;;;:6;:16;:::i;:::-;2602:218;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1840:991;1794:1037;1835:3;;1794:1037;;;;2988:10;-1:-1:-1;;;;;2978:43:24;;:45;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;2978:45:24;;;;;;;;;;;;:::i;:::-;2961:63;;-1:-1:-1;;;2961:63:24;;;;;;;;:::i;2144:388:59:-;2399:34;;:::i;:::-;-1:-1:-1;;;;;;;;;;;;;;;;;2330:10:59;2342:19;;;;2363:17;;;;2342:10;2363:17;:::i;:::-;1488:11;;1471:67;;-1:-1:-1;;;1471:67:59;;-1:-1:-1;;;;;22422:32:64;;;1471:67:59;;;22404:51:64;22471:18;;;22464:34;;;1383:173:59;;;;;22514:18:64;;;22507:34;;;1383:173:59;1488:11;;;;1471:37;;22377:18:64;;1471:67:59;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2486:39:::1;2492:10;2504:4;2510:14;2486:5;:39::i;:::-;2479:46;;;;2144:388:::0;;;;;;;;;:::o;3252:105:15:-;1531:13:37;:11;:13::i;:::-;3319:31:15::1;::::0;-1:-1:-1;;;3319:31:15;;-1:-1:-1;;;;;3368:32:64;;;3319:31:15::1;::::0;::::1;3350:51:64::0;3319:8:15::1;:20;::::0;::::1;::::0;3323:18:64;;3319:31:15::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;3252:105:::0;:::o;3679:409:24:-;3958:10;3980:4;3958:27;3954:50;;3994:10;;-1:-1:-1;;;3994:10:24;;;;;;;;;;;3954:50;4014:67;4033:7;4042:5;4049:8;;4059:9;4070:10;;4014:18;:67::i;1100:139::-;1531:13:37;:11;:13::i;:::-;1175:8:24::1;:20:::0;;-1:-1:-1;;;;;;1175:20:24::1;-1:-1:-1::0;;;;;1175:20:24;::::1;::::0;;::::1;::::0;;;1210:22:::1;::::0;3350:51:64;;;1210:22:24::1;::::0;3338:2:64;3323:18;1210:22:24::1;3204:203:64::0;2543:215:37;1531:13;:11;:13::i;:::-;-1:-1:-1;;;;;2627:22:37;::::1;2623:91;;2672:31;::::0;-1:-1:-1;;;2672:31:37;;2700:1:::1;2672:31;::::0;::::1;3350:51:64::0;3323:18;;2672:31:37::1;3204:203:64::0;2623:91:37::1;2723:28;2742:8;2723:18;:28::i;:::-;2543:215:::0;:::o;1562:111:59:-;1531:13:37;:11;:13::i;:::-;1640:11:59::1;:26:::0;;-1:-1:-1;;;;;;1640:26:59::1;-1:-1:-1::0;;;;;1640:26:59;;;::::1;::::0;;;::::1;::::0;;1562:111::o;2771:149:16:-;2853:4;2900:13;;;;;;2876:5;;2853:4;;2882:13;;2900:6;2882:13;:::i;:::-;2876:20;;;;;;;;;;;;;-1:-1:-1;2876:20:16;;:37;;2771:149;-1:-1:-1;;2771:149:16:o;8989:128:46:-;9073:37;9082:5;9089:7;9098:5;9105:4;9073:8;:37::i;18026:668:29:-;18168:20;18190:24;18364:22;18376:9;18364:11;:22::i;:::-;18349:37;;18512:12;18493:31;;18594:12;18575:16;:31;18571:117;;;18629:48;;-1:-1:-1;;;18629:48:29;;;;;22726:25:64;;;22767:18;;;22760:34;;;22699:18;;18629:48:29;22552:248:64;18571:117:29;18026:668;;;;;;:::o;2718:196:15:-;2822:11;;;2788:7;2822:11;;;:5;:11;;;;;;;2843:43;;2874:12;;-1:-1:-1;;;2874:12:15;;22979:10:64;22967:23;;2874:12:15;;;22949:42:64;22922:18;;2874:12:15;22805:192:64;12802:1806:29;13279:17;13299:36;:17;:8;;:15;:17::i;:::-;2891:2:32;2780:123;13299:36:29;13279:56;;13468:24;13495:62;13503:9;13514:26;13520:19;:8;;:17;:19::i;:::-;13514:5;:26::i;:::-;13542:14;;;;:7;:14;:::i;:::-;13495:7;:62::i;:::-;13468:89;-1:-1:-1;243:2:32;-1:-1:-1;;13568:955:29;;;13672:23;13698:175;13741:13;;;;;;;;:::i;:::-;13772:14;;;;:7;:14;:::i;:::-;13804:16;13838:21;:8;;:19;:21::i;:::-;13698:25;:175::i;:::-;14420:92;;-1:-1:-1;;;14420:92:29;;13672:201;;-1:-1:-1;;;;;;14420:8:29;:20;;;;:92;;14441:9;;14452:5;;14459:1;;13672:201;;14420:92;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;13595:928;13568:955;-1:-1:-1;;;;;14538:63:29;;14550:5;14538:63;14557:14;;;;:7;:14;:::i;:::-;14538:63;;;15150:10:64;15138:23;;;15120:42;;15193:2;15178:18;;15171:34;;;15093:18;14538:63:29;;;;;;;13105:1503;;12802:1806;;;;;;;:::o;10663:477:46:-;-1:-1:-1;;;;;3952:18:46;;;10762:24;3952:18;;;:11;:18;;;;;;;;:27;;;;;;;;;;-1:-1:-1;;10828:37:46;;10824:310;;10904:5;10885:16;:24;10881:130;;;10936:60;;-1:-1:-1;;;10936:60:46;;-1:-1:-1;;;;;22422:32:64;;10936:60:46;;;22404:51:64;22471:18;;;22464:34;;;22514:18;;;22507:34;;;22377:18;;10936:60:46;22202:345:64;10881:130:46;11052:57;11061:5;11068:7;11096:5;11077:16;:24;11103:5;11052:8;:57::i;:::-;10752:388;10663:477;;;:::o;5656:300::-;-1:-1:-1;;;;;5739:18:46;;5735:86;;5780:30;;-1:-1:-1;;;5780:30:46;;5807:1;5780:30;;;3350:51:64;3323:18;;5780:30:46;3204:203:64;5735:86:46;-1:-1:-1;;;;;5834:16:46;;5830:86;;5873:32;;-1:-1:-1;;;5873:32:46;;5902:1;5873:32;;;3350:51:64;3323:18;;5873:32:46;3204:203:64;5830:86:46;5925:24;5933:4;5939:2;5943:5;5925:7;:24::i;1796:162:37:-;1684:7;1710:6;-1:-1:-1;;;;;1710:6:37;735:10:52;1855:23:37;1851:101;;1901:40;;-1:-1:-1;;;1901:40:37;;735:10:52;1901:40:37;;;3350:51:64;3323:18;;1901:40:37;3204:203:64;2286:134:15;2359:11;;;;;;;:5;:11;;;;;;;;;:19;;;2393:20;;15120:42:64;;;15178:18;;15171:34;;;2393:20:15;;15093:18:64;2393:20:15;;;;;;;2286:134;;:::o;10848:1436:29:-;10980:20;11002;11034:15;11205:324;11237:10;:13;;;11264:16;11270:9;11264:5;:16::i;:::-;11498:21;;;;:10;:21;:::i;:::-;11205:324;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;11205:18:29;;-1:-1:-1;;;11205:324:29:i;:::-;11181:348;;-1:-1:-1;11181:348:29;-1:-1:-1;11609:14:29;11181:348;11626:33;;2123:1;11626:33;;;2169:1;11626:33;11609:50;-1:-1:-1;11781:67:29;11796:17;;;;:10;:17;:::i;:::-;11815:7;11824:23;;;;:10;:23;:::i;11781:67::-;12106:12;;11771:77;;-1:-1:-1;;;;;;12106:12:29;12198:23;;12194:83;;12223:54;;-1:-1:-1;;;12223:54:29;;-1:-1:-1;;;;;12223:36:29;;;;;:54;;12260:7;;12269;;12223:54;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;12194:83;11024:1260;;;10848:1436;;;;;:::o;2038:391:17:-;-1:-1:-1;;;;;;;;;;;;;;;;;2259:8:17;-1:-1:-1;;;;;2259:14:17;;2291:86;;;;;;;;2307:7;2291:86;;;;;;2316:25;2333:7;2316:16;:25::i;:::-;2291:86;;;;2343:8;2291:86;;;;2353:8;2291:86;;;;2363:13;2291:86;;;;;2403:4;2259:163;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;2240:182;2038:391;-1:-1:-1;;;;;2038:391:17:o;2912:187:37:-;2985:16;3004:6;;-1:-1:-1;;;;;3020:17:37;;;-1:-1:-1;;;;;;3020:17:37;;;;;;3052:40;;3004:6;;;;;;;3052:40;;2985:16;3052:40;2975:124;2912:187;:::o;2092:357:23:-;2254:12;2235:8;808:1;1059:20;2235:8;1077:1;1059:17;:20::i;:::-;:30;;;1055:82;;1116:20;:8;1134:1;1116:17;:20::i;:::-;1098:39;;-1:-1:-1;;;1098:39:23;;5149:6:64;5137:19;;;1098:39:23;;;5119:38:64;5092:18;;1098:39:23;4975:188:64;1055:82:23;2278:19:::1;2300:51;2338:4;2344:6;2300:37;:51::i;:::-;2278:73;;2368:74;2386:8;306:1:0;2435:6:23;2368:17;:74::i;2237:514:22:-:0;2345:9;2340:354;2364:16;:23;2360:1;:27;2340:354;;;2522:48;2542:16;2559:1;2542:19;;;;;;;;:::i;:::-;;;;;;;:27;;;2522:19;:48::i;:::-;2656:16;2673:1;2656:19;;;;;;;;:::i;:::-;;;;;;;:27;;;2584:15;:40;2600:16;2617:1;2600:19;;;;;;;;:::i;:::-;;;;;;;:23;;;2584:40;;;;;;;;;;;;;;;:69;2625:16;2642:1;2625:19;;;;;;;;:::i;:::-;;;;;;;:27;;;2584:69;;;;;;;;;;;;;;;:99;;;;;;:::i;:::-;-1:-1:-1;2389:3:22;;2340:354;;;;2709:35;2727:16;2709:35;;;;;;:::i;4631:264::-;4801:1;4787:16;;4781:23;4827:28;;;463:1;4827:28;4823:65;;4879:8;4864:24;;-1:-1:-1;;;4864:24:22;;;;;;;;:::i;9221:1333:29:-;9375:34;;:::i;:::-;-1:-1:-1;;;;;;;;;;;;;;;;;9773:20:29;;9823:140;9843:10;9867:19;;;;9900:22;;;;9936:17;;;;9867:10;9936:17;:::i;:::-;9823:6;:140::i;:::-;9772:191;;;;10052:20;10074;10098:49;10118:10;10130:16;10098:19;:49::i;:::-;10051:96;;-1:-1:-1;10051:96:29;-1:-1:-1;10270:66:29;10278:17;;;;:10;:17;:::i;:::-;10297:7;10306;10270:66;;;;;;;10315:4;10270:66;:::i;:::-;10321:14;10270:7;:66::i;:::-;10402:42;;;;;;;;;;;;;;;;;;;10468:15;;10257:79;;-1:-1:-1;10402:42:29;;-1:-1:-1;10504:10:29;;10468:15;10460:87;;10485:17;;;;:10;:17;:::i;:::-;10460:87;;;30215:10:64;30203:23;;;30185:42;;30258:2;30243:18;;30236:34;;;30286:18;;30279:34;;;30173:2;30158:18;10460:87:29;;;;;;;9441:1113;;;;9221:1333;;;;;;:::o;9949:432:46:-;-1:-1:-1;;;;;10061:19:46;;10057:89;;10103:32;;-1:-1:-1;;;10103:32:46;;10132:1;10103:32;;;3350:51:64;3323:18;;10103:32:46;3204:203:64;10057:89:46;-1:-1:-1;;;;;10159:21:46;;10155:90;;10203:31;;-1:-1:-1;;;10203:31:46;;10231:1;10203:31;;;3350:51:64;3323:18;;10203:31:46;3204:203:64;10155:90:46;-1:-1:-1;;;;;10254:18:46;;;;;;;:11;:18;;;;;;;;:27;;;;;;;;;:35;;;10299:76;;;;10349:7;-1:-1:-1;;;;;10333:31:46;10342:5;-1:-1:-1;;;;;10333:31:46;;10358:5;10333:31;;;;5919:25:64;;5907:2;5892:18;;5773:177;10333:31:46;;;;;;;;9949:432;;;;:::o;16535:172:29:-;16606:16;16679:21;16642:33;16679:21;16642:9;:33;:::i;:::-;16641:59;;;;:::i;1573:123:32:-;1633:7;1667:21;188:2;1633:7;1667:4;;:21;:::i;:::-;1659:30;;;:::i;1874:152::-;1936:6;1975:42;243:2;188;1975:4;;:42;:::i;:::-;1968:50;;;:::i;:::-;1961:58;;;1874:152;-1:-1:-1;;;1874:152:32:o;16931:139:29:-;16995:16;17030:33;17042:21;-1:-1:-1;;;;;17030:33:29;;;:::i;4622:462:59:-;4756:24;-1:-1:-1;;;;;4796:19:59;;4792:46;;4831:6;4817:21;;4792:46;4934:21;4940:3;4945:9;4934:5;:21::i;:::-;-1:-1:-1;5068:9:59;;4622:462;-1:-1:-1;;4622:462:59:o;2186:130:32:-;2250:12;2281:28;:4;243:2;2281:4;;:28;:::i;:::-;2274:35;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;2274:35:32;;2186:130;-1:-1:-1;;;;;;2186:130:32:o;640:284:31:-;824:17;877:6;885:7;894:9;905:11;860:57;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;853:64;;640:284;;;;;;:::o;6271:1107:46:-;-1:-1:-1;;;;;6360:18:46;;6356:540;;6512:5;6496:12;;:21;;;;;;;:::i;:::-;;;;-1:-1:-1;6356:540:46;;-1:-1:-1;6356:540:46;;-1:-1:-1;;;;;6570:15:46;;6548:19;6570:15;;;:9;:15;;;;;;6603:19;;;6599:115;;;6649:50;;-1:-1:-1;;;6649:50:46;;-1:-1:-1;;;;;22422:32:64;;6649:50:46;;;22404:51:64;22471:18;;;22464:34;;;22514:18;;;22507:34;;;22377:18;;6649:50:46;22202:345:64;6599:115:46;-1:-1:-1;;;;;6834:15:46;;;;;;:9;:15;;;;;6852:19;;;;6834:37;;6356:540;-1:-1:-1;;;;;6910:16:46;;6906:425;;7073:12;:21;;;;;;;6906:425;;;-1:-1:-1;;;;;7284:13:46;;;;;;:9;:13;;;;;:22;;;;;;6906:425;7361:2;-1:-1:-1;;;;;7346:25:46;7355:4;-1:-1:-1;;;;;7346:25:46;;7365:5;7346:25;;;;5919::64;;5907:2;5892:18;;5773:177;7346:25:46;;;;;;;;6271:1107;;;:::o;17294:147:29:-;17359:15;17400:33;17412:21;17400:9;:33;:::i;598:506:32:-;791:18;;732:17;;791:22;;;934:163;;1074:7;1083:13;1057:40;;;;;;;;32198:19:64;;;32273:3;32251:16;-1:-1:-1;;;;;;32247:51:64;32242:2;32233:12;;32226:73;32324:2;32315:12;;32043:290;1057:40:32;;;;;;;;;;;;;934:163;;;976:7;985:13;1017:10;1030:11;959:83;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;934:163;927:170;;598:506;;;;;;:::o;12935:305:63:-;13013:6;13056:10;:6;13065:1;13056:10;:::i;:::-;13039:6;:13;:27;;13031:60;;;;-1:-1:-1;;;13031:60:63;;32972:2:64;13031:60:63;;;32954:21:64;33011:2;32991:18;;;32984:30;-1:-1:-1;;;33030:18:64;;;33023:50;33090:18;;13031:60:63;32770:344:64;13031:60:63;-1:-1:-1;13168:29:63;13184:3;13168:29;13162:36;;12935:305::o;3460:191:0:-;3544:12;3575:11;;;;:69;;3614:30;;;-1:-1:-1;;;;;;33354:3:64;33350:16;;;33346:25;;3614:30:0;;;33334:38:64;33406:16;;;33402:25;33388:12;;;33381:47;33444:12;3614:30:0;;;;;;;;;;;;3575:69;;;3589:22;;-1:-1:-1;;;;;;33616:3:64;33612:16;;;33608:62;3589:22:0;;;33596:75:64;33687:12;;3589:22:0;;;;;;;;;;;;3568:76;;3460:191;;;;:::o;6602:435:23:-;6766:12;6747:8;808:1;1059:20;6747:8;1077:1;1059:17;:20::i;:::-;:30;;;1055:82;;1116:20;:8;1134:1;1116:17;:20::i;1055:82::-;6843:8:::1;250:1:0;6912:25:23;:7;:14;:23;:25::i;:::-;:29;::::0;6940:1:::1;6912:29;:::i;:::-;6980:11;7009:7;6809:221;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;6790:240;;6602:435:::0;;;;;;:::o;3720:567:59:-;3881:20;3903:24;3974:44;3985:9;3996:12;4010:7;3974:10;:44::i;:::-;3939:79;;-1:-1:-1;3939:79:59;-1:-1:-1;4254:26:59;4260:5;3939:79;4254:5;:26::i;:::-;3720:567;;;;;;;:::o;3188:766:17:-;3389:31;;:::i;:::-;3554:20;3577:26;3588:4;:14;;;3577:10;:26::i;:::-;3617:15;;;;3554:49;;-1:-1:-1;3617:19:17;3613:53;;3638:28;3650:4;:15;;;3638:11;:28::i;:::-;3755:8;-1:-1:-1;;;;;3755:13:17;;3777:12;3809:92;;;;;;;;3825:7;3809:92;;;;;;3834:25;3851:7;3834:16;:25::i;:::-;3809:92;;;;3861:8;3809:92;;;;3871:8;3809:92;;;;3899:1;3881:4;:15;;;:19;3809:92;;;;;3919:14;3755:192;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;3677:270;3188:766;-1:-1:-1;;;;;;;3188:766:17:o;7721:208:46:-;-1:-1:-1;;;;;7791:21:46;;7787:91;;7835:32;;-1:-1:-1;;;7835:32:46;;7864:1;7835:32;;;3350:51:64;3323:18;;7835:32:46;3204:203:64;7787:91:46;7887:35;7903:1;7907:7;7916:5;7887:7;:35::i;16291:213:55:-;16347:6;16377:16;16369:24;;16365:103;;;16416:41;;-1:-1:-1;;;16416:41:55;;16447:2;16416:41;;;35176:36:64;35228:18;;;35221:34;;;35149:18;;16416:41:55;34995:266:64;16365:103:55;-1:-1:-1;16491:5:55;16291:213::o;8247:206:46:-;-1:-1:-1;;;;;8317:21:46;;8313:89;;8361:30;;-1:-1:-1;;;8361:30:46;;8388:1;8361:30;;;3350:51:64;3323:18;;8361:30:46;3204:203:64;8313:89:46;8411:35;8419:7;8436:1;8440:5;8411:7;:35::i;4650:191:17:-;4716:17;4762:10;4749:9;:23;4745:62;;4781:26;;-1:-1:-1;;;4781:26:17;;4797:9;4781:26;;;5919:25:64;5892:18;;4781:26:17;5773:177:64;5218:410:17;5371:15;5389:8;-1:-1:-1;;;;;5389:16:17;;:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;5371:36;-1:-1:-1;;;;;;5421:21:17;;5417:54;;5451:20;;-1:-1:-1;;;5451:20:17;;;;;;;;;;;5417:54;1829:53:50;;;5578:10:17;1829:53:50;;;35762:34:64;;;5598:8:17;-1:-1:-1;;;;;35832:15:64;;;35812:18;;;35805:43;35864:18;;;;35857:34;;;1829:53:50;;;;;;;;;;35697:18:64;;;;1829:53:50;;;;;;;;-1:-1:-1;;;;;1829:53:50;-1:-1:-1;;;1829:53:50;;;5545:76:17;;:32;;;5609:11;;1802:81:50;;5545:32:17;;-1:-1:-1;4504:33:50;5545:32:17;1829:53:50;4504:27;:33::i;:::-;4478:59;;4551:10;:17;4572:1;4551:22;;:57;;;;;4589:10;4578:30;;;;;;;;;;;;:::i;:::-;4577:31;4551:57;4547:135;;;4631:40;;-1:-1:-1;;;4631:40:50;;-1:-1:-1;;;;;3368:32:64;;4631:40:50;;;3350:51:64;3323:18;;4631:40:50;3204:203:64;2705:151:51;2780:12;2811:38;2833:6;2841:4;2847:1;2780:12;3421;3435:23;3462:6;-1:-1:-1;;;;;3462:11:51;3481:5;3488:4;3462:31;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3420:73;;;;3510:55;3537:6;3545:7;3554:10;4769:12;4798:7;4793:408;;4821:19;4829:10;4821:7;:19::i;:::-;4793:408;;;5045:17;;:22;:49;;;;-1:-1:-1;;;;;;5071:18:51;;;:23;5045:49;5041:119;;;5121:24;;-1:-1:-1;;;5121:24:51;;-1:-1:-1;;;;;3368:32:64;;5121:24:51;;;3350:51:64;3323:18;;5121:24:51;3204:203:64;5041:119:51;-1:-1:-1;5180:10:51;5173:17;;5743:516;5874:17;;:21;5870:383;;6102:10;6096:17;6158:15;6145:10;6141:2;6137:19;6130:44;5870:383;6225:17;;-1:-1:-1;;;6225:17:51;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;14:289:64:-;56:3;94:5;88:12;121:6;116:3;109:19;177:6;170:4;163:5;159:16;152:4;147:3;143:14;137:47;229:1;222:4;213:6;208:3;204:16;200:27;193:38;292:4;285:2;281:7;276:2;268:6;264:15;260:29;255:3;251:39;247:50;240:57;;;14:289;;;;:::o;308:220::-;457:2;446:9;439:21;420:4;477:45;518:2;507:9;503:18;495:6;477:45;:::i;533:131::-;-1:-1:-1;;;;;608:31:64;;598:42;;588:70;;654:1;651;644:12;669:315;737:6;745;798:2;786:9;777:7;773:23;769:32;766:52;;;814:1;811;804:12;766:52;853:9;840:23;872:31;897:5;872:31;:::i;:::-;922:5;974:2;959:18;;;;946:32;;-1:-1:-1;;;669:315:64:o;1181:158::-;1243:5;1288:3;1279:6;1274:3;1270:16;1266:26;1263:46;;;1305:1;1302;1295:12;1263:46;-1:-1:-1;1327:6:64;1181:158;-1:-1:-1;1181:158:64:o;1344:360::-;1432:6;1485:2;1473:9;1464:7;1460:23;1456:32;1453:52;;;1501:1;1498;1491:12;1453:52;1541:9;1528:23;-1:-1:-1;;;;;1566:6:64;1563:30;1560:50;;;1606:1;1603;1596:12;1560:50;1629:69;1690:7;1681:6;1670:9;1666:22;1629:69;:::i;1863:1336::-;1783:12;;1771:25;;1845:4;1834:16;;;1828:23;1812:14;;;1805:47;2229:4;2277:3;2262:19;;2354:2;2392:3;2387:2;2376:9;2372:18;2365:31;2416:6;2451;2445:13;2482:6;2474;2467:22;2520:3;2509:9;2505:19;2498:26;;2583:3;2573:6;2570:1;2566:14;2555:9;2551:30;2547:40;2533:54;;2606:4;2645;2637:6;2633:17;2668:1;2678:429;2692:6;2689:1;2686:13;2678:429;;;2757:22;;;-1:-1:-1;;2753:37:64;2741:50;;2814:13;;2855:9;;2840:25;;2904:11;;2898:18;2936:15;;;2929:27;;;2979:48;3011:15;;;2898:18;2979:48;:::i;:::-;2969:58;-1:-1:-1;;3085:12:64;;;;3050:15;;;;2714:1;2707:9;2678:429;;;-1:-1:-1;;1783:12:64;;3189:2;3174:18;;1771:25;-1:-1:-1;;;1845:4:64;1834:16;;1828:23;1812:14;;;1805:47;-1:-1:-1;3124:6:64;-1:-1:-1;3139:54:64;1709:149;3412:154;3471:5;3516:2;3507:6;3502:3;3498:16;3494:25;3491:45;;;3532:1;3529;3522:12;3571:347;3622:8;3632:6;3686:3;3679:4;3671:6;3667:17;3663:27;3653:55;;3704:1;3701;3694:12;3653:55;-1:-1:-1;3727:20:64;;-1:-1:-1;;;;;3759:30:64;;3756:50;;;3802:1;3799;3792:12;3756:50;3839:4;3831:6;3827:17;3815:29;;3891:3;3884:4;3875:6;3867;3863:19;3859:30;3856:39;3853:59;;;3908:1;3905;3898:12;3853:59;3571:347;;;;;:::o;3923:1047::-;4065:6;4073;4081;4089;4097;4105;4113;4166:3;4154:9;4145:7;4141:23;4137:33;4134:53;;;4183:1;4180;4173:12;4134:53;4206;4251:7;4240:9;4206:53;:::i;:::-;4196:63;;4306:2;4295:9;4291:18;4278:32;4268:42;;4361:3;4350:9;4346:19;4333:33;-1:-1:-1;;;;;4426:2:64;4418:6;4415:14;4412:34;;;4442:1;4439;4432:12;4412:34;4481:58;4531:7;4522:6;4511:9;4507:22;4481:58;:::i;:::-;4558:8;;-1:-1:-1;4455:84:64;-1:-1:-1;4643:3:64;4628:19;;4615:33;;-1:-1:-1;4657:31:64;4615:33;4657:31;:::i;:::-;4707:5;;-1:-1:-1;4765:3:64;4750:19;;4737:33;;4782:16;;;4779:36;;;4811:1;4808;4801:12;4779:36;;4850:60;4902:7;4891:8;4880:9;4876:24;4850:60;:::i;:::-;3923:1047;;;;-1:-1:-1;3923:1047:64;;-1:-1:-1;3923:1047:64;;;;4824:86;;-1:-1:-1;;;3923:1047:64:o;5955:456::-;6032:6;6040;6048;6101:2;6089:9;6080:7;6076:23;6072:32;6069:52;;;6117:1;6114;6107:12;6069:52;6156:9;6143:23;6175:31;6200:5;6175:31;:::i;:::-;6225:5;-1:-1:-1;6282:2:64;6267:18;;6254:32;6295:33;6254:32;6295:33;:::i;:::-;5955:456;;6347:7;;-1:-1:-1;;;6401:2:64;6386:18;;;;6373:32;;5955:456::o;6605:163::-;6672:20;;6732:10;6721:22;;6711:33;;6701:61;;6758:1;6755;6748:12;6701:61;6605:163;;;:::o;6773:252::-;6840:6;6848;6901:2;6889:9;6880:7;6876:23;6872:32;6869:52;;;6917:1;6914;6907:12;6869:52;6940:28;6958:9;6940:28;:::i;7030:118::-;7116:5;7109:13;7102:21;7095:5;7092:32;7082:60;;7138:1;7135;7128:12;7153:489;7247:6;7255;7308:2;7296:9;7287:7;7283:23;7279:32;7276:52;;;7324:1;7321;7314:12;7276:52;7364:9;7351:23;-1:-1:-1;;;;;7389:6:64;7386:30;7383:50;;;7429:1;7426;7419:12;7383:50;7452:69;7513:7;7504:6;7493:9;7489:22;7452:69;:::i;:::-;7442:79;;;7571:2;7560:9;7556:18;7543:32;7584:28;7606:5;7584:28;:::i;:::-;7631:5;7621:15;;;7153:489;;;;;:::o;7647:255::-;1783:12;;1771:25;;1845:4;1834:16;;;1828:23;1812:14;;;1805:47;7839:2;7824:18;;7851:45;1709:149;7907:159;7974:20;;8034:6;8023:18;;8013:29;;8003:57;;8056:1;8053;8046:12;8071:256;8137:6;8145;8198:2;8186:9;8177:7;8173:23;8169:32;8166:52;;;8214:1;8211;8204:12;8166:52;8237:28;8255:9;8237:28;:::i;:::-;8227:38;;8284:37;8317:2;8306:9;8302:18;8284:37;:::i;:::-;8274:47;;8071:256;;;;;:::o;8792:247::-;8851:6;8904:2;8892:9;8883:7;8879:23;8875:32;8872:52;;;8920:1;8917;8910:12;8872:52;8959:9;8946:23;8978:31;9003:5;8978:31;:::i;9249:669::-;9362:6;9370;9378;9386;9439:3;9427:9;9418:7;9414:23;9410:33;9407:53;;;9456:1;9453;9446:12;9407:53;9479;9524:7;9513:9;9479:53;:::i;:::-;9469:63;;9583:2;9572:9;9568:18;9555:32;-1:-1:-1;;;;;9602:6:64;9599:30;9596:50;;;9642:1;9639;9632:12;9596:50;9681:58;9731:7;9722:6;9711:9;9707:22;9681:58;:::i;:::-;9758:8;;-1:-1:-1;9655:84:64;-1:-1:-1;;9843:3:64;9828:19;;9815:33;9857:31;9815:33;9857:31;:::i;:::-;9249:669;;;;-1:-1:-1;9249:669:64;;-1:-1:-1;;9249:669:64:o;10180:395::-;10271:8;10281:6;10335:3;10328:4;10320:6;10316:17;10312:27;10302:55;;10353:1;10350;10343:12;10302:55;-1:-1:-1;10376:20:64;;-1:-1:-1;;;;;10408:30:64;;10405:50;;;10451:1;10448;10441:12;10405:50;10488:4;10480:6;10476:17;10464:29;;10548:3;10541:4;10531:6;10528:1;10524:14;10516:6;10512:27;10508:38;10505:47;10502:67;;;10565:1;10562;10555:12;10580:504;10705:6;10713;10766:2;10754:9;10745:7;10741:23;10737:32;10734:52;;;10782:1;10779;10772:12;10734:52;10822:9;10809:23;-1:-1:-1;;;;;10847:6:64;10844:30;10841:50;;;10887:1;10884;10877:12;10841:50;10926:98;11016:7;11007:6;10996:9;10992:22;10926:98;:::i;:::-;11043:8;;10900:124;;-1:-1:-1;10580:504:64;-1:-1:-1;;;;10580:504:64:o;11089:184::-;11147:6;11200:2;11188:9;11179:7;11175:23;11171:32;11168:52;;;11216:1;11213;11206:12;11168:52;11239:28;11257:9;11239:28;:::i;11460:553::-;11546:6;11554;11562;11570;11623:2;11611:9;11602:7;11598:23;11594:32;11591:52;;;11639:1;11636;11629:12;11591:52;11662:28;11680:9;11662:28;:::i;:::-;11652:38;;11709:37;11742:2;11731:9;11727:18;11709:37;:::i;:::-;11699:47;;11797:2;11786:9;11782:18;11769:32;-1:-1:-1;;;;;11816:6:64;11813:30;11810:50;;;11856:1;11853;11846:12;11810:50;11895:58;11945:7;11936:6;11925:9;11921:22;11895:58;:::i;:::-;11460:553;;;;-1:-1:-1;11972:8:64;-1:-1:-1;;;;11460:553:64:o;12521:656::-;12658:6;12666;12674;12718:9;12709:7;12705:23;12748:3;12744:2;12740:12;12737:32;;;12765:1;12762;12755:12;12737:32;12805:9;12792:23;-1:-1:-1;;;;;12830:6:64;12827:30;12824:50;;;12870:1;12867;12860:12;12824:50;12893:69;12954:7;12945:6;12934:9;12930:22;12893:69;:::i;:::-;12883:79;-1:-1:-1;;12996:2:64;-1:-1:-1;;12978:16:64;;12974:25;12971:45;;;13012:1;13009;13002:12;12971:45;;13050:2;13039:9;13035:18;13025:28;;13103:2;13092:9;13088:18;13075:32;13116:31;13141:5;13116:31;:::i;:::-;13166:5;13156:15;;;12521:656;;;;;:::o;13182:611::-;13424:4;13466:3;13455:9;13451:19;13443:27;;13503:6;13497:13;13486:9;13479:32;-1:-1:-1;;;;;13571:4:64;13563:6;13559:17;13553:24;13549:49;13542:4;13531:9;13527:20;13520:79;13646:4;13638:6;13634:17;13628:24;13661:62;13717:4;13706:9;13702:20;13688:12;1783;;1771:25;;1845:4;1834:16;;;1828:23;1812:14;;1805:47;1709:149;13661:62;-1:-1:-1;1783:12:64;;13782:3;13767:19;;1771:25;1845:4;1834:16;;1828:23;1812:14;;;1805:47;13732:55;1709:149;13798:388;13866:6;13874;13927:2;13915:9;13906:7;13902:23;13898:32;13895:52;;;13943:1;13940;13933:12;13895:52;13982:9;13969:23;14001:31;14026:5;14001:31;:::i;:::-;14051:5;-1:-1:-1;14108:2:64;14093:18;;14080:32;14121:33;14080:32;14121:33;:::i;14191:235::-;14275:6;14328:2;14316:9;14307:7;14303:23;14299:32;14296:52;;;14344:1;14341;14334:12;14296:52;14367:53;14412:7;14401:9;14367:53;:::i;14431:380::-;14510:1;14506:12;;;;14553;;;14574:61;;14628:4;14620:6;14616:17;14606:27;;14574:61;14681:2;14673:6;14670:14;14650:18;14647:38;14644:161;;14727:10;14722:3;14718:20;14715:1;14708:31;14762:4;14759:1;14752:15;14790:4;14787:1;14780:15;14816:127;14877:10;14872:3;14868:20;14865:1;14858:31;14908:4;14905:1;14898:15;14932:4;14929:1;14922:15;15216:127;15277:10;15272:3;15268:20;15265:1;15258:31;15308:4;15305:1;15298:15;15332:4;15329:1;15322:15;15348:253;15420:2;15414:9;15462:4;15450:17;;-1:-1:-1;;;;;15482:34:64;;15518:22;;;15479:62;15476:88;;;15544:18;;:::i;:::-;15580:2;15573:22;15348:253;:::o;15606:257::-;15678:4;15672:11;;;15710:17;;-1:-1:-1;;;;;15742:34:64;;15778:22;;;15739:62;15736:88;;;15804:18;;:::i;15868:275::-;15939:2;15933:9;16004:2;15985:13;;-1:-1:-1;;15981:27:64;15969:40;;-1:-1:-1;;;;;16024:34:64;;16060:22;;;16021:62;16018:88;;;16086:18;;:::i;:::-;16122:2;16115:22;15868:275;;-1:-1:-1;15868:275:64:o;16148:186::-;16196:4;-1:-1:-1;;;;;16221:6:64;16218:30;16215:56;;;16251:18;;:::i;:::-;-1:-1:-1;16317:2:64;16296:15;-1:-1:-1;;16292:29:64;16323:4;16288:40;;16148:186::o;16339:1755::-;16531:9;-1:-1:-1;;;;;16606:2:64;16598:6;16595:14;16592:40;;;16612:18;;:::i;:::-;16658:6;16655:1;16651:14;16684:4;16708:28;16732:2;16728;16724:11;16708:28;:::i;:::-;16770:19;;;16840:14;;;;16805:12;;;;16877:14;16866:26;;16863:46;;;16905:1;16902;16895:12;16863:46;16929:5;16943:1118;16959:6;16954:3;16951:15;16943:1118;;;17045:3;17032:17;17081:2;17068:11;17065:19;17062:39;;;17097:1;17094;17087:12;17062:39;17124:23;;17192:4;17171:14;17167:23;;;17163:34;17160:54;;;17210:1;17207;17200:12;17160:54;17242:22;;:::i;:::-;17293:21;17311:2;17293:21;:::i;:::-;17284:7;17277:38;17353:30;17379:2;17375;17371:11;17353:30;:::i;:::-;17348:2;17339:7;17335:16;17328:56;17407:2;17457;17453;17449:11;17436:25;17488:2;17480:6;17477:14;17474:34;;;17504:1;17501;17494:12;17474:34;17531:15;;;;;17588:14;17581:4;17573:13;;17569:34;17559:62;;17617:1;17614;17607:12;17559:62;17657:2;17644:16;17686:48;17702:31;17730:2;17702:31;:::i;:::-;17686:48;:::i;:::-;17761:2;17754:5;17747:17;17805:14;17800:2;17795;17791;17787:11;17783:20;17780:40;17777:60;;;17833:1;17830;17823:12;17777:60;17892:2;17887;17883;17879:11;17874:2;17867:5;17863:14;17850:45;17940:1;17919:14;;;17915:23;;17908:34;;;;17962:16;;;17955:31;17999:20;;-1:-1:-1;18039:12:64;;;;16976;;16943:1118;;;-1:-1:-1;18083:5:64;16339:1755;-1:-1:-1;;;;;;;16339:1755:64:o;18099:331::-;18204:9;18215;18257:8;18245:10;18242:24;18239:44;;;18279:1;18276;18269:12;18239:44;18308:6;18298:8;18295:20;18292:40;;;18328:1;18325;18318:12;18292:40;-1:-1:-1;;18354:23:64;;;18399:25;;;;;-1:-1:-1;18099:331:64:o;18435:211::-;18476:3;18514:5;18508:12;18558:6;18551:4;18544:5;18540:16;18535:3;18529:36;18620:1;18584:16;;18609:13;;;-1:-1:-1;18584:16:64;;18435:211;-1:-1:-1;18435:211:64:o;18651:369::-;18842:3;18870:29;18895:3;18887:6;18870:29;:::i;:::-;18933:6;18925;18921:2;18908:32;18994:1;18959:15;;18983:13;;;-1:-1:-1;18959:15:64;;18651:369;-1:-1:-1;;;18651:369:64:o;19025:266::-;19113:6;19108:3;19101:19;19165:6;19158:5;19151:4;19146:3;19142:14;19129:43;-1:-1:-1;19217:1:64;19192:16;;;19210:4;19188:27;;;19181:38;;;;19273:2;19252:15;;;-1:-1:-1;;19248:29:64;19239:39;;;19235:50;;19025:266::o;19296:244::-;19453:2;19442:9;19435:21;19416:4;19473:61;19530:2;19519:9;19515:18;19507:6;19499;19473:61;:::i;19545:331::-;19644:4;19702:11;19689:25;19796:3;19792:8;19781;19765:14;19761:29;19757:44;19737:18;19733:69;19723:97;;19816:1;19813;19806:12;19723:97;19837:33;;;;;19545:331;-1:-1:-1;;19545:331:64:o;19881:521::-;19958:4;19964:6;20024:11;20011:25;20118:2;20114:7;20103:8;20087:14;20083:29;20079:43;20059:18;20055:68;20045:96;;20137:1;20134;20127:12;20045:96;20164:33;;20216:20;;;-1:-1:-1;;;;;;20248:30:64;;20245:50;;;20291:1;20288;20281:12;20245:50;20324:4;20312:17;;-1:-1:-1;20355:14:64;20351:27;;;20341:38;;20338:58;;;20392:1;20389;20382:12;20407:129;-1:-1:-1;;;;;20485:5:64;20481:30;20474:5;20471:41;20461:69;;20526:1;20523;20516:12;20541:990;20917:10;20890:25;20908:6;20890:25;:::i;:::-;20886:42;20875:9;20868:61;20992:4;20984:6;20980:17;20967:31;20960:4;20949:9;20945:20;20938:61;20849:4;21046;21038:6;21034:17;21021:31;21061:30;21085:5;21061:30;:::i;:::-;-1:-1:-1;;;;;21133:5:64;21129:30;21122:4;21111:9;21107:20;21100:60;;21196:6;21191:2;21180:9;21176:18;21169:34;21240:3;21234;21223:9;21219:19;21212:32;21267:62;21324:3;21313:9;21309:19;21301:6;21293;21267:62;:::i;:::-;-1:-1:-1;;;;;21366:32:64;;21386:3;21345:19;;21338:61;21436:22;;;21430:3;21415:19;;21408:51;21476:49;21440:6;21510;21502;21476:49;:::i;:::-;21468:57;20541:990;-1:-1:-1;;;;;;;;;;20541:990:64:o;21536:661::-;21615:6;21668:2;21656:9;21647:7;21643:23;21639:32;21636:52;;;21684:1;21681;21674:12;21636:52;21717:9;21711:16;-1:-1:-1;;;;;21742:6:64;21739:30;21736:50;;;21782:1;21779;21772:12;21736:50;21805:22;;21858:4;21850:13;;21846:27;-1:-1:-1;21836:55:64;;21887:1;21884;21877:12;21836:55;21916:2;21910:9;21941:48;21957:31;21985:2;21957:31;:::i;21941:48::-;22012:2;22005:5;21998:17;22052:7;22047:2;22042;22038;22034:11;22030:20;22027:33;22024:53;;;22073:1;22070;22063:12;22024:53;22121:2;22116;22112;22108:11;22103:2;22096:5;22092:14;22086:38;22165:1;22144:14;;;22160:2;22140:23;22133:34;;;;22148:5;21536:661;-1:-1:-1;;;;21536:661:64:o;23002:245::-;23060:6;23113:2;23101:9;23092:7;23088:23;23084:32;23081:52;;;23129:1;23126;23119:12;23081:52;23168:9;23155:23;23187:30;23211:5;23187:30;:::i;23252:479::-;23519:1;23515;23510:3;23506:11;23502:19;23494:6;23490:32;23479:9;23472:51;23559:6;23554:2;23543:9;23539:18;23532:34;23614:6;23606;23602:19;23597:2;23586:9;23582:18;23575:47;23658:3;23653:2;23642:9;23638:18;23631:31;23453:4;23679:46;23720:3;23709:9;23705:19;23697:6;23679:46;:::i;24004:379::-;24197:2;24186:9;24179:21;24160:4;24223:45;24264:2;24253:9;24249:18;24241:6;24223:45;:::i;:::-;24316:9;24308:6;24304:22;24299:2;24288:9;24284:18;24277:50;24344:33;24370:6;24362;24344:33;:::i;24388:245::-;24455:6;24508:2;24496:9;24487:7;24483:23;24479:32;24476:52;;;24524:1;24521;24514:12;24476:52;24556:9;24550:16;24575:28;24597:5;24575:28;:::i;24638:889::-;24859:2;24848:9;24841:21;24917:10;24908:6;24902:13;24898:30;24893:2;24882:9;24878:18;24871:58;24983:4;24975:6;24971:17;24965:24;24960:2;24949:9;24945:18;24938:52;24822:4;25037:2;25029:6;25025:15;25019:22;25078:4;25072:3;25061:9;25057:19;25050:33;25106:52;25153:3;25142:9;25138:19;25124:12;25106:52;:::i;:::-;25092:66;;25207:2;25199:6;25195:15;25189:22;25281:2;25277:7;25265:9;25257:6;25253:22;25249:36;25242:4;25231:9;25227:20;25220:66;25309:41;25343:6;25327:14;25309:41;:::i;:::-;25419:3;25407:16;;;;25401:23;25394:31;25387:39;25381:3;25366:19;;25359:68;-1:-1:-1;;;;;;;;25488:32:64;;;;25481:4;25466:20;;;25459:62;25295:55;24638:889::o;25532:284::-;25602:5;25650:4;25638:9;25633:3;25629:19;25625:30;25622:50;;;25668:1;25665;25658:12;25622:50;25690:22;;:::i;:::-;25681:31;;25741:9;25735:16;25728:5;25721:31;25805:2;25794:9;25790:18;25784:25;25779:2;25772:5;25768:14;25761:49;25532:284;;;;:::o;25821:258::-;25920:6;25973:2;25961:9;25952:7;25948:23;25944:32;25941:52;;;25989:1;25986;25979:12;25941:52;26012:61;26065:7;26054:9;26012:61;:::i;26425:517::-;26526:2;26521:3;26518:11;26515:421;;;26562:5;26559:1;26552:16;26606:4;26603:1;26593:18;26676:2;26664:10;26660:19;26657:1;26653:27;26647:4;26643:38;26712:4;26700:10;26697:20;26694:47;;;-1:-1:-1;26735:4:64;26694:47;26790:2;26785:3;26781:12;26778:1;26774:20;26768:4;26764:31;26754:41;;26845:81;26863:2;26856:5;26853:13;26845:81;;;26922:1;26908:16;;26889:1;26878:13;26845:81;;27118:1341;27242:3;27236:10;-1:-1:-1;;;;;27261:6:64;27258:30;27255:56;;;27291:18;;:::i;:::-;27320:96;27409:6;27369:38;27401:4;27395:11;27369:38;:::i;:::-;27363:4;27320:96;:::i;:::-;27471:4;;27528:2;27517:14;;27545:1;27540:662;;;;28246:1;28263:6;28260:89;;;-1:-1:-1;28315:19:64;;;28309:26;28260:89;-1:-1:-1;;27075:1:64;27071:11;;;27067:24;27063:29;27053:40;27099:1;27095:11;;;27050:57;28362:81;;27510:943;;27540:662;26372:1;26365:14;;;26409:4;26396:18;;-1:-1:-1;;27576:20:64;;;27693:236;27707:7;27704:1;27701:14;27693:236;;;27796:19;;;27790:26;27775:42;;27888:27;;;;27856:1;27844:14;;;;27723:19;;27693:236;;;27697:3;27957:6;27948:7;27945:19;27942:201;;;28018:19;;;28012:26;-1:-1:-1;;28101:1:64;28097:14;;;28113:3;28093:24;28089:37;28085:42;28070:58;28055:74;;27942:201;;;28189:1;28180:6;28177:1;28173:14;28169:22;28163:4;28156:36;27510:943;;;;;27118:1341;;:::o;28464:1164::-;28680:4;28709:2;28749;28738:9;28734:18;28779:2;28768:9;28761:21;28802:6;28837;28831:13;28868:6;28860;28853:22;28894:2;28884:12;;28927:2;28916:9;28912:18;28905:25;;28989:2;28979:6;28976:1;28972:14;28961:9;28957:30;28953:39;29027:2;29019:6;29015:15;29048:1;29058:541;29072:6;29069:1;29066:13;29058:541;;;29137:22;;;-1:-1:-1;;29133:36:64;29121:49;;29193:13;;29265:9;;29276:10;29261:26;29246:42;;29335:11;;;29329:18;29349:6;29325:31;29308:15;;;29301:56;29396:11;;29390:18;29229:4;29428:15;;;29421:27;;;29471:48;29503:15;;;29390:18;29471:48;:::i;:::-;29577:12;;;;29461:58;-1:-1:-1;;;29542:15:64;;;;29094:1;29087:9;29058:541;;;-1:-1:-1;29616:6:64;;28464:1164;-1:-1:-1;;;;;;;;28464:1164:64:o;29633:347::-;29721:6;29774:2;29762:9;29753:7;29749:23;29745:32;29742:52;;;29790:1;29787;29780:12;29742:52;29816:22;;:::i;:::-;29874:9;29861:23;29854:5;29847:38;29945:2;29934:9;29930:18;29917:32;29912:2;29905:5;29901:14;29894:56;29969:5;29959:15;;;29633:347;;;;:::o;30324:127::-;30385:10;30380:3;30376:20;30373:1;30366:31;30416:4;30413:1;30406:15;30440:4;30437:1;30430:15;30456:217;30496:1;30522;30512:132;;30566:10;30561:3;30557:20;30554:1;30547:31;30601:4;30598:1;30591:15;30629:4;30626:1;30619:15;30512:132;-1:-1:-1;30658:9:64;;30456:217::o;30678:168::-;30751:9;;;30782;;30799:15;;;30793:22;;30779:37;30769:71;;30820:18;;:::i;30851:255::-;30971:19;;31010:2;31002:11;;30999:101;;;-1:-1:-1;;31071:2:64;31067:12;;;31064:1;31060:20;31056:33;31045:45;30851:255;;;;:::o;31111:331::-;-1:-1:-1;;;;;;31231:19:64;;31315:11;;;;31346:1;31338:10;;31335:101;;;31423:2;31417;31410:3;31407:1;31403:11;31400:1;31396:19;31392:28;31388:2;31384:37;31380:46;31371:55;;31335:101;;;31111:331;;;;:::o;31447:461::-;31712:3;31690:16;;;-1:-1:-1;;;;;;31686:51:64;31674:64;;31793:3;31771:16;;;-1:-1:-1;;;;;;31767:43:64;31763:1;31754:11;;31747:64;31836:2;31827:12;;31820:28;;;-1:-1:-1;31864:38:64;31898:2;31889:12;;31881:6;31864:38;:::i;31913:125::-;31978:9;;;31999:10;;;31996:36;;;32012:18;;:::i;32338:427::-;32579:6;32574:3;32567:19;-1:-1:-1;;;;;32642:3:64;32638:28;32629:6;32624:3;32620:16;32616:51;32611:2;32606:3;32602:12;32595:73;32698:6;32693:2;32688:3;32684:12;32677:28;32549:3;32721:38;32755:2;32750:3;32746:12;32738:6;32721:38;:::i;33710:168::-;33777:6;33803:10;;;33815;;;33799:27;;33838:11;;;33835:37;;;33852:18;;:::i;:::-;33835:37;33710:168;;;;:::o;33883:578::-;34132:3;34163:29;34188:3;34180:6;34163:29;:::i;:::-;-1:-1:-1;;;;;;34215:3:64;34251:16;;;34247:25;;34233:40;;-1:-1:-1;;;;;;34330:3:64;34308:16;;;34304:38;34300:1;34289:13;;34282:61;34378:16;;;34374:25;34370:1;34359:13;;34352:48;34416:39;34452:1;34441:13;;34433:6;34416:39;:::i;:::-;34409:46;33883:578;-1:-1:-1;;;;;;;;33883:578:64:o;34466:524::-;34569:6;34622:3;34610:9;34601:7;34597:23;34593:33;34590:53;;;34639:1;34636;34629:12;34590:53;34665:22;;:::i;:::-;34716:9;34710:16;34703:5;34696:31;34772:2;34761:9;34757:18;34751:25;34785:32;34809:7;34785:32;:::i;:::-;34844:2;34833:14;;34826:31;34889:70;34951:7;34946:2;34931:18;;34889:70;:::i;:::-;34884:2;34873:14;;34866:94;34877:5;34466:524;-1:-1:-1;;;34466:524:64:o;35266:251::-;35336:6;35389:2;35377:9;35368:7;35364:23;35360:32;35357:52;;;35405:1;35402;35395:12;35357:52;35437:9;35431:16;35456:31;35481:5;35456:31;:::i;35902:189::-;36031:3;36056:29;36081:3;36073:6;36056:29;:::i

Swarm Source

ipfs://9f446328d24683dd170fe48c27426571a6db9bb6c23d1c50f2bdebc79956ffd3
[ Download: CSV Export  ]

A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.