{"constructor_args":"0x000000000000000000000000ec306e46549a7e8f4fce823d3058f2d134133b1700000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd67500000000000000000000000000000000000000000000021e19e0c9bab2400000","is_partially_verified":false,"is_changed_bytecode":false,"abi":[{"inputs":[{"internalType":"address","name":"_minter","type":"address"},{"internalType":"address","name":"_layerZeroEndpoint","type":"address"},{"internalType":"uint256","name":"_cap","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"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":[{"indexed":true,"internalType":"uint16","name":"dstChainId","type":"uint16"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"bytes","name":"toAddress","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"}],"name":"FeedToChain","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"indexed":false,"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"indexed":false,"internalType":"uint64","name":"_nonce","type":"uint64"},{"indexed":false,"internalType":"bytes","name":"_payload","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"_reason","type":"bytes"}],"name":"MessageFailed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"ReceiveFromChain","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"indexed":false,"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"indexed":false,"internalType":"uint64","name":"_nonce","type":"uint64"},{"indexed":false,"internalType":"bytes32","name":"_payloadHash","type":"bytes32"}],"name":"RetryMessageSuccess","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":false,"internalType":"bytes","name":"_toAddress","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"SendToChain","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint16","name":"dstChainId","type":"uint16"},{"indexed":false,"internalType":"bytes","name":"toAddress","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"cap","type":"uint256"}],"name":"SetCapFor","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint16","name":"dstChainId","type":"uint16"},{"indexed":false,"internalType":"bytes","name":"toAddress","type":"bytes"},{"indexed":false,"internalType":"bool","name":"flag","type":"bool"}],"name":"SetEnableFor","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"_type","type":"uint16"},{"indexed":false,"internalType":"uint256","name":"_minDstGas","type":"uint256"}],"name":"SetMinDstGas","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"precrime","type":"address"}],"name":"SetPrecrime","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_remoteChainId","type":"uint16"},{"indexed":false,"internalType":"bytes","name":"_path","type":"bytes"}],"name":"SetTrustedRemote","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_remoteChainId","type":"uint16"},{"indexed":false,"internalType":"bytes","name":"_remoteAddress","type":"bytes"}],"name":"SetTrustedRemoteAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"_useCustomAdapterParams","type":"bool"}],"name":"SetUseCustomAdapterParams","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":"DAY_INTERVAL","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_PAYLOAD_SIZE_LIMIT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NO_EXTRA_GAS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PT_FEED","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PT_SEND","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PT_SET_CAP","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PT_SET_ENABLE","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"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":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","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":"address","name":"_from","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"cap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"circulatingSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"enable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes","name":"_toAddress","type":"bytes"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bool","name":"_useZro","type":"bool"},{"internalType":"bytes","name":"_adapterParams","type":"bytes"}],"name":"estimateSendFee","outputs":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"zroFee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"},{"internalType":"bytes","name":"","type":"bytes"},{"internalType":"uint64","name":"","type":"uint64"}],"name":"failedMessages","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"}],"name":"forceResumeReceive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_version","type":"uint16"},{"internalType":"uint16","name":"_chainId","type":"uint16"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"_configType","type":"uint256"}],"name":"getConfig","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getQuota","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_remoteChainId","type":"uint16"}],"name":"getTrustedRemoteAddress","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"}],"name":"isTrustedRemote","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lzEndpoint","outputs":[{"internalType":"contract ILayerZeroEndpoint","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"internalType":"uint64","name":"_nonce","type":"uint64"},{"internalType":"bytes","name":"_payload","type":"bytes"}],"name":"lzReceive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"},{"internalType":"uint16","name":"","type":"uint16"}],"name":"minDstGasLookup","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"minter","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":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"internalType":"uint64","name":"_nonce","type":"uint64"},{"internalType":"bytes","name":"_payload","type":"bytes"}],"name":"nonblockingLzReceive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"}],"name":"payloadSizeLimitLookup","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"precrime","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"quota","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"internalType":"uint64","name":"_nonce","type":"uint64"},{"internalType":"bytes","name":"_payload","type":"bytes"}],"name":"retryMessage","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes","name":"_toAddress","type":"bytes"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address payable","name":"_refundAddress","type":"address"},{"internalType":"address","name":"_zroPaymentAddress","type":"address"},{"internalType":"bytes","name":"_adapterParams","type":"bytes"}],"name":"sendFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"uint256","name":"_cap","type":"uint256"},{"internalType":"bytes","name":"_toAddress","type":"bytes"}],"name":"setCapFor","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_version","type":"uint16"},{"internalType":"uint16","name":"_chainId","type":"uint16"},{"internalType":"uint256","name":"_configType","type":"uint256"},{"internalType":"bytes","name":"_config","type":"bytes"}],"name":"setConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bool","name":"_flag","type":"bool"},{"internalType":"bytes","name":"_toAddress","type":"bytes"}],"name":"setEnableFor","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"uint16","name":"_packetType","type":"uint16"},{"internalType":"uint256","name":"_minGas","type":"uint256"}],"name":"setMinDstGas","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"uint256","name":"_size","type":"uint256"}],"name":"setPayloadSizeLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_precrime","type":"address"}],"name":"setPrecrime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_version","type":"uint16"}],"name":"setReceiveVersion","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_version","type":"uint16"}],"name":"setSendVersion","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_remoteChainId","type":"uint16"},{"internalType":"bytes","name":"_path","type":"bytes"}],"name":"setTrustedRemote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_remoteChainId","type":"uint16"},{"internalType":"bytes","name":"_remoteAddress","type":"bytes"}],"name":"setTrustedRemoteAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_useCustomAdapterParams","type":"bool"}],"name":"setUseCustomAdapterParams","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"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":"tokenPrice","outputs":[{"internalType":"uint256","name":"price","type":"uint256"}],"stateMutability":"nonpayable","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":"amount","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":"amount","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":"uint16","name":"","type":"uint16"}],"name":"trustedRemoteLookup","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes","name":"_toAddress","type":"bytes"}],"name":"updatePrice","outputs":[{"internalType":"uint256","name":"price","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"useCustomAdapterParams","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}],"conflicting_implementations":null,"certified":false,"additional_sources":[{"file_path":"@layerzerolabs/solidity-examples/contracts/interfaces/ILayerZeroEndpoint.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\nimport \"./ILayerZeroUserApplicationConfig.sol\";\n\ninterface ILayerZeroEndpoint is ILayerZeroUserApplicationConfig {\n    // @notice send a LayerZero message to the specified address at a LayerZero endpoint.\n    // @param _dstChainId - the destination chain identifier\n    // @param _destination - the address on destination chain (in bytes). address length/format may vary by chains\n    // @param _payload - a custom bytes payload to send to the destination contract\n    // @param _refundAddress - if the source transaction is cheaper than the amount of value passed, refund the additional amount to this address\n    // @param _zroPaymentAddress - the address of the ZRO token holder who would pay for the transaction\n    // @param _adapterParams - parameters for custom functionality. e.g. receive airdropped native gas from the relayer on destination\n    function send(uint16 _dstChainId, bytes calldata _destination, bytes calldata _payload, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams) external payable;\n\n    // @notice used by the messaging library to publish verified payload\n    // @param _srcChainId - the source chain identifier\n    // @param _srcAddress - the source contract (as bytes) at the source chain\n    // @param _dstAddress - the address on destination chain\n    // @param _nonce - the unbound message ordering nonce\n    // @param _gasLimit - the gas limit for external contract execution\n    // @param _payload - verified payload to send to the destination contract\n    function receivePayload(uint16 _srcChainId, bytes calldata _srcAddress, address _dstAddress, uint64 _nonce, uint _gasLimit, bytes calldata _payload) external;\n\n    // @notice get the inboundNonce of a lzApp from a source chain which could be EVM or non-EVM chain\n    // @param _srcChainId - the source chain identifier\n    // @param _srcAddress - the source chain contract address\n    function getInboundNonce(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (uint64);\n\n    // @notice get the outboundNonce from this source chain which, consequently, is always an EVM\n    // @param _srcAddress - the source chain contract address\n    function getOutboundNonce(uint16 _dstChainId, address _srcAddress) external view returns (uint64);\n\n    // @notice gets a quote in source native gas, for the amount that send() requires to pay for message delivery\n    // @param _dstChainId - the destination chain identifier\n    // @param _userApplication - the user app address on this EVM chain\n    // @param _payload - the custom message to send over LayerZero\n    // @param _payInZRO - if false, user app pays the protocol fee in native token\n    // @param _adapterParam - parameters for the adapter service, e.g. send some dust native token to dstChain\n    function estimateFees(uint16 _dstChainId, address _userApplication, bytes calldata _payload, bool _payInZRO, bytes calldata _adapterParam) external view returns (uint nativeFee, uint zroFee);\n\n    // @notice get this Endpoint's immutable source identifier\n    function getChainId() external view returns (uint16);\n\n    // @notice the interface to retry failed message on this Endpoint destination\n    // @param _srcChainId - the source chain identifier\n    // @param _srcAddress - the source chain contract address\n    // @param _payload - the payload to be retried\n    function retryPayload(uint16 _srcChainId, bytes calldata _srcAddress, bytes calldata _payload) external;\n\n    // @notice query if any STORED payload (message blocking) at the endpoint.\n    // @param _srcChainId - the source chain identifier\n    // @param _srcAddress - the source chain contract address\n    function hasStoredPayload(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (bool);\n\n    // @notice query if the _libraryAddress is valid for sending msgs.\n    // @param _userApplication - the user app address on this EVM chain\n    function getSendLibraryAddress(address _userApplication) external view returns (address);\n\n    // @notice query if the _libraryAddress is valid for receiving msgs.\n    // @param _userApplication - the user app address on this EVM chain\n    function getReceiveLibraryAddress(address _userApplication) external view returns (address);\n\n    // @notice query if the non-reentrancy guard for send() is on\n    // @return true if the guard is on. false otherwise\n    function isSendingPayload() external view returns (bool);\n\n    // @notice query if the non-reentrancy guard for receive() is on\n    // @return true if the guard is on. false otherwise\n    function isReceivingPayload() external view returns (bool);\n\n    // @notice get the configuration of the LayerZero messaging library of the specified version\n    // @param _version - messaging library version\n    // @param _chainId - the chainId for the pending config change\n    // @param _userApplication - the contract address of the user application\n    // @param _configType - type of configuration. every messaging library has its own convention.\n    function getConfig(uint16 _version, uint16 _chainId, address _userApplication, uint _configType) external view returns (bytes memory);\n\n    // @notice get the send() LayerZero messaging library version\n    // @param _userApplication - the contract address of the user application\n    function getSendVersion(address _userApplication) external view returns (uint16);\n\n    // @notice get the lzReceive() LayerZero messaging library version\n    // @param _userApplication - the contract address of the user application\n    function getReceiveVersion(address _userApplication) external view returns (uint16);\n}\n"},{"file_path":"@layerzerolabs/solidity-examples/contracts/interfaces/ILayerZeroReceiver.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\ninterface ILayerZeroReceiver {\n    // @notice LayerZero endpoint will invoke this function to deliver the message on the destination\n    // @param _srcChainId - the source endpoint identifier\n    // @param _srcAddress - the source sending contract address from the source chain\n    // @param _nonce - the ordered message nonce\n    // @param _payload - the signed payload is the UA bytes has encoded to be sent\n    function lzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) external;\n}\n"},{"file_path":"@layerzerolabs/solidity-examples/contracts/interfaces/ILayerZeroUserApplicationConfig.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\ninterface ILayerZeroUserApplicationConfig {\n    // @notice set the configuration of the LayerZero messaging library of the specified version\n    // @param _version - messaging library version\n    // @param _chainId - the chainId for the pending config change\n    // @param _configType - type of configuration. every messaging library has its own convention.\n    // @param _config - configuration in the bytes. can encode arbitrary content.\n    function setConfig(uint16 _version, uint16 _chainId, uint _configType, bytes calldata _config) external;\n\n    // @notice set the send() LayerZero messaging library version to _version\n    // @param _version - new messaging library version\n    function setSendVersion(uint16 _version) external;\n\n    // @notice set the lzReceive() LayerZero messaging library version to _version\n    // @param _version - new messaging library version\n    function setReceiveVersion(uint16 _version) external;\n\n    // @notice Only when the UA needs to resume the message flow in blocking mode and clear the stored payload\n    // @param _srcChainId - the chainId of the source chain\n    // @param _srcAddress - the contract address of the source contract at the source chain\n    function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) external;\n}\n"},{"file_path":"@layerzerolabs/solidity-examples/contracts/lzApp/LzApp.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../interfaces/ILayerZeroReceiver.sol\";\nimport \"../interfaces/ILayerZeroUserApplicationConfig.sol\";\nimport \"../interfaces/ILayerZeroEndpoint.sol\";\nimport \"../util/BytesLib.sol\";\n\n/*\n * a generic LzReceiver implementation\n */\nabstract contract LzApp is Ownable, ILayerZeroReceiver, ILayerZeroUserApplicationConfig {\n    using BytesLib for bytes;\n\n    // ua can not send payload larger than this by default, but it can be changed by the ua owner\n    uint constant public DEFAULT_PAYLOAD_SIZE_LIMIT = 10000;\n\n    ILayerZeroEndpoint public immutable lzEndpoint;\n    mapping(uint16 => bytes) public trustedRemoteLookup;\n    mapping(uint16 => mapping(uint16 => uint)) public minDstGasLookup;\n    mapping(uint16 => uint) public payloadSizeLimitLookup;\n    address public precrime;\n\n    event SetPrecrime(address precrime);\n    event SetTrustedRemote(uint16 _remoteChainId, bytes _path);\n    event SetTrustedRemoteAddress(uint16 _remoteChainId, bytes _remoteAddress);\n    event SetMinDstGas(uint16 _dstChainId, uint16 _type, uint _minDstGas);\n\n    constructor(address _endpoint) {\n        lzEndpoint = ILayerZeroEndpoint(_endpoint);\n    }\n\n    function lzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) public virtual override {\n        // lzReceive must be called by the endpoint for security\n        require(_msgSender() == address(lzEndpoint), \"LzApp: invalid endpoint caller\");\n\n        bytes memory trustedRemote = trustedRemoteLookup[_srcChainId];\n        // if will still block the message pathway from (srcChainId, srcAddress). should not receive message from untrusted remote.\n        require(_srcAddress.length == trustedRemote.length && trustedRemote.length > 0 && keccak256(_srcAddress) == keccak256(trustedRemote), \"LzApp: invalid source sending contract\");\n\n        _blockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload);\n    }\n\n    // abstract function - the default behaviour of LayerZero is blocking. See: NonblockingLzApp if you dont need to enforce ordered messaging\n    function _blockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual;\n\n    function _lzSend(uint16 _dstChainId, bytes memory _payload, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams, uint _nativeFee) internal virtual {\n        bytes memory trustedRemote = trustedRemoteLookup[_dstChainId];\n        require(trustedRemote.length != 0, \"LzApp: destination chain is not a trusted source\");\n        _checkPayloadSize(_dstChainId, _payload.length);\n        lzEndpoint.send{value: _nativeFee}(_dstChainId, trustedRemote, _payload, _refundAddress, _zroPaymentAddress, _adapterParams);\n    }\n\n    function _checkGasLimit(uint16 _dstChainId, uint16 _type, bytes memory _adapterParams, uint _extraGas) internal view virtual {\n        uint providedGasLimit = _getGasLimit(_adapterParams);\n        uint minGasLimit = minDstGasLookup[_dstChainId][_type] + _extraGas;\n        require(minGasLimit > 0, \"LzApp: minGasLimit not set\");\n        require(providedGasLimit >= minGasLimit, \"LzApp: gas limit is too low\");\n    }\n\n    function _getGasLimit(bytes memory _adapterParams) internal pure virtual returns (uint gasLimit) {\n        require(_adapterParams.length >= 34, \"LzApp: invalid adapterParams\");\n        assembly {\n            gasLimit := mload(add(_adapterParams, 34))\n        }\n    }\n\n    function _checkPayloadSize(uint16 _dstChainId, uint _payloadSize) internal view virtual {\n        uint payloadSizeLimit = payloadSizeLimitLookup[_dstChainId];\n        if (payloadSizeLimit == 0) { // use default if not set\n            payloadSizeLimit = DEFAULT_PAYLOAD_SIZE_LIMIT;\n        }\n        require(_payloadSize <= payloadSizeLimit, \"LzApp: payload size is too large\");\n    }\n\n    //---------------------------UserApplication config----------------------------------------\n    function getConfig(uint16 _version, uint16 _chainId, address, uint _configType) external view returns (bytes memory) {\n        return lzEndpoint.getConfig(_version, _chainId, address(this), _configType);\n    }\n\n    // generic config for LayerZero user Application\n    function setConfig(uint16 _version, uint16 _chainId, uint _configType, bytes calldata _config) external override onlyOwner {\n        lzEndpoint.setConfig(_version, _chainId, _configType, _config);\n    }\n\n    function setSendVersion(uint16 _version) external override onlyOwner {\n        lzEndpoint.setSendVersion(_version);\n    }\n\n    function setReceiveVersion(uint16 _version) external override onlyOwner {\n        lzEndpoint.setReceiveVersion(_version);\n    }\n\n    function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) external override onlyOwner {\n        lzEndpoint.forceResumeReceive(_srcChainId, _srcAddress);\n    }\n\n    // _path = abi.encodePacked(remoteAddress, localAddress)\n    // this function set the trusted path for the cross-chain communication\n    function setTrustedRemote(uint16 _remoteChainId, bytes calldata _path) external onlyOwner {\n        trustedRemoteLookup[_remoteChainId] = _path;\n        emit SetTrustedRemote(_remoteChainId, _path);\n    }\n\n    function setTrustedRemoteAddress(uint16 _remoteChainId, bytes calldata _remoteAddress) external onlyOwner {\n        trustedRemoteLookup[_remoteChainId] = abi.encodePacked(_remoteAddress, address(this));\n        emit SetTrustedRemoteAddress(_remoteChainId, _remoteAddress);\n    }\n\n    function getTrustedRemoteAddress(uint16 _remoteChainId) external view returns (bytes memory) {\n        bytes memory path = trustedRemoteLookup[_remoteChainId];\n        require(path.length != 0, \"LzApp: no trusted path record\");\n        return path.slice(0, path.length - 20); // the last 20 bytes should be address(this)\n    }\n\n    function setPrecrime(address _precrime) external onlyOwner {\n        precrime = _precrime;\n        emit SetPrecrime(_precrime);\n    }\n\n    function setMinDstGas(uint16 _dstChainId, uint16 _packetType, uint _minGas) external onlyOwner {\n        require(_minGas > 0, \"LzApp: invalid minGas\");\n        minDstGasLookup[_dstChainId][_packetType] = _minGas;\n        emit SetMinDstGas(_dstChainId, _packetType, _minGas);\n    }\n\n    // if the size is 0, it means default size limit\n    function setPayloadSizeLimit(uint16 _dstChainId, uint _size) external onlyOwner {\n        payloadSizeLimitLookup[_dstChainId] = _size;\n    }\n\n    //--------------------------- VIEW FUNCTION ----------------------------------------\n    function isTrustedRemote(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (bool) {\n        bytes memory trustedSource = trustedRemoteLookup[_srcChainId];\n        return keccak256(trustedSource) == keccak256(_srcAddress);\n    }\n}\n"},{"file_path":"@layerzerolabs/solidity-examples/contracts/lzApp/NonblockingLzApp.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./LzApp.sol\";\nimport \"../util/ExcessivelySafeCall.sol\";\n\n/*\n * the default LayerZero messaging behaviour is blocking, i.e. any failed message will block the channel\n * this abstract class try-catch all fail messages and store locally for future retry. hence, non-blocking\n * NOTE: if the srcAddress is not configured properly, it will still block the message pathway from (srcChainId, srcAddress)\n */\nabstract contract NonblockingLzApp is LzApp {\n    using ExcessivelySafeCall for address;\n\n    constructor(address _endpoint) LzApp(_endpoint) {}\n\n    mapping(uint16 => mapping(bytes => mapping(uint64 => bytes32))) public failedMessages;\n\n    event MessageFailed(uint16 _srcChainId, bytes _srcAddress, uint64 _nonce, bytes _payload, bytes _reason);\n    event RetryMessageSuccess(uint16 _srcChainId, bytes _srcAddress, uint64 _nonce, bytes32 _payloadHash);\n\n    // overriding the virtual function in LzReceiver\n    function _blockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual override {\n        (bool success, bytes memory reason) = address(this).excessivelySafeCall(gasleft(), 150, abi.encodeWithSelector(this.nonblockingLzReceive.selector, _srcChainId, _srcAddress, _nonce, _payload));\n        // try-catch all errors/exceptions\n        if (!success) {\n            _storeFailedMessage(_srcChainId, _srcAddress, _nonce, _payload, reason);\n        }\n    }\n\n    function _storeFailedMessage(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload, bytes memory _reason) internal virtual {\n        failedMessages[_srcChainId][_srcAddress][_nonce] = keccak256(_payload);\n        emit MessageFailed(_srcChainId, _srcAddress, _nonce, _payload, _reason);\n    }\n\n    function nonblockingLzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) public virtual {\n        // only internal transaction\n        require(_msgSender() == address(this), \"NonblockingLzApp: caller must be LzApp\");\n        _nonblockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload);\n    }\n\n    //@notice override this function\n    function _nonblockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual;\n\n    function retryMessage(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) public payable virtual {\n        // assert there is message to retry\n        bytes32 payloadHash = failedMessages[_srcChainId][_srcAddress][_nonce];\n        require(payloadHash != bytes32(0), \"NonblockingLzApp: no stored message\");\n        require(keccak256(_payload) == payloadHash, \"NonblockingLzApp: invalid payload\");\n        // clear the stored message\n        failedMessages[_srcChainId][_srcAddress][_nonce] = bytes32(0);\n        // execute the message. revert if it fails again\n        _nonblockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload);\n        emit RetryMessageSuccess(_srcChainId, _srcAddress, _nonce, payloadHash);\n    }\n}\n"},{"file_path":"@layerzerolabs/solidity-examples/contracts/token/oft/IOFT.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\nimport \"./IOFTCore.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * @dev Interface of the OFT standard\n */\ninterface IOFT is IOFTCore, IERC20 {\n\n}\n"},{"file_path":"@layerzerolabs/solidity-examples/contracts/token/oft/IOFTCore.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\n/**\n * @dev Interface of the IOFT core standard\n */\ninterface IOFTCore is IERC165 {\n    /**\n     * @dev estimate send token `_tokenId` to (`_dstChainId`, `_toAddress`)\n     * _dstChainId - L0 defined chain id to send tokens too\n     * _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain\n     * _amount - amount of the tokens to transfer\n     * _useZro - indicates to use zro to pay L0 fees\n     * _adapterParam - flexible bytes array to indicate messaging adapter services in L0\n     */\n    function estimateSendFee(uint16 _dstChainId, bytes calldata _toAddress, uint _amount, bool _useZro, bytes calldata _adapterParams) external view returns (uint nativeFee, uint zroFee);\n\n    /**\n     * @dev send `_amount` amount of token to (`_dstChainId`, `_toAddress`) from `_from`\n     * `_from` the owner of token\n     * `_dstChainId` the destination chain identifier\n     * `_toAddress` can be any size depending on the `dstChainId`.\n     * `_amount` the quantity of tokens in wei\n     * `_refundAddress` the address LayerZero refunds if too much message fee is sent\n     * `_zroPaymentAddress` set to address(0x0) if not paying in ZRO (LayerZero Token)\n     * `_adapterParams` is a flexible bytes array to indicate messaging adapter services\n     */\n    function sendFrom(address _from, uint16 _dstChainId, bytes calldata _toAddress, uint _amount, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams) external payable;\n\n    /**\n     * @dev returns the circulating amount of tokens on current chain\n     */\n    function circulatingSupply() external view returns (uint);\n\n    /**\n     * @dev returns the address of the ERC20 token\n     */\n    function token() external view returns (address);\n\n    /**\n     * @dev Emitted when `_amount` tokens are moved from the `_sender` to (`_dstChainId`, `_toAddress`)\n     * `_nonce` is the outbound nonce\n     */\n    event SendToChain(uint16 indexed _dstChainId, address indexed _from, bytes _toAddress, uint _amount);\n\n    /**\n     * @dev Emitted when `_amount` tokens are received from `_srcChainId` into the `_toAddress` on the local chain.\n     * `_nonce` is the inbound nonce.\n     */\n    event ReceiveFromChain(uint16 indexed _srcChainId, address indexed _to, uint _amount);\n\n    event SetUseCustomAdapterParams(bool _useCustomAdapterParams);\n}\n"},{"file_path":"@layerzerolabs/solidity-examples/contracts/token/oft/OFT.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./IOFT.sol\";\nimport \"./OFTCore.sol\";\n\n// override decimal() function is needed\ncontract OFT is OFTCore, ERC20, IOFT {\n    constructor(string memory _name, string memory _symbol, address _lzEndpoint) ERC20(_name, _symbol) OFTCore(_lzEndpoint) {}\n\n    function supportsInterface(bytes4 interfaceId) public view virtual override(OFTCore, IERC165) returns (bool) {\n        return interfaceId == type(IOFT).interfaceId || interfaceId == type(IERC20).interfaceId || super.supportsInterface(interfaceId);\n    }\n\n    function token() public view virtual override returns (address) {\n        return address(this);\n    }\n\n    function circulatingSupply() public view virtual override returns (uint) {\n        return totalSupply();\n    }\n\n    function _debitFrom(address _from, uint16, bytes memory, uint _amount) internal virtual override returns(uint) {\n        address spender = _msgSender();\n        if (_from != spender) _spendAllowance(_from, spender, _amount);\n        _burn(_from, _amount);\n        return _amount;\n    }\n\n    function _creditTo(uint16, address _toAddress, uint _amount) internal virtual override returns(uint) {\n        _mint(_toAddress, _amount);\n        return _amount;\n    }\n}\n"},{"file_path":"@layerzerolabs/solidity-examples/contracts/token/oft/OFTCore.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../../lzApp/NonblockingLzApp.sol\";\nimport \"./IOFTCore.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nabstract contract OFTCore is NonblockingLzApp, ERC165, IOFTCore {\n    using BytesLib for bytes;\n\n    uint public constant NO_EXTRA_GAS = 0;\n\n    // packet type\n    uint16 public constant PT_SEND = 0;\n\n    bool public useCustomAdapterParams;\n\n    constructor(address _lzEndpoint) NonblockingLzApp(_lzEndpoint) {}\n\n    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n        return interfaceId == type(IOFTCore).interfaceId || super.supportsInterface(interfaceId);\n    }\n\n    function estimateSendFee(uint16 _dstChainId, bytes calldata _toAddress, uint _amount, bool _useZro, bytes calldata _adapterParams) public view virtual override returns (uint nativeFee, uint zroFee) {\n        // mock the payload for sendFrom()\n        bytes memory payload = abi.encode(PT_SEND, _toAddress, _amount);\n        return lzEndpoint.estimateFees(_dstChainId, address(this), payload, _useZro, _adapterParams);\n    }\n\n    function sendFrom(address _from, uint16 _dstChainId, bytes calldata _toAddress, uint _amount, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams) public payable virtual override {\n        _send(_from, _dstChainId, _toAddress, _amount, _refundAddress, _zroPaymentAddress, _adapterParams);\n    }\n\n    function setUseCustomAdapterParams(bool _useCustomAdapterParams) public virtual onlyOwner {\n        useCustomAdapterParams = _useCustomAdapterParams;\n        emit SetUseCustomAdapterParams(_useCustomAdapterParams);\n    }\n\n    function _nonblockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual override {\n        uint16 packetType;\n        assembly {\n            packetType := mload(add(_payload, 32))\n        }\n\n        if (packetType == PT_SEND) {\n            _sendAck(_srcChainId, _srcAddress, _nonce, _payload);\n        } else {\n            revert(\"OFTCore: unknown packet type\");\n        }\n    }\n\n    function _send(address _from, uint16 _dstChainId, bytes memory _toAddress, uint _amount, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams) internal virtual {\n        _checkAdapterParams(_dstChainId, PT_SEND, _adapterParams, NO_EXTRA_GAS);\n\n        uint amount = _debitFrom(_from, _dstChainId, _toAddress, _amount);\n\n        bytes memory lzPayload = abi.encode(PT_SEND, _toAddress, amount);\n        _lzSend(_dstChainId, lzPayload, _refundAddress, _zroPaymentAddress, _adapterParams, msg.value);\n\n        emit SendToChain(_dstChainId, _from, _toAddress, amount);\n    }\n\n    function _sendAck(uint16 _srcChainId, bytes memory, uint64, bytes memory _payload) internal virtual {\n        (, bytes memory toAddressBytes, uint amount) = abi.decode(_payload, (uint16, bytes, uint));\n\n        address to = toAddressBytes.toAddress(0);\n\n        amount = _creditTo(_srcChainId, to, amount);\n        emit ReceiveFromChain(_srcChainId, to, amount);\n    }\n\n    function _checkAdapterParams(uint16 _dstChainId, uint16 _pkType, bytes memory _adapterParams, uint _extraGas) internal virtual {\n        if (useCustomAdapterParams) {\n            _checkGasLimit(_dstChainId, _pkType, _adapterParams, _extraGas);\n        } else {\n            require(_adapterParams.length == 0, \"OFTCore: _adapterParams must be empty.\");\n        }\n    }\n\n    function _debitFrom(address _from, uint16 _dstChainId, bytes memory _toAddress, uint _amount) internal virtual returns(uint);\n\n    function _creditTo(uint16 _srcChainId, address _toAddress, uint _amount) internal virtual returns(uint);\n}\n"},{"file_path":"@layerzerolabs/solidity-examples/contracts/token/oft/extension/BasedOFT.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../OFT.sol\";\n\ncontract BasedOFT is OFT {\n    constructor(string memory _name, string memory _symbol, address _lzEndpoint) OFT(_name, _symbol, _lzEndpoint) {}\n\n    function circulatingSupply() public view virtual override returns (uint) {\n        unchecked {\n            return totalSupply() - balanceOf(address(this));\n        }\n    }\n\n    function _debitFrom(address _from, uint16, bytes memory, uint _amount) internal virtual override returns(uint) {\n        address spender = _msgSender();\n        if (_from != spender) _spendAllowance(_from, spender, _amount);\n        _transfer(_from, address(this), _amount);\n        return _amount;\n    }\n\n    function _creditTo(uint16, address _toAddress, uint _amount) internal virtual override returns(uint) {\n        _transfer(address(this), _toAddress, _amount);\n        return _amount;\n    }\n}\n"},{"file_path":"@layerzerolabs/solidity-examples/contracts/util/BytesLib.sol","source_code":"// SPDX-License-Identifier: Unlicense\n/*\n * @title Solidity Bytes Arrays Utils\n * @author Gonçalo Sá <goncalo.sa@consensys.net>\n *\n * @dev Bytes tightly packed arrays utility library for ethereum contracts written in Solidity.\n *      The library lets you concatenate, slice and type cast bytes arrays both in memory and storage.\n */\npragma solidity >=0.8.0 <0.9.0;\n\n\nlibrary BytesLib {\n    function concat(\n        bytes memory _preBytes,\n        bytes memory _postBytes\n    )\n    internal\n    pure\n    returns (bytes memory)\n    {\n        bytes memory tempBytes;\n\n        assembly {\n        // Get a location of some free memory and store it in tempBytes as\n        // Solidity does for memory variables.\n            tempBytes := mload(0x40)\n\n        // Store the length of the first bytes array at the beginning of\n        // the memory for tempBytes.\n            let length := mload(_preBytes)\n            mstore(tempBytes, length)\n\n        // Maintain a memory counter for the current write location in the\n        // temp bytes array by adding the 32 bytes for the array length to\n        // the starting location.\n            let mc := add(tempBytes, 0x20)\n        // Stop copying when the memory counter reaches the length of the\n        // first bytes array.\n            let end := add(mc, length)\n\n            for {\n            // Initialize a copy counter to the start of the _preBytes data,\n            // 32 bytes into its memory.\n                let cc := add(_preBytes, 0x20)\n            } lt(mc, end) {\n            // Increase both counters by 32 bytes each iteration.\n                mc := add(mc, 0x20)\n                cc := add(cc, 0x20)\n            } {\n            // Write the _preBytes data into the tempBytes memory 32 bytes\n            // at a time.\n                mstore(mc, mload(cc))\n            }\n\n        // Add the length of _postBytes to the current length of tempBytes\n        // and store it as the new length in the first 32 bytes of the\n        // tempBytes memory.\n            length := mload(_postBytes)\n            mstore(tempBytes, add(length, mload(tempBytes)))\n\n        // Move the memory counter back from a multiple of 0x20 to the\n        // actual end of the _preBytes data.\n            mc := end\n        // Stop copying when the memory counter reaches the new combined\n        // length of the arrays.\n            end := add(mc, length)\n\n            for {\n                let cc := add(_postBytes, 0x20)\n            } lt(mc, end) {\n                mc := add(mc, 0x20)\n                cc := add(cc, 0x20)\n            } {\n                mstore(mc, mload(cc))\n            }\n\n        // Update the free-memory pointer by padding our last write location\n        // to 32 bytes: add 31 bytes to the end of tempBytes to move to the\n        // next 32 byte block, then round down to the nearest multiple of\n        // 32. If the sum of the length of the two arrays is zero then add\n        // one before rounding down to leave a blank 32 bytes (the length block with 0).\n            mstore(0x40, and(\n            add(add(end, iszero(add(length, mload(_preBytes)))), 31),\n            not(31) // Round down to the nearest 32 bytes.\n            ))\n        }\n\n        return tempBytes;\n    }\n\n    function concatStorage(bytes storage _preBytes, bytes memory _postBytes) internal {\n        assembly {\n        // Read the first 32 bytes of _preBytes storage, which is the length\n        // of the array. (We don't need to use the offset into the slot\n        // because arrays use the entire slot.)\n            let fslot := sload(_preBytes.slot)\n        // Arrays of 31 bytes or less have an even value in their slot,\n        // while longer arrays have an odd value. The actual length is\n        // the slot divided by two for odd values, and the lowest order\n        // byte divided by two for even values.\n        // If the slot is even, bitwise and the slot with 255 and divide by\n        // two to get the length. If the slot is odd, bitwise and the slot\n        // with -1 and divide by two.\n            let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2)\n            let mlength := mload(_postBytes)\n            let newlength := add(slength, mlength)\n        // slength can contain both the length and contents of the array\n        // if length < 32 bytes so let's prepare for that\n        // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage\n            switch add(lt(slength, 32), lt(newlength, 32))\n            case 2 {\n            // Since the new array still fits in the slot, we just need to\n            // update the contents of the slot.\n            // uint256(bytes_storage) = uint256(bytes_storage) + uint256(bytes_memory) + new_length\n                sstore(\n                _preBytes.slot,\n                // all the modifications to the slot are inside this\n                // next block\n                add(\n                // we can just add to the slot contents because the\n                // bytes we want to change are the LSBs\n                fslot,\n                add(\n                mul(\n                div(\n                // load the bytes from memory\n                mload(add(_postBytes, 0x20)),\n                // zero all bytes to the right\n                exp(0x100, sub(32, mlength))\n                ),\n                // and now shift left the number of bytes to\n                // leave space for the length in the slot\n                exp(0x100, sub(32, newlength))\n                ),\n                // increase length by the double of the memory\n                // bytes length\n                mul(mlength, 2)\n                )\n                )\n                )\n            }\n            case 1 {\n            // The stored value fits in the slot, but the combined value\n            // will exceed it.\n            // get the keccak hash to get the contents of the array\n                mstore(0x0, _preBytes.slot)\n                let sc := add(keccak256(0x0, 0x20), div(slength, 32))\n\n            // save new length\n                sstore(_preBytes.slot, add(mul(newlength, 2), 1))\n\n            // The contents of the _postBytes array start 32 bytes into\n            // the structure. Our first read should obtain the `submod`\n            // bytes that can fit into the unused space in the last word\n            // of the stored array. To get this, we read 32 bytes starting\n            // from `submod`, so the data we read overlaps with the array\n            // contents by `submod` bytes. Masking the lowest-order\n            // `submod` bytes allows us to add that value directly to the\n            // stored value.\n\n                let submod := sub(32, slength)\n                let mc := add(_postBytes, submod)\n                let end := add(_postBytes, mlength)\n                let mask := sub(exp(0x100, submod), 1)\n\n                sstore(\n                sc,\n                add(\n                and(\n                fslot,\n                0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00\n                ),\n                and(mload(mc), mask)\n                )\n                )\n\n                for {\n                    mc := add(mc, 0x20)\n                    sc := add(sc, 1)\n                } lt(mc, end) {\n                    sc := add(sc, 1)\n                    mc := add(mc, 0x20)\n                } {\n                    sstore(sc, mload(mc))\n                }\n\n                mask := exp(0x100, sub(mc, end))\n\n                sstore(sc, mul(div(mload(mc), mask), mask))\n            }\n            default {\n            // get the keccak hash to get the contents of the array\n                mstore(0x0, _preBytes.slot)\n            // Start copying to the last used word of the stored array.\n                let sc := add(keccak256(0x0, 0x20), div(slength, 32))\n\n            // save new length\n                sstore(_preBytes.slot, add(mul(newlength, 2), 1))\n\n            // Copy over the first `submod` bytes of the new data as in\n            // case 1 above.\n                let slengthmod := mod(slength, 32)\n                let mlengthmod := mod(mlength, 32)\n                let submod := sub(32, slengthmod)\n                let mc := add(_postBytes, submod)\n                let end := add(_postBytes, mlength)\n                let mask := sub(exp(0x100, submod), 1)\n\n                sstore(sc, add(sload(sc), and(mload(mc), mask)))\n\n                for {\n                    sc := add(sc, 1)\n                    mc := add(mc, 0x20)\n                } lt(mc, end) {\n                    sc := add(sc, 1)\n                    mc := add(mc, 0x20)\n                } {\n                    sstore(sc, mload(mc))\n                }\n\n                mask := exp(0x100, sub(mc, end))\n\n                sstore(sc, mul(div(mload(mc), mask), mask))\n            }\n        }\n    }\n\n    function slice(\n        bytes memory _bytes,\n        uint256 _start,\n        uint256 _length\n    )\n    internal\n    pure\n    returns (bytes memory)\n    {\n        require(_length + 31 >= _length, \"slice_overflow\");\n        require(_bytes.length >= _start + _length, \"slice_outOfBounds\");\n\n        bytes memory tempBytes;\n\n        assembly {\n            switch iszero(_length)\n            case 0 {\n            // Get a location of some free memory and store it in tempBytes as\n            // Solidity does for memory variables.\n                tempBytes := mload(0x40)\n\n            // The first word of the slice result is potentially a partial\n            // word read from the original array. To read it, we calculate\n            // the length of that partial word and start copying that many\n            // bytes into the array. The first word we copy will start with\n            // data we don't care about, but the last `lengthmod` bytes will\n            // land at the beginning of the contents of the new array. When\n            // we're done copying, we overwrite the full first word with\n            // the actual length of the slice.\n                let lengthmod := and(_length, 31)\n\n            // The multiplication in the next line is necessary\n            // because when slicing multiples of 32 bytes (lengthmod == 0)\n            // the following copy loop was copying the origin's length\n            // and then ending prematurely not copying everything it should.\n                let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))\n                let end := add(mc, _length)\n\n                for {\n                // The multiplication in the next line has the same exact purpose\n                // as the one above.\n                    let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)\n                } lt(mc, end) {\n                    mc := add(mc, 0x20)\n                    cc := add(cc, 0x20)\n                } {\n                    mstore(mc, mload(cc))\n                }\n\n                mstore(tempBytes, _length)\n\n            //update free-memory pointer\n            //allocating the array padded to 32 bytes like the compiler does now\n                mstore(0x40, and(add(mc, 31), not(31)))\n            }\n            //if we want a zero-length slice let's just return a zero-length array\n            default {\n                tempBytes := mload(0x40)\n            //zero out the 32 bytes slice we are about to return\n            //we need to do it because Solidity does not garbage collect\n                mstore(tempBytes, 0)\n\n                mstore(0x40, add(tempBytes, 0x20))\n            }\n        }\n\n        return tempBytes;\n    }\n\n    function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) {\n        require(_bytes.length >= _start + 20, \"toAddress_outOfBounds\");\n        address tempAddress;\n\n        assembly {\n            tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)\n        }\n\n        return tempAddress;\n    }\n\n    function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) {\n        require(_bytes.length >= _start + 1 , \"toUint8_outOfBounds\");\n        uint8 tempUint;\n\n        assembly {\n            tempUint := mload(add(add(_bytes, 0x1), _start))\n        }\n\n        return tempUint;\n    }\n\n    function toUint16(bytes memory _bytes, uint256 _start) internal pure returns (uint16) {\n        require(_bytes.length >= _start + 2, \"toUint16_outOfBounds\");\n        uint16 tempUint;\n\n        assembly {\n            tempUint := mload(add(add(_bytes, 0x2), _start))\n        }\n\n        return tempUint;\n    }\n\n    function toUint32(bytes memory _bytes, uint256 _start) internal pure returns (uint32) {\n        require(_bytes.length >= _start + 4, \"toUint32_outOfBounds\");\n        uint32 tempUint;\n\n        assembly {\n            tempUint := mload(add(add(_bytes, 0x4), _start))\n        }\n\n        return tempUint;\n    }\n\n    function toUint64(bytes memory _bytes, uint256 _start) internal pure returns (uint64) {\n        require(_bytes.length >= _start + 8, \"toUint64_outOfBounds\");\n        uint64 tempUint;\n\n        assembly {\n            tempUint := mload(add(add(_bytes, 0x8), _start))\n        }\n\n        return tempUint;\n    }\n\n    function toUint96(bytes memory _bytes, uint256 _start) internal pure returns (uint96) {\n        require(_bytes.length >= _start + 12, \"toUint96_outOfBounds\");\n        uint96 tempUint;\n\n        assembly {\n            tempUint := mload(add(add(_bytes, 0xc), _start))\n        }\n\n        return tempUint;\n    }\n\n    function toUint128(bytes memory _bytes, uint256 _start) internal pure returns (uint128) {\n        require(_bytes.length >= _start + 16, \"toUint128_outOfBounds\");\n        uint128 tempUint;\n\n        assembly {\n            tempUint := mload(add(add(_bytes, 0x10), _start))\n        }\n\n        return tempUint;\n    }\n\n    function toUint256(bytes memory _bytes, uint256 _start) internal pure returns (uint256) {\n        require(_bytes.length >= _start + 32, \"toUint256_outOfBounds\");\n        uint256 tempUint;\n\n        assembly {\n            tempUint := mload(add(add(_bytes, 0x20), _start))\n        }\n\n        return tempUint;\n    }\n\n    function toBytes32(bytes memory _bytes, uint256 _start) internal pure returns (bytes32) {\n        require(_bytes.length >= _start + 32, \"toBytes32_outOfBounds\");\n        bytes32 tempBytes32;\n\n        assembly {\n            tempBytes32 := mload(add(add(_bytes, 0x20), _start))\n        }\n\n        return tempBytes32;\n    }\n\n    function equal(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bool) {\n        bool success = true;\n\n        assembly {\n            let length := mload(_preBytes)\n\n        // if lengths don't match the arrays are not equal\n            switch eq(length, mload(_postBytes))\n            case 1 {\n            // cb is a circuit breaker in the for loop since there's\n            //  no said feature for inline assembly loops\n            // cb = 1 - don't breaker\n            // cb = 0 - break\n                let cb := 1\n\n                let mc := add(_preBytes, 0x20)\n                let end := add(mc, length)\n\n                for {\n                    let cc := add(_postBytes, 0x20)\n                // the next line is the loop condition:\n                // while(uint256(mc < end) + cb == 2)\n                } eq(add(lt(mc, end), cb), 2) {\n                    mc := add(mc, 0x20)\n                    cc := add(cc, 0x20)\n                } {\n                // if any of these checks fails then arrays are not equal\n                    if iszero(eq(mload(mc), mload(cc))) {\n                    // unsuccess:\n                        success := 0\n                        cb := 0\n                    }\n                }\n            }\n            default {\n            // unsuccess:\n                success := 0\n            }\n        }\n\n        return success;\n    }\n\n    function equalStorage(\n        bytes storage _preBytes,\n        bytes memory _postBytes\n    )\n    internal\n    view\n    returns (bool)\n    {\n        bool success = true;\n\n        assembly {\n        // we know _preBytes_offset is 0\n            let fslot := sload(_preBytes.slot)\n        // Decode the length of the stored array like in concatStorage().\n            let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2)\n            let mlength := mload(_postBytes)\n\n        // if lengths don't match the arrays are not equal\n            switch eq(slength, mlength)\n            case 1 {\n            // slength can contain both the length and contents of the array\n            // if length < 32 bytes so let's prepare for that\n            // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage\n                if iszero(iszero(slength)) {\n                    switch lt(slength, 32)\n                    case 1 {\n                    // blank the last byte which is the length\n                        fslot := mul(div(fslot, 0x100), 0x100)\n\n                        if iszero(eq(fslot, mload(add(_postBytes, 0x20)))) {\n                        // unsuccess:\n                            success := 0\n                        }\n                    }\n                    default {\n                    // cb is a circuit breaker in the for loop since there's\n                    //  no said feature for inline assembly loops\n                    // cb = 1 - don't breaker\n                    // cb = 0 - break\n                        let cb := 1\n\n                    // get the keccak hash to get the contents of the array\n                        mstore(0x0, _preBytes.slot)\n                        let sc := keccak256(0x0, 0x20)\n\n                        let mc := add(_postBytes, 0x20)\n                        let end := add(mc, mlength)\n\n                    // the next line is the loop condition:\n                    // while(uint256(mc < end) + cb == 2)\n                        for {} eq(add(lt(mc, end), cb), 2) {\n                            sc := add(sc, 1)\n                            mc := add(mc, 0x20)\n                        } {\n                            if iszero(eq(sload(sc), mload(mc))) {\n                            // unsuccess:\n                                success := 0\n                                cb := 0\n                            }\n                        }\n                    }\n                }\n            }\n            default {\n            // unsuccess:\n                success := 0\n            }\n        }\n\n        return success;\n    }\n}\n"},{"file_path":"@layerzerolabs/solidity-examples/contracts/util/ExcessivelySafeCall.sol","source_code":"// SPDX-License-Identifier: MIT OR Apache-2.0\npragma solidity >=0.7.6;\n\nlibrary ExcessivelySafeCall {\n    uint256 constant LOW_28_MASK =\n    0x00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff;\n\n    /// @notice Use when you _really_ really _really_ don't trust the called\n    /// contract. This prevents the called contract from causing reversion of\n    /// the caller in as many ways as we can.\n    /// @dev The main difference between this and a solidity low-level call is\n    /// that we limit the number of bytes that the callee can cause to be\n    /// copied to caller memory. This prevents stupid things like malicious\n    /// contracts returning 10,000,000 bytes causing a local OOG when copying\n    /// to memory.\n    /// @param _target The address to call\n    /// @param _gas The amount of gas to forward to the remote contract\n    /// @param _maxCopy The maximum number of bytes of returndata to copy\n    /// to memory.\n    /// @param _calldata The data to send to the remote contract\n    /// @return success and returndata, as `.call()`. Returndata is capped to\n    /// `_maxCopy` bytes.\n    function excessivelySafeCall(\n        address _target,\n        uint256 _gas,\n        uint16 _maxCopy,\n        bytes memory _calldata\n    ) internal returns (bool, bytes memory) {\n        // set up for assembly call\n        uint256 _toCopy;\n        bool _success;\n        bytes memory _returnData = new bytes(_maxCopy);\n        // dispatch message to recipient\n        // by assembly calling \"handle\" function\n        // we call via assembly to avoid memcopying a very large returndata\n        // returned by a malicious contract\n        assembly {\n            _success := call(\n            _gas, // gas\n            _target, // recipient\n            0, // ether value\n            add(_calldata, 0x20), // inloc\n            mload(_calldata), // inlen\n            0, // outloc\n            0 // outlen\n            )\n        // limit our copy to 256 bytes\n            _toCopy := returndatasize()\n            if gt(_toCopy, _maxCopy) {\n                _toCopy := _maxCopy\n            }\n        // Store the length of the copied bytes\n            mstore(_returnData, _toCopy)\n        // copy the bytes from returndata[0:_toCopy]\n            returndatacopy(add(_returnData, 0x20), 0, _toCopy)\n        }\n        return (_success, _returnData);\n    }\n\n    /// @notice Use when you _really_ really _really_ don't trust the called\n    /// contract. This prevents the called contract from causing reversion of\n    /// the caller in as many ways as we can.\n    /// @dev The main difference between this and a solidity low-level call is\n    /// that we limit the number of bytes that the callee can cause to be\n    /// copied to caller memory. This prevents stupid things like malicious\n    /// contracts returning 10,000,000 bytes causing a local OOG when copying\n    /// to memory.\n    /// @param _target The address to call\n    /// @param _gas The amount of gas to forward to the remote contract\n    /// @param _maxCopy The maximum number of bytes of returndata to copy\n    /// to memory.\n    /// @param _calldata The data to send to the remote contract\n    /// @return success and returndata, as `.call()`. Returndata is capped to\n    /// `_maxCopy` bytes.\n    function excessivelySafeStaticCall(\n        address _target,\n        uint256 _gas,\n        uint16 _maxCopy,\n        bytes memory _calldata\n    ) internal view returns (bool, bytes memory) {\n        // set up for assembly call\n        uint256 _toCopy;\n        bool _success;\n        bytes memory _returnData = new bytes(_maxCopy);\n        // dispatch message to recipient\n        // by assembly calling \"handle\" function\n        // we call via assembly to avoid memcopying a very large returndata\n        // returned by a malicious contract\n        assembly {\n            _success := staticcall(\n            _gas, // gas\n            _target, // recipient\n            add(_calldata, 0x20), // inloc\n            mload(_calldata), // inlen\n            0, // outloc\n            0 // outlen\n            )\n        // limit our copy to 256 bytes\n            _toCopy := returndatasize()\n            if gt(_toCopy, _maxCopy) {\n                _toCopy := _maxCopy\n            }\n        // Store the length of the copied bytes\n            mstore(_returnData, _toCopy)\n        // copy the bytes from returndata[0:_toCopy]\n            returndatacopy(add(_returnData, 0x20), 0, _toCopy)\n        }\n        return (_success, _returnData);\n    }\n\n    /**\n     * @notice Swaps function selectors in encoded contract calls\n     * @dev Allows reuse of encoded calldata for functions with identical\n     * argument types but different names. It simply swaps out the first 4 bytes\n     * for the new selector. This function modifies memory in place, and should\n     * only be used with caution.\n     * @param _newSelector The new 4-byte selector\n     * @param _buf The encoded contract args\n     */\n    function swapSelector(bytes4 _newSelector, bytes memory _buf)\n    internal\n    pure\n    {\n        require(_buf.length >= 4);\n        uint256 _mask = LOW_28_MASK;\n        assembly {\n        // load the first word of\n            let _word := mload(add(_buf, 0x20))\n        // mask out the top 4 bytes\n        // /x\n            _word := and(_word, _mask)\n            _word := or(_newSelector, _word)\n            mstore(add(_buf, 0x20), _word)\n        }\n    }\n}\n"},{"file_path":"@openzeppelin/contracts/access/Ownable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n    address private _owner;\n\n    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n    /**\n     * @dev Initializes the contract setting the deployer as the initial owner.\n     */\n    constructor() {\n        _transferOwnership(_msgSender());\n    }\n\n    /**\n     * @dev Throws if called by any account other than the owner.\n     */\n    modifier onlyOwner() {\n        _checkOwner();\n        _;\n    }\n\n    /**\n     * @dev Returns the address of the current owner.\n     */\n    function owner() public view virtual returns (address) {\n        return _owner;\n    }\n\n    /**\n     * @dev Throws if the sender is not the owner.\n     */\n    function _checkOwner() internal view virtual {\n        require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n    }\n\n    /**\n     * @dev Leaves the contract without owner. It will not be possible to call\n     * `onlyOwner` functions. Can only be called by the current owner.\n     *\n     * NOTE: Renouncing ownership will leave the contract without an owner,\n     * thereby disabling any functionality that is only available to the owner.\n     */\n    function renounceOwnership() public virtual onlyOwner {\n        _transferOwnership(address(0));\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Can only be called by the current owner.\n     */\n    function transferOwnership(address newOwner) public virtual onlyOwner {\n        require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n        _transferOwnership(newOwner);\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Internal function without access restriction.\n     */\n    function _transferOwnership(address newOwner) internal virtual {\n        address oldOwner = _owner;\n        _owner = newOwner;\n        emit OwnershipTransferred(oldOwner, newOwner);\n    }\n}\n"},{"file_path":"@openzeppelin/contracts/security/ReentrancyGuard.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n    // Booleans are more expensive than uint256 or any type that takes up a full\n    // word because each write operation emits an extra SLOAD to first read the\n    // slot's contents, replace the bits taken up by the boolean, and then write\n    // back. This is the compiler's defense against contract upgrades and\n    // pointer aliasing, and it cannot be disabled.\n\n    // The values being non-zero value makes deployment a bit more expensive,\n    // but in exchange the refund on every call to nonReentrant will be lower in\n    // amount. Since refunds are capped to a percentage of the total\n    // transaction's gas, it is best to keep them low in cases like this one, to\n    // increase the likelihood of the full refund coming into effect.\n    uint256 private constant _NOT_ENTERED = 1;\n    uint256 private constant _ENTERED = 2;\n\n    uint256 private _status;\n\n    constructor() {\n        _status = _NOT_ENTERED;\n    }\n\n    /**\n     * @dev Prevents a contract from calling itself, directly or indirectly.\n     * Calling a `nonReentrant` function from another `nonReentrant`\n     * function is not supported. It is possible to prevent this from happening\n     * by making the `nonReentrant` function external, and making it call a\n     * `private` function that does the actual work.\n     */\n    modifier nonReentrant() {\n        _nonReentrantBefore();\n        _;\n        _nonReentrantAfter();\n    }\n\n    function _nonReentrantBefore() private {\n        // On the first call to nonReentrant, _status will be _NOT_ENTERED\n        require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n        // Any calls to nonReentrant after this point will fail\n        _status = _ENTERED;\n    }\n\n    function _nonReentrantAfter() private {\n        // By storing the original value once again, a refund is triggered (see\n        // https://eips.ethereum.org/EIPS/eip-2200)\n        _status = _NOT_ENTERED;\n    }\n\n    /**\n     * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n     * `nonReentrant` function in the call stack.\n     */\n    function _reentrancyGuardEntered() internal view returns (bool) {\n        return _status == _ENTERED;\n    }\n}\n"},{"file_path":"@openzeppelin/contracts/token/ERC20/ERC20.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n    mapping(address => uint256) private _balances;\n\n    mapping(address => mapping(address => uint256)) private _allowances;\n\n    uint256 private _totalSupply;\n\n    string private _name;\n    string private _symbol;\n\n    /**\n     * @dev Sets the values for {name} and {symbol}.\n     *\n     * All two of these values are immutable: they can only be set once during\n     * construction.\n     */\n    constructor(string memory name_, string memory symbol_) {\n        _name = name_;\n        _symbol = symbol_;\n    }\n\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() public view virtual override returns (string memory) {\n        return _name;\n    }\n\n    /**\n     * @dev Returns the symbol of the token, usually a shorter version of the\n     * name.\n     */\n    function symbol() public view virtual override returns (string memory) {\n        return _symbol;\n    }\n\n    /**\n     * @dev Returns the number of decimals used to get its user representation.\n     * For example, if `decimals` equals `2`, a balance of `505` tokens should\n     * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n     *\n     * Tokens usually opt for a value of 18, imitating the relationship between\n     * Ether and Wei. This is the default value returned by this function, unless\n     * it's overridden.\n     *\n     * NOTE: This information is only used for _display_ purposes: it in\n     * no way affects any of the arithmetic of the contract, including\n     * {IERC20-balanceOf} and {IERC20-transfer}.\n     */\n    function decimals() public view virtual override returns (uint8) {\n        return 18;\n    }\n\n    /**\n     * @dev See {IERC20-totalSupply}.\n     */\n    function totalSupply() public view virtual override returns (uint256) {\n        return _totalSupply;\n    }\n\n    /**\n     * @dev See {IERC20-balanceOf}.\n     */\n    function balanceOf(address account) public view virtual override returns (uint256) {\n        return _balances[account];\n    }\n\n    /**\n     * @dev See {IERC20-transfer}.\n     *\n     * Requirements:\n     *\n     * - `to` cannot be the zero address.\n     * - the caller must have a balance of at least `amount`.\n     */\n    function transfer(address to, uint256 amount) public virtual override returns (bool) {\n        address owner = _msgSender();\n        _transfer(owner, to, amount);\n        return true;\n    }\n\n    /**\n     * @dev See {IERC20-allowance}.\n     */\n    function allowance(address owner, address spender) public view virtual override returns (uint256) {\n        return _allowances[owner][spender];\n    }\n\n    /**\n     * @dev See {IERC20-approve}.\n     *\n     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n     * `transferFrom`. This is semantically equivalent to an infinite approval.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     */\n    function approve(address spender, uint256 amount) public virtual override returns (bool) {\n        address owner = _msgSender();\n        _approve(owner, spender, amount);\n        return true;\n    }\n\n    /**\n     * @dev See {IERC20-transferFrom}.\n     *\n     * Emits an {Approval} event indicating the updated allowance. This is not\n     * required by the EIP. See the note at the beginning of {ERC20}.\n     *\n     * NOTE: Does not update the allowance if the current allowance\n     * is the maximum `uint256`.\n     *\n     * Requirements:\n     *\n     * - `from` and `to` cannot be the zero address.\n     * - `from` must have a balance of at least `amount`.\n     * - the caller must have allowance for ``from``'s tokens of at least\n     * `amount`.\n     */\n    function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {\n        address spender = _msgSender();\n        _spendAllowance(from, spender, amount);\n        _transfer(from, to, amount);\n        return true;\n    }\n\n    /**\n     * @dev Atomically increases the allowance granted to `spender` by the caller.\n     *\n     * This is an alternative to {approve} that can be used as a mitigation for\n     * problems described in {IERC20-approve}.\n     *\n     * Emits an {Approval} event indicating the updated allowance.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     */\n    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n        address owner = _msgSender();\n        _approve(owner, spender, allowance(owner, spender) + addedValue);\n        return true;\n    }\n\n    /**\n     * @dev Atomically decreases the allowance granted to `spender` by the caller.\n     *\n     * This is an alternative to {approve} that can be used as a mitigation for\n     * problems described in {IERC20-approve}.\n     *\n     * Emits an {Approval} event indicating the updated allowance.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     * - `spender` must have allowance for the caller of at least\n     * `subtractedValue`.\n     */\n    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n        address owner = _msgSender();\n        uint256 currentAllowance = allowance(owner, spender);\n        require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n        unchecked {\n            _approve(owner, spender, currentAllowance - subtractedValue);\n        }\n\n        return true;\n    }\n\n    /**\n     * @dev Moves `amount` of tokens from `from` to `to`.\n     *\n     * This internal function is equivalent to {transfer}, and can be used to\n     * e.g. implement automatic token fees, slashing mechanisms, etc.\n     *\n     * Emits a {Transfer} event.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `from` must have a balance of at least `amount`.\n     */\n    function _transfer(address from, address to, uint256 amount) internal virtual {\n        require(from != address(0), \"ERC20: transfer from the zero address\");\n        require(to != address(0), \"ERC20: transfer to the zero address\");\n\n        _beforeTokenTransfer(from, to, amount);\n\n        uint256 fromBalance = _balances[from];\n        require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n        unchecked {\n            _balances[from] = fromBalance - amount;\n            // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n            // decrementing then incrementing.\n            _balances[to] += amount;\n        }\n\n        emit Transfer(from, to, amount);\n\n        _afterTokenTransfer(from, to, amount);\n    }\n\n    /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n     * the total supply.\n     *\n     * Emits a {Transfer} event with `from` set to the zero address.\n     *\n     * Requirements:\n     *\n     * - `account` cannot be the zero address.\n     */\n    function _mint(address account, uint256 amount) internal virtual {\n        require(account != address(0), \"ERC20: mint to the zero address\");\n\n        _beforeTokenTransfer(address(0), account, amount);\n\n        _totalSupply += amount;\n        unchecked {\n            // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n            _balances[account] += amount;\n        }\n        emit Transfer(address(0), account, amount);\n\n        _afterTokenTransfer(address(0), account, amount);\n    }\n\n    /**\n     * @dev Destroys `amount` tokens from `account`, reducing the\n     * total supply.\n     *\n     * Emits a {Transfer} event with `to` set to the zero address.\n     *\n     * Requirements:\n     *\n     * - `account` cannot be the zero address.\n     * - `account` must have at least `amount` tokens.\n     */\n    function _burn(address account, uint256 amount) internal virtual {\n        require(account != address(0), \"ERC20: burn from the zero address\");\n\n        _beforeTokenTransfer(account, address(0), amount);\n\n        uint256 accountBalance = _balances[account];\n        require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n        unchecked {\n            _balances[account] = accountBalance - amount;\n            // Overflow not possible: amount <= accountBalance <= totalSupply.\n            _totalSupply -= amount;\n        }\n\n        emit Transfer(account, address(0), amount);\n\n        _afterTokenTransfer(account, address(0), amount);\n    }\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n     *\n     * This internal function is equivalent to `approve`, and can be used to\n     * e.g. set automatic allowances for certain subsystems, etc.\n     *\n     * Emits an {Approval} event.\n     *\n     * Requirements:\n     *\n     * - `owner` cannot be the zero address.\n     * - `spender` cannot be the zero address.\n     */\n    function _approve(address owner, address spender, uint256 amount) internal virtual {\n        require(owner != address(0), \"ERC20: approve from the zero address\");\n        require(spender != address(0), \"ERC20: approve to the zero address\");\n\n        _allowances[owner][spender] = amount;\n        emit Approval(owner, spender, amount);\n    }\n\n    /**\n     * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n     *\n     * Does not update the allowance amount in case of infinite allowance.\n     * Revert if not enough allowance is available.\n     *\n     * Might emit an {Approval} event.\n     */\n    function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\n        uint256 currentAllowance = allowance(owner, spender);\n        if (currentAllowance != type(uint256).max) {\n            require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n            unchecked {\n                _approve(owner, spender, currentAllowance - amount);\n            }\n        }\n    }\n\n    /**\n     * @dev Hook that is called before any transfer of tokens. This includes\n     * minting and burning.\n     *\n     * Calling conditions:\n     *\n     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n     * will be transferred to `to`.\n     * - when `from` is zero, `amount` tokens will be minted for `to`.\n     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n     * - `from` and `to` are never both zero.\n     *\n     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n     */\n    function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n\n    /**\n     * @dev Hook that is called after any transfer of tokens. This includes\n     * minting and burning.\n     *\n     * Calling conditions:\n     *\n     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n     * has been transferred to `to`.\n     * - when `from` is zero, `amount` tokens have been minted for `to`.\n     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n     * - `from` and `to` are never both zero.\n     *\n     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n     */\n    function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n}\n"},{"file_path":"@openzeppelin/contracts/token/ERC20/IERC20.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Returns the amount of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the amount of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves `amount` tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Moves `amount` tokens from `from` to `to` using the\n     * allowance mechanism. `amount` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n"},{"file_path":"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() external view returns (string memory);\n\n    /**\n     * @dev Returns the symbol of the token.\n     */\n    function symbol() external view returns (string memory);\n\n    /**\n     * @dev Returns the decimals places of the token.\n     */\n    function decimals() external view returns (uint8);\n}\n"},{"file_path":"@openzeppelin/contracts/utils/Context.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n    function _msgSender() internal view virtual returns (address) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view virtual returns (bytes calldata) {\n        return msg.data;\n    }\n}\n"},{"file_path":"@openzeppelin/contracts/utils/introspection/ERC165.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n        return interfaceId == type(IERC165).interfaceId;\n    }\n}\n"},{"file_path":"@openzeppelin/contracts/utils/introspection/IERC165.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n    /**\n     * @dev Returns true if this contract implements the interface defined by\n     * `interfaceId`. See the corresponding\n     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n     * to learn more about how these ids are created.\n     *\n     * This function call must use less than 30 000 gas.\n     */\n    function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"},{"file_path":"@openzeppelin/contracts/utils/structs/EnumerableSet.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n *     // Add the library methods\n *     using EnumerableSet for EnumerableSet.AddressSet;\n *\n *     // Declare a set state variable\n *     EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n    // To implement this library for multiple types with as little code\n    // repetition as possible, we write it in terms of a generic Set type with\n    // bytes32 values.\n    // The Set implementation uses private functions, and user-facing\n    // implementations (such as AddressSet) are just wrappers around the\n    // underlying Set.\n    // This means that we can only create new EnumerableSets for types that fit\n    // in bytes32.\n\n    struct Set {\n        // Storage of set values\n        bytes32[] _values;\n        // Position of the value in the `values` array, plus 1 because index 0\n        // means a value is not in the set.\n        mapping(bytes32 => uint256) _indexes;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function _add(Set storage set, bytes32 value) private returns (bool) {\n        if (!_contains(set, value)) {\n            set._values.push(value);\n            // The value is stored at length-1, but we add 1 to all indexes\n            // and use 0 as a sentinel value\n            set._indexes[value] = set._values.length;\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function _remove(Set storage set, bytes32 value) private returns (bool) {\n        // We read and store the value's index to prevent multiple reads from the same storage slot\n        uint256 valueIndex = set._indexes[value];\n\n        if (valueIndex != 0) {\n            // Equivalent to contains(set, value)\n            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n            // the array, and then remove the last element (sometimes called as 'swap and pop').\n            // This modifies the order of the array, as noted in {at}.\n\n            uint256 toDeleteIndex = valueIndex - 1;\n            uint256 lastIndex = set._values.length - 1;\n\n            if (lastIndex != toDeleteIndex) {\n                bytes32 lastValue = set._values[lastIndex];\n\n                // Move the last value to the index where the value to delete is\n                set._values[toDeleteIndex] = lastValue;\n                // Update the index for the moved value\n                set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\n            }\n\n            // Delete the slot where the moved value was stored\n            set._values.pop();\n\n            // Delete the index for the deleted slot\n            delete set._indexes[value];\n\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function _contains(Set storage set, bytes32 value) private view returns (bool) {\n        return set._indexes[value] != 0;\n    }\n\n    /**\n     * @dev Returns the number of values on the set. O(1).\n     */\n    function _length(Set storage set) private view returns (uint256) {\n        return set._values.length;\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function _at(Set storage set, uint256 index) private view returns (bytes32) {\n        return set._values[index];\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function _values(Set storage set) private view returns (bytes32[] memory) {\n        return set._values;\n    }\n\n    // Bytes32Set\n\n    struct Bytes32Set {\n        Set _inner;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n        return _add(set._inner, value);\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n        return _remove(set._inner, value);\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n        return _contains(set._inner, value);\n    }\n\n    /**\n     * @dev Returns the number of values in the set. O(1).\n     */\n    function length(Bytes32Set storage set) internal view returns (uint256) {\n        return _length(set._inner);\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n        return _at(set._inner, index);\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n        bytes32[] memory store = _values(set._inner);\n        bytes32[] memory result;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := store\n        }\n\n        return result;\n    }\n\n    // AddressSet\n\n    struct AddressSet {\n        Set _inner;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function add(AddressSet storage set, address value) internal returns (bool) {\n        return _add(set._inner, bytes32(uint256(uint160(value))));\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function remove(AddressSet storage set, address value) internal returns (bool) {\n        return _remove(set._inner, bytes32(uint256(uint160(value))));\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(AddressSet storage set, address value) internal view returns (bool) {\n        return _contains(set._inner, bytes32(uint256(uint160(value))));\n    }\n\n    /**\n     * @dev Returns the number of values in the set. O(1).\n     */\n    function length(AddressSet storage set) internal view returns (uint256) {\n        return _length(set._inner);\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(AddressSet storage set, uint256 index) internal view returns (address) {\n        return address(uint160(uint256(_at(set._inner, index))));\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function values(AddressSet storage set) internal view returns (address[] memory) {\n        bytes32[] memory store = _values(set._inner);\n        address[] memory result;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := store\n        }\n\n        return result;\n    }\n\n    // UintSet\n\n    struct UintSet {\n        Set _inner;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function add(UintSet storage set, uint256 value) internal returns (bool) {\n        return _add(set._inner, bytes32(value));\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function remove(UintSet storage set, uint256 value) internal returns (bool) {\n        return _remove(set._inner, bytes32(value));\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n        return _contains(set._inner, bytes32(value));\n    }\n\n    /**\n     * @dev Returns the number of values in the set. O(1).\n     */\n    function length(UintSet storage set) internal view returns (uint256) {\n        return _length(set._inner);\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n        return uint256(_at(set._inner, index));\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function values(UintSet storage set) internal view returns (uint256[] memory) {\n        bytes32[] memory store = _values(set._inner);\n        uint256[] memory result;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := store\n        }\n\n        return result;\n    }\n}\n"},{"file_path":"@uniswap/v3-periphery/contracts/libraries/TransferHelper.sol","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.6.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\nlibrary TransferHelper {\n    /// @notice Transfers tokens from the targeted address to the given destination\n    /// @notice Errors with 'STF' if transfer fails\n    /// @param token The contract address of the token to be transferred\n    /// @param from The originating address from which the tokens will be transferred\n    /// @param to The destination address of the transfer\n    /// @param value The amount to be transferred\n    function safeTransferFrom(\n        address token,\n        address from,\n        address to,\n        uint256 value\n    ) internal {\n        (bool success, bytes memory data) =\n            token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value));\n        require(success && (data.length == 0 || abi.decode(data, (bool))), 'STF');\n    }\n\n    /// @notice Transfers tokens from msg.sender to a recipient\n    /// @dev Errors with ST if transfer fails\n    /// @param token The contract address of the token which will be transferred\n    /// @param to The recipient of the transfer\n    /// @param value The value of the transfer\n    function safeTransfer(\n        address token,\n        address to,\n        uint256 value\n    ) internal {\n        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transfer.selector, to, value));\n        require(success && (data.length == 0 || abi.decode(data, (bool))), 'ST');\n    }\n\n    /// @notice Approves the stipulated contract to spend the given allowance in the given token\n    /// @dev Errors with 'SA' if transfer fails\n    /// @param token The contract address of the token to be approved\n    /// @param to The target of the approval\n    /// @param value The amount of the given token the target will be allowed to spend\n    function safeApprove(\n        address token,\n        address to,\n        uint256 value\n    ) internal {\n        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.approve.selector, to, value));\n        require(success && (data.length == 0 || abi.decode(data, (bool))), 'SA');\n    }\n\n    /// @notice Transfers ETH to the recipient address\n    /// @dev Fails with `STE`\n    /// @param to The destination of the transfer\n    /// @param value The value to be transferred\n    function safeTransferETH(address to, uint256 value) internal {\n        (bool success, ) = to.call{value: value}(new bytes(0));\n        require(success, 'STE');\n    }\n}\n"},{"file_path":"project:/contracts/AssetsVault.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\nimport {TransferHelper} from \"@uniswap/v3-periphery/contracts/libraries/TransferHelper.sol\";\n\ncontract AssetsVault {\n    address public stoneVault;\n    address public strategyController;\n\n    modifier onlyPermit() {\n        require(\n            stoneVault == msg.sender || strategyController == msg.sender,\n            \"not permit\"\n        );\n        _;\n    }\n\n    constructor(address _stoneVault, address _strategyController) {\n        require(\n            _stoneVault != address(0) && _strategyController != address(0),\n            \"ZERO ADDRESS\"\n        );\n        stoneVault = _stoneVault;\n        strategyController = _strategyController;\n    }\n\n    function deposit() external payable {\n        require(msg.value != 0, \"too small\");\n    }\n\n    function withdraw(address _to, uint256 _amount) external onlyPermit {\n        TransferHelper.safeTransferETH(_to, _amount);\n    }\n\n    function setNewVault(address _vault) external onlyPermit {\n        stoneVault = _vault;\n    }\n\n    function getBalance() external view returns (uint256 amount) {\n        amount = address(this).balance;\n    }\n\n    receive() external payable {}\n}\n"},{"file_path":"project:/contracts/StoneVault.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\nimport {ReentrancyGuard} from \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {TransferHelper} from \"@uniswap/v3-periphery/contracts/libraries/TransferHelper.sol\";\n\nimport {Minter} from \"./token/Minter.sol\";\nimport {Stone} from \"./token/Stone.sol\";\nimport {AssetsVault} from \"./AssetsVault.sol\";\nimport {StrategyController} from \"./strategies/StrategyController.sol\";\n\nimport {VaultMath} from \"./libraries/VaultMath.sol\";\n\ncontract StoneVault is ReentrancyGuard, Ownable {\n    uint256 internal constant MULTIPLIER = 1e18;\n    uint256 internal constant ONE_HUNDRED_PERCENT = 1e6;\n    uint256 internal constant MAXMIUM_FEE_RATE = ONE_HUNDRED_PERCENT / 100; // 1%\n    uint256 internal constant MINIMUM_REBASE_INTERVAL = 7 * 24 * 60 * 60;\n\n    uint256 public constant VERSION = 1;\n\n    uint256 public rebaseTimeInterval = 24 * 60 * 60;\n\n    address public immutable minter;\n    address public immutable stone;\n    address payable public immutable strategyController;\n    address payable public immutable assetsVault;\n\n    address public proposal;\n\n    address public feeRecipient;\n\n    uint256 public latestRoundID;\n\n    uint256 public withdrawableAmountInPast;\n    uint256 public withdrawingSharesInPast;\n    uint256 public withdrawingSharesInRound;\n\n    uint256 public withdrawFeeRate;\n\n    uint256 public rebaseTime;\n\n    mapping(uint256 => uint256) public roundPricePerShare;\n    mapping(uint256 => uint256) public settlementTime;\n\n    mapping(address => UserReceipt) public userReceipts;\n\n    struct UserReceipt {\n        uint256 withdrawRound;\n        uint256 withdrawShares;\n        uint256 withdrawableAmount;\n    }\n\n    event Deposit(\n        address indexed account,\n        uint256 amount,\n        uint256 mint,\n        uint256 round\n    );\n    event InitiateWithdraw(\n        address indexed account,\n        uint256 shares,\n        uint256 round\n    );\n    event CancelWithdraw(\n        address indexed account,\n        uint256 amount,\n        uint256 round\n    );\n    event Withdrawn(address indexed account, uint256 amount, uint256 round);\n    event WithdrawnFromStrategy(\n        address indexed account,\n        uint256 amount,\n        uint256 actualAmount,\n        uint256 round\n    );\n    event RollToNextRound(\n        uint256 round,\n        uint256 vaultIn,\n        uint256 vaultOut,\n        uint256 sharePrice\n    );\n    event StragetyAdded(address strategy);\n    event StragetyDestroyed(address strategy);\n    event StragetyCleared(address strategy);\n    event PortfolioConfigUpdated(address[] strategies, uint256[] ratios);\n    event FeeCharged(address indexed account, uint256 amount);\n    event SetWithdrawFeeRate(uint256 oldRate, uint256 newRate);\n    event SetFeeRecipient(address oldAddr, address newAddr);\n    event SetRebaseInterval(uint256 interval);\n\n    modifier onlyProposal() {\n        require(proposal == msg.sender, \"not proposal\");\n        _;\n    }\n\n    constructor(\n        address _minter,\n        address _proposal,\n        address payable _assetsVault,\n        address[] memory _strategies,\n        uint256[] memory _ratios\n    ) {\n        require(\n            _minter != address(0) &&\n                _proposal != address(0) &&\n                _assetsVault != address(0),\n            \"ZERO ADDRESS\"\n        );\n\n        uint256 length = _strategies.length;\n        for (uint256 i; i < length; i++) {\n            require(_strategies[i] != address(0), \"ZERO ADDRESS\");\n        }\n\n        minter = _minter;\n        proposal = _proposal;\n        assetsVault = _assetsVault;\n\n        feeRecipient = msg.sender;\n\n        StrategyController controller = new StrategyController(\n            _assetsVault,\n            _strategies,\n            _ratios\n        );\n        strategyController = payable(address(controller));\n        stone = Minter(_minter).stone();\n\n        roundPricePerShare[0] = MULTIPLIER;\n        latestRoundID = 0;\n    }\n\n    function deposit()\n        external\n        payable\n        nonReentrant\n        returns (uint256 mintAmount)\n    {\n        mintAmount = _depositFor(msg.value, msg.sender);\n    }\n\n    function depositFor(\n        address _user\n    ) external payable nonReentrant returns (uint256 mintAmount) {\n        mintAmount = _depositFor(msg.value, _user);\n    }\n\n    function _depositFor(\n        uint256 _amount,\n        address _user\n    ) internal returns (uint256 mintAmount) {\n        require(_amount != 0, \"too small\");\n\n        uint256 sharePrice;\n        uint256 currSharePrice = currentSharePrice();\n        if (latestRoundID == 0) {\n            sharePrice = MULTIPLIER;\n        } else {\n            uint256 latestSharePrice = roundPricePerShare[latestRoundID - 1];\n            sharePrice = latestSharePrice > currSharePrice\n                ? latestSharePrice\n                : currSharePrice;\n        }\n\n        mintAmount = (_amount * MULTIPLIER) / sharePrice;\n\n        AssetsVault(assetsVault).deposit{value: address(this).balance}();\n        Minter(minter).mint(_user, mintAmount);\n\n        emit Deposit(_user, _amount, mintAmount, latestRoundID);\n    }\n\n    function requestWithdraw(uint256 _shares) external nonReentrant {\n        require(_shares != 0, \"too small\");\n        require(latestRoundID != 0, \"should withdraw instantly\");\n        Stone stoneToken = Stone(stone);\n        Minter stoneMinter = Minter(minter);\n\n        require(stoneToken.balanceOf(msg.sender) >= _shares, \"exceed balance\");\n\n        TransferHelper.safeTransferFrom(\n            stone,\n            msg.sender,\n            address(this),\n            _shares\n        );\n\n        withdrawingSharesInRound = withdrawingSharesInRound + _shares;\n\n        UserReceipt storage receipt = userReceipts[msg.sender];\n\n        if (receipt.withdrawRound == latestRoundID) {\n            receipt.withdrawShares = receipt.withdrawShares + _shares;\n        } else if (receipt.withdrawRound == 0) {\n            receipt.withdrawShares = _shares;\n            receipt.withdrawRound = latestRoundID;\n        } else {\n            // Withdraw previous round share first\n            uint256 withdrawAmount = VaultMath.sharesToAsset(\n                receipt.withdrawShares,\n                roundPricePerShare[receipt.withdrawRound]\n            );\n\n            stoneMinter.burn(address(this), receipt.withdrawShares);\n            withdrawingSharesInPast =\n                withdrawingSharesInPast -\n                receipt.withdrawShares;\n\n            receipt.withdrawShares = _shares;\n            receipt.withdrawableAmount =\n                receipt.withdrawableAmount +\n                withdrawAmount;\n            receipt.withdrawRound = latestRoundID;\n        }\n\n        emit InitiateWithdraw(msg.sender, _shares, latestRoundID);\n    }\n\n    function cancelWithdraw(uint256 _shares) external nonReentrant {\n        require(_shares != 0, \"too small\");\n\n        UserReceipt storage receipt = userReceipts[msg.sender];\n        require(receipt.withdrawRound == latestRoundID, \"no pending withdraw\");\n        require(receipt.withdrawShares >= _shares, \"exceed pending withdraw\");\n\n        receipt.withdrawShares = receipt.withdrawShares - _shares;\n\n        TransferHelper.safeTransfer(stone, msg.sender, _shares);\n\n        if (receipt.withdrawShares == 0) {\n            receipt.withdrawRound = 0;\n        }\n\n        withdrawingSharesInRound = withdrawingSharesInRound - _shares;\n\n        emit CancelWithdraw(msg.sender, _shares, latestRoundID);\n    }\n\n    function instantWithdraw(\n        uint256 _amount,\n        uint256 _shares\n    ) external nonReentrant returns (uint256 actualWithdrawn) {\n        require(_amount != 0 || _shares != 0, \"too small\");\n\n        AssetsVault aVault = AssetsVault(assetsVault);\n        Minter stoneMinter = Minter(minter);\n\n        (uint256 idleAmount, ) = getVaultAvailableAmount();\n\n        if (_amount != 0) {\n            UserReceipt storage receipt = userReceipts[msg.sender];\n\n            if (\n                receipt.withdrawRound != latestRoundID &&\n                receipt.withdrawRound != 0\n            ) {\n                // Withdraw previous round share first\n                uint256 withdrawAmount = VaultMath.sharesToAsset(\n                    receipt.withdrawShares,\n                    roundPricePerShare[receipt.withdrawRound]\n                );\n\n                stoneMinter.burn(address(this), receipt.withdrawShares);\n\n                withdrawingSharesInPast =\n                    withdrawingSharesInPast -\n                    receipt.withdrawShares;\n                receipt.withdrawShares = 0;\n                receipt.withdrawableAmount =\n                    receipt.withdrawableAmount +\n                    withdrawAmount;\n                receipt.withdrawRound = 0;\n            }\n\n            require(\n                receipt.withdrawableAmount >= _amount,\n                \"exceed withdrawable\"\n            );\n\n            receipt.withdrawableAmount = receipt.withdrawableAmount - _amount;\n            withdrawableAmountInPast = withdrawableAmountInPast - _amount;\n            actualWithdrawn = _amount;\n\n            emit Withdrawn(msg.sender, _amount, latestRoundID);\n        }\n\n        if (_shares != 0) {\n            uint256 sharePrice;\n\n            if (latestRoundID == 0) {\n                sharePrice = MULTIPLIER;\n            } else {\n                uint256 currSharePrice = currentSharePrice();\n                uint256 latestSharePrice = roundPricePerShare[\n                    latestRoundID - 1\n                ];\n\n                sharePrice = latestSharePrice < currSharePrice\n                    ? latestSharePrice\n                    : currSharePrice;\n            }\n\n            uint256 ethAmount = VaultMath.sharesToAsset(_shares, sharePrice);\n\n            stoneMinter.burn(msg.sender, _shares);\n\n            if (ethAmount <= idleAmount) {\n                actualWithdrawn = actualWithdrawn + ethAmount;\n\n                emit Withdrawn(msg.sender, ethAmount, latestRoundID);\n            } else {\n                actualWithdrawn = actualWithdrawn + idleAmount;\n                ethAmount = ethAmount - idleAmount;\n\n                StrategyController controller = StrategyController(\n                    strategyController\n                );\n                uint256 actualAmount = controller.forceWithdraw(ethAmount);\n\n                actualWithdrawn = actualWithdrawn + actualAmount;\n\n                emit WithdrawnFromStrategy(\n                    msg.sender,\n                    ethAmount,\n                    actualAmount,\n                    latestRoundID\n                );\n            }\n        }\n\n        require(aVault.getBalance() >= actualWithdrawn, \"still need wait\");\n\n        uint256 withFee;\n        if (withdrawFeeRate != 0) {\n            withFee = (actualWithdrawn * withdrawFeeRate) / ONE_HUNDRED_PERCENT;\n            aVault.withdraw(feeRecipient, withFee);\n\n            emit FeeCharged(msg.sender, withFee);\n        }\n        aVault.withdraw(msg.sender, actualWithdrawn - withFee);\n    }\n\n    function rollToNextRound() external {\n        require(\n            block.timestamp > rebaseTime + rebaseTimeInterval,\n            \"already rebased\"\n        );\n\n        StrategyController controller = StrategyController(strategyController);\n        AssetsVault aVault = AssetsVault(assetsVault);\n        uint256 previewSharePrice = currentSharePrice();\n\n        uint256 vaultBalance = aVault.getBalance();\n        uint256 amountToWithdraw = VaultMath.sharesToAsset(\n            withdrawingSharesInRound,\n            previewSharePrice\n        );\n        uint256 amountVaultNeed = withdrawableAmountInPast + amountToWithdraw;\n        uint256 allPendingValue = controller.getAllStrategyPendingValue();\n\n        uint256 vaultIn;\n        uint256 vaultOut;\n\n        if (vaultBalance > amountVaultNeed) {\n            vaultIn = vaultBalance - amountVaultNeed;\n        } else if (vaultBalance + allPendingValue < amountVaultNeed) {\n            vaultOut = amountVaultNeed - vaultBalance - allPendingValue;\n        }\n\n        controller.rebaseStrategies(vaultIn, vaultOut);\n\n        uint256 newSharePrice = currentSharePrice();\n        roundPricePerShare[latestRoundID] = previewSharePrice < newSharePrice\n            ? previewSharePrice\n            : newSharePrice;\n\n        settlementTime[latestRoundID] = block.timestamp;\n        latestRoundID = latestRoundID + 1;\n\n        withdrawingSharesInPast =\n            withdrawingSharesInPast +\n            withdrawingSharesInRound;\n        withdrawableAmountInPast =\n            withdrawableAmountInPast +\n            VaultMath.sharesToAsset(withdrawingSharesInRound, newSharePrice);\n        withdrawingSharesInRound = 0;\n        rebaseTime = block.timestamp;\n\n        emit RollToNextRound(latestRoundID, vaultIn, vaultOut, newSharePrice);\n    }\n\n    function addStrategy(address _strategy) external onlyProposal {\n        StrategyController controller = StrategyController(strategyController);\n\n        controller.addStrategy(_strategy);\n        emit StragetyAdded(_strategy);\n    }\n\n    function destroyStrategy(address _strategy) external onlyOwner {\n        StrategyController controller = StrategyController(strategyController);\n\n        controller.destroyStrategy(_strategy);\n        emit StragetyDestroyed(_strategy);\n    }\n\n    function clearStrategy(address _strategy) external onlyOwner {\n        StrategyController controller = StrategyController(strategyController);\n\n        controller.clearStrategy(_strategy);\n        emit StragetyCleared(_strategy);\n    }\n\n    function updatePortfolioConfig(\n        address[] memory _strategies,\n        uint256[] memory _ratios\n    ) external onlyProposal {\n        StrategyController controller = StrategyController(strategyController);\n\n        controller.setStrategies(_strategies, _ratios);\n\n        emit PortfolioConfigUpdated(_strategies, _ratios);\n    }\n\n    function updateProposal(address _proposal) external onlyProposal {\n        proposal = _proposal;\n    }\n\n    function migrateVault(address _vault) external onlyProposal {\n        Minter(minter).setNewVault(_vault);\n        AssetsVault(assetsVault).setNewVault(_vault);\n        StrategyController(strategyController).setNewVault(_vault);\n    }\n\n    function currentSharePrice() public returns (uint256 price) {\n        Stone stoneToken = Stone(stone);\n        uint256 totalStone = stoneToken.totalSupply();\n        if (\n            latestRoundID == 0 ||\n            totalStone == 0 ||\n            totalStone == withdrawingSharesInPast\n        ) {\n            return MULTIPLIER;\n        }\n\n        uint256 etherAmount = AssetsVault(assetsVault).getBalance() +\n            StrategyController(strategyController).getAllStrategiesValue() -\n            withdrawableAmountInPast;\n        uint256 activeShare = totalStone - withdrawingSharesInPast;\n\n        return (etherAmount * MULTIPLIER) / activeShare;\n    }\n\n    function getVaultAvailableAmount()\n        public\n        returns (uint256 idleAmount, uint256 investedAmount)\n    {\n        AssetsVault vault = AssetsVault(assetsVault);\n\n        if (vault.getBalance() > withdrawableAmountInPast) {\n            idleAmount = vault.getBalance() - withdrawableAmountInPast;\n        }\n\n        investedAmount = StrategyController(strategyController)\n            .getAllStrategyValidValue();\n    }\n\n    function setWithdrawFeeRate(uint256 _withdrawFeeRate) external onlyOwner {\n        require(_withdrawFeeRate <= MAXMIUM_FEE_RATE, \"exceed maximum\");\n\n        emit SetWithdrawFeeRate(withdrawFeeRate, _withdrawFeeRate);\n\n        withdrawFeeRate = _withdrawFeeRate;\n    }\n\n    function setFeeRecipient(address _feeRecipient) external onlyOwner {\n        require(_feeRecipient != address(0), \"zero address\");\n\n        emit SetFeeRecipient(feeRecipient, _feeRecipient);\n\n        feeRecipient = _feeRecipient;\n    }\n\n    function setRebaseInterval(uint256 _interval) external onlyOwner {\n        require(_interval <= MINIMUM_REBASE_INTERVAL, \"invalid\");\n\n        rebaseTimeInterval = _interval;\n        emit SetRebaseInterval(rebaseTimeInterval);\n    }\n\n    receive() external payable {}\n}\n"},{"file_path":"project:/contracts/libraries/VaultMath.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\nlibrary VaultMath {\n    uint256 internal constant DECIMALS = 18;\n\n    function assetToShares(\n        uint256 _assetAmount,\n        uint256 _assetPerShare\n    ) internal pure returns (uint256) {\n        require(_assetPerShare > 1, \"Vault Lib: invalid assetPerShare\");\n        return (_assetAmount * (10 ** DECIMALS)) / _assetPerShare;\n    }\n\n    function sharesToAsset(\n        uint256 _shares,\n        uint256 _assetPerShare\n    ) internal pure returns (uint256) {\n        require(_assetPerShare > 1, \"Vault Lib: invalid assetPerShare\");\n        return (_shares * _assetPerShare) / (10 ** DECIMALS);\n    }\n}\n"},{"file_path":"project:/contracts/strategies/Strategy.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\nimport {StrategyController} from \"../strategies/StrategyController.sol\";\n\nabstract contract Strategy {\n    address payable public immutable controller;\n\n    address public governance;\n\n    string public name;\n\n    modifier onlyGovernance() {\n        require(governance == msg.sender, \"not governace\");\n        _;\n    }\n\n    event TransferGovernance(address oldOwner, address newOwner);\n\n    constructor(address payable _controller, string memory _name) {\n        require(_controller != address(0), \"ZERO ADDRESS\");\n\n        governance = msg.sender;\n        controller = _controller;\n        name = _name;\n    }\n\n    modifier onlyController() {\n        require(controller == msg.sender, \"not controller\");\n        _;\n    }\n\n    function deposit() public payable virtual onlyController {}\n\n    function withdraw(\n        uint256 _amount\n    ) public virtual onlyController returns (uint256 actualAmount) {}\n\n    function instantWithdraw(\n        uint256 _amount\n    ) public virtual onlyController returns (uint256 actualAmount) {}\n\n    function clear() public virtual onlyController returns (uint256 amount) {}\n\n    function execPendingRequest(\n        uint256 _amount\n    ) public virtual returns (uint256 amount) {}\n\n    function getAllValue() public virtual returns (uint256 value) {}\n\n    function getPendingValue() public virtual returns (uint256 value) {}\n\n    function getInvestedValue() public virtual returns (uint256 value) {}\n\n    function checkPendingStatus()\n        public\n        virtual\n        returns (uint256 pending, uint256 executable)\n    {}\n\n    function setGovernance(address governance_) external onlyGovernance {\n        emit TransferGovernance(governance, governance_);\n        governance = governance_;\n    }\n}\n"},{"file_path":"project:/contracts/strategies/StrategyController.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\nimport {EnumerableSet} from \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\nimport {TransferHelper} from \"@uniswap/v3-periphery/contracts/libraries/TransferHelper.sol\";\n\nimport {Strategy} from \"./Strategy.sol\";\nimport {AssetsVault} from \"../AssetsVault.sol\";\n\ncontract StrategyController {\n    using EnumerableSet for EnumerableSet.AddressSet;\n\n    uint256 internal constant ONE_HUNDRED_PERCENT = 1e6;\n\n    address public stoneVault;\n    address payable public immutable assetsVault;\n\n    EnumerableSet.AddressSet private strategies;\n\n    mapping(address => uint256) public ratios;\n\n    struct StrategyDiff {\n        address strategy;\n        bool isDeposit;\n        uint256 amount;\n    }\n\n    modifier onlyVault() {\n        require(stoneVault == msg.sender, \"not vault\");\n        _;\n    }\n\n    constructor(\n        address payable _assetsVault,\n        address[] memory _strategies,\n        uint256[] memory _ratios\n    ) {\n        require(_assetsVault != address(0), \"ZERO ADDRESS\");\n\n        uint256 length = _strategies.length;\n        for (uint256 i; i < length; i++) {\n            require(_strategies[i] != address(0), \"ZERO ADDRESS\");\n        }\n\n        stoneVault = msg.sender;\n        assetsVault = _assetsVault;\n\n        _initStrategies(_strategies, _ratios);\n    }\n\n    function onlyRebaseStrategies() external {\n        _rebase(0, 0);\n    }\n\n    function forceWithdraw(\n        uint256 _amount\n    ) external onlyVault returns (uint256 actualAmount) {\n        uint256 balanceBeforeRepay = address(this).balance;\n\n        if (balanceBeforeRepay >= _amount) {\n            _repayToVault();\n\n            actualAmount = balanceBeforeRepay;\n        } else {\n            actualAmount =\n                _forceWithdraw(_amount - balanceBeforeRepay) +\n                balanceBeforeRepay;\n        }\n    }\n\n    function setStrategies(\n        address[] memory _strategies,\n        uint256[] memory _ratios\n    ) external onlyVault {\n        _setStrategies(_strategies, _ratios);\n    }\n\n    function addStrategy(address _strategy) external onlyVault {\n        require(!strategies.contains(_strategy), \"already exist\");\n\n        strategies.add(_strategy);\n    }\n\n    function rebaseStrategies(\n        uint256 _in,\n        uint256 _out\n    ) external payable onlyVault {\n        _rebase(_in, _out);\n    }\n\n    function destroyStrategy(address _strategy) external onlyVault {\n        _destoryStrategy(_strategy);\n    }\n\n    function _rebase(uint256 _in, uint256 _out) internal {\n        require(_in == 0 || _out == 0, \"only deposit or withdraw\");\n\n        if (_in != 0) {\n            AssetsVault(assetsVault).withdraw(address(this), _in);\n        }\n        uint256 total = getAllStrategyValidValue();\n        if (total < _out) {\n            total = 0;\n        } else {\n            total = total + _in - _out;\n        }\n\n        uint256 length = strategies.length();\n        StrategyDiff[] memory diffs = new StrategyDiff[](length);\n        uint256 head;\n        uint256 tail = length - 1;\n        for (uint i; i < length; i++) {\n            address strategy = strategies.at(i);\n            if (ratios[strategy] == 0) {\n                _clearStrategy(strategy, true);\n                continue;\n            }\n            uint256 newPosition = (total * ratios[strategy]) /\n                ONE_HUNDRED_PERCENT;\n            uint256 position = getStrategyValidValue(strategy);\n\n            if (newPosition < position) {\n                diffs[head] = StrategyDiff(\n                    strategy,\n                    false,\n                    position - newPosition\n                );\n                head++;\n            } else if (newPosition > position) {\n                diffs[tail] = StrategyDiff(\n                    strategy,\n                    true,\n                    newPosition - position\n                );\n                if (tail != 0) {\n                    tail--;\n                }\n            }\n        }\n\n        length = diffs.length;\n        for (uint256 i; i < length; i++) {\n            StrategyDiff memory diff = diffs[i];\n\n            if (diff.amount == 0) {\n                continue;\n            }\n\n            if (diff.isDeposit) {\n                if (address(this).balance < diff.amount) {\n                    diff.amount = address(this).balance;\n                }\n                _depositToStrategy(diff.strategy, diff.amount);\n            } else {\n                _withdrawFromStrategy(diff.strategy, diff.amount);\n            }\n        }\n\n        _repayToVault();\n    }\n\n    function _repayToVault() internal {\n        if (address(this).balance != 0) {\n            TransferHelper.safeTransferETH(assetsVault, address(this).balance);\n        }\n    }\n\n    function _depositToStrategy(address _strategy, uint256 _amount) internal {\n        Strategy(_strategy).deposit{value: _amount}();\n    }\n\n    function _withdrawFromStrategy(\n        address _strategy,\n        uint256 _amount\n    ) internal {\n        Strategy(_strategy).withdraw(_amount);\n    }\n\n    function _forceWithdraw(\n        uint256 _amount\n    ) internal returns (uint256 actualAmount) {\n        uint256 length = strategies.length();\n        for (uint i; i < length; i++) {\n            address strategy = strategies.at(i);\n\n            uint256 withAmount = (_amount * ratios[strategy]) /\n                ONE_HUNDRED_PERCENT;\n\n            if (withAmount != 0) {\n                actualAmount =\n                    Strategy(strategy).instantWithdraw(withAmount) +\n                    actualAmount;\n            }\n        }\n\n        _repayToVault();\n    }\n\n    function getStrategyValue(\n        address _strategy\n    ) public returns (uint256 _value) {\n        return Strategy(_strategy).getAllValue();\n    }\n\n    function getStrategyValidValue(\n        address _strategy\n    ) public returns (uint256 _value) {\n        return Strategy(_strategy).getInvestedValue();\n    }\n\n    function getStrategyPendingValue(\n        address _strategy\n    ) public returns (uint256 _value) {\n        return Strategy(_strategy).getPendingValue();\n    }\n\n    function getAllStrategiesValue() public returns (uint256 _value) {\n        uint256 length = strategies.length();\n        for (uint i; i < length; i++) {\n            _value = _value + getStrategyValue(strategies.at(i));\n        }\n    }\n\n    function getAllStrategyValidValue() public returns (uint256 _value) {\n        uint256 length = strategies.length();\n        for (uint i; i < length; i++) {\n            _value = _value + getStrategyValidValue(strategies.at(i));\n        }\n    }\n\n    function getAllStrategyPendingValue() public returns (uint256 _value) {\n        uint256 length = strategies.length();\n        for (uint i; i < length; i++) {\n            _value = _value + getStrategyPendingValue(strategies.at(i));\n        }\n    }\n\n    function getStrategies()\n        public\n        view\n        returns (address[] memory addrs, uint256[] memory portions)\n    {\n        uint256 length = strategies.length();\n\n        addrs = new address[](length);\n        portions = new uint256[](length);\n\n        for (uint256 i; i < length; i++) {\n            address addr = strategies.at(i);\n            addrs[i] = addr;\n            portions[i] = ratios[addr];\n        }\n    }\n\n    function _initStrategies(\n        address[] memory _strategies,\n        uint256[] memory _ratios\n    ) internal {\n        require(_strategies.length == _ratios.length, \"invalid length\");\n\n        uint256 totalRatio;\n        uint256 length = _strategies.length;\n        for (uint i; i < length; i++) {\n            strategies.add(_strategies[i]);\n            ratios[_strategies[i]] = _ratios[i];\n            totalRatio = totalRatio + _ratios[i];\n        }\n        require(totalRatio <= ONE_HUNDRED_PERCENT, \"exceed 100%\");\n    }\n\n    function _setStrategies(\n        address[] memory _strategies,\n        uint256[] memory _ratios\n    ) internal {\n        uint256 length = _strategies.length;\n        require(length == _ratios.length, \"invalid length\");\n\n        uint256 oldLength = strategies.length();\n        for (uint i; i < oldLength; i++) {\n            ratios[strategies.at(i)] = 0;\n        }\n        uint256 totalRatio;\n        for (uint i; i < length; i++) {\n            require(\n                Strategy(_strategies[i]).controller() == address(this),\n                \"controller mismatch\"\n            );\n            strategies.add(_strategies[i]);\n            ratios[_strategies[i]] = _ratios[i];\n            totalRatio = totalRatio + _ratios[i];\n        }\n        require(totalRatio <= ONE_HUNDRED_PERCENT, \"exceed 100%\");\n    }\n\n    function clearStrategy(address _strategy) public onlyVault {\n        _clearStrategy(_strategy, false);\n    }\n\n    function _clearStrategy(address _strategy, bool _isRebase) internal {\n        Strategy(_strategy).clear();\n\n        if (!_isRebase) {\n            _repayToVault();\n        }\n    }\n\n    function _destoryStrategy(address _strategy) internal {\n        require(_couldDestroyStrategy(_strategy), \"still active\");\n\n        strategies.remove(_strategy);\n\n        _repayToVault();\n    }\n\n    function _couldDestroyStrategy(\n        address _strategy\n    ) internal returns (bool status) {\n        return\n            ratios[_strategy] == 0 && Strategy(_strategy).getAllValue() < 1e4;\n    }\n\n    function setNewVault(address _vault) external onlyVault {\n        stoneVault = _vault;\n    }\n\n    receive() external payable {}\n}\n"},{"file_path":"project:/contracts/token/Minter.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\nimport {Stone} from \"./Stone.sol\";\nimport {StoneVault} from \"../StoneVault.sol\";\n\ncontract Minter {\n    // TODO: governable upgrade\n    address public stone;\n    address payable public vault;\n\n    modifier onlyVault() {\n        require(msg.sender == vault, \"not vault\");\n        _;\n    }\n\n    constructor(address _stone, address payable _vault) {\n        stone = _stone;\n        vault = _vault;\n    }\n\n    function mint(address _to, uint256 _amount) external onlyVault {\n        Stone(stone).mint(_to, _amount);\n    }\n\n    function burn(address _from, uint256 _amount) external onlyVault {\n        Stone(stone).burn(_from, _amount);\n    }\n\n    function setNewVault(address _vault) external onlyVault {\n        vault = payable(_vault);\n    }\n\n    function getTokenPrice() public returns (uint256 price) {\n        price = StoneVault(vault).currentSharePrice();\n    }\n}\n"}],"is_verified_via_sourcify":true,"can_be_visualized_via_sol2uml":true,"evm_version":"shanghai","language":"solidity","is_verified_via_eth_bytecode_db":true,"is_fully_verified":true,"license_type":"none","is_blueprint":false,"name":"Stone","creation_bytecode":"0x60a0604052600e805460ff191660011790553480156200001d575f80fd5b50604051620040113803806200401183398101604081905262000040916200017d565b6040518060400160405280601081526020016f29ba30b5b2a9ba37b7329022ba3432b960811b8152506040518060400160405280600581526020016453544f4e4560d81b815250838282828282828080620000aa620000a46200010e60201b60201c565b62000112565b6001600160a01b031660805250600a9050620000c783826200025b565b50600b620000d682826200025b565b5050600c80546001600160a01b0319166001600160a01b039b909b169a909a17909955505050600d9390935550620003239350505050565b3390565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b038116811462000178575f80fd5b919050565b5f805f6060848603121562000190575f80fd5b6200019b8462000161565b9250620001ab6020850162000161565b9150604084015190509250925092565b634e487b7160e01b5f52604160045260245ffd5b600181811c90821680620001e457607f821691505b6020821081036200020357634e487b7160e01b5f52602260045260245ffd5b50919050565b601f82111562000256575f81815260208120601f850160051c81016020861015620002315750805b601f850160051c820191505b8181101562000252578281556001016200023d565b5050505b505050565b81516001600160401b03811115620002775762000277620001bb565b6200028f81620002888454620001cf565b8462000209565b602080601f831160018114620002c5575f8415620002ad5750858301515b5f19600386901b1c1916600185901b17855562000252565b5f85815260208120601f198616915b82811015620002f557888601518255948401946001909101908401620002d4565b50858210156200031357878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b608051613c9d620003745f395f8181610812015281816109bd01528181610cd301528181610d8c01528181610e79015281816110480152818161188601528181611df101526125580152613c9d5ff3fe6080604052600436106102a5575f3560e01c80621d3567146102a957806301ffc9a7146102ca57806306fdde03146102fe578063075461721461031f57806307e0db171461034b578063095ea7b31461036a5780630df374831461038957806310ddb137146103a857806318160ddd146103c75780631df8ba77146103e557806323b872dd146103f95780632a205e3d14610418578063313ce5671461044c578063355274ea14610467578063395093511461047c5780633d8b38f61461049b5780633f1f4fa4146104ba57806340c10f19146104e557806342d65a8d146105045780634477051514610523578063471744d1146105365780634c42899a1461055d57806351905636146105705780635b8c41e61461058357806366ad5c8a146105d057806368322ff5146105ef5780636abe0abf1461060257806370a0823114610618578063715018a6146106375780637533d7881461064b5780637ff9b5961461066a5780638cfd8f5c1461067e5780638da5cb5b146106b457806390e9097a146106c85780639358928b146106db578063950c8a74146106ef57806395d89b411461070e5780639dc29fac146107225780639f38369a14610741578063a162b0a214610760578063a3907d711461078b578063a457c2d7146107a4578063a6c3d165146107c3578063a9059cbb146107e2578063b353aaa714610801578063baf3292d14610834578063c446183414610853578063ca5ea40614610868578063cbed8b9c1461087c578063d1b4a2d81461089b578063d1deba1f146108ae578063dd62ed3e146108c1578063df2a5b3b146108e0578063e3ec18ae146108ff578063eab45d9c14610913578063eb8d72b714610932578063ed629c5c14610951578063f2fde38b1461096a578063f5ecbdbc14610989578063fc0c546a146109a8575b5f80fd5b3480156102b4575f80fd5b506102c86102c3366004612dc5565b6109ba565b005b3480156102d5575f80fd5b506102e96102e4366004612e54565b610be5565b60405190151581526020015b60405180910390f35b348015610309575f80fd5b50610312610c22565b6040516102f59190612ec8565b34801561032a575f80fd5b50600c5461033e906001600160a01b031681565b6040516102f59190612eda565b348015610356575f80fd5b506102c8610365366004612eee565b610cb2565b348015610375575f80fd5b506102e9610384366004612f1d565b610d36565b348015610394575f80fd5b506102c86103a3366004612f47565b610d4d565b3480156103b3575f80fd5b506102c86103c2366004612eee565b610d6b565b3480156103d2575f80fd5b506009545b6040519081526020016102f5565b3480156103f0575f80fd5b506103d7610dc3565b348015610404575f80fd5b506102e9610413366004612f63565b610e15565b348015610423575f80fd5b50610437610432366004612fb0565b610e38565b604080519283526020830191909152016102f5565b348015610457575f80fd5b50604051601281526020016102f5565b348015610472575f80fd5b506103d7600d5481565b348015610487575f80fd5b506102e9610496366004612f1d565b610f07565b3480156104a6575f80fd5b506102e96104b5366004613048565b610f28565b3480156104c5575f80fd5b506103d76104d4366004612eee565b60036020525f908152604090205481565b3480156104f0575f80fd5b506102c86104ff366004612f1d565b610ff1565b34801561050f575f80fd5b506102c861051e366004613048565b611029565b34801561052e575f80fd5b506103d75f81565b348015610541575f80fd5b5061054a600181565b60405161ffff90911681526020016102f5565b348015610568575f80fd5b5061054a5f81565b6102c861057e366004613098565b6110aa565b34801561058e575f80fd5b506103d761059d366004613215565b600560209081525f9384526040808520845180860184018051928152908401958401959095209452929052825290205481565b3480156105db575f80fd5b506102c86105ea366004612dc5565b61119d565b6102c86105fd366004613270565b611277565b34801561060d575f80fd5b506103d76201518081565b348015610623575f80fd5b506103d76106323660046132cb565b611368565b348015610642575f80fd5b506102c8611382565b348015610656575f80fd5b50610312610665366004612eee565b611395565b348015610675575f80fd5b506103d761142c565b348015610689575f80fd5b506103d76106983660046132e6565b600260209081525f928352604080842090915290825290205481565b3480156106bf575f80fd5b5061033e61149d565b6103d76106d636600461331d565b6114ab565b3480156106e6575f80fd5b506103d7611593565b3480156106fa575f80fd5b5060045461033e906001600160a01b031681565b348015610719575f80fd5b506103126115a6565b34801561072d575f80fd5b506102c861073c366004612f1d565b6115b5565b34801561074c575f80fd5b5061031261075b366004612eee565b6115e9565b34801561076b575f80fd5b506103d761077a366004613369565b600f6020525f908152604090205481565b348015610796575f80fd5b50600e546102e99060ff1681565b3480156107af575f80fd5b506102e96107be366004612f1d565b6116fa565b3480156107ce575f80fd5b506102c86107dd366004613048565b611774565b3480156107ed575f80fd5b506102e96107fc366004612f1d565b6117fc565b34801561080c575f80fd5b5061033e7f000000000000000000000000000000000000000000000000000000000000000081565b34801561083f575f80fd5b506102c861084e3660046132cb565b611809565b34801561085e575f80fd5b506103d761271081565b348015610873575f80fd5b5061054a600281565b348015610887575f80fd5b506102c8610896366004613380565b611867565b6102c86108a93660046133ed565b6118f7565b6102c86108bc366004612dc5565b6119bb565b3480156108cc575f80fd5b506103d76108db36600461342b565b611bcb565b3480156108eb575f80fd5b506102c86108fa366004613457565b611bf5565b34801561090a575f80fd5b5061054a600381565b34801561091e575f80fd5b506102c861092d366004613484565b611ca5565b34801561093d575f80fd5b506102c861094c366004613048565b611cee565b34801561095c575f80fd5b506006546102e99060ff1681565b348015610975575f80fd5b506102c86109843660046132cb565b611d47565b348015610994575f80fd5b506103126109a336600461349d565b611dc0565b3480156109b3575f80fd5b503061033e565b337f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031614610a375760405162461bcd60e51b815260206004820152601e60248201527f4c7a4170703a20696e76616c696420656e64706f696e742063616c6c6572000060448201526064015b60405180910390fd5b61ffff86165f9081526001602052604081208054610a54906134eb565b80601f0160208091040260200160405190810160405280929190818152602001828054610a80906134eb565b8015610acb5780601f10610aa257610100808354040283529160200191610acb565b820191905f5260205f20905b815481529060010190602001808311610aae57829003601f168201915b50505050509050805186869050148015610ae557505f8151115b8015610b0d575080516020820120604051610b039088908890613523565b6040518091039020145b610b685760405162461bcd60e51b815260206004820152602660248201527f4c7a4170703a20696e76616c696420736f757263652073656e64696e6720636f6044820152651b9d1c9858dd60d21b6064820152608401610a2e565b610bdc8787878080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525050604080516020601f8a018190048102820181019092528881528a9350915088908890819084018382808284375f92019190915250611e6d92505050565b50505050505050565b5f6001600160e01b031982161580610c0d57506001600160e01b031982166336372b0760e01b145b80610c1c5750610c1c82611ee5565b92915050565b6060600a8054610c31906134eb565b80601f0160208091040260200160405190810160405280929190818152602001828054610c5d906134eb565b8015610ca85780601f10610c7f57610100808354040283529160200191610ca8565b820191905f5260205f20905b815481529060010190602001808311610c8b57829003601f168201915b5050505050905090565b610cba611f19565b6040516307e0db1760e01b815261ffff821660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906307e0db17906024015b5f604051808303815f87803b158015610d1d575f80fd5b505af1158015610d2f573d5f803e3d5ffd5b5050505050565b5f33610d43818585611f78565b5060019392505050565b610d55611f19565b61ffff9091165f90815260036020526040902055565b610d73611f19565b6040516310ddb13760e01b815261ffff821660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906310ddb13790602401610d06565b5f80600f81610dd56201518042613546565b81526020019081526020015f2054905080600d54118015610df85750600e5460ff165b15610e115780600d54610e0b9190613565565b91505090565b5090565b5f33610e2285828561209b565b610e2d858585612113565b506001949350505050565b5f805f80898989604051602001610e5294939291906135a0565b60408051601f198184030181529082905263040a7bb160e41b825291506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906340a7bb1090610eb8908d90309086908c908c908c906004016135ce565b6040805180830381865afa158015610ed2573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ef69190613623565b925092505097509795505050505050565b5f33610d43818585610f198383611bcb565b610f239190613645565b611f78565b61ffff83165f9081526001602052604081208054829190610f48906134eb565b80601f0160208091040260200160405190810160405280929190818152602001828054610f74906134eb565b8015610fbf5780601f10610f9657610100808354040283529160200191610fbf565b820191905f5260205f20905b815481529060010190602001808311610fa257829003601f168201915b505050505090508383604051610fd6929190613523565b60405180910390208180519060200120149150509392505050565b600c546001600160a01b0316331461101b5760405162461bcd60e51b8152600401610a2e90613658565b61102582826122a9565b5050565b611031611f19565b6040516342d65a8d60e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906342d65a8d9061108190869086908690600401613674565b5f604051808303815f87803b158015611098575f80fd5b505af1158015610bdc573d5f803e3d5ffd5b600e5460ff166110cc5760405162461bcd60e51b8152600401610a2e90613691565b4661ffff891681036110f05760405162461bcd60e51b8152600401610a2e906136b2565b5f6110fe6201518042613546565b600d545f828152600f60205260409020549192509061111d9089613645565b11156111585760405162461bcd60e51b815260206004820152600a6024820152690457863656564206361760b41b6044820152606401610a2e565b5f818152600f6020526040902054611171908890613645565b5f828152600f60205260409020556111908b8b8b8b8b8b8b8b8b612355565b5050505050505050505050565b3330146111fb5760405162461bcd60e51b815260206004820152602660248201527f4e6f6e626c6f636b696e674c7a4170703a2063616c6c6572206d7573742062656044820152650204c7a4170760d41b6064820152608401610a2e565b61126f8686868080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525050604080516020601f8901819004810282018101909252878152899350915087908790819084018382808284375f920191909152506123cd92505050565b505050505050565b61127f611f19565b4661ffff84168190036112f157600e805460ff191684151517905560405161ffff8516905f80516020613c08833981519152906112c09030906020016136d6565b60408051601f1981840301815290829052600e546112e39260ff909116906136ee565b60405180910390a250505050565b5f6002838560405160200161130893929190613711565b60405160208183030381529060405290506113358582335f60405180602001604052805f81525034612433565b8461ffff165f80516020613c0883398151915284866040516113589291906136ee565b60405180910390a250505b505050565b6001600160a01b03165f9081526007602052604090205490565b61138a611f19565b6113935f6125d0565b565b60016020525f9081526040902080546113ad906134eb565b80601f01602080910402602001604051908101604052809291908181526020018280546113d9906134eb565b80156114245780601f106113fb57610100808354040283529160200191611424565b820191905f5260205f20905b81548152906001019060200180831161140757829003601f168201915b505050505081565b600c54604080516325ca7a8760e11b815290515f926001600160a01b031691634b94f50e916004808301926020929190829003018187875af1158015611474573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611498919061373f565b905090565b5f546001600160a01b031690565b600e545f9060ff166114cf5760405162461bcd60e51b8152600401610a2e90613691565b4661ffff841681036114f35760405162461bcd60e51b8152600401610a2e906136b2565b6114fb61142c565b91505f60018484426040516020016115169493929190613756565b60405160208183030381529060405290506115438582335f60405180602001604052805f81525034612433565b336001600160a01b03168561ffff167fa9abd88cb9207ea146a8c570a7c926ee640d4ef1eed13893a603f574d762f8818686604051611583929190613785565b60405180910390a3505092915050565b5f61159d30611368565b60095403905090565b6060600b8054610c31906134eb565b600c546001600160a01b031633146115df5760405162461bcd60e51b8152600401610a2e90613658565b611025828261261f565b61ffff81165f9081526001602052604081208054606092919061160b906134eb565b80601f0160208091040260200160405190810160405280929190818152602001828054611637906134eb565b80156116825780601f1061165957610100808354040283529160200191611682565b820191905f5260205f20905b81548152906001019060200180831161166557829003601f168201915b5050505050905080515f036116d95760405162461bcd60e51b815260206004820152601d60248201527f4c7a4170703a206e6f20747275737465642070617468207265636f72640000006044820152606401610a2e565b6116f35f601483516116eb9190613565565b83919061273e565b9392505050565b5f33816117078286611bcb565b9050838110156117675760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610a2e565b610e2d8286868403611f78565b61177c611f19565b818130604051602001611791939291906137a6565b60408051601f1981840301815291815261ffff85165f908152600160205220906117bb9082613820565b507f8c0400cfe2d1199b1a725c78960bcc2a344d869b80590d0f2bd005db15a572ce8383836040516117ef93929190613674565b60405180910390a1505050565b5f33610d43818585612113565b611811611f19565b600480546001600160a01b0319166001600160a01b0383161790556040517f5db758e995a17ec1ad84bdef7e8c3293a0bd6179bcce400dff5d4c3d87db726b9061185c908390612eda565b60405180910390a150565b61186f611f19565b6040516332fb62e760e21b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063cbed8b9c906118c390889088908890889088906004016138d6565b5f604051808303815f87803b1580156118da575f80fd5b505af11580156118ec573d5f803e3d5ffd5b505050505050505050565b6118ff611f19565b4661ffff84168190036119545782600d819055508361ffff165f80516020613c288339815191523060405160200161193791906136d6565b60408051601f1981840301815290829052600d546112e392613785565b5f6003838560405160200161196b9392919061390e565b60405160208183030381529060405290506119988582335f60405180602001604052805f81525034612433565b8461ffff165f80516020613c288339815191528486604051611358929190613785565b61ffff86165f9081526005602052604080822090516119dd9088908890613523565b90815260408051602092819003830190206001600160401b0387165f9081529252902054905080611a5c5760405162461bcd60e51b815260206004820152602360248201527f4e6f6e626c6f636b696e674c7a4170703a206e6f2073746f726564206d65737360448201526261676560e81b6064820152608401610a2e565b808383604051611a6d929190613523565b604051809103902014611acc5760405162461bcd60e51b815260206004820152602160248201527f4e6f6e626c6f636b696e674c7a4170703a20696e76616c6964207061796c6f616044820152601960fa1b6064820152608401610a2e565b61ffff87165f908152600560205260408082209051611aee9089908990613523565b90815260408051602092819003830181206001600160401b0389165f90815290845282902093909355601f88018290048202830182019052868252611b8391899189908990819084018382808284375f9201919091525050604080516020601f8a018190048102820181019092528881528a9350915088908890819084018382808284375f920191909152506123cd92505050565b7fc264d91f3adc5588250e1551f547752ca0cfa8f6b530d243b9f9f4cab10ea8e58787878785604051611bba95949392919061393a565b60405180910390a150505050505050565b6001600160a01b039182165f90815260086020908152604080832093909416825291909152205490565b611bfd611f19565b5f8111611c445760405162461bcd60e51b81526020600482015260156024820152744c7a4170703a20696e76616c6964206d696e47617360581b6044820152606401610a2e565b61ffff8381165f8181526002602090815260408083209487168084529482529182902085905581519283528201929092529081018290527f9d5c7c0b934da8fefa9c7760c98383778a12dfbfc0c3b3106518f43fb9508ac0906060016117ef565b611cad611f19565b6006805460ff19168215159081179091556040519081527f1584ad594a70cbe1e6515592e1272a987d922b097ead875069cebe8b40c004a49060200161185c565b611cf6611f19565b61ffff83165f908152600160205260409020611d13828483613974565b507ffa41487ad5d6728f0b19276fa1eddc16558578f5109fc39d2dc33c3230470dab8383836040516117ef93929190613674565b611d4f611f19565b6001600160a01b038116611db45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a2e565b611dbd816125d0565b50565b604051633d7b2f6f60e21b815261ffff808616600483015284166024820152306044820152606481018290526060907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063f5ecbdbc906084015f60405180830381865afa158015611e3d573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052611e649190810190613a73565b95945050505050565b5f80611ecf5a60966366ad5c8a60e01b89898989604051602401611e949493929190613aa4565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091523092919061284a565b915091508161126f5761126f86868686856128ce565b5f6001600160e01b03198216630a72677560e11b1480610c1c57506301ffc9a760e01b6001600160e01b0319831614610c1c565b33611f2261149d565b6001600160a01b0316146113935760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a2e565b6001600160a01b038316611fda5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610a2e565b6001600160a01b03821661203b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610a2e565b6001600160a01b038381165f8181526008602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b5f6120a68484611bcb565b90505f19811461210d57818110156121005760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610a2e565b61210d8484848403611f78565b50505050565b6001600160a01b0383166121775760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610a2e565b6001600160a01b0382166121d95760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610a2e565b6001600160a01b0383165f90815260076020526040902054818110156122505760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610a2e565b6001600160a01b038085165f8181526007602052604080822086860390559286168082529083902080548601905591515f80516020613c488339815191529061229c9086815260200190565b60405180910390a361210d565b6001600160a01b0382166122ff5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610a2e565b8060095f8282546123109190613645565b90915550506001600160a01b0382165f818152600760209081526040808320805486019055518481525f80516020613c48833981519152910160405180910390a35050565b6118ec898989898080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525050604080516020601f8a018190048102820181019092528881528c93508b92508a918a908a90819084018382808284375f9201919091525061296892505050565b602081015161ffff81166123ec576123e785858585612a0b565b610d2f565b60405162461bcd60e51b815260206004820152601c60248201527b4f4654436f72653a20756e6b6e6f776e207061636b6574207479706560201b6044820152606401610a2e565b61ffff86165f9081526001602052604081208054612450906134eb565b80601f016020809104026020016040519081016040528092919081815260200182805461247c906134eb565b80156124c75780601f1061249e576101008083540402835291602001916124c7565b820191905f5260205f20905b8154815290600101906020018083116124aa57829003601f168201915b5050505050905080515f036125375760405162461bcd60e51b815260206004820152603060248201527f4c7a4170703a2064657374696e6174696f6e20636861696e206973206e6f742060448201526f61207472757374656420736f7572636560801b6064820152608401610a2e565b612542878751612a93565b60405162c5803160e81b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c5803100908490612599908b9086908c908c908c908c90600401613ae1565b5f604051808303818588803b1580156125b0575f80fd5b505af11580156125c2573d5f803e3d5ffd5b505050505050505050505050565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03821661267f5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610a2e565b6001600160a01b0382165f90815260076020526040902054818110156126f25760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610a2e565b6001600160a01b0383165f8181526007602090815260408083208686039055600980548790039055518581529192915f80516020613c48833981519152910160405180910390a3505050565b60608161274c81601f613645565b101561278b5760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b6044820152606401610a2e565b6127958284613645565b845110156127d95760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b6044820152606401610a2e565b6060821580156127f75760405191505f825260208201604052612841565b6040519150601f8416801560200281840101858101878315602002848b0101015b81831015612830578051835260209283019201612818565b5050858452601f01601f1916604052505b50949350505050565b5f60605f805f8661ffff166001600160401b0381111561286c5761286c613159565b6040519080825280601f01601f191660200182016040528015612896576020820181803683370190505b5090505f808751602089015f8d8df191503d9250868311156128b6578692505b828152825f602083013e909890975095505050505050565b818051906020012060055f8761ffff1661ffff1681526020019081526020015f20856040516128fd9190613b3a565b9081526040805191829003602090810183206001600160401b0388165f908152915220919091557fe183f33de2837795525b4792ca4cd60535bd77c53b7e7030060bfcf5734d6b0c906129599087908790879087908790613b55565b60405180910390a15050505050565b612974865f835f612b03565b5f61298188888888612b7d565b90505f8087836040516020016129999392919061390e565b60405160208183030381529060405290506129b8888287878734612433565b886001600160a01b03168861ffff167f39a4c66499bcf4b56d79f0dde8ed7a9d4925a0df55825206b2b8531e202be0d089856040516129f8929190613785565b60405180910390a3505050505050505050565b5f8082806020019051810190612a219190613bb2565b90935091505f9050612a338382612baf565b9050612a40878284612c13565b9150806001600160a01b03168761ffff167fbf551ec93859b170f9b2141bd9298bf3f64322c6f7beb2543a0cb669834118bf84604051612a8291815260200190565b60405180910390a350505050505050565b61ffff82165f9081526003602052604081205490819003612ab357506127105b808211156113635760405162461bcd60e51b815260206004820181905260248201527f4c7a4170703a207061796c6f61642073697a6520697320746f6f206c617267656044820152606401610a2e565b60065460ff1615612b1f57612b1a84848484612c26565b61210d565b81511561210d5760405162461bcd60e51b815260206004820152602660248201527f4f4654436f72653a205f61646170746572506172616d73206d7573742062652060448201526532b6b83a3c9760d11b6064820152608401610a2e565b5f336001600160a01b0386168114612b9a57612b9a86828561209b565b612ba5863085612113565b5090949350505050565b5f612bbb826014613645565b83511015612c035760405162461bcd60e51b8152602060048201526015602482015274746f416464726573735f6f75744f66426f756e647360581b6044820152606401610a2e565b500160200151600160601b900490565b5f612c1f308484612113565b5092915050565b5f612c3083612cfd565b61ffff8087165f90815260026020908152604080832093891683529290529081205491925090612c61908490613645565b90505f8111612caf5760405162461bcd60e51b815260206004820152601a602482015279131e905c1c0e881b5a5b91d85cd31a5b5a5d081b9bdd081cd95d60321b6044820152606401610a2e565b8082101561126f5760405162461bcd60e51b815260206004820152601b60248201527a4c7a4170703a20676173206c696d697420697320746f6f206c6f7760281b6044820152606401610a2e565b5f602282511015612d4f5760405162461bcd60e51b815260206004820152601c60248201527b4c7a4170703a20696e76616c69642061646170746572506172616d7360201b6044820152606401610a2e565b506022015190565b61ffff81168114611dbd575f80fd5b5f8083601f840112612d76575f80fd5b5081356001600160401b03811115612d8c575f80fd5b602083019150836020828501011115612da3575f80fd5b9250929050565b80356001600160401b0381168114612dc0575f80fd5b919050565b5f805f805f8060808789031215612dda575f80fd5b8635612de581612d57565b955060208701356001600160401b0380821115612e00575f80fd5b612e0c8a838b01612d66565b9097509550859150612e2060408a01612daa565b94506060890135915080821115612e35575f80fd5b50612e4289828a01612d66565b979a9699509497509295939492505050565b5f60208284031215612e64575f80fd5b81356001600160e01b0319811681146116f3575f80fd5b5f5b83811015612e95578181015183820152602001612e7d565b50505f910152565b5f8151808452612eb4816020860160208601612e7b565b601f01601f19169290920160200192915050565b602081525f6116f36020830184612e9d565b6001600160a01b0391909116815260200190565b5f60208284031215612efe575f80fd5b81356116f381612d57565b6001600160a01b0381168114611dbd575f80fd5b5f8060408385031215612f2e575f80fd5b8235612f3981612f09565b946020939093013593505050565b5f8060408385031215612f58575f80fd5b8235612f3981612d57565b5f805f60608486031215612f75575f80fd5b8335612f8081612f09565b92506020840135612f9081612f09565b929592945050506040919091013590565b80358015158114612dc0575f80fd5b5f805f805f805f60a0888a031215612fc6575f80fd5b8735612fd181612d57565b965060208801356001600160401b0380821115612fec575f80fd5b612ff88b838c01612d66565b909850965060408a0135955086915061301360608b01612fa1565b945060808a0135915080821115613028575f80fd5b506130358a828b01612d66565b989b979a50959850939692959293505050565b5f805f6040848603121561305a575f80fd5b833561306581612d57565b925060208401356001600160401b0381111561307f575f80fd5b61308b86828701612d66565b9497909650939450505050565b5f805f805f805f805f60e08a8c0312156130b0575f80fd5b89356130bb81612f09565b985060208a01356130cb81612d57565b975060408a01356001600160401b03808211156130e6575f80fd5b6130f28d838e01612d66565b909950975060608c0135965060808c0135915061310e82612f09565b90945060a08b01359061312082612f09565b90935060c08b01359080821115613135575f80fd5b506131428c828d01612d66565b915080935050809150509295985092959850929598565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f191681016001600160401b038111828210171561319557613195613159565b604052919050565b5f6001600160401b038211156131b5576131b5613159565b50601f01601f191660200190565b5f82601f8301126131d2575f80fd5b81356131e56131e08261319d565b61316d565b8181528460208386010111156131f9575f80fd5b816020850160208301375f918101602001919091529392505050565b5f805f60608486031215613227575f80fd5b833561323281612d57565b925060208401356001600160401b0381111561324c575f80fd5b613258868287016131c3565b92505061326760408501612daa565b90509250925092565b5f805f60608486031215613282575f80fd5b833561328d81612d57565b925061329b60208501612fa1565b915060408401356001600160401b038111156132b5575f80fd5b6132c1868287016131c3565b9150509250925092565b5f602082840312156132db575f80fd5b81356116f381612f09565b5f80604083850312156132f7575f80fd5b823561330281612d57565b9150602083013561331281612d57565b809150509250929050565b5f806040838503121561332e575f80fd5b823561333981612d57565b915060208301356001600160401b03811115613353575f80fd5b61335f858286016131c3565b9150509250929050565b5f60208284031215613379575f80fd5b5035919050565b5f805f805f60808688031215613394575f80fd5b853561339f81612d57565b945060208601356133af81612d57565b93506040860135925060608601356001600160401b038111156133d0575f80fd5b6133dc88828901612d66565b969995985093965092949392505050565b5f805f606084860312156133ff575f80fd5b833561340a81612d57565b92506020840135915060408401356001600160401b038111156132b5575f80fd5b5f806040838503121561343c575f80fd5b823561344781612f09565b9150602083013561331281612f09565b5f805f60608486031215613469575f80fd5b833561347481612d57565b92506020840135612f9081612d57565b5f60208284031215613494575f80fd5b6116f382612fa1565b5f805f80608085870312156134b0575f80fd5b84356134bb81612d57565b935060208501356134cb81612d57565b925060408501356134db81612f09565b9396929550929360600135925050565b600181811c908216806134ff57607f821691505b60208210810361351d57634e487b7160e01b5f52602260045260245ffd5b50919050565b818382375f9101908152919050565b634e487b7160e01b5f52601160045260245ffd5b5f8261356057634e487b7160e01b5f52601260045260245ffd5b500490565b81810381811115610c1c57610c1c613532565b81835281816020850137505f828201602090810191909152601f909101601f19169091010190565b61ffff85168152606060208201525f6135bd606083018587613578565b905082604083015295945050505050565b61ffff871681526001600160a01b038616602082015260a0604082018190525f906135fb90830187612e9d565b85151560608401528281036080840152613616818587613578565b9998505050505050505050565b5f8060408385031215613634575f80fd5b505080516020909101519092909150565b80820180821115610c1c57610c1c613532565b6020808252600290820152614e4d60f01b604082015260600190565b61ffff84168152604060208201525f611e64604083018486613578565b6020808252600790820152661a5b9d985b1a5960ca1b604082015260600190565b6020808252600a908201526939b0b6b29031b430b4b760b11b604082015260600190565b60609190911b6001600160601b031916815260140190565b604081525f6137006040830185612e9d565b905082151560208301529392505050565b61ffff84168152606060208201525f61372d6060830185612e9d565b90508215156040830152949350505050565b5f6020828403121561374f575f80fd5b5051919050565b61ffff85168152608060208201525f6137726080830186612e9d565b6040830194909452506060015292915050565b604081525f6137976040830185612e9d565b90508260208301529392505050565b8284823760609190911b6001600160601b0319169101908152601401919050565b601f821115611363575f81815260208120601f850160051c810160208610156137ed5750805b601f850160051c820191505b8181101561126f578281556001016137f9565b5f19600383901b1c191660019190911b1790565b81516001600160401b0381111561383957613839613159565b61384d8161384784546134eb565b846137c7565b602080601f83116001811461387b575f84156138695750858301515b613873858261380c565b86555061126f565b5f85815260208120601f198616915b828110156138a95788860151825594840194600190910190840161388a565b50858210156138c657878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b5f61ffff808816835280871660208401525084604083015260806060830152613903608083018486613578565b979650505050505050565b61ffff84168152606060208201525f61392a6060830185612e9d565b9050826040830152949350505050565b61ffff86168152608060208201525f613957608083018688613578565b6001600160401b0394909416604083015250606001529392505050565b6001600160401b0383111561398b5761398b613159565b61399f8361399983546134eb565b836137c7565b5f601f8411600181146139cb575f85156139b95750838201355b6139c3868261380c565b845550610d2f565b5f83815260209020601f19861690835b828110156139fb57868501358255602094850194600190920191016139db565b5086821015613a17575f1960f88860031b161c19848701351681555b505060018560011b0183555050505050565b5f82601f830112613a38575f80fd5b8151613a466131e08261319d565b818152846020838601011115613a5a575f80fd5b613a6b826020830160208701612e7b565b949350505050565b5f60208284031215613a83575f80fd5b81516001600160401b03811115613a98575f80fd5b613a6b84828501613a29565b61ffff85168152608060208201525f613ac06080830186612e9d565b6001600160401b038516604084015282810360608401526139038185612e9d565b61ffff8716815260c060208201525f613afd60c0830188612e9d565b8281036040840152613b0f8188612e9d565b6001600160a01b0387811660608601528616608085015283810360a085015290506136168185612e9d565b5f8251613b4b818460208701612e7b565b9190910192915050565b61ffff8616815260a060208201525f613b7160a0830187612e9d565b6001600160401b03861660408401528281036060840152613b928186612e9d565b90508281036080840152613ba68185612e9d565b98975050505050505050565b5f805f60608486031215613bc4575f80fd5b8351613bcf81612d57565b60208501519093506001600160401b03811115613bea575f80fd5b613bf686828701613a29565b92505060408401519050925092509256fe8bf89adedf6e5cb38caf3b2cc7e255e668fec50ffeee80e627d7ee7ff42ea89ffba6058f70462ebfb18b3e74d307def7438209fc600413e1fc842c59b0ba5bf4ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212200925be473ed0a77aaeba73c62029065d5a6c096f58b568386f13c80bcd4271d964736f6c63430008150033000000000000000000000000ec306e46549a7e8f4fce823d3058f2d134133b1700000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd67500000000000000000000000000000000000000000000021e19e0c9bab2400000","external_libraries":[],"proxy_type":null,"implementations":[],"verified_at":"2023-12-13T10:00:49.015071Z","is_verified_via_verifier_alliance":false,"compiler_version":"0.8.21+commit.d9974bed","decoded_constructor_args":[["0xEc306E46549A7E8f4fCE823D3058f2D134133B17",{"internalType":"address","name":"_minter","type":"address"}],["0x66A71Dcef29A0fFBDBE3c6a460a3B5BC225Cd675",{"internalType":"address","name":"_layerZeroEndpoint","type":"address"}],["10000000000000000000000",{"internalType":"uint256","name":"_cap","type":"uint256"}]],"sourcify_repo_url":"https://repo.sourcify.dev/1/0x7122985656e38BDC0302Db86685bb972b145bD3C","optimization_runs":10,"compiler_settings":{"evmVersion":"shanghai","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":true,"runs":10},"remappings":[]},"is_verified":true,"verified_twin_address_hash":null,"optimization_enabled":true,"deployed_bytecode":"0x6080604052600436106102a5575f3560e01c80621d3567146102a957806301ffc9a7146102ca57806306fdde03146102fe578063075461721461031f57806307e0db171461034b578063095ea7b31461036a5780630df374831461038957806310ddb137146103a857806318160ddd146103c75780631df8ba77146103e557806323b872dd146103f95780632a205e3d14610418578063313ce5671461044c578063355274ea14610467578063395093511461047c5780633d8b38f61461049b5780633f1f4fa4146104ba57806340c10f19146104e557806342d65a8d146105045780634477051514610523578063471744d1146105365780634c42899a1461055d57806351905636146105705780635b8c41e61461058357806366ad5c8a146105d057806368322ff5146105ef5780636abe0abf1461060257806370a0823114610618578063715018a6146106375780637533d7881461064b5780637ff9b5961461066a5780638cfd8f5c1461067e5780638da5cb5b146106b457806390e9097a146106c85780639358928b146106db578063950c8a74146106ef57806395d89b411461070e5780639dc29fac146107225780639f38369a14610741578063a162b0a214610760578063a3907d711461078b578063a457c2d7146107a4578063a6c3d165146107c3578063a9059cbb146107e2578063b353aaa714610801578063baf3292d14610834578063c446183414610853578063ca5ea40614610868578063cbed8b9c1461087c578063d1b4a2d81461089b578063d1deba1f146108ae578063dd62ed3e146108c1578063df2a5b3b146108e0578063e3ec18ae146108ff578063eab45d9c14610913578063eb8d72b714610932578063ed629c5c14610951578063f2fde38b1461096a578063f5ecbdbc14610989578063fc0c546a146109a8575b5f80fd5b3480156102b4575f80fd5b506102c86102c3366004612dc5565b6109ba565b005b3480156102d5575f80fd5b506102e96102e4366004612e54565b610be5565b60405190151581526020015b60405180910390f35b348015610309575f80fd5b50610312610c22565b6040516102f59190612ec8565b34801561032a575f80fd5b50600c5461033e906001600160a01b031681565b6040516102f59190612eda565b348015610356575f80fd5b506102c8610365366004612eee565b610cb2565b348015610375575f80fd5b506102e9610384366004612f1d565b610d36565b348015610394575f80fd5b506102c86103a3366004612f47565b610d4d565b3480156103b3575f80fd5b506102c86103c2366004612eee565b610d6b565b3480156103d2575f80fd5b506009545b6040519081526020016102f5565b3480156103f0575f80fd5b506103d7610dc3565b348015610404575f80fd5b506102e9610413366004612f63565b610e15565b348015610423575f80fd5b50610437610432366004612fb0565b610e38565b604080519283526020830191909152016102f5565b348015610457575f80fd5b50604051601281526020016102f5565b348015610472575f80fd5b506103d7600d5481565b348015610487575f80fd5b506102e9610496366004612f1d565b610f07565b3480156104a6575f80fd5b506102e96104b5366004613048565b610f28565b3480156104c5575f80fd5b506103d76104d4366004612eee565b60036020525f908152604090205481565b3480156104f0575f80fd5b506102c86104ff366004612f1d565b610ff1565b34801561050f575f80fd5b506102c861051e366004613048565b611029565b34801561052e575f80fd5b506103d75f81565b348015610541575f80fd5b5061054a600181565b60405161ffff90911681526020016102f5565b348015610568575f80fd5b5061054a5f81565b6102c861057e366004613098565b6110aa565b34801561058e575f80fd5b506103d761059d366004613215565b600560209081525f9384526040808520845180860184018051928152908401958401959095209452929052825290205481565b3480156105db575f80fd5b506102c86105ea366004612dc5565b61119d565b6102c86105fd366004613270565b611277565b34801561060d575f80fd5b506103d76201518081565b348015610623575f80fd5b506103d76106323660046132cb565b611368565b348015610642575f80fd5b506102c8611382565b348015610656575f80fd5b50610312610665366004612eee565b611395565b348015610675575f80fd5b506103d761142c565b348015610689575f80fd5b506103d76106983660046132e6565b600260209081525f928352604080842090915290825290205481565b3480156106bf575f80fd5b5061033e61149d565b6103d76106d636600461331d565b6114ab565b3480156106e6575f80fd5b506103d7611593565b3480156106fa575f80fd5b5060045461033e906001600160a01b031681565b348015610719575f80fd5b506103126115a6565b34801561072d575f80fd5b506102c861073c366004612f1d565b6115b5565b34801561074c575f80fd5b5061031261075b366004612eee565b6115e9565b34801561076b575f80fd5b506103d761077a366004613369565b600f6020525f908152604090205481565b348015610796575f80fd5b50600e546102e99060ff1681565b3480156107af575f80fd5b506102e96107be366004612f1d565b6116fa565b3480156107ce575f80fd5b506102c86107dd366004613048565b611774565b3480156107ed575f80fd5b506102e96107fc366004612f1d565b6117fc565b34801561080c575f80fd5b5061033e7f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd67581565b34801561083f575f80fd5b506102c861084e3660046132cb565b611809565b34801561085e575f80fd5b506103d761271081565b348015610873575f80fd5b5061054a600281565b348015610887575f80fd5b506102c8610896366004613380565b611867565b6102c86108a93660046133ed565b6118f7565b6102c86108bc366004612dc5565b6119bb565b3480156108cc575f80fd5b506103d76108db36600461342b565b611bcb565b3480156108eb575f80fd5b506102c86108fa366004613457565b611bf5565b34801561090a575f80fd5b5061054a600381565b34801561091e575f80fd5b506102c861092d366004613484565b611ca5565b34801561093d575f80fd5b506102c861094c366004613048565b611cee565b34801561095c575f80fd5b506006546102e99060ff1681565b348015610975575f80fd5b506102c86109843660046132cb565b611d47565b348015610994575f80fd5b506103126109a336600461349d565b611dc0565b3480156109b3575f80fd5b503061033e565b337f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd6756001600160a01b031614610a375760405162461bcd60e51b815260206004820152601e60248201527f4c7a4170703a20696e76616c696420656e64706f696e742063616c6c6572000060448201526064015b60405180910390fd5b61ffff86165f9081526001602052604081208054610a54906134eb565b80601f0160208091040260200160405190810160405280929190818152602001828054610a80906134eb565b8015610acb5780601f10610aa257610100808354040283529160200191610acb565b820191905f5260205f20905b815481529060010190602001808311610aae57829003601f168201915b50505050509050805186869050148015610ae557505f8151115b8015610b0d575080516020820120604051610b039088908890613523565b6040518091039020145b610b685760405162461bcd60e51b815260206004820152602660248201527f4c7a4170703a20696e76616c696420736f757263652073656e64696e6720636f6044820152651b9d1c9858dd60d21b6064820152608401610a2e565b610bdc8787878080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525050604080516020601f8a018190048102820181019092528881528a9350915088908890819084018382808284375f92019190915250611e6d92505050565b50505050505050565b5f6001600160e01b031982161580610c0d57506001600160e01b031982166336372b0760e01b145b80610c1c5750610c1c82611ee5565b92915050565b6060600a8054610c31906134eb565b80601f0160208091040260200160405190810160405280929190818152602001828054610c5d906134eb565b8015610ca85780601f10610c7f57610100808354040283529160200191610ca8565b820191905f5260205f20905b815481529060010190602001808311610c8b57829003601f168201915b5050505050905090565b610cba611f19565b6040516307e0db1760e01b815261ffff821660048201527f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd6756001600160a01b0316906307e0db17906024015b5f604051808303815f87803b158015610d1d575f80fd5b505af1158015610d2f573d5f803e3d5ffd5b5050505050565b5f33610d43818585611f78565b5060019392505050565b610d55611f19565b61ffff9091165f90815260036020526040902055565b610d73611f19565b6040516310ddb13760e01b815261ffff821660048201527f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd6756001600160a01b0316906310ddb13790602401610d06565b5f80600f81610dd56201518042613546565b81526020019081526020015f2054905080600d54118015610df85750600e5460ff165b15610e115780600d54610e0b9190613565565b91505090565b5090565b5f33610e2285828561209b565b610e2d858585612113565b506001949350505050565b5f805f80898989604051602001610e5294939291906135a0565b60408051601f198184030181529082905263040a7bb160e41b825291506001600160a01b037f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd67516906340a7bb1090610eb8908d90309086908c908c908c906004016135ce565b6040805180830381865afa158015610ed2573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ef69190613623565b925092505097509795505050505050565b5f33610d43818585610f198383611bcb565b610f239190613645565b611f78565b61ffff83165f9081526001602052604081208054829190610f48906134eb565b80601f0160208091040260200160405190810160405280929190818152602001828054610f74906134eb565b8015610fbf5780601f10610f9657610100808354040283529160200191610fbf565b820191905f5260205f20905b815481529060010190602001808311610fa257829003601f168201915b505050505090508383604051610fd6929190613523565b60405180910390208180519060200120149150509392505050565b600c546001600160a01b0316331461101b5760405162461bcd60e51b8152600401610a2e90613658565b61102582826122a9565b5050565b611031611f19565b6040516342d65a8d60e01b81526001600160a01b037f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd67516906342d65a8d9061108190869086908690600401613674565b5f604051808303815f87803b158015611098575f80fd5b505af1158015610bdc573d5f803e3d5ffd5b600e5460ff166110cc5760405162461bcd60e51b8152600401610a2e90613691565b4661ffff891681036110f05760405162461bcd60e51b8152600401610a2e906136b2565b5f6110fe6201518042613546565b600d545f828152600f60205260409020549192509061111d9089613645565b11156111585760405162461bcd60e51b815260206004820152600a6024820152690457863656564206361760b41b6044820152606401610a2e565b5f818152600f6020526040902054611171908890613645565b5f828152600f60205260409020556111908b8b8b8b8b8b8b8b8b612355565b5050505050505050505050565b3330146111fb5760405162461bcd60e51b815260206004820152602660248201527f4e6f6e626c6f636b696e674c7a4170703a2063616c6c6572206d7573742062656044820152650204c7a4170760d41b6064820152608401610a2e565b61126f8686868080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525050604080516020601f8901819004810282018101909252878152899350915087908790819084018382808284375f920191909152506123cd92505050565b505050505050565b61127f611f19565b4661ffff84168190036112f157600e805460ff191684151517905560405161ffff8516905f80516020613c08833981519152906112c09030906020016136d6565b60408051601f1981840301815290829052600e546112e39260ff909116906136ee565b60405180910390a250505050565b5f6002838560405160200161130893929190613711565b60405160208183030381529060405290506113358582335f60405180602001604052805f81525034612433565b8461ffff165f80516020613c0883398151915284866040516113589291906136ee565b60405180910390a250505b505050565b6001600160a01b03165f9081526007602052604090205490565b61138a611f19565b6113935f6125d0565b565b60016020525f9081526040902080546113ad906134eb565b80601f01602080910402602001604051908101604052809291908181526020018280546113d9906134eb565b80156114245780601f106113fb57610100808354040283529160200191611424565b820191905f5260205f20905b81548152906001019060200180831161140757829003601f168201915b505050505081565b600c54604080516325ca7a8760e11b815290515f926001600160a01b031691634b94f50e916004808301926020929190829003018187875af1158015611474573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611498919061373f565b905090565b5f546001600160a01b031690565b600e545f9060ff166114cf5760405162461bcd60e51b8152600401610a2e90613691565b4661ffff841681036114f35760405162461bcd60e51b8152600401610a2e906136b2565b6114fb61142c565b91505f60018484426040516020016115169493929190613756565b60405160208183030381529060405290506115438582335f60405180602001604052805f81525034612433565b336001600160a01b03168561ffff167fa9abd88cb9207ea146a8c570a7c926ee640d4ef1eed13893a603f574d762f8818686604051611583929190613785565b60405180910390a3505092915050565b5f61159d30611368565b60095403905090565b6060600b8054610c31906134eb565b600c546001600160a01b031633146115df5760405162461bcd60e51b8152600401610a2e90613658565b611025828261261f565b61ffff81165f9081526001602052604081208054606092919061160b906134eb565b80601f0160208091040260200160405190810160405280929190818152602001828054611637906134eb565b80156116825780601f1061165957610100808354040283529160200191611682565b820191905f5260205f20905b81548152906001019060200180831161166557829003601f168201915b5050505050905080515f036116d95760405162461bcd60e51b815260206004820152601d60248201527f4c7a4170703a206e6f20747275737465642070617468207265636f72640000006044820152606401610a2e565b6116f35f601483516116eb9190613565565b83919061273e565b9392505050565b5f33816117078286611bcb565b9050838110156117675760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610a2e565b610e2d8286868403611f78565b61177c611f19565b818130604051602001611791939291906137a6565b60408051601f1981840301815291815261ffff85165f908152600160205220906117bb9082613820565b507f8c0400cfe2d1199b1a725c78960bcc2a344d869b80590d0f2bd005db15a572ce8383836040516117ef93929190613674565b60405180910390a1505050565b5f33610d43818585612113565b611811611f19565b600480546001600160a01b0319166001600160a01b0383161790556040517f5db758e995a17ec1ad84bdef7e8c3293a0bd6179bcce400dff5d4c3d87db726b9061185c908390612eda565b60405180910390a150565b61186f611f19565b6040516332fb62e760e21b81526001600160a01b037f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd675169063cbed8b9c906118c390889088908890889088906004016138d6565b5f604051808303815f87803b1580156118da575f80fd5b505af11580156118ec573d5f803e3d5ffd5b505050505050505050565b6118ff611f19565b4661ffff84168190036119545782600d819055508361ffff165f80516020613c288339815191523060405160200161193791906136d6565b60408051601f1981840301815290829052600d546112e392613785565b5f6003838560405160200161196b9392919061390e565b60405160208183030381529060405290506119988582335f60405180602001604052805f81525034612433565b8461ffff165f80516020613c288339815191528486604051611358929190613785565b61ffff86165f9081526005602052604080822090516119dd9088908890613523565b90815260408051602092819003830190206001600160401b0387165f9081529252902054905080611a5c5760405162461bcd60e51b815260206004820152602360248201527f4e6f6e626c6f636b696e674c7a4170703a206e6f2073746f726564206d65737360448201526261676560e81b6064820152608401610a2e565b808383604051611a6d929190613523565b604051809103902014611acc5760405162461bcd60e51b815260206004820152602160248201527f4e6f6e626c6f636b696e674c7a4170703a20696e76616c6964207061796c6f616044820152601960fa1b6064820152608401610a2e565b61ffff87165f908152600560205260408082209051611aee9089908990613523565b90815260408051602092819003830181206001600160401b0389165f90815290845282902093909355601f88018290048202830182019052868252611b8391899189908990819084018382808284375f9201919091525050604080516020601f8a018190048102820181019092528881528a9350915088908890819084018382808284375f920191909152506123cd92505050565b7fc264d91f3adc5588250e1551f547752ca0cfa8f6b530d243b9f9f4cab10ea8e58787878785604051611bba95949392919061393a565b60405180910390a150505050505050565b6001600160a01b039182165f90815260086020908152604080832093909416825291909152205490565b611bfd611f19565b5f8111611c445760405162461bcd60e51b81526020600482015260156024820152744c7a4170703a20696e76616c6964206d696e47617360581b6044820152606401610a2e565b61ffff8381165f8181526002602090815260408083209487168084529482529182902085905581519283528201929092529081018290527f9d5c7c0b934da8fefa9c7760c98383778a12dfbfc0c3b3106518f43fb9508ac0906060016117ef565b611cad611f19565b6006805460ff19168215159081179091556040519081527f1584ad594a70cbe1e6515592e1272a987d922b097ead875069cebe8b40c004a49060200161185c565b611cf6611f19565b61ffff83165f908152600160205260409020611d13828483613974565b507ffa41487ad5d6728f0b19276fa1eddc16558578f5109fc39d2dc33c3230470dab8383836040516117ef93929190613674565b611d4f611f19565b6001600160a01b038116611db45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a2e565b611dbd816125d0565b50565b604051633d7b2f6f60e21b815261ffff808616600483015284166024820152306044820152606481018290526060907f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd6756001600160a01b03169063f5ecbdbc906084015f60405180830381865afa158015611e3d573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052611e649190810190613a73565b95945050505050565b5f80611ecf5a60966366ad5c8a60e01b89898989604051602401611e949493929190613aa4565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091523092919061284a565b915091508161126f5761126f86868686856128ce565b5f6001600160e01b03198216630a72677560e11b1480610c1c57506301ffc9a760e01b6001600160e01b0319831614610c1c565b33611f2261149d565b6001600160a01b0316146113935760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a2e565b6001600160a01b038316611fda5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610a2e565b6001600160a01b03821661203b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610a2e565b6001600160a01b038381165f8181526008602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b5f6120a68484611bcb565b90505f19811461210d57818110156121005760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610a2e565b61210d8484848403611f78565b50505050565b6001600160a01b0383166121775760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610a2e565b6001600160a01b0382166121d95760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610a2e565b6001600160a01b0383165f90815260076020526040902054818110156122505760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610a2e565b6001600160a01b038085165f8181526007602052604080822086860390559286168082529083902080548601905591515f80516020613c488339815191529061229c9086815260200190565b60405180910390a361210d565b6001600160a01b0382166122ff5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610a2e565b8060095f8282546123109190613645565b90915550506001600160a01b0382165f818152600760209081526040808320805486019055518481525f80516020613c48833981519152910160405180910390a35050565b6118ec898989898080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525050604080516020601f8a018190048102820181019092528881528c93508b92508a918a908a90819084018382808284375f9201919091525061296892505050565b602081015161ffff81166123ec576123e785858585612a0b565b610d2f565b60405162461bcd60e51b815260206004820152601c60248201527b4f4654436f72653a20756e6b6e6f776e207061636b6574207479706560201b6044820152606401610a2e565b61ffff86165f9081526001602052604081208054612450906134eb565b80601f016020809104026020016040519081016040528092919081815260200182805461247c906134eb565b80156124c75780601f1061249e576101008083540402835291602001916124c7565b820191905f5260205f20905b8154815290600101906020018083116124aa57829003601f168201915b5050505050905080515f036125375760405162461bcd60e51b815260206004820152603060248201527f4c7a4170703a2064657374696e6174696f6e20636861696e206973206e6f742060448201526f61207472757374656420736f7572636560801b6064820152608401610a2e565b612542878751612a93565b60405162c5803160e81b81526001600160a01b037f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd675169063c5803100908490612599908b9086908c908c908c908c90600401613ae1565b5f604051808303818588803b1580156125b0575f80fd5b505af11580156125c2573d5f803e3d5ffd5b505050505050505050505050565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03821661267f5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610a2e565b6001600160a01b0382165f90815260076020526040902054818110156126f25760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610a2e565b6001600160a01b0383165f8181526007602090815260408083208686039055600980548790039055518581529192915f80516020613c48833981519152910160405180910390a3505050565b60608161274c81601f613645565b101561278b5760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b6044820152606401610a2e565b6127958284613645565b845110156127d95760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b6044820152606401610a2e565b6060821580156127f75760405191505f825260208201604052612841565b6040519150601f8416801560200281840101858101878315602002848b0101015b81831015612830578051835260209283019201612818565b5050858452601f01601f1916604052505b50949350505050565b5f60605f805f8661ffff166001600160401b0381111561286c5761286c613159565b6040519080825280601f01601f191660200182016040528015612896576020820181803683370190505b5090505f808751602089015f8d8df191503d9250868311156128b6578692505b828152825f602083013e909890975095505050505050565b818051906020012060055f8761ffff1661ffff1681526020019081526020015f20856040516128fd9190613b3a565b9081526040805191829003602090810183206001600160401b0388165f908152915220919091557fe183f33de2837795525b4792ca4cd60535bd77c53b7e7030060bfcf5734d6b0c906129599087908790879087908790613b55565b60405180910390a15050505050565b612974865f835f612b03565b5f61298188888888612b7d565b90505f8087836040516020016129999392919061390e565b60405160208183030381529060405290506129b8888287878734612433565b886001600160a01b03168861ffff167f39a4c66499bcf4b56d79f0dde8ed7a9d4925a0df55825206b2b8531e202be0d089856040516129f8929190613785565b60405180910390a3505050505050505050565b5f8082806020019051810190612a219190613bb2565b90935091505f9050612a338382612baf565b9050612a40878284612c13565b9150806001600160a01b03168761ffff167fbf551ec93859b170f9b2141bd9298bf3f64322c6f7beb2543a0cb669834118bf84604051612a8291815260200190565b60405180910390a350505050505050565b61ffff82165f9081526003602052604081205490819003612ab357506127105b808211156113635760405162461bcd60e51b815260206004820181905260248201527f4c7a4170703a207061796c6f61642073697a6520697320746f6f206c617267656044820152606401610a2e565b60065460ff1615612b1f57612b1a84848484612c26565b61210d565b81511561210d5760405162461bcd60e51b815260206004820152602660248201527f4f4654436f72653a205f61646170746572506172616d73206d7573742062652060448201526532b6b83a3c9760d11b6064820152608401610a2e565b5f336001600160a01b0386168114612b9a57612b9a86828561209b565b612ba5863085612113565b5090949350505050565b5f612bbb826014613645565b83511015612c035760405162461bcd60e51b8152602060048201526015602482015274746f416464726573735f6f75744f66426f756e647360581b6044820152606401610a2e565b500160200151600160601b900490565b5f612c1f308484612113565b5092915050565b5f612c3083612cfd565b61ffff8087165f90815260026020908152604080832093891683529290529081205491925090612c61908490613645565b90505f8111612caf5760405162461bcd60e51b815260206004820152601a602482015279131e905c1c0e881b5a5b91d85cd31a5b5a5d081b9bdd081cd95d60321b6044820152606401610a2e565b8082101561126f5760405162461bcd60e51b815260206004820152601b60248201527a4c7a4170703a20676173206c696d697420697320746f6f206c6f7760281b6044820152606401610a2e565b5f602282511015612d4f5760405162461bcd60e51b815260206004820152601c60248201527b4c7a4170703a20696e76616c69642061646170746572506172616d7360201b6044820152606401610a2e565b506022015190565b61ffff81168114611dbd575f80fd5b5f8083601f840112612d76575f80fd5b5081356001600160401b03811115612d8c575f80fd5b602083019150836020828501011115612da3575f80fd5b9250929050565b80356001600160401b0381168114612dc0575f80fd5b919050565b5f805f805f8060808789031215612dda575f80fd5b8635612de581612d57565b955060208701356001600160401b0380821115612e00575f80fd5b612e0c8a838b01612d66565b9097509550859150612e2060408a01612daa565b94506060890135915080821115612e35575f80fd5b50612e4289828a01612d66565b979a9699509497509295939492505050565b5f60208284031215612e64575f80fd5b81356001600160e01b0319811681146116f3575f80fd5b5f5b83811015612e95578181015183820152602001612e7d565b50505f910152565b5f8151808452612eb4816020860160208601612e7b565b601f01601f19169290920160200192915050565b602081525f6116f36020830184612e9d565b6001600160a01b0391909116815260200190565b5f60208284031215612efe575f80fd5b81356116f381612d57565b6001600160a01b0381168114611dbd575f80fd5b5f8060408385031215612f2e575f80fd5b8235612f3981612f09565b946020939093013593505050565b5f8060408385031215612f58575f80fd5b8235612f3981612d57565b5f805f60608486031215612f75575f80fd5b8335612f8081612f09565b92506020840135612f9081612f09565b929592945050506040919091013590565b80358015158114612dc0575f80fd5b5f805f805f805f60a0888a031215612fc6575f80fd5b8735612fd181612d57565b965060208801356001600160401b0380821115612fec575f80fd5b612ff88b838c01612d66565b909850965060408a0135955086915061301360608b01612fa1565b945060808a0135915080821115613028575f80fd5b506130358a828b01612d66565b989b979a50959850939692959293505050565b5f805f6040848603121561305a575f80fd5b833561306581612d57565b925060208401356001600160401b0381111561307f575f80fd5b61308b86828701612d66565b9497909650939450505050565b5f805f805f805f805f60e08a8c0312156130b0575f80fd5b89356130bb81612f09565b985060208a01356130cb81612d57565b975060408a01356001600160401b03808211156130e6575f80fd5b6130f28d838e01612d66565b909950975060608c0135965060808c0135915061310e82612f09565b90945060a08b01359061312082612f09565b90935060c08b01359080821115613135575f80fd5b506131428c828d01612d66565b915080935050809150509295985092959850929598565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f191681016001600160401b038111828210171561319557613195613159565b604052919050565b5f6001600160401b038211156131b5576131b5613159565b50601f01601f191660200190565b5f82601f8301126131d2575f80fd5b81356131e56131e08261319d565b61316d565b8181528460208386010111156131f9575f80fd5b816020850160208301375f918101602001919091529392505050565b5f805f60608486031215613227575f80fd5b833561323281612d57565b925060208401356001600160401b0381111561324c575f80fd5b613258868287016131c3565b92505061326760408501612daa565b90509250925092565b5f805f60608486031215613282575f80fd5b833561328d81612d57565b925061329b60208501612fa1565b915060408401356001600160401b038111156132b5575f80fd5b6132c1868287016131c3565b9150509250925092565b5f602082840312156132db575f80fd5b81356116f381612f09565b5f80604083850312156132f7575f80fd5b823561330281612d57565b9150602083013561331281612d57565b809150509250929050565b5f806040838503121561332e575f80fd5b823561333981612d57565b915060208301356001600160401b03811115613353575f80fd5b61335f858286016131c3565b9150509250929050565b5f60208284031215613379575f80fd5b5035919050565b5f805f805f60808688031215613394575f80fd5b853561339f81612d57565b945060208601356133af81612d57565b93506040860135925060608601356001600160401b038111156133d0575f80fd5b6133dc88828901612d66565b969995985093965092949392505050565b5f805f606084860312156133ff575f80fd5b833561340a81612d57565b92506020840135915060408401356001600160401b038111156132b5575f80fd5b5f806040838503121561343c575f80fd5b823561344781612f09565b9150602083013561331281612f09565b5f805f60608486031215613469575f80fd5b833561347481612d57565b92506020840135612f9081612d57565b5f60208284031215613494575f80fd5b6116f382612fa1565b5f805f80608085870312156134b0575f80fd5b84356134bb81612d57565b935060208501356134cb81612d57565b925060408501356134db81612f09565b9396929550929360600135925050565b600181811c908216806134ff57607f821691505b60208210810361351d57634e487b7160e01b5f52602260045260245ffd5b50919050565b818382375f9101908152919050565b634e487b7160e01b5f52601160045260245ffd5b5f8261356057634e487b7160e01b5f52601260045260245ffd5b500490565b81810381811115610c1c57610c1c613532565b81835281816020850137505f828201602090810191909152601f909101601f19169091010190565b61ffff85168152606060208201525f6135bd606083018587613578565b905082604083015295945050505050565b61ffff871681526001600160a01b038616602082015260a0604082018190525f906135fb90830187612e9d565b85151560608401528281036080840152613616818587613578565b9998505050505050505050565b5f8060408385031215613634575f80fd5b505080516020909101519092909150565b80820180821115610c1c57610c1c613532565b6020808252600290820152614e4d60f01b604082015260600190565b61ffff84168152604060208201525f611e64604083018486613578565b6020808252600790820152661a5b9d985b1a5960ca1b604082015260600190565b6020808252600a908201526939b0b6b29031b430b4b760b11b604082015260600190565b60609190911b6001600160601b031916815260140190565b604081525f6137006040830185612e9d565b905082151560208301529392505050565b61ffff84168152606060208201525f61372d6060830185612e9d565b90508215156040830152949350505050565b5f6020828403121561374f575f80fd5b5051919050565b61ffff85168152608060208201525f6137726080830186612e9d565b6040830194909452506060015292915050565b604081525f6137976040830185612e9d565b90508260208301529392505050565b8284823760609190911b6001600160601b0319169101908152601401919050565b601f821115611363575f81815260208120601f850160051c810160208610156137ed5750805b601f850160051c820191505b8181101561126f578281556001016137f9565b5f19600383901b1c191660019190911b1790565b81516001600160401b0381111561383957613839613159565b61384d8161384784546134eb565b846137c7565b602080601f83116001811461387b575f84156138695750858301515b613873858261380c565b86555061126f565b5f85815260208120601f198616915b828110156138a95788860151825594840194600190910190840161388a565b50858210156138c657878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b5f61ffff808816835280871660208401525084604083015260806060830152613903608083018486613578565b979650505050505050565b61ffff84168152606060208201525f61392a6060830185612e9d565b9050826040830152949350505050565b61ffff86168152608060208201525f613957608083018688613578565b6001600160401b0394909416604083015250606001529392505050565b6001600160401b0383111561398b5761398b613159565b61399f8361399983546134eb565b836137c7565b5f601f8411600181146139cb575f85156139b95750838201355b6139c3868261380c565b845550610d2f565b5f83815260209020601f19861690835b828110156139fb57868501358255602094850194600190920191016139db565b5086821015613a17575f1960f88860031b161c19848701351681555b505060018560011b0183555050505050565b5f82601f830112613a38575f80fd5b8151613a466131e08261319d565b818152846020838601011115613a5a575f80fd5b613a6b826020830160208701612e7b565b949350505050565b5f60208284031215613a83575f80fd5b81516001600160401b03811115613a98575f80fd5b613a6b84828501613a29565b61ffff85168152608060208201525f613ac06080830186612e9d565b6001600160401b038516604084015282810360608401526139038185612e9d565b61ffff8716815260c060208201525f613afd60c0830188612e9d565b8281036040840152613b0f8188612e9d565b6001600160a01b0387811660608601528616608085015283810360a085015290506136168185612e9d565b5f8251613b4b818460208701612e7b565b9190910192915050565b61ffff8616815260a060208201525f613b7160a0830187612e9d565b6001600160401b03861660408401528281036060840152613b928186612e9d565b90508281036080840152613ba68185612e9d565b98975050505050505050565b5f805f60608486031215613bc4575f80fd5b8351613bcf81612d57565b60208501519093506001600160401b03811115613bea575f80fd5b613bf686828701613a29565b92505060408401519050925092509256fe8bf89adedf6e5cb38caf3b2cc7e255e668fec50ffeee80e627d7ee7ff42ea89ffba6058f70462ebfb18b3e74d307def7438209fc600413e1fc842c59b0ba5bf4ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212200925be473ed0a77aaeba73c62029065d5a6c096f58b568386f13c80bcd4271d964736f6c63430008150033","source_code":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\nimport \"@layerzerolabs/solidity-examples/contracts/token/oft/extension/BasedOFT.sol\";\n\nimport {Minter} from \"./Minter.sol\";\n\ncontract Stone is BasedOFT {\n    uint256 public constant DAY_INTERVAL = 24 * 60 * 60;\n\n    address public minter;\n\n    uint16 public constant PT_FEED = 1;\n    uint16 public constant PT_SET_ENABLE = 2;\n    uint16 public constant PT_SET_CAP = 3;\n\n    uint256 public cap;\n    bool public enable = true;\n\n    mapping(uint256 => uint256) public quota;\n\n    event FeedToChain(\n        uint16 indexed dstChainId,\n        address indexed from,\n        bytes toAddress,\n        uint price\n    );\n    event SetCapFor(uint16 indexed dstChainId, bytes toAddress, uint cap);\n    event SetEnableFor(uint16 indexed dstChainId, bytes toAddress, bool flag);\n\n    constructor(\n        address _minter,\n        address _layerZeroEndpoint,\n        uint256 _cap\n    ) BasedOFT(\"StakeStone Ether\", \"STONE\", _layerZeroEndpoint) {\n        minter = _minter;\n        cap = _cap;\n    }\n\n    modifier onlyMinter() {\n        require(msg.sender == minter, \"NM\");\n        _;\n    }\n\n    function mint(address _to, uint256 _amount) external onlyMinter {\n        _mint(_to, _amount);\n    }\n\n    function burn(address _from, uint256 _amount) external onlyMinter {\n        _burn(_from, _amount);\n    }\n\n    function sendFrom(\n        address _from,\n        uint16 _dstChainId,\n        bytes calldata _toAddress,\n        uint _amount,\n        address payable _refundAddress,\n        address _zroPaymentAddress,\n        bytes calldata _adapterParams\n    ) public payable override(IOFTCore, OFTCore) {\n        require(enable, \"invalid\");\n\n        uint256 id;\n        assembly {\n            id := chainid()\n        }\n        require(id != _dstChainId, \"same chain\");\n\n        uint256 day = block.timestamp / DAY_INTERVAL;\n        require(_amount + quota[day] <= cap, \"Exceed cap\");\n\n        quota[day] = quota[day] + _amount;\n\n        super.sendFrom(\n            _from,\n            _dstChainId,\n            _toAddress,\n            _amount,\n            _refundAddress,\n            _zroPaymentAddress,\n            _adapterParams\n        );\n    }\n\n    function updatePrice(\n        uint16 _dstChainId,\n        bytes memory _toAddress\n    ) external payable returns (uint256 price) {\n        require(enable, \"invalid\");\n\n        uint256 id;\n        assembly {\n            id := chainid()\n        }\n        require(id != _dstChainId, \"same chain\");\n\n        price = tokenPrice();\n\n        bytes memory lzPayload = abi.encode(\n            PT_FEED,\n            _toAddress,\n            price,\n            block.timestamp\n        );\n\n        _lzSend(\n            _dstChainId,\n            lzPayload,\n            payable(msg.sender),\n            address(0),\n            bytes(\"\"),\n            msg.value\n        );\n\n        emit FeedToChain(_dstChainId, msg.sender, _toAddress, price);\n    }\n\n    function setEnableFor(\n        uint16 _dstChainId,\n        bool _flag,\n        bytes memory _toAddress\n    ) external payable onlyOwner {\n        uint256 id;\n        assembly {\n            id := chainid()\n        }\n\n        if (_dstChainId == id) {\n            enable = _flag;\n\n            emit SetEnableFor(\n                _dstChainId,\n                abi.encodePacked(address(this)),\n                enable\n            );\n            return;\n        }\n\n        bytes memory lzPayload = abi.encode(PT_SET_ENABLE, _toAddress, _flag);\n        _lzSend(\n            _dstChainId,\n            lzPayload,\n            payable(msg.sender),\n            address(0),\n            bytes(\"\"),\n            msg.value\n        );\n\n        emit SetEnableFor(_dstChainId, _toAddress, _flag);\n    }\n\n    function setCapFor(\n        uint16 _dstChainId,\n        uint256 _cap,\n        bytes memory _toAddress\n    ) external payable onlyOwner {\n        uint256 id;\n        assembly {\n            id := chainid()\n        }\n\n        if (_dstChainId == id) {\n            cap = _cap;\n\n            emit SetCapFor(_dstChainId, abi.encodePacked(address(this)), cap);\n            return;\n        }\n\n        bytes memory lzPayload = abi.encode(PT_SET_CAP, _toAddress, _cap);\n        _lzSend(\n            _dstChainId,\n            lzPayload,\n            payable(msg.sender),\n            address(0),\n            bytes(\"\"),\n            msg.value\n        );\n\n        emit SetCapFor(_dstChainId, _toAddress, _cap);\n    }\n\n    function tokenPrice() public returns (uint256 price) {\n        price = Minter(minter).getTokenPrice();\n    }\n\n    function getQuota() external view returns (uint256) {\n        uint256 amount = quota[block.timestamp / DAY_INTERVAL];\n        if (cap > amount && enable) {\n            return cap - amount;\n        }\n    }\n}\n","creation_status":"success","file_path":"project:/contracts/token/Stone.sol"}