Overview ERC-1155
Max Total Supply:
0 LL
Holders:
17,414
Transfers:
-
Contract:
Official Site:
[ Download CSV Export ]
OVERVIEW
Sci-fi collectable card game with NFTs.# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
ParallelAlpha
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; import "./ILayerZeroUserApplicationConfig.sol"; interface ILayerZeroEndpoint is ILayerZeroUserApplicationConfig { // @notice send a LayerZero message to the specified address at a LayerZero endpoint. // @param _dstChainId - the destination chain identifier // @param _destination - the address on destination chain (in bytes). address length/format may vary by chains // @param _payload - a custom bytes payload to send to the destination contract // @param _refundAddress - if the source transaction is cheaper than the amount of value passed, refund the additional amount to this address // @param _zroPaymentAddress - the address of the ZRO token holder who would pay for the transaction // @param _adapterParams - parameters for custom functionality. e.g. receive airdropped native gas from the relayer on destination function send(uint16 _dstChainId, bytes calldata _destination, bytes calldata _payload, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams) external payable; // @notice used by the messaging library to publish verified payload // @param _srcChainId - the source chain identifier // @param _srcAddress - the source contract (as bytes) at the source chain // @param _dstAddress - the address on destination chain // @param _nonce - the unbound message ordering nonce // @param _gasLimit - the gas limit for external contract execution // @param _payload - verified payload to send to the destination contract function receivePayload(uint16 _srcChainId, bytes calldata _srcAddress, address _dstAddress, uint64 _nonce, uint _gasLimit, bytes calldata _payload) external; // @notice get the inboundNonce of a lzApp from a source chain which could be EVM or non-EVM chain // @param _srcChainId - the source chain identifier // @param _srcAddress - the source chain contract address function getInboundNonce(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (uint64); // @notice get the outboundNonce from this source chain which, consequently, is always an EVM // @param _srcAddress - the source chain contract address function getOutboundNonce(uint16 _dstChainId, address _srcAddress) external view returns (uint64); // @notice gets a quote in source native gas, for the amount that send() requires to pay for message delivery // @param _dstChainId - the destination chain identifier // @param _userApplication - the user app address on this EVM chain // @param _payload - the custom message to send over LayerZero // @param _payInZRO - if false, user app pays the protocol fee in native token // @param _adapterParam - parameters for the adapter service, e.g. send some dust native token to dstChain function estimateFees(uint16 _dstChainId, address _userApplication, bytes calldata _payload, bool _payInZRO, bytes calldata _adapterParam) external view returns (uint nativeFee, uint zroFee); // @notice get this Endpoint's immutable source identifier function getChainId() external view returns (uint16); // @notice the interface to retry failed message on this Endpoint destination // @param _srcChainId - the source chain identifier // @param _srcAddress - the source chain contract address // @param _payload - the payload to be retried function retryPayload(uint16 _srcChainId, bytes calldata _srcAddress, bytes calldata _payload) external; // @notice query if any STORED payload (message blocking) at the endpoint. // @param _srcChainId - the source chain identifier // @param _srcAddress - the source chain contract address function hasStoredPayload(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (bool); // @notice query if the _libraryAddress is valid for sending msgs. // @param _userApplication - the user app address on this EVM chain function getSendLibraryAddress(address _userApplication) external view returns (address); // @notice query if the _libraryAddress is valid for receiving msgs. // @param _userApplication - the user app address on this EVM chain function getReceiveLibraryAddress(address _userApplication) external view returns (address); // @notice query if the non-reentrancy guard for send() is on // @return true if the guard is on. false otherwise function isSendingPayload() external view returns (bool); // @notice query if the non-reentrancy guard for receive() is on // @return true if the guard is on. false otherwise function isReceivingPayload() external view returns (bool); // @notice get the configuration of the LayerZero messaging library of the specified version // @param _version - messaging library version // @param _chainId - the chainId for the pending config change // @param _userApplication - the contract address of the user application // @param _configType - type of configuration. every messaging library has its own convention. function getConfig(uint16 _version, uint16 _chainId, address _userApplication, uint _configType) external view returns (bytes memory); // @notice get the send() LayerZero messaging library version // @param _userApplication - the contract address of the user application function getSendVersion(address _userApplication) external view returns (uint16); // @notice get the lzReceive() LayerZero messaging library version // @param _userApplication - the contract address of the user application function getReceiveVersion(address _userApplication) external view returns (uint16); }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; interface ILayerZeroReceiver { // @notice LayerZero endpoint will invoke this function to deliver the message on the destination // @param _srcChainId - the source endpoint identifier // @param _srcAddress - the source sending contract address from the source chain // @param _nonce - the ordered message nonce // @param _payload - the signed payload is the UA bytes has encoded to be sent function lzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; interface ILayerZeroUserApplicationConfig { // @notice set the configuration of the LayerZero messaging library of the specified version // @param _version - messaging library version // @param _chainId - the chainId for the pending config change // @param _configType - type of configuration. every messaging library has its own convention. // @param _config - configuration in the bytes. can encode arbitrary content. function setConfig(uint16 _version, uint16 _chainId, uint _configType, bytes calldata _config) external; // @notice set the send() LayerZero messaging library version to _version // @param _version - new messaging library version function setSendVersion(uint16 _version) external; // @notice set the lzReceive() LayerZero messaging library version to _version // @param _version - new messaging library version function setReceiveVersion(uint16 _version) external; // @notice Only when the UA needs to resume the message flow in blocking mode and clear the stored payload // @param _srcChainId - the chainId of the source chain // @param _srcAddress - the contract address of the source contract at the source chain function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "../interfaces/ILayerZeroReceiver.sol"; import "../interfaces/ILayerZeroUserApplicationConfig.sol"; import "../interfaces/ILayerZeroEndpoint.sol"; import "../util/BytesLib.sol"; /* * a generic LzReceiver implementation */ abstract contract LzApp is Ownable, ILayerZeroReceiver, ILayerZeroUserApplicationConfig { using BytesLib for bytes; // ua can not send payload larger than this by default, but it can be changed by the ua owner uint constant public DEFAULT_PAYLOAD_SIZE_LIMIT = 10000; ILayerZeroEndpoint public immutable lzEndpoint; mapping(uint16 => bytes) public trustedRemoteLookup; mapping(uint16 => mapping(uint16 => uint)) public minDstGasLookup; mapping(uint16 => uint) public payloadSizeLimitLookup; address public precrime; event SetPrecrime(address precrime); event SetTrustedRemote(uint16 _remoteChainId, bytes _path); event SetTrustedRemoteAddress(uint16 _remoteChainId, bytes _remoteAddress); event SetMinDstGas(uint16 _dstChainId, uint16 _type, uint _minDstGas); constructor(address _endpoint) { lzEndpoint = ILayerZeroEndpoint(_endpoint); } function lzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) public virtual override { // lzReceive must be called by the endpoint for security require(_msgSender() == address(lzEndpoint), "LzApp: invalid endpoint caller"); bytes memory trustedRemote = trustedRemoteLookup[_srcChainId]; // if will still block the message pathway from (srcChainId, srcAddress). should not receive message from untrusted remote. require(_srcAddress.length == trustedRemote.length && trustedRemote.length > 0 && keccak256(_srcAddress) == keccak256(trustedRemote), "LzApp: invalid source sending contract"); _blockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload); } // abstract function - the default behaviour of LayerZero is blocking. See: NonblockingLzApp if you dont need to enforce ordered messaging function _blockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual; function _lzSend(uint16 _dstChainId, bytes memory _payload, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams, uint _nativeFee) internal virtual { bytes memory trustedRemote = trustedRemoteLookup[_dstChainId]; require(trustedRemote.length != 0, "LzApp: destination chain is not a trusted source"); _checkPayloadSize(_dstChainId, _payload.length); lzEndpoint.send{value: _nativeFee}(_dstChainId, trustedRemote, _payload, _refundAddress, _zroPaymentAddress, _adapterParams); } function _checkGasLimit(uint16 _dstChainId, uint16 _type, bytes memory _adapterParams, uint _extraGas) internal view virtual { uint providedGasLimit = _getGasLimit(_adapterParams); uint minGasLimit = minDstGasLookup[_dstChainId][_type] + _extraGas; require(minGasLimit > 0, "LzApp: minGasLimit not set"); require(providedGasLimit >= minGasLimit, "LzApp: gas limit is too low"); } function _getGasLimit(bytes memory _adapterParams) internal pure virtual returns (uint gasLimit) { require(_adapterParams.length >= 34, "LzApp: invalid adapterParams"); assembly { gasLimit := mload(add(_adapterParams, 34)) } } function _checkPayloadSize(uint16 _dstChainId, uint _payloadSize) internal view virtual { uint payloadSizeLimit = payloadSizeLimitLookup[_dstChainId]; if (payloadSizeLimit == 0) { // use default if not set payloadSizeLimit = DEFAULT_PAYLOAD_SIZE_LIMIT; } require(_payloadSize <= payloadSizeLimit, "LzApp: payload size is too large"); } //---------------------------UserApplication config---------------------------------------- function getConfig(uint16 _version, uint16 _chainId, address, uint _configType) external view returns (bytes memory) { return lzEndpoint.getConfig(_version, _chainId, address(this), _configType); } // generic config for LayerZero user Application function setConfig(uint16 _version, uint16 _chainId, uint _configType, bytes calldata _config) external override onlyOwner { lzEndpoint.setConfig(_version, _chainId, _configType, _config); } function setSendVersion(uint16 _version) external override onlyOwner { lzEndpoint.setSendVersion(_version); } function setReceiveVersion(uint16 _version) external override onlyOwner { lzEndpoint.setReceiveVersion(_version); } function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) external override onlyOwner { lzEndpoint.forceResumeReceive(_srcChainId, _srcAddress); } // _path = abi.encodePacked(remoteAddress, localAddress) // this function set the trusted path for the cross-chain communication function setTrustedRemote(uint16 _srcChainId, bytes calldata _path) external onlyOwner { trustedRemoteLookup[_srcChainId] = _path; emit SetTrustedRemote(_srcChainId, _path); } function setTrustedRemoteAddress(uint16 _remoteChainId, bytes calldata _remoteAddress) external onlyOwner { trustedRemoteLookup[_remoteChainId] = abi.encodePacked(_remoteAddress, address(this)); emit SetTrustedRemoteAddress(_remoteChainId, _remoteAddress); } function getTrustedRemoteAddress(uint16 _remoteChainId) external view returns (bytes memory) { bytes memory path = trustedRemoteLookup[_remoteChainId]; require(path.length != 0, "LzApp: no trusted path record"); return path.slice(0, path.length - 20); // the last 20 bytes should be address(this) } function setPrecrime(address _precrime) external onlyOwner { precrime = _precrime; emit SetPrecrime(_precrime); } function setMinDstGas(uint16 _dstChainId, uint16 _packetType, uint _minGas) external onlyOwner { require(_minGas > 0, "LzApp: invalid minGas"); minDstGasLookup[_dstChainId][_packetType] = _minGas; emit SetMinDstGas(_dstChainId, _packetType, _minGas); } // if the size is 0, it means default size limit function setPayloadSizeLimit(uint16 _dstChainId, uint _size) external onlyOwner { payloadSizeLimitLookup[_dstChainId] = _size; } //--------------------------- VIEW FUNCTION ---------------------------------------- function isTrustedRemote(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (bool) { bytes memory trustedSource = trustedRemoteLookup[_srcChainId]; return keccak256(trustedSource) == keccak256(_srcAddress); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./LzApp.sol"; import "../util/ExcessivelySafeCall.sol"; /* * the default LayerZero messaging behaviour is blocking, i.e. any failed message will block the channel * this abstract class try-catch all fail messages and store locally for future retry. hence, non-blocking * NOTE: if the srcAddress is not configured properly, it will still block the message pathway from (srcChainId, srcAddress) */ abstract contract NonblockingLzApp is LzApp { using ExcessivelySafeCall for address; constructor(address _endpoint) LzApp(_endpoint) {} mapping(uint16 => mapping(bytes => mapping(uint64 => bytes32))) public failedMessages; event MessageFailed(uint16 _srcChainId, bytes _srcAddress, uint64 _nonce, bytes _payload, bytes _reason); event RetryMessageSuccess(uint16 _srcChainId, bytes _srcAddress, uint64 _nonce, bytes32 _payloadHash); // overriding the virtual function in LzReceiver function _blockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual override { (bool success, bytes memory reason) = address(this).excessivelySafeCall(gasleft(), 150, abi.encodeWithSelector(this.nonblockingLzReceive.selector, _srcChainId, _srcAddress, _nonce, _payload)); // try-catch all errors/exceptions if (!success) { _storeFailedMessage(_srcChainId, _srcAddress, _nonce, _payload, reason); } } function _storeFailedMessage(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload, bytes memory _reason) internal virtual { failedMessages[_srcChainId][_srcAddress][_nonce] = keccak256(_payload); emit MessageFailed(_srcChainId, _srcAddress, _nonce, _payload, _reason); } function nonblockingLzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) public virtual { // only internal transaction require(_msgSender() == address(this), "NonblockingLzApp: caller must be LzApp"); _nonblockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload); } //@notice override this function function _nonblockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual; function retryMessage(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) public payable virtual { // assert there is message to retry bytes32 payloadHash = failedMessages[_srcChainId][_srcAddress][_nonce]; require(payloadHash != bytes32(0), "NonblockingLzApp: no stored message"); require(keccak256(_payload) == payloadHash, "NonblockingLzApp: invalid payload"); // clear the stored message failedMessages[_srcChainId][_srcAddress][_nonce] = bytes32(0); // execute the message. revert if it fails again _nonblockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload); emit RetryMessageSuccess(_srcChainId, _srcAddress, _nonce, payloadHash); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; import "./IONFT1155Core.sol"; import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; /** * @dev Interface of the ONFT standard */ interface IONFT1155 is IONFT1155Core, IERC1155 { }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; /** * @dev Interface of the ONFT Core standard */ interface IONFT1155Core is IERC165 { event SendToChain(uint16 indexed _dstChainId, address indexed _from, bytes indexed _toAddress, uint _tokenId, uint _amount); event SendBatchToChain(uint16 indexed _dstChainId, address indexed _from, bytes indexed _toAddress, uint[] _tokenIds, uint[] _amounts); event ReceiveFromChain(uint16 indexed _srcChainId, bytes indexed _srcAddress, address indexed _toAddress, uint _tokenId, uint _amount); event ReceiveBatchFromChain(uint16 indexed _srcChainId, bytes indexed _srcAddress, address indexed _toAddress, uint[] _tokenIds, uint[] _amounts); // _from - address where tokens should be deducted from on behalf of // _dstChainId - L0 defined chain id to send tokens too // _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain // _tokenId - token Id to transfer // _amount - amount of the tokens to transfer // _refundAddress - address on src that will receive refund for any overpayment of L0 fees // _zroPaymentAddress - if paying in zro, pass the address to use. using 0x0 indicates not paying fees in zro // _adapterParams - flexible bytes array to indicate messaging adapter services in L0 function sendFrom(address _from, uint16 _dstChainId, bytes calldata _toAddress, uint _tokenId, uint _amount, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams) external payable; // _from - address where tokens should be deducted from on behalf of // _dstChainId - L0 defined chain id to send tokens too // _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain // _tokenIds - token Ids to transfer // _amounts - amounts of the tokens to transfer // _refundAddress - address on src that will receive refund for any overpayment of L0 fees // _zroPaymentAddress - if paying in zro, pass the address to use. using 0x0 indicates not paying fees in zro // _adapterParams - flexible bytes array to indicate messaging adapter services in L0 function sendBatchFrom(address _from, uint16 _dstChainId, bytes calldata _toAddress, uint[] calldata _tokenIds, uint[] calldata _amounts, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams) external payable; // _dstChainId - L0 defined chain id to send tokens too // _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain // _tokenId - token Id to transfer // _amount - amount of the tokens to transfer // _useZro - indicates to use zro to pay L0 fees // _adapterParams - flexible bytes array to indicate messaging adapter services in L0 function estimateSendFee(uint16 _dstChainId, bytes calldata _toAddress, uint _tokenId, uint _amount, bool _useZro, bytes calldata _adapterParams) external view returns (uint nativeFee, uint zroFee); // _dstChainId - L0 defined chain id to send tokens too // _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain // _tokenIds - tokens Id to transfer // _amounts - amounts of the tokens to transfer // _useZro - indicates to use zro to pay L0 fees // _adapterParams - flexible bytes array to indicate messaging adapter services in L0 function estimateSendBatchFee(uint16 _dstChainId, bytes calldata _toAddress, uint[] calldata _tokenIds, uint[] calldata _amounts, bool _useZro, bytes calldata _adapterParams) external view returns (uint nativeFee, uint zroFee); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IONFT1155.sol"; import "./ONFT1155Core.sol"; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; // NOTE: this ONFT contract has no public minting logic. // must implement your own minting logic in child classes contract ONFT1155 is ONFT1155Core, ERC1155, IONFT1155 { constructor(string memory _uri, address _lzEndpoint) ERC1155(_uri) ONFT1155Core(_lzEndpoint) {} function supportsInterface(bytes4 interfaceId) public view virtual override(ONFT1155Core, ERC1155, IERC165) returns (bool) { return interfaceId == type(IONFT1155).interfaceId || super.supportsInterface(interfaceId); } function _debitFrom(address _from, uint16, bytes memory, uint[] memory _tokenIds, uint[] memory _amounts) internal virtual override { address spender = _msgSender(); require(spender == _from || isApprovedForAll(_from, spender), "ONFT1155: send caller is not owner nor approved"); _burnBatch(_from, _tokenIds, _amounts); } function _creditTo(uint16, address _toAddress, uint[] memory _tokenIds, uint[] memory _amounts) internal virtual override { _mintBatch(_toAddress, _tokenIds, _amounts, ""); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IONFT1155Core.sol"; import "../../lzApp/NonblockingLzApp.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; abstract contract ONFT1155Core is NonblockingLzApp, ERC165, IONFT1155Core { uint public constant NO_EXTRA_GAS = 0; uint16 public constant FUNCTION_TYPE_SEND = 1; uint16 public constant FUNCTION_TYPE_SEND_BATCH = 2; bool public useCustomAdapterParams; event SetUseCustomAdapterParams(bool _useCustomAdapterParams); constructor(address _lzEndpoint) NonblockingLzApp(_lzEndpoint) {} function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IONFT1155Core).interfaceId || super.supportsInterface(interfaceId); } function estimateSendFee(uint16 _dstChainId, bytes memory _toAddress, uint _tokenId, uint _amount, bool _useZro, bytes memory _adapterParams) public view virtual override returns (uint nativeFee, uint zroFee) { return estimateSendBatchFee(_dstChainId, _toAddress, _toSingletonArray(_tokenId), _toSingletonArray(_amount), _useZro, _adapterParams); } function estimateSendBatchFee(uint16 _dstChainId, bytes memory _toAddress, uint[] memory _tokenIds, uint[] memory _amounts, bool _useZro, bytes memory _adapterParams) public view virtual override returns (uint nativeFee, uint zroFee) { bytes memory payload = abi.encode(_toAddress, _tokenIds, _amounts); return lzEndpoint.estimateFees(_dstChainId, address(this), payload, _useZro, _adapterParams); } function sendFrom(address _from, uint16 _dstChainId, bytes memory _toAddress, uint _tokenId, uint _amount, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams) public payable virtual override { _sendBatch(_from, _dstChainId, _toAddress, _toSingletonArray(_tokenId), _toSingletonArray(_amount), _refundAddress, _zroPaymentAddress, _adapterParams); } function sendBatchFrom(address _from, uint16 _dstChainId, bytes memory _toAddress, uint[] memory _tokenIds, uint[] memory _amounts, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams) public payable virtual override { _sendBatch(_from, _dstChainId, _toAddress, _tokenIds, _amounts, _refundAddress, _zroPaymentAddress, _adapterParams); } function _sendBatch(address _from, uint16 _dstChainId, bytes memory _toAddress, uint[] memory _tokenIds, uint[] memory _amounts, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams) internal virtual { _debitFrom(_from, _dstChainId, _toAddress, _tokenIds, _amounts); bytes memory payload = abi.encode(_toAddress, _tokenIds, _amounts); if (_tokenIds.length == 1) { if (useCustomAdapterParams) { _checkGasLimit(_dstChainId, FUNCTION_TYPE_SEND, _adapterParams, NO_EXTRA_GAS); } else { require(_adapterParams.length == 0, "LzApp: _adapterParams must be empty."); } _lzSend(_dstChainId, payload, _refundAddress, _zroPaymentAddress, _adapterParams, msg.value); emit SendToChain(_dstChainId, _from, _toAddress, _tokenIds[0], _amounts[0]); } else if (_tokenIds.length > 1) { if (useCustomAdapterParams) { _checkGasLimit(_dstChainId, FUNCTION_TYPE_SEND_BATCH, _adapterParams, NO_EXTRA_GAS); } else { require(_adapterParams.length == 0, "LzApp: _adapterParams must be empty."); } _lzSend(_dstChainId, payload, _refundAddress, _zroPaymentAddress, _adapterParams, msg.value); emit SendBatchToChain(_dstChainId, _from, _toAddress, _tokenIds, _amounts); } } function _nonblockingLzReceive( uint16 _srcChainId, bytes memory _srcAddress, uint64, /*_nonce*/ bytes memory _payload ) internal virtual override { // decode and load the toAddress (bytes memory toAddressBytes, uint[] memory tokenIds, uint[] memory amounts) = abi.decode(_payload, (bytes, uint[], uint[])); address toAddress; assembly { toAddress := mload(add(toAddressBytes, 20)) } _creditTo(_srcChainId, toAddress, tokenIds, amounts); if (tokenIds.length == 1) { emit ReceiveFromChain(_srcChainId, _srcAddress, toAddress, tokenIds[0], amounts[0]); } else if (tokenIds.length > 1) { emit ReceiveBatchFromChain(_srcChainId, _srcAddress, toAddress, tokenIds, amounts); } } function setUseCustomAdapterParams(bool _useCustomAdapterParams) external onlyOwner { useCustomAdapterParams = _useCustomAdapterParams; emit SetUseCustomAdapterParams(_useCustomAdapterParams); } function _debitFrom(address _from, uint16 _dstChainId, bytes memory _toAddress, uint[] memory _tokenIds, uint[] memory _amounts) internal virtual; function _creditTo(uint16 _srcChainId, address _toAddress, uint[] memory _tokenIds, uint[] memory _amounts) internal virtual; function _toSingletonArray(uint element) internal pure returns (uint[] memory) { uint[] memory array = new uint[](1); array[0] = element; return array; } }
// SPDX-License-Identifier: Unlicense /* * @title Solidity Bytes Arrays Utils * @author Gonçalo Sá <[email protected]> * * @dev Bytes tightly packed arrays utility library for ethereum contracts written in Solidity. * The library lets you concatenate, slice and type cast bytes arrays both in memory and storage. */ pragma solidity >=0.8.0 <0.9.0; library BytesLib { function concat( bytes memory _preBytes, bytes memory _postBytes ) internal pure returns (bytes memory) { bytes memory tempBytes; assembly { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(0x40) // Store the length of the first bytes array at the beginning of // the memory for tempBytes. let length := mload(_preBytes) mstore(tempBytes, length) // Maintain a memory counter for the current write location in the // temp bytes array by adding the 32 bytes for the array length to // the starting location. let mc := add(tempBytes, 0x20) // Stop copying when the memory counter reaches the length of the // first bytes array. let end := add(mc, length) for { // Initialize a copy counter to the start of the _preBytes data, // 32 bytes into its memory. let cc := add(_preBytes, 0x20) } lt(mc, end) { // Increase both counters by 32 bytes each iteration. mc := add(mc, 0x20) cc := add(cc, 0x20) } { // Write the _preBytes data into the tempBytes memory 32 bytes // at a time. mstore(mc, mload(cc)) } // Add the length of _postBytes to the current length of tempBytes // and store it as the new length in the first 32 bytes of the // tempBytes memory. length := mload(_postBytes) mstore(tempBytes, add(length, mload(tempBytes))) // Move the memory counter back from a multiple of 0x20 to the // actual end of the _preBytes data. mc := end // Stop copying when the memory counter reaches the new combined // length of the arrays. end := add(mc, length) for { let cc := add(_postBytes, 0x20) } lt(mc, end) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { mstore(mc, mload(cc)) } // Update the free-memory pointer by padding our last write location // to 32 bytes: add 31 bytes to the end of tempBytes to move to the // next 32 byte block, then round down to the nearest multiple of // 32. If the sum of the length of the two arrays is zero then add // one before rounding down to leave a blank 32 bytes (the length block with 0). mstore(0x40, and( add(add(end, iszero(add(length, mload(_preBytes)))), 31), not(31) // Round down to the nearest 32 bytes. )) } return tempBytes; } function concatStorage(bytes storage _preBytes, bytes memory _postBytes) internal { assembly { // Read the first 32 bytes of _preBytes storage, which is the length // of the array. (We don't need to use the offset into the slot // because arrays use the entire slot.) let fslot := sload(_preBytes.slot) // Arrays of 31 bytes or less have an even value in their slot, // while longer arrays have an odd value. The actual length is // the slot divided by two for odd values, and the lowest order // byte divided by two for even values. // If the slot is even, bitwise and the slot with 255 and divide by // two to get the length. If the slot is odd, bitwise and the slot // with -1 and divide by two. let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2) let mlength := mload(_postBytes) let newlength := add(slength, mlength) // slength can contain both the length and contents of the array // if length < 32 bytes so let's prepare for that // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage switch add(lt(slength, 32), lt(newlength, 32)) case 2 { // Since the new array still fits in the slot, we just need to // update the contents of the slot. // uint256(bytes_storage) = uint256(bytes_storage) + uint256(bytes_memory) + new_length sstore( _preBytes.slot, // all the modifications to the slot are inside this // next block add( // we can just add to the slot contents because the // bytes we want to change are the LSBs fslot, add( mul( div( // load the bytes from memory mload(add(_postBytes, 0x20)), // zero all bytes to the right exp(0x100, sub(32, mlength)) ), // and now shift left the number of bytes to // leave space for the length in the slot exp(0x100, sub(32, newlength)) ), // increase length by the double of the memory // bytes length mul(mlength, 2) ) ) ) } case 1 { // The stored value fits in the slot, but the combined value // will exceed it. // get the keccak hash to get the contents of the array mstore(0x0, _preBytes.slot) let sc := add(keccak256(0x0, 0x20), div(slength, 32)) // save new length sstore(_preBytes.slot, add(mul(newlength, 2), 1)) // The contents of the _postBytes array start 32 bytes into // the structure. Our first read should obtain the `submod` // bytes that can fit into the unused space in the last word // of the stored array. To get this, we read 32 bytes starting // from `submod`, so the data we read overlaps with the array // contents by `submod` bytes. Masking the lowest-order // `submod` bytes allows us to add that value directly to the // stored value. let submod := sub(32, slength) let mc := add(_postBytes, submod) let end := add(_postBytes, mlength) let mask := sub(exp(0x100, submod), 1) sstore( sc, add( and( fslot, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00 ), and(mload(mc), mask) ) ) for { mc := add(mc, 0x20) sc := add(sc, 1) } lt(mc, end) { sc := add(sc, 1) mc := add(mc, 0x20) } { sstore(sc, mload(mc)) } mask := exp(0x100, sub(mc, end)) sstore(sc, mul(div(mload(mc), mask), mask)) } default { // get the keccak hash to get the contents of the array mstore(0x0, _preBytes.slot) // Start copying to the last used word of the stored array. let sc := add(keccak256(0x0, 0x20), div(slength, 32)) // save new length sstore(_preBytes.slot, add(mul(newlength, 2), 1)) // Copy over the first `submod` bytes of the new data as in // case 1 above. let slengthmod := mod(slength, 32) let mlengthmod := mod(mlength, 32) let submod := sub(32, slengthmod) let mc := add(_postBytes, submod) let end := add(_postBytes, mlength) let mask := sub(exp(0x100, submod), 1) sstore(sc, add(sload(sc), and(mload(mc), mask))) for { sc := add(sc, 1) mc := add(mc, 0x20) } lt(mc, end) { sc := add(sc, 1) mc := add(mc, 0x20) } { sstore(sc, mload(mc)) } mask := exp(0x100, sub(mc, end)) sstore(sc, mul(div(mload(mc), mask), mask)) } } } function slice( bytes memory _bytes, uint256 _start, uint256 _length ) internal pure returns (bytes memory) { require(_length + 31 >= _length, "slice_overflow"); require(_bytes.length >= _start + _length, "slice_outOfBounds"); bytes memory tempBytes; assembly { switch iszero(_length) case 0 { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(0x40) // The first word of the slice result is potentially a partial // word read from the original array. To read it, we calculate // the length of that partial word and start copying that many // bytes into the array. The first word we copy will start with // data we don't care about, but the last `lengthmod` bytes will // land at the beginning of the contents of the new array. When // we're done copying, we overwrite the full first word with // the actual length of the slice. let lengthmod := and(_length, 31) // The multiplication in the next line is necessary // because when slicing multiples of 32 bytes (lengthmod == 0) // the following copy loop was copying the origin's length // and then ending prematurely not copying everything it should. let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod))) let end := add(mc, _length) for { // The multiplication in the next line has the same exact purpose // as the one above. let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start) } lt(mc, end) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { mstore(mc, mload(cc)) } mstore(tempBytes, _length) //update free-memory pointer //allocating the array padded to 32 bytes like the compiler does now mstore(0x40, and(add(mc, 31), not(31))) } //if we want a zero-length slice let's just return a zero-length array default { tempBytes := mload(0x40) //zero out the 32 bytes slice we are about to return //we need to do it because Solidity does not garbage collect mstore(tempBytes, 0) mstore(0x40, add(tempBytes, 0x20)) } } return tempBytes; } function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) { require(_bytes.length >= _start + 20, "toAddress_outOfBounds"); address tempAddress; assembly { tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000) } return tempAddress; } function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) { require(_bytes.length >= _start + 1 , "toUint8_outOfBounds"); uint8 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x1), _start)) } return tempUint; } function toUint16(bytes memory _bytes, uint256 _start) internal pure returns (uint16) { require(_bytes.length >= _start + 2, "toUint16_outOfBounds"); uint16 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x2), _start)) } return tempUint; } function toUint32(bytes memory _bytes, uint256 _start) internal pure returns (uint32) { require(_bytes.length >= _start + 4, "toUint32_outOfBounds"); uint32 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x4), _start)) } return tempUint; } function toUint64(bytes memory _bytes, uint256 _start) internal pure returns (uint64) { require(_bytes.length >= _start + 8, "toUint64_outOfBounds"); uint64 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x8), _start)) } return tempUint; } function toUint96(bytes memory _bytes, uint256 _start) internal pure returns (uint96) { require(_bytes.length >= _start + 12, "toUint96_outOfBounds"); uint96 tempUint; assembly { tempUint := mload(add(add(_bytes, 0xc), _start)) } return tempUint; } function toUint128(bytes memory _bytes, uint256 _start) internal pure returns (uint128) { require(_bytes.length >= _start + 16, "toUint128_outOfBounds"); uint128 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x10), _start)) } return tempUint; } function toUint256(bytes memory _bytes, uint256 _start) internal pure returns (uint256) { require(_bytes.length >= _start + 32, "toUint256_outOfBounds"); uint256 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x20), _start)) } return tempUint; } function toBytes32(bytes memory _bytes, uint256 _start) internal pure returns (bytes32) { require(_bytes.length >= _start + 32, "toBytes32_outOfBounds"); bytes32 tempBytes32; assembly { tempBytes32 := mload(add(add(_bytes, 0x20), _start)) } return tempBytes32; } function equal(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bool) { bool success = true; assembly { let length := mload(_preBytes) // if lengths don't match the arrays are not equal switch eq(length, mload(_postBytes)) case 1 { // cb is a circuit breaker in the for loop since there's // no said feature for inline assembly loops // cb = 1 - don't breaker // cb = 0 - break let cb := 1 let mc := add(_preBytes, 0x20) let end := add(mc, length) for { let cc := add(_postBytes, 0x20) // the next line is the loop condition: // while(uint256(mc < end) + cb == 2) } eq(add(lt(mc, end), cb), 2) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { // if any of these checks fails then arrays are not equal if iszero(eq(mload(mc), mload(cc))) { // unsuccess: success := 0 cb := 0 } } } default { // unsuccess: success := 0 } } return success; } function equalStorage( bytes storage _preBytes, bytes memory _postBytes ) internal view returns (bool) { bool success = true; assembly { // we know _preBytes_offset is 0 let fslot := sload(_preBytes.slot) // Decode the length of the stored array like in concatStorage(). let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2) let mlength := mload(_postBytes) // if lengths don't match the arrays are not equal switch eq(slength, mlength) case 1 { // slength can contain both the length and contents of the array // if length < 32 bytes so let's prepare for that // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage if iszero(iszero(slength)) { switch lt(slength, 32) case 1 { // blank the last byte which is the length fslot := mul(div(fslot, 0x100), 0x100) if iszero(eq(fslot, mload(add(_postBytes, 0x20)))) { // unsuccess: success := 0 } } default { // cb is a circuit breaker in the for loop since there's // no said feature for inline assembly loops // cb = 1 - don't breaker // cb = 0 - break let cb := 1 // get the keccak hash to get the contents of the array mstore(0x0, _preBytes.slot) let sc := keccak256(0x0, 0x20) let mc := add(_postBytes, 0x20) let end := add(mc, mlength) // the next line is the loop condition: // while(uint256(mc < end) + cb == 2) for {} eq(add(lt(mc, end), cb), 2) { sc := add(sc, 1) mc := add(mc, 0x20) } { if iszero(eq(sload(sc), mload(mc))) { // unsuccess: success := 0 cb := 0 } } } } } default { // unsuccess: success := 0 } } return success; } }
// SPDX-License-Identifier: MIT OR Apache-2.0 pragma solidity >=0.7.6; library ExcessivelySafeCall { uint256 constant LOW_28_MASK = 0x00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff; /// @notice Use when you _really_ really _really_ don't trust the called /// contract. This prevents the called contract from causing reversion of /// the caller in as many ways as we can. /// @dev The main difference between this and a solidity low-level call is /// that we limit the number of bytes that the callee can cause to be /// copied to caller memory. This prevents stupid things like malicious /// contracts returning 10,000,000 bytes causing a local OOG when copying /// to memory. /// @param _target The address to call /// @param _gas The amount of gas to forward to the remote contract /// @param _maxCopy The maximum number of bytes of returndata to copy /// to memory. /// @param _calldata The data to send to the remote contract /// @return success and returndata, as `.call()`. Returndata is capped to /// `_maxCopy` bytes. function excessivelySafeCall( address _target, uint256 _gas, uint16 _maxCopy, bytes memory _calldata ) internal returns (bool, bytes memory) { // set up for assembly call uint256 _toCopy; bool _success; bytes memory _returnData = new bytes(_maxCopy); // dispatch message to recipient // by assembly calling "handle" function // we call via assembly to avoid memcopying a very large returndata // returned by a malicious contract assembly { _success := call( _gas, // gas _target, // recipient 0, // ether value add(_calldata, 0x20), // inloc mload(_calldata), // inlen 0, // outloc 0 // outlen ) // limit our copy to 256 bytes _toCopy := returndatasize() if gt(_toCopy, _maxCopy) { _toCopy := _maxCopy } // Store the length of the copied bytes mstore(_returnData, _toCopy) // copy the bytes from returndata[0:_toCopy] returndatacopy(add(_returnData, 0x20), 0, _toCopy) } return (_success, _returnData); } /// @notice Use when you _really_ really _really_ don't trust the called /// contract. This prevents the called contract from causing reversion of /// the caller in as many ways as we can. /// @dev The main difference between this and a solidity low-level call is /// that we limit the number of bytes that the callee can cause to be /// copied to caller memory. This prevents stupid things like malicious /// contracts returning 10,000,000 bytes causing a local OOG when copying /// to memory. /// @param _target The address to call /// @param _gas The amount of gas to forward to the remote contract /// @param _maxCopy The maximum number of bytes of returndata to copy /// to memory. /// @param _calldata The data to send to the remote contract /// @return success and returndata, as `.call()`. Returndata is capped to /// `_maxCopy` bytes. function excessivelySafeStaticCall( address _target, uint256 _gas, uint16 _maxCopy, bytes memory _calldata ) internal view returns (bool, bytes memory) { // set up for assembly call uint256 _toCopy; bool _success; bytes memory _returnData = new bytes(_maxCopy); // dispatch message to recipient // by assembly calling "handle" function // we call via assembly to avoid memcopying a very large returndata // returned by a malicious contract assembly { _success := staticcall( _gas, // gas _target, // recipient add(_calldata, 0x20), // inloc mload(_calldata), // inlen 0, // outloc 0 // outlen ) // limit our copy to 256 bytes _toCopy := returndatasize() if gt(_toCopy, _maxCopy) { _toCopy := _maxCopy } // Store the length of the copied bytes mstore(_returnData, _toCopy) // copy the bytes from returndata[0:_toCopy] returndatacopy(add(_returnData, 0x20), 0, _toCopy) } return (_success, _returnData); } /** * @notice Swaps function selectors in encoded contract calls * @dev Allows reuse of encoded calldata for functions with identical * argument types but different names. It simply swaps out the first 4 bytes * for the new selector. This function modifies memory in place, and should * only be used with caution. * @param _newSelector The new 4-byte selector * @param _buf The encoded contract args */ function swapSelector(bytes4 _newSelector, bytes memory _buf) internal pure { require(_buf.length >= 4); uint256 _mask = LOW_28_MASK; assembly { // load the first word of let _word := mload(add(_buf, 0x20)) // mask out the top 4 bytes // /x _word := and(_word, _mask) _word := or(_newSelector, _word) mstore(add(_buf, 0x20), _word) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC1155/ERC1155.sol) pragma solidity ^0.8.0; import "./IERC1155.sol"; import "./IERC1155Receiver.sol"; import "./extensions/IERC1155MetadataURI.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of the basic standard multi-token. * See https://eips.ethereum.org/EIPS/eip-1155 * Originally based on code by Enjin: https://github.com/enjin/erc-1155 * * _Available since v3.1._ */ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI { using Address for address; // Mapping from token ID to account balances mapping(uint256 => mapping(address => uint256)) private _balances; // Mapping from account to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json string private _uri; /** * @dev See {_setURI}. */ constructor(string memory uri_) { _setURI(uri_); } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC1155).interfaceId || interfaceId == type(IERC1155MetadataURI).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC1155MetadataURI-uri}. * * This implementation returns the same URI for *all* token types. It relies * on the token type ID substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * Clients calling this function must replace the `\{id\}` substring with the * actual token type ID. */ function uri(uint256) public view virtual override returns (string memory) { return _uri; } /** * @dev See {IERC1155-balanceOf}. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) public view virtual override returns (uint256) { require(account != address(0), "ERC1155: address zero is not a valid owner"); return _balances[id][account]; } /** * @dev See {IERC1155-balanceOfBatch}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] memory accounts, uint256[] memory ids) public view virtual override returns (uint256[] memory) { require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch"); uint256[] memory batchBalances = new uint256[](accounts.length); for (uint256 i = 0; i < accounts.length; ++i) { batchBalances[i] = balanceOf(accounts[i], ids[i]); } return batchBalances; } /** * @dev See {IERC1155-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC1155-isApprovedForAll}. */ function isApprovedForAll(address account, address operator) public view virtual override returns (bool) { return _operatorApprovals[account][operator]; } /** * @dev See {IERC1155-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) public virtual override { require( from == _msgSender() || isApprovedForAll(from, _msgSender()), "ERC1155: caller is not token owner or approved" ); _safeTransferFrom(from, to, id, amount, data); } /** * @dev See {IERC1155-safeBatchTransferFrom}. */ function safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) public virtual override { require( from == _msgSender() || isApprovedForAll(from, _msgSender()), "ERC1155: caller is not token owner or approved" ); _safeBatchTransferFrom(from, to, ids, amounts, data); } /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: transfer to the zero address"); address operator = _msgSender(); uint256[] memory ids = _asSingletonArray(id); uint256[] memory amounts = _asSingletonArray(amount); _beforeTokenTransfer(operator, from, to, ids, amounts, data); uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: insufficient balance for transfer"); unchecked { _balances[id][from] = fromBalance - amount; } _balances[id][to] += amount; emit TransferSingle(operator, from, to, id, amount); _afterTokenTransfer(operator, from, to, ids, amounts, data); _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function _safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); require(to != address(0), "ERC1155: transfer to the zero address"); address operator = _msgSender(); _beforeTokenTransfer(operator, from, to, ids, amounts, data); for (uint256 i = 0; i < ids.length; ++i) { uint256 id = ids[i]; uint256 amount = amounts[i]; uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: insufficient balance for transfer"); unchecked { _balances[id][from] = fromBalance - amount; } _balances[id][to] += amount; } emit TransferBatch(operator, from, to, ids, amounts); _afterTokenTransfer(operator, from, to, ids, amounts, data); _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data); } /** * @dev Sets a new URI for all token types, by relying on the token type ID * substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * By this mechanism, any occurrence of the `\{id\}` substring in either the * URI or any of the amounts in the JSON file at said URI will be replaced by * clients with the token type ID. * * For example, the `https://token-cdn-domain/\{id\}.json` URI would be * interpreted by clients as * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json` * for token type ID 0x4cce0. * * See {uri}. * * Because these URIs cannot be meaningfully represented by the {URI} event, * this function emits no events. */ function _setURI(string memory newuri) internal virtual { _uri = newuri; } /** * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _mint( address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); address operator = _msgSender(); uint256[] memory ids = _asSingletonArray(id); uint256[] memory amounts = _asSingletonArray(amount); _beforeTokenTransfer(operator, address(0), to, ids, amounts, data); _balances[id][to] += amount; emit TransferSingle(operator, address(0), to, id, amount); _afterTokenTransfer(operator, address(0), to, ids, amounts, data); _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function _mintBatch( address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); address operator = _msgSender(); _beforeTokenTransfer(operator, address(0), to, ids, amounts, data); for (uint256 i = 0; i < ids.length; i++) { _balances[ids[i]][to] += amounts[i]; } emit TransferBatch(operator, address(0), to, ids, amounts); _afterTokenTransfer(operator, address(0), to, ids, amounts, data); _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data); } /** * @dev Destroys `amount` tokens of token type `id` from `from` * * Emits a {TransferSingle} event. * * Requirements: * * - `from` cannot be the zero address. * - `from` must have at least `amount` tokens of token type `id`. */ function _burn( address from, uint256 id, uint256 amount ) internal virtual { require(from != address(0), "ERC1155: burn from the zero address"); address operator = _msgSender(); uint256[] memory ids = _asSingletonArray(id); uint256[] memory amounts = _asSingletonArray(amount); _beforeTokenTransfer(operator, from, address(0), ids, amounts, ""); uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: burn amount exceeds balance"); unchecked { _balances[id][from] = fromBalance - amount; } emit TransferSingle(operator, from, address(0), id, amount); _afterTokenTransfer(operator, from, address(0), ids, amounts, ""); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. */ function _burnBatch( address from, uint256[] memory ids, uint256[] memory amounts ) internal virtual { require(from != address(0), "ERC1155: burn from the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); address operator = _msgSender(); _beforeTokenTransfer(operator, from, address(0), ids, amounts, ""); for (uint256 i = 0; i < ids.length; i++) { uint256 id = ids[i]; uint256 amount = amounts[i]; uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: burn amount exceeds balance"); unchecked { _balances[id][from] = fromBalance - amount; } } emit TransferBatch(operator, from, address(0), ids, amounts); _afterTokenTransfer(operator, from, address(0), ids, amounts, ""); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits an {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC1155: setting approval status for self"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Hook that is called before any token transfer. This includes minting * and burning, as well as batched variants. * * The same hook is called on both single and batched variants. For single * transfers, the length of the `ids` and `amounts` arrays will be 1. * * Calling conditions (for each `id` and `amount` pair): * * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens * of token type `id` will be transferred to `to`. * - When `from` is zero, `amount` tokens of token type `id` will be minted * for `to`. * - when `to` is zero, `amount` of ``from``'s tokens of token type `id` * will be burned. * - `from` and `to` are never both zero. * - `ids` and `amounts` have the same, non-zero length. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual {} /** * @dev Hook that is called after any token transfer. This includes minting * and burning, as well as batched variants. * * The same hook is called on both single and batched variants. For single * transfers, the length of the `id` and `amount` arrays will be 1. * * Calling conditions (for each `id` and `amount` pair): * * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens * of token type `id` will be transferred to `to`. * - When `from` is zero, `amount` tokens of token type `id` will be minted * for `to`. * - when `to` is zero, `amount` of ``from``'s tokens of token type `id` * will be burned. * - `from` and `to` are never both zero. * - `ids` and `amounts` have the same, non-zero length. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual {} function _doSafeTransferAcceptanceCheck( address operator, address from, address to, uint256 id, uint256 amount, bytes memory data ) private { if (to.isContract()) { try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) { if (response != IERC1155Receiver.onERC1155Received.selector) { revert("ERC1155: ERC1155Receiver rejected tokens"); } } catch Error(string memory reason) { revert(reason); } catch { revert("ERC1155: transfer to non-ERC1155Receiver implementer"); } } } function _doSafeBatchTransferAcceptanceCheck( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) private { if (to.isContract()) { try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns ( bytes4 response ) { if (response != IERC1155Receiver.onERC1155BatchReceived.selector) { revert("ERC1155: ERC1155Receiver rejected tokens"); } } catch Error(string memory reason) { revert(reason); } catch { revert("ERC1155: transfer to non-ERC1155Receiver implementer"); } } } function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) { uint256[] memory array = new uint256[](1); array[0] = element; return array; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol) pragma solidity ^0.8.0; import "../IERC1155.sol"; /** * @dev Interface of the optional ERC1155MetadataExtension interface, as defined * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP]. * * _Available since v3.1._ */ interface IERC1155MetadataURI is IERC1155 { /** * @dev Returns the URI for token type `id`. * * If the `\{id\}` substring is present in the URI, it must be replaced by * clients with the actual token type ID. */ function uri(uint256 id) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC1155 compliant contract, as defined in the * https://eips.ethereum.org/EIPS/eip-1155[EIP]. * * _Available since v3.1._ */ interface IERC1155 is IERC165 { /** * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`. */ event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); /** * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all * transfers. */ event TransferBatch( address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values ); /** * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to * `approved`. */ event ApprovalForAll(address indexed account, address indexed operator, bool approved); /** * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. * * If an {URI} event was emitted for `id`, the standard * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value * returned by {IERC1155MetadataURI-uri}. */ event URI(string value, uint256 indexed id); /** * @dev Returns the amount of tokens of token type `id` owned by `account`. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) external view returns (uint256); /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory); /** * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the caller. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. * * See {setApprovalForAll}. */ function isApprovedForAll(address account, address operator) external view returns (bool); /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes calldata data ) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev _Available since v3.1._ */ interface IERC1155Receiver is IERC165 { /** * @dev Handles the receipt of a single ERC1155 token type. This function is * called at the end of a `safeTransferFrom` after the balance has been updated. * * NOTE: To accept the transfer, this must return * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` * (i.e. 0xf23a6e61, or its own function selector). * * @param operator The address which initiated the transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param id The ID of the token being transferred * @param value The amount of tokens being transferred * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed */ function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns (bytes4); /** * @dev Handles the receipt of a multiple ERC1155 token types. This function * is called at the end of a `safeBatchTransferFrom` after the balances have * been updated. * * NOTE: To accept the transfer(s), this must return * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` * (i.e. 0xbc197c81, or its own function selector). * * @param operator The address which initiated the batch transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param ids An array containing ids of each token being transferred (order and length must match values array) * @param values An array containing amounts of each token being transferred (order and length must match ids array) * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed */ function onERC1155BatchReceived( address operator, address from, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV // Deprecated in v4.8 } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/EIP712.sol) pragma solidity ^0.8.0; import "./ECDSA.sol"; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible, * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding * they need in their contracts using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * _Available since v3.4._ */ abstract contract EIP712 { /* solhint-disable var-name-mixedcase */ // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to // invalidate the cached domain separator if the chain id changes. bytes32 private immutable _CACHED_DOMAIN_SEPARATOR; uint256 private immutable _CACHED_CHAIN_ID; address private immutable _CACHED_THIS; bytes32 private immutable _HASHED_NAME; bytes32 private immutable _HASHED_VERSION; bytes32 private immutable _TYPE_HASH; /* solhint-enable var-name-mixedcase */ /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ constructor(string memory name, string memory version) { bytes32 hashedName = keccak256(bytes(name)); bytes32 hashedVersion = keccak256(bytes(version)); bytes32 typeHash = keccak256( "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" ); _HASHED_NAME = hashedName; _HASHED_VERSION = hashedVersion; _CACHED_CHAIN_ID = block.chainid; _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion); _CACHED_THIS = address(this); _TYPE_HASH = typeHash; } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) { return _CACHED_DOMAIN_SEPARATOR; } else { return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION); } } function _buildDomainSeparator( bytes32 typeHash, bytes32 nameHash, bytes32 versionHash ) private view returns (bytes32) { return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this))); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: MIT // solhint-disable no-inline-assembly pragma solidity >=0.6.9; import "./IERC2771Recipient.sol"; /** * @title The ERC-2771 Recipient Base Abstract Class - Implementation * * @notice Note that this contract was called `BaseRelayRecipient` in the previous revision of the GSN. * * @notice A base contract to be inherited by any contract that want to receive relayed transactions. * * @notice A subclass must use `_msgSender()` instead of `msg.sender`. */ abstract contract ERC2771Recipient is IERC2771Recipient { /* * Forwarder singleton we accept calls from */ address private _trustedForwarder; constructor(address trustedForwarder) { _trustedForwarder = trustedForwarder; } /** * :warning: **Warning** :warning: The Forwarder can have a full control over your Recipient. Only trust verified Forwarder. * @notice Method is not a required method to allow Recipients to trust multiple Forwarders. Not recommended yet. * @return forwarder The address of the Forwarder contract that is being used. */ function getTrustedForwarder() public view virtual returns (address forwarder) { return _trustedForwarder; } function _setTrustedForwarder(address _forwarder) internal { _trustedForwarder = _forwarder; } /// @inheritdoc IERC2771Recipient function isTrustedForwarder( address forwarder ) public view virtual override returns (bool) { return forwarder == _trustedForwarder; } /// @inheritdoc IERC2771Recipient function _msgSender() internal view virtual override returns (address ret) { if (msg.data.length >= 20 && isTrustedForwarder(msg.sender)) { // At this point we know that the sender is a trusted forwarder, // so we trust that the last bytes of msg.data are the verified sender address. // extract sender address from the end of msg.data assembly { ret := shr(96, calldataload(sub(calldatasize(), 20))) } } else { ret = msg.sender; } } /// @inheritdoc IERC2771Recipient function _msgData() internal view virtual override returns (bytes calldata ret) { if (msg.data.length >= 20 && isTrustedForwarder(msg.sender)) { return msg.data[0:msg.data.length - 20]; } else { return msg.data; } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title The ERC-2771 Recipient Base Abstract Class - Declarations * * @notice A contract must implement this interface in order to support relayed transaction. * * @notice It is recommended that your contract inherits from the ERC2771Recipient contract. */ abstract contract IERC2771Recipient { /** * :warning: **Warning** :warning: The Forwarder can have a full control over your Recipient. Only trust verified Forwarder. * @param forwarder The address of the Forwarder contract that is being used. * @return isTrustedForwarder `true` if the Forwarder is trusted to forward relayed transactions by this Recipient. */ function isTrustedForwarder( address forwarder ) public view virtual returns (bool); /** * @notice Use this method the contract anywhere instead of msg.sender to support relayed transactions. * @return sender The real sender of this call. * For a call that came through the Forwarder the real sender is extracted from the last 20 bytes of the `msg.data`. * Otherwise simply returns `msg.sender`. */ function _msgSender() internal view virtual returns (address); /** * @notice Use this method in the contract instead of `msg.data` when difference matters (hashing, signature, etc.) * @return data The real `msg.data` of this call. * For a call that came through the Forwarder, the real sender address was appended as the last 20 bytes * of the `msg.data` - so this method will strip those 20 bytes off. * Otherwise (if the call was made directly and not through the forwarder) simply returns `msg.data`. */ function _msgData() internal view virtual returns (bytes calldata); }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.0; pragma abicoder v2; import "@openzeppelin/contracts/interfaces/IERC165.sol"; /** * @title The Forwarder Interface * @notice The contracts implementing this interface take a role of authorization, authentication and replay protection * for contracts that choose to trust a `Forwarder`, instead of relying on a mechanism built into the Ethereum protocol. * * @notice if the `Forwarder` contract decides that an incoming `ForwardRequest` is valid, it must append 20 bytes that * represent the caller to the `data` field of the request and send this new data to the target address (the `to` field) * * :warning: **Warning** :warning: The Forwarder can have a full control over a `Recipient` contract. * Any vulnerability in a `Forwarder` implementation can make all of its `Recipient` contracts susceptible! * Recipient contracts should only trust forwarders that passed through security audit, * otherwise they are susceptible to identity theft. */ interface IForwarder is IERC165 { /** * @notice A representation of a request for a `Forwarder` to send `data` on behalf of a `from` to a target (`to`). */ struct ForwardRequest { address from; address to; uint256 value; uint256 gas; uint256 nonce; bytes data; uint256 validUntilTime; } event DomainRegistered(bytes32 indexed domainSeparator, bytes domainValue); event RequestTypeRegistered(bytes32 indexed typeHash, string typeStr); /** * @param from The address of a sender. * @return The nonce for this address. */ function getNonce(address from) external view returns (uint256); /** * @notice Verify the transaction is valid and can be executed. * Implementations must validate the signature and the nonce of the request are correct. * Does not revert and returns successfully if the input is valid. * Reverts if any validation has failed. For instance, if either signature or nonce are incorrect. * Reverts if `domainSeparator` or `requestTypeHash` are not registered as well. */ function verify( ForwardRequest calldata forwardRequest, bytes32 domainSeparator, bytes32 requestTypeHash, bytes calldata suffixData, bytes calldata signature ) external view; /** * @notice Executes a transaction specified by the `ForwardRequest`. * The transaction is first verified and then executed. * The success flag and returned bytes array of the `CALL` are returned as-is. * * This method would revert only in case of a verification error. * * All the target errors are reported using the returned success flag and returned bytes array. * * @param forwardRequest All requested transaction parameters. * @param domainSeparator The domain used when signing this request. * @param requestTypeHash The request type used when signing this request. * @param suffixData The ABI-encoded extension data for the current `RequestType` used when signing this request. * @param signature The client signature to be validated. * * @return success The success flag of the underlying `CALL` to the target address. * @return ret The byte array returned by the underlying `CALL` to the target address. */ function execute( ForwardRequest calldata forwardRequest, bytes32 domainSeparator, bytes32 requestTypeHash, bytes calldata suffixData, bytes calldata signature ) external payable returns (bool success, bytes memory ret); /** * @notice Register a new Request typehash. * * @notice This is necessary for the Forwarder to be able to verify the signatures conforming to the ERC-712. * * @param typeName The name of the request type. * @param typeSuffix Any extra data after the generic params. Must contain add at least one param. * The generic ForwardRequest type is always registered by the constructor. */ function registerRequestType( string calldata typeName, string calldata typeSuffix ) external; /** * @notice Register a new domain separator. * * @notice This is necessary for the Forwarder to be able to verify the signatures conforming to the ERC-712. * * @notice The domain separator must have the following fields: `name`, `version`, `chainId`, `verifyingContract`. * The `chainId` is the current network's `chainId`, and the `verifyingContract` is this Forwarder's address. * This method accepts the domain name and version to create and register the domain separator value. * @param name The domain's display name. * @param version The domain/protocol version. */ function registerDomainSeparator( string calldata name, string calldata version, uint256 chainId ) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; interface IParallelAlphaInvoke { /** * @dev Invalid address of zero * * @param addressType Which address is incorrectly set */ error ZeroAddress(string addressType); /** * @dev Native transfer error */ error TransferError(); /** * @dev Invalid adapter params */ error InvalidAdapterParams(); /** * @dev Invalid batch size */ error ExceedsBatchSizeLimit(); /** * @dev Emitted when the new forwarder is set * @param forwarder The address of the new forwarder */ event TrustedForwarderSet(address forwarder); /** * @dev Emitted when the new prime is set * @param prime The address of the new prime */ event PrimeSet(address prime); /** * @dev Emitted when the batch size limit is set * @param batchSizeLimit The new batch size limit */ event BatchSizeLimitSet(uint256 batchSizeLimit); /** * @dev Fired when a new gateway (i.e. spend handler contract) is registered * @param handler - The address of the newly registered invokeSpend handler contract * @param nftDestinationAddress - The address to which Parallel Alpha was collected * @param nativeTokenDestinationAddress - The address to which native token was collected * @param primeDestinationAddress - The address to which PRIME was collected */ event SpendGatewayRegistered( address indexed handler, address nftDestinationAddress, address nativeTokenDestinationAddress, address primeDestinationAddress ); /** * @dev Fired when the handler is invoked * @param from - The address of the invoker * @param nftDestination - The address to which nfts was collected * @param nativeDestination - The address to which ETH or whatever native token was collected * @param primeDestination - The address to which PRIME was collected * @param id - The arbitrary identifier used for tracking * @param nativeValue - The amount of ETH or whatever native token that was sent * @param primeValue - The amount of PRIME that was sent * @param data - Additional data that was sent */ event SpendInvoked( address indexed from, address nftDestination, address nativeDestination, address primeDestination, uint256 id, uint256[] _tokenIds, uint256[] _amounts, uint256 nativeValue, uint256 primeValue, bytes data ); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; abstract contract InvokeSpendHandler { function handleInvokeSpend( address _from, address _nftDestinationAddress, address _nativeDestinationAddress, address _primeDestinationAddress, uint256 _id, uint256[] memory _tokenIds, uint256[] memory _amounts, uint256 _ethValue, uint256 _primeValue, bytes memory _data ) external virtual; } /** * @notice SpendGateway record stores the details of an InvokeSpendHandler contract */ struct SpendGateway { address nftDestinationAddress; address nativeDestinationAddress; address primeDestinationAddress; InvokeSpendHandler invokeSpendHandler; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import { Context } from "@openzeppelin/contracts/utils/Context.sol"; import { ParallelAlphaInvoke } from "./ParallelAlphaInvoke.sol"; import { IForwarder } from "../metatx/IForwarder.sol"; import { ERC2771Recipient } from "../metatx/ERC2771Recipient.sol"; contract ParallelAlpha is ParallelAlphaInvoke { constructor( address _lzEndpoint, address _forwarder ) ParallelAlphaInvoke(_lzEndpoint, _forwarder) {} }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; import { ONFT1155, ONFT1155Core, IONFT1155Core } from "@layerzerolabs/solidity-examples/contracts/token/onft/ONFT1155.sol"; import { ERC1155, IERC1155, Context } from "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import { ReentrancyGuard } from "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import { SafeERC20, IERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { Strings } from "@openzeppelin/contracts/utils/Strings.sol"; import { EIP712, ECDSA } from "@openzeppelin/contracts/utils/cryptography/EIP712.sol"; import { RevokableDefaultOperatorFilterer } from "operator-filter-registry/src/RevokableDefaultOperatorFilterer.sol"; import { UpdatableOperatorFilterer } from "operator-filter-registry/src/UpdatableOperatorFilterer.sol"; import { SpendGateway, InvokeSpendHandler } from "./libraries/ParallelAlphaLib.sol"; import { IParallelAlphaInvoke } from "./interfaces/IParallelAlphaInvoke.sol"; import { ERC2771Recipient } from "../metatx/ERC2771Recipient.sol"; contract ParallelAlphaInvoke is IParallelAlphaInvoke, ONFT1155, ReentrancyGuard, ERC2771Recipient, RevokableDefaultOperatorFilterer { using SafeERC20 for IERC20; using Strings for uint256; /// @notice Address of prime contract. IERC20 public prime; /// @notice Batch size upper limit. uint256 public batchSizeLimit = 111; /// @notice A descriptive name for a collection of NFTs in this contract string public name; /// @notice An abbreviated name for NFTs in this contract string public symbol; /// @notice a record of all SpendGateways mapping(uint256 => SpendGateway) public spendGateways; /// @param _lzEndpoint Layer Zero endpoint constructor( address _lzEndpoint, address _forwarder ) ONFT1155( "https://nftdata.parallelnft.com/api/tokens/parallel-alpha/ipfs/{id}", _lzEndpoint ) ERC2771Recipient(_forwarder) { name = "parallel"; symbol = "LL"; prime = IERC20(0xb23d80f5FefcDDaa212212F028021B41DEd428CF); } /** * @dev Returns the address of the current owner. */ function owner() public view override(Ownable, UpdatableOperatorFilterer) returns (address) { return super.owner(); } /** * @dev Returns the URI for token type `id`. * * If the `\{id\}` substring is present in the URI, it must be replaced by * clients with the actual token type ID. */ function uri( uint256 _tokenId ) public view virtual override returns (string memory) { string memory baseURI = super.uri(_tokenId); // Exit early if the baseURI is empty. if (bytes(baseURI).length == 0) { return ""; } // Check if the last character in baseURI is a slash. if (bytes(baseURI)[bytes(baseURI).length - 1] != bytes("/")[0]) { return baseURI; } return string.concat(baseURI, _tokenId.toString()); } /** * @dev Sets a new URI for all token types, by relying on the token type ID * substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * By this mechanism, any occurrence of the `\{id\}` substring in either the * URI or any of the amounts in the JSON file at said URI will be replaced by * clients with the token type ID. * * For example, the `https://token-cdn-domain/\{id\}.json` URI would be * interpreted by clients as * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json` * for token type ID 0x4cce0. * * See {uri}. * * Because these URIs cannot be meaningfully represented by the {URI} event, * this function emits no events. */ function setURI(string memory _uri) external onlyOwner { _setURI(_uri); } /** * @notice Updated trusted forwarder address. * @param _forwarder New trusted forwarder address. */ function setTrustedForwarder(address _forwarder) external onlyOwner { _setTrustedForwarder(_forwarder); emit TrustedForwarderSet(_forwarder); } /** * @notice Updated prime contract address. * @param _prime New prime contract address. */ function setPrime(address _prime) external onlyOwner { prime = IERC20(_prime); emit PrimeSet(_prime); } /** * @notice Updates batch size limit. * @param _batchSizeLimit New batch size limit. */ function setBatchSizeLimit(uint256 _batchSizeLimit) external onlyOwner { batchSizeLimit = _batchSizeLimit; emit BatchSizeLimitSet(_batchSizeLimit); } /** * @notice Allow the caller to send Parallel Alpha to the Echelon Ecosystem of smart * contracts. Parallel Alpha are collected to the destination address, * handler is invoked to trigger downstream logic and events * * @param _id An id of the gateway * @param _tokenIds Token id of the Parallel Alpha that was sent * @param _amounts The amount of an Parallel Alpha that was sent to the * invokeSpend function (and was collected to gateway handler) * @param _primeValue The amount of an prime that was sent to the * invokeSpend function (and was collected to gateway handler) * @param _data Catch-all param to allow the caller to pass additional * data to the handler */ function invokeSpend( uint256 _id, uint256[] calldata _tokenIds, uint256[] calldata _amounts, uint256 _primeValue, bytes memory _data ) public payable nonReentrant { SpendGateway memory gateway = spendGateways[_id]; if (gateway.nftDestinationAddress == address(0)) revert ZeroAddress("nftDestinationAddress"); // pull the native token to nativeDestinationAddress if (msg.value != 0) { (bool success, ) = payable(gateway.nativeDestinationAddress).call{ value: msg.value }(""); if (!success) revert TransferError(); } // pull the prime to primeDestinationAddress if (_primeValue != 0) { prime.safeTransferFrom( _msgSender(), gateway.primeDestinationAddress, _primeValue ); } // pull the Nfts to nftReceiverAddress if (_tokenIds.length != 0) { _safeBatchTransferFrom( _msgSender(), gateway.nftDestinationAddress, _tokenIds, _amounts, "" ); } // invoke the handler function with all transaction data InvokeSpendHandler(gateway.invokeSpendHandler).handleInvokeSpend( _msgSender(), gateway.nftDestinationAddress, gateway.nativeDestinationAddress, gateway.primeDestinationAddress, _id, _tokenIds, _amounts, msg.value, _primeValue, _data ); emit SpendInvoked( _msgSender(), gateway.nftDestinationAddress, gateway.nativeDestinationAddress, gateway.primeDestinationAddress, _id, _tokenIds, _amounts, msg.value, _primeValue, _data ); } /** * @notice Allow an address with admin role to add a handler contract for invoke * @param _id - The id of the newly added handler contracts * @param _nftDestinationAddress - The address to which the Parallel Alpha are collected * @param _nativeDestinationAddress - The address to which Native token is collected * @param _primeDestinationAddress - The address to which prime is collected * @param _invokeSpendHandler - The address of the new invoke handler contract to be registered */ function setGateway( uint256 _id, address _nftDestinationAddress, address _nativeDestinationAddress, address _primeDestinationAddress, address _invokeSpendHandler ) public onlyOwner { if (_nftDestinationAddress == address(0)) revert ZeroAddress("_nftDestinationAddress"); if (_nativeDestinationAddress == address(0)) revert ZeroAddress("_nativeDestinationAddress"); if (_primeDestinationAddress == address(0)) revert ZeroAddress("_primeDestinationAddress"); if (_invokeSpendHandler == address(0)) revert ZeroAddress("_invokeSpendHandler"); SpendGateway memory gateway; gateway.nftDestinationAddress = _nftDestinationAddress; gateway.nativeDestinationAddress = _nativeDestinationAddress; gateway.primeDestinationAddress = _primeDestinationAddress; gateway.invokeSpendHandler = InvokeSpendHandler(_invokeSpendHandler); spendGateways[_id] = gateway; emit SpendGatewayRegistered( _invokeSpendHandler, _nftDestinationAddress, _nativeDestinationAddress, _primeDestinationAddress ); } function _debitFrom( address _from, uint16 _dstChainId, bytes memory _toAddress, uint[] memory _tokenIds, uint[] memory _amounts ) internal virtual override { if (_tokenIds.length > batchSizeLimit) { revert ExceedsBatchSizeLimit(); } super._debitFrom(_from, _dstChainId, _toAddress, _tokenIds, _amounts); } /** * @notice Overridden _msgSender to handle ERC2771 */ function _msgSender() internal view virtual override(Context, ERC2771Recipient) returns (address ret) { ret = ERC2771Recipient._msgSender(); } /** * @notice Overridden _msgData to handle ERC2771 */ function _msgData() internal view virtual override(Context, ERC2771Recipient) returns (bytes calldata) { return ERC2771Recipient._msgData(); } /** * @dev See {IERC1155-setApprovalForAll}. * In this example the added modifier ensures that the operator is allowed by the OperatorFilterRegistry. */ function setApprovalForAll( address operator, bool approved ) public override(ERC1155, IERC1155) onlyAllowedOperatorApproval(operator) { super.setApprovalForAll(operator, approved); } /** * @dev See {IERC1155-safeTransferFrom}. * In this example the added modifier ensures that the operator is allowed by the OperatorFilterRegistry. */ function safeTransferFrom( address from, address to, uint256 tokenId, uint256 amount, bytes memory data ) public override(ERC1155, IERC1155) onlyAllowedOperator(from) { super.safeTransferFrom(from, to, tokenId, amount, data); } /** * @dev See {IERC1155-safeBatchTransferFrom}. * In this example the added modifier ensures that the operator is allowed by the OperatorFilterRegistry. */ function safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) public virtual override(ERC1155, IERC1155) onlyAllowedOperator(from) { super.safeBatchTransferFrom(from, to, ids, amounts, data); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; interface IOperatorFilterRegistry { /** * @notice Returns true if operator is not filtered for a given token, either by address or codeHash. Also returns * true if supplied registrant address is not registered. */ function isOperatorAllowed(address registrant, address operator) external view returns (bool); /** * @notice Registers an address with the registry. May be called by address itself or by EIP-173 owner. */ function register(address registrant) external; /** * @notice Registers an address with the registry and "subscribes" to another address's filtered operators and codeHashes. */ function registerAndSubscribe(address registrant, address subscription) external; /** * @notice Registers an address with the registry and copies the filtered operators and codeHashes from another * address without subscribing. */ function registerAndCopyEntries(address registrant, address registrantToCopy) external; /** * @notice Unregisters an address with the registry and removes its subscription. May be called by address itself or by EIP-173 owner. * Note that this does not remove any filtered addresses or codeHashes. * Also note that any subscriptions to this registrant will still be active and follow the existing filtered addresses and codehashes. */ function unregister(address addr) external; /** * @notice Update an operator address for a registered address - when filtered is true, the operator is filtered. */ function updateOperator(address registrant, address operator, bool filtered) external; /** * @notice Update multiple operators for a registered address - when filtered is true, the operators will be filtered. Reverts on duplicates. */ function updateOperators(address registrant, address[] calldata operators, bool filtered) external; /** * @notice Update a codeHash for a registered address - when filtered is true, the codeHash is filtered. */ function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external; /** * @notice Update multiple codeHashes for a registered address - when filtered is true, the codeHashes will be filtered. Reverts on duplicates. */ function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered) external; /** * @notice Subscribe an address to another registrant's filtered operators and codeHashes. Will remove previous * subscription if present. * Note that accounts with subscriptions may go on to subscribe to other accounts - in this case, * subscriptions will not be forwarded. Instead the former subscription's existing entries will still be * used. */ function subscribe(address registrant, address registrantToSubscribe) external; /** * @notice Unsubscribe an address from its current subscribed registrant, and optionally copy its filtered operators and codeHashes. */ function unsubscribe(address registrant, bool copyExistingEntries) external; /** * @notice Get the subscription address of a given registrant, if any. */ function subscriptionOf(address addr) external returns (address registrant); /** * @notice Get the set of addresses subscribed to a given registrant. * Note that order is not guaranteed as updates are made. */ function subscribers(address registrant) external returns (address[] memory); /** * @notice Get the subscriber at a given index in the set of addresses subscribed to a given registrant. * Note that order is not guaranteed as updates are made. */ function subscriberAt(address registrant, uint256 index) external returns (address); /** * @notice Copy filtered operators and codeHashes from a different registrantToCopy to addr. */ function copyEntriesOf(address registrant, address registrantToCopy) external; /** * @notice Returns true if operator is filtered by a given address or its subscription. */ function isOperatorFiltered(address registrant, address operator) external returns (bool); /** * @notice Returns true if the hash of an address's code is filtered by a given address or its subscription. */ function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool); /** * @notice Returns true if a codeHash is filtered by a given address or its subscription. */ function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool); /** * @notice Returns a list of filtered operators for a given address or its subscription. */ function filteredOperators(address addr) external returns (address[] memory); /** * @notice Returns the set of filtered codeHashes for a given address or its subscription. * Note that order is not guaranteed as updates are made. */ function filteredCodeHashes(address addr) external returns (bytes32[] memory); /** * @notice Returns the filtered operator at the given index of the set of filtered operators for a given address or * its subscription. * Note that order is not guaranteed as updates are made. */ function filteredOperatorAt(address registrant, uint256 index) external returns (address); /** * @notice Returns the filtered codeHash at the given index of the list of filtered codeHashes for a given address or * its subscription. * Note that order is not guaranteed as updates are made. */ function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32); /** * @notice Returns true if an address has registered */ function isRegistered(address addr) external returns (bool); /** * @dev Convenience method to compute the code hash of an arbitrary contract */ function codeHashOf(address addr) external returns (bytes32); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; address constant CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS = 0x000000000000AAeB6D7670E522A718067333cd4E; address constant CANONICAL_CORI_SUBSCRIPTION = 0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6;
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import {RevokableOperatorFilterer} from "./RevokableOperatorFilterer.sol"; import {CANONICAL_CORI_SUBSCRIPTION, CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS} from "./lib/Constants.sol"; /** * @title RevokableDefaultOperatorFilterer * @notice Inherits from RevokableOperatorFilterer and automatically subscribes to the default OpenSea subscription. * Note that OpenSea will disable creator earnings enforcement if filtered operators begin fulfilling orders * on-chain, eg, if the registry is revoked or bypassed. */ abstract contract RevokableDefaultOperatorFilterer is RevokableOperatorFilterer { /// @dev The constructor that is called when the contract is being deployed. constructor() RevokableOperatorFilterer(CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS, CANONICAL_CORI_SUBSCRIPTION, true) {} }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import {UpdatableOperatorFilterer} from "./UpdatableOperatorFilterer.sol"; import {IOperatorFilterRegistry} from "./IOperatorFilterRegistry.sol"; /** * @title RevokableOperatorFilterer * @notice This contract is meant to allow contracts to permanently skip OperatorFilterRegistry checks if desired. The * Registry itself has an "unregister" function, but if the contract is ownable, the owner can re-register at * any point. As implemented, this abstract contract allows the contract owner to permanently skip the * OperatorFilterRegistry checks by calling revokeOperatorFilterRegistry. Once done, the registry * address cannot be further updated. * Note that OpenSea will still disable creator earnings enforcement if filtered operators begin fulfilling orders * on-chain, eg, if the registry is revoked or bypassed. */ abstract contract RevokableOperatorFilterer is UpdatableOperatorFilterer { /// @dev Emitted when the registry has already been revoked. error RegistryHasBeenRevoked(); /// @dev Emitted when the initial registry address is attempted to be set to the zero address. error InitialRegistryAddressCannotBeZeroAddress(); event OperatorFilterRegistryRevoked(); bool public isOperatorFilterRegistryRevoked; /// @dev The constructor that is called when the contract is being deployed. constructor(address _registry, address subscriptionOrRegistrantToCopy, bool subscribe) UpdatableOperatorFilterer(_registry, subscriptionOrRegistrantToCopy, subscribe) { // don't allow creating a contract with a permanently revoked registry if (_registry == address(0)) { revert InitialRegistryAddressCannotBeZeroAddress(); } } /** * @notice Update the address that the contract will make OperatorFilter checks against. When set to the zero * address, checks will be permanently bypassed, and the address cannot be updated again. OnlyOwner. */ function updateOperatorFilterRegistryAddress(address newRegistry) public override { if (msg.sender != owner()) { revert OnlyOwner(); } // if registry has been revoked, do not allow further updates if (isOperatorFilterRegistryRevoked) { revert RegistryHasBeenRevoked(); } operatorFilterRegistry = IOperatorFilterRegistry(newRegistry); emit OperatorFilterRegistryAddressUpdated(newRegistry); } /** * @notice Revoke the OperatorFilterRegistry address, permanently bypassing checks. OnlyOwner. */ function revokeOperatorFilterRegistry() public { if (msg.sender != owner()) { revert OnlyOwner(); } // if registry has been revoked, do not allow further updates if (isOperatorFilterRegistryRevoked) { revert RegistryHasBeenRevoked(); } // set to zero address to bypass checks operatorFilterRegistry = IOperatorFilterRegistry(address(0)); isOperatorFilterRegistryRevoked = true; emit OperatorFilterRegistryRevoked(); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import {IOperatorFilterRegistry} from "./IOperatorFilterRegistry.sol"; /** * @title UpdatableOperatorFilterer * @notice Abstract contract whose constructor automatically registers and optionally subscribes to or copies another * registrant's entries in the OperatorFilterRegistry. This contract allows the Owner to update the * OperatorFilterRegistry address via updateOperatorFilterRegistryAddress, including to the zero address, * which will bypass registry checks. * Note that OpenSea will still disable creator earnings enforcement if filtered operators begin fulfilling orders * on-chain, eg, if the registry is revoked or bypassed. * @dev This smart contract is meant to be inherited by token contracts so they can use the following: * - `onlyAllowedOperator` modifier for `transferFrom` and `safeTransferFrom` methods. * - `onlyAllowedOperatorApproval` modifier for `approve` and `setApprovalForAll` methods. */ abstract contract UpdatableOperatorFilterer { /// @dev Emitted when an operator is not allowed. error OperatorNotAllowed(address operator); /// @dev Emitted when someone other than the owner is trying to call an only owner function. error OnlyOwner(); event OperatorFilterRegistryAddressUpdated(address newRegistry); IOperatorFilterRegistry public operatorFilterRegistry; /// @dev The constructor that is called when the contract is being deployed. constructor(address _registry, address subscriptionOrRegistrantToCopy, bool subscribe) { IOperatorFilterRegistry registry = IOperatorFilterRegistry(_registry); operatorFilterRegistry = registry; // If an inheriting token contract is deployed to a network without the registry deployed, the modifier // will not revert, but the contract will need to be registered with the registry once it is deployed in // order for the modifier to filter addresses. if (address(registry).code.length > 0) { if (subscribe) { registry.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy); } else { if (subscriptionOrRegistrantToCopy != address(0)) { registry.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy); } else { registry.register(address(this)); } } } } /** * @dev A helper function to check if the operator is allowed. */ modifier onlyAllowedOperator(address from) virtual { // Allow spending tokens from addresses with balance // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred // from an EOA. if (from != msg.sender) { _checkFilterOperator(msg.sender); } _; } /** * @dev A helper function to check if the operator approval is allowed. */ modifier onlyAllowedOperatorApproval(address operator) virtual { _checkFilterOperator(operator); _; } /** * @notice Update the address that the contract will make OperatorFilter checks against. When set to the zero * address, checks will be bypassed. OnlyOwner. */ function updateOperatorFilterRegistryAddress(address newRegistry) public virtual { if (msg.sender != owner()) { revert OnlyOwner(); } operatorFilterRegistry = IOperatorFilterRegistry(newRegistry); emit OperatorFilterRegistryAddressUpdated(newRegistry); } /** * @dev Assume the contract has an owner, but leave specific Ownable implementation up to inheriting contract. */ function owner() public view virtual returns (address); /** * @dev A helper function to check if the operator is allowed. */ function _checkFilterOperator(address operator) internal view virtual { IOperatorFilterRegistry registry = operatorFilterRegistry; // Check registry code length to facilitate testing in environments without a deployed registry. if (address(registry) != address(0) && address(registry).code.length > 0) { // under normal circumstances, this function will revert rather than return false, but inheriting contracts // may specify their own OperatorFilterRegistry implementations, which may behave differently if (!registry.isOperatorAllowed(address(this), operator)) { revert OperatorNotAllowed(operator); } } } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_lzEndpoint","type":"address"},{"internalType":"address","name":"_forwarder","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ExceedsBatchSizeLimit","type":"error"},{"inputs":[],"name":"InitialRegistryAddressCannotBeZeroAddress","type":"error"},{"inputs":[],"name":"InvalidAdapterParams","type":"error"},{"inputs":[],"name":"OnlyOwner","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"OperatorNotAllowed","type":"error"},{"inputs":[],"name":"RegistryHasBeenRevoked","type":"error"},{"inputs":[],"name":"TransferError","type":"error"},{"inputs":[{"internalType":"string","name":"addressType","type":"string"}],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"batchSizeLimit","type":"uint256"}],"name":"BatchSizeLimitSet","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":false,"internalType":"address","name":"newRegistry","type":"address"}],"name":"OperatorFilterRegistryAddressUpdated","type":"event"},{"anonymous":false,"inputs":[],"name":"OperatorFilterRegistryRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"prime","type":"address"}],"name":"PrimeSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"indexed":true,"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"indexed":true,"internalType":"address","name":"_toAddress","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"_amounts","type":"uint256[]"}],"name":"ReceiveBatchFromChain","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"indexed":true,"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"indexed":true,"internalType":"address","name":"_toAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"_tokenId","type":"uint256"},{"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":true,"internalType":"bytes","name":"_toAddress","type":"bytes"},{"indexed":false,"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"_amounts","type":"uint256[]"}],"name":"SendBatchToChain","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"bytes","name":"_toAddress","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"_tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"SendToChain","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":"handler","type":"address"},{"indexed":false,"internalType":"address","name":"nftDestinationAddress","type":"address"},{"indexed":false,"internalType":"address","name":"nativeTokenDestinationAddress","type":"address"},{"indexed":false,"internalType":"address","name":"primeDestinationAddress","type":"address"}],"name":"SpendGatewayRegistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"address","name":"nftDestination","type":"address"},{"indexed":false,"internalType":"address","name":"nativeDestination","type":"address"},{"indexed":false,"internalType":"address","name":"primeDestination","type":"address"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"_amounts","type":"uint256[]"},{"indexed":false,"internalType":"uint256","name":"nativeValue","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"primeValue","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"}],"name":"SpendInvoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"values","type":"uint256[]"}],"name":"TransferBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"TransferSingle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"forwarder","type":"address"}],"name":"TrustedForwarderSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"value","type":"string"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"URI","type":"event"},{"inputs":[],"name":"DEFAULT_PAYLOAD_SIZE_LIMIT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FUNCTION_TYPE_SEND","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FUNCTION_TYPE_SEND_BATCH","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NO_EXTRA_GAS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"balanceOfBatch","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"batchSizeLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes","name":"_toAddress","type":"bytes"},{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"},{"internalType":"bool","name":"_useZro","type":"bool"},{"internalType":"bytes","name":"_adapterParams","type":"bytes"}],"name":"estimateSendBatchFee","outputs":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"zroFee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes","name":"_toAddress","type":"bytes"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"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":"getTrustedForwarder","outputs":[{"internalType":"address","name":"forwarder","type":"address"}],"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":"uint256","name":"_id","type":"uint256"},{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"},{"internalType":"uint256","name":"_primeValue","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"invokeSpend","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isOperatorFilterRegistryRevoked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"forwarder","type":"address"}],"name":"isTrustedForwarder","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"}],"name":"isTrustedRemote","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lzEndpoint","outputs":[{"internalType":"contract ILayerZeroEndpoint","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"internalType":"uint64","name":"_nonce","type":"uint64"},{"internalType":"bytes","name":"_payload","type":"bytes"}],"name":"lzReceive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"},{"internalType":"uint16","name":"","type":"uint16"}],"name":"minDstGasLookup","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"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":"operatorFilterRegistry","outputs":[{"internalType":"contract IOperatorFilterRegistry","name":"","type":"address"}],"stateMutability":"view","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":[],"name":"prime","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"internalType":"uint64","name":"_nonce","type":"uint64"},{"internalType":"bytes","name":"_payload","type":"bytes"}],"name":"retryMessage","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"revokeOperatorFilterRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeBatchTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes","name":"_toAddress","type":"bytes"},{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"},{"internalType":"address payable","name":"_refundAddress","type":"address"},{"internalType":"address","name":"_zroPaymentAddress","type":"address"},{"internalType":"bytes","name":"_adapterParams","type":"bytes"}],"name":"sendBatchFrom","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":"_tokenId","type":"uint256"},{"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":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_batchSizeLimit","type":"uint256"}],"name":"setBatchSizeLimit","outputs":[],"stateMutability":"nonpayable","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":"uint256","name":"_id","type":"uint256"},{"internalType":"address","name":"_nftDestinationAddress","type":"address"},{"internalType":"address","name":"_nativeDestinationAddress","type":"address"},{"internalType":"address","name":"_primeDestinationAddress","type":"address"},{"internalType":"address","name":"_invokeSpendHandler","type":"address"}],"name":"setGateway","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"uint16","name":"_packetType","type":"uint16"},{"internalType":"uint256","name":"_minGas","type":"uint256"}],"name":"setMinDstGas","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"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":"address","name":"_prime","type":"address"}],"name":"setPrime","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":"address","name":"_forwarder","type":"address"}],"name":"setTrustedForwarder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_path","type":"bytes"}],"name":"setTrustedRemote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_remoteChainId","type":"uint16"},{"internalType":"bytes","name":"_remoteAddress","type":"bytes"}],"name":"setTrustedRemoteAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_uri","type":"string"}],"name":"setURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_useCustomAdapterParams","type":"bool"}],"name":"setUseCustomAdapterParams","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"spendGateways","outputs":[{"internalType":"address","name":"nftDestinationAddress","type":"address"},{"internalType":"address","name":"nativeDestinationAddress","type":"address"},{"internalType":"address","name":"primeDestinationAddress","type":"address"},{"internalType":"contract InvokeSpendHandler","name":"invokeSpendHandler","type":"address"}],"stateMutability":"view","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":[{"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":"address","name":"newRegistry","type":"address"}],"name":"updateOperatorFilterRegistryAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"uri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"useCustomAdapterParams","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60a0604052606f600e553480156200001657600080fd5b5060405162005ef338038062005ef383398101604081905262000039916200038d565b81816daaeb6d7670e522a718067333cd4e733cc6cdda760b79bafa08df41ecfa224f810dceb660018282828660405180608001604052806043815260200162005eb06043913989818180806200009862000092620002bc565b620002d8565b6001600160a01b031660805250620000b290508162000328565b50506001600a5550600b80546001600160a01b039283166001600160a01b031991821617909155600c8054928616929091168217905583903b15620002035781156200016257604051633e9f1edf60e11b81523060048201526001600160a01b038481166024830152821690637d3e3dbe906044015b600060405180830381600087803b1580156200014357600080fd5b505af115801562000158573d6000803e3d6000fd5b5050505062000203565b6001600160a01b03831615620001a75760405163a0af290360e01b81523060048201526001600160a01b03848116602483015282169063a0af29039060440162000128565b604051632210724360e11b81523060048201526001600160a01b03821690634420e48690602401600060405180830381600087803b158015620001e957600080fd5b505af1158015620001fe573d6000803e3d6000fd5b505050505b5050506001600160a01b0384169050620002305760405163c49d17ad60e01b815260040160405180910390fd5b50506040805180820190915260088152671c185c985b1b195b60c21b6020820152600f91506200026190826200046a565b50604080518082019091526002815261131360f21b60208201526010906200028a90826200046a565b5050600d80546001600160a01b03191673b23d80f5fefcddaa212212f028021b41ded428cf1790555062000536915050565b6000620002d36200033a60201b620024eb1760201c565b905090565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60096200033682826200046a565b5050565b600060143610801590620003585750600b546001600160a01b031633145b156200036b575060131936013560601c90565b503390565b80516001600160a01b03811681146200038857600080fd5b919050565b60008060408385031215620003a157600080fd5b620003ac8362000370565b9150620003bc6020840162000370565b90509250929050565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680620003f057607f821691505b6020821081036200041157634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200046557600081815260208120601f850160051c81016020861015620004405750805b601f850160051c820191505b8181101562000461578281556001016200044c565b5050505b505050565b81516001600160401b03811115620004865762000486620003c5565b6200049e81620004978454620003db565b8462000417565b602080601f831160018114620004d65760008415620004bd5750858301515b600019600386901b1c1916600185901b17855562000461565b600085815260208120601f198616915b828110156200050757888601518255948401946001909101908401620004e6565b5085821015620005265787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6080516159266200058a6000396000818161094501528181610bd401528181610f89015281816110e40152818161155001528181611afd01528181611f5e0152818161246901526136e501526159266000f3fe60806040526004361061038a5760003560e01c80638cfd8f5c116101dc578063c92daad611610102578063e985e9c5116100a0578063ed629c5c1161006f578063ed629c5c14610b58578063f242432a14610b72578063f2fde38b14610b92578063f5ecbdbc14610bb257600080fd5b8063e985e9c514610aae578063eab45d9c14610af7578063eb8d72b714610b17578063ecba222a14610b3757600080fd5b8063ce1b815f116100dc578063ce1b815f14610a3d578063d1deba1f14610a5b578063da74222814610a6e578063df2a5b3b14610a8e57600080fd5b8063c92daad6146109dd578063c9e18c6f146109fd578063cbed8b9c14610a1d57600080fd5b8063af3fb21c1161017a578063b8d1e53211610149578063b8d1e53214610967578063baf3292d14610987578063c4461834146109a7578063c7ee005e146109bd57600080fd5b8063af3fb21c146108de578063b0ccc31e146108f3578063b253566314610913578063b353aaa71461093357600080fd5b806395d89b41116101b657806395d89b41146108695780639f38369a1461087e578063a22cb4651461089e578063a6c3d165146108be57600080fd5b80638cfd8f5c146107df5780638da5cb5b14610817578063950c8a741461084957600080fd5b80633d8b38f6116102c15780634e1273f41161025f57806366ad5c8a1161022e57806366ad5c8a14610755578063715018a6146107755780637533d7881461078a5780638608e5f8146107aa57600080fd5b80634e1273f414610695578063572b6c05146106c25780635b8c41e6146106f15780635ef9432a1461074057600080fd5b806342d65a8d1161029b57806342d65a8d1461063a578063447705151461065a5780634ab4e6871461066f5780634db8226a1461068257600080fd5b80633d8b38f6146105da5780633e112e57146105fa5780633f1f4fa41461060d57600080fd5b80630e89341c1161032e578063149e3e1f11610308578063149e3e1f1461055c578063161e6e561461058457806324e4c043146105a45780632eb2c2d6146105ba57600080fd5b80630e89341c1461049657806310ddb137146104b6578063111cdc90146104d657600080fd5b806302fe53051161036a57806302fe53051461041457806306fdde031461043457806307e0db17146104565780630df374831461047657600080fd5b80621d35671461038f578062fdd58e146103b157806301ffc9a7146103e4575b600080fd5b34801561039b57600080fd5b506103af6103aa366004614156565b610bd2565b005b3480156103bd57600080fd5b506103d16103cc366004614209565b610e13565b6040519081526020015b60405180910390f35b3480156103f057600080fd5b506104046103ff36600461424b565b610ea9565b60405190151581526020016103db565b34801561042057600080fd5b506103af61042f366004614317565b610ec6565b34801561044057600080fd5b50610449610eda565b6040516103db91906143af565b34801561046257600080fd5b506103af6104713660046143c2565b610f68565b34801561048257600080fd5b506103af6104913660046143dd565b610ff1565b3480156104a257600080fd5b506104496104b13660046143f9565b611010565b3480156104c257600080fd5b506103af6104d13660046143c2565b6110c3565b3480156104e257600080fd5b506105296104f13660046143f9565b60116020526000908152604090208054600182015460028301546003909301546001600160a01b039283169391831692918216911684565b604080516001600160a01b03958616815293851660208501529184169183019190915290911660608201526080016103db565b34801561056857600080fd5b50610571600281565b60405161ffff90911681526020016103db565b34801561059057600080fd5b506103af61059f3660046143f9565b61111b565b3480156105b057600080fd5b506103d1600e5481565b3480156105c657600080fd5b506103af6105d53660046144c6565b61115f565b3480156105e657600080fd5b506104046105f5366004614573565b61118e565b6103af610608366004614609565b61125a565b34801561061957600080fd5b506103d16106283660046143c2565b60036020526000908152604090205481565b34801561064657600080fd5b506103af610655366004614573565b611531565b34801561066657600080fd5b506103d1600081565b6103af61067d3660046146af565b6115b7565b6103af61069036600461479e565b6115d1565b3480156106a157600080fd5b506106b56106b0366004614844565b6115f1565b6040516103db919061494b565b3480156106ce57600080fd5b506104046106dd36600461495e565b600b546001600160a01b0391821691161490565b3480156106fd57600080fd5b506103d161070c36600461497b565b6005602090815260009384526040808520845180860184018051928152908401958401959095209452929052825290205481565b34801561074c57600080fd5b506103af61171a565b34801561076157600080fd5b506103af610770366004614156565b6117b1565b34801561078157600080fd5b506103af611895565b34801561079657600080fd5b506104496107a53660046143c2565b6118a9565b3480156107b657600080fd5b506107ca6107c53660046149f1565b6118c2565b604080519283526020830191909152016103db565b3480156107eb57600080fd5b506103d16107fa366004614a8b565b600260209081526000928352604080842090915290825290205481565b34801561082357600080fd5b506000546001600160a01b03165b6040516001600160a01b0390911681526020016103db565b34801561085557600080fd5b50600454610831906001600160a01b031681565b34801561087557600080fd5b506104496118f7565b34801561088a57600080fd5b506104496108993660046143c2565b611904565b3480156108aa57600080fd5b506103af6108b9366004614abe565b611a1a565b3480156108ca57600080fd5b506103af6108d9366004614573565b611a33565b3480156108ea57600080fd5b50610571600181565b3480156108ff57600080fd5b50600c54610831906001600160a01b031681565b34801561091f57600080fd5b506107ca61092e366004614af7565b611abc565b34801561093f57600080fd5b506108317f000000000000000000000000000000000000000000000000000000000000000081565b34801561097357600080fd5b506103af61098236600461495e565b611b8a565b34801561099357600080fd5b506103af6109a236600461495e565b611c2e565b3480156109b357600080fd5b506103d161271081565b3480156109c957600080fd5b50600d54610831906001600160a01b031681565b3480156109e957600080fd5b506103af6109f8366004614ba9565b611c84565b348015610a0957600080fd5b506103af610a1836600461495e565b611ee9565b348015610a2957600080fd5b506103af610a38366004614c11565b611f3f565b348015610a4957600080fd5b50600b546001600160a01b0316610831565b6103af610a69366004614156565b611fd4565b348015610a7a57600080fd5b506103af610a8936600461495e565b6121ea565b348015610a9a57600080fd5b506103af610aa9366004614c7f565b612246565b348015610aba57600080fd5b50610404610ac9366004614cbb565b6001600160a01b03918216600090815260086020908152604080832093909416825291909152205460ff1690565b348015610b0357600080fd5b506103af610b12366004614ce9565b6122f8565b348015610b2357600080fd5b506103af610b32366004614573565b612341565b348015610b4357600080fd5b50600c5461040490600160a01b900460ff1681565b348015610b6457600080fd5b506006546104049060ff1681565b348015610b7e57600080fd5b506103af610b8d366004614d06565b61239b565b348015610b9e57600080fd5b506103af610bad36600461495e565b6123c2565b348015610bbe57600080fd5b50610449610bcd366004614d6e565b612438565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610c04612520565b6001600160a01b031614610c5f5760405162461bcd60e51b815260206004820152601e60248201527f4c7a4170703a20696e76616c696420656e64706f696e742063616c6c6572000060448201526064015b60405180910390fd5b61ffff861660009081526001602052604081208054610c7d90614dbb565b80601f0160208091040260200160405190810160405280929190818152602001828054610ca990614dbb565b8015610cf65780601f10610ccb57610100808354040283529160200191610cf6565b820191906000526020600020905b815481529060010190602001808311610cd957829003601f168201915b50505050509050805186869050148015610d11575060008151115b8015610d39575080516020820120604051610d2f9088908890614df5565b6040518091039020145b610d945760405162461bcd60e51b815260206004820152602660248201527f4c7a4170703a20696e76616c696420736f757263652073656e64696e6720636f6044820152651b9d1c9858dd60d21b6064820152608401610c56565b610e0a8787878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8a018190048102820181019092528881528a93509150889088908190840183828082843760009201919091525061252a92505050565b50505050505050565b60006001600160a01b038316610e7e5760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a2061646472657373207a65726f206973206e6f742061207660448201526930b634b21037bbb732b960b11b6064820152608401610c56565b5060008181526007602090815260408083206001600160a01b03861684529091529020545b92915050565b60006001600160e01b031982161580610ea35750610ea3826125a3565b610ece6125e3565b610ed78161265c565b50565b600f8054610ee790614dbb565b80601f0160208091040260200160405190810160405280929190818152602001828054610f1390614dbb565b8015610f605780601f10610f3557610100808354040283529160200191610f60565b820191906000526020600020905b815481529060010190602001808311610f4357829003601f168201915b505050505081565b610f706125e3565b6040516307e0db1760e01b815261ffff821660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906307e0db17906024015b600060405180830381600087803b158015610fd657600080fd5b505af1158015610fea573d6000803e3d6000fd5b5050505050565b610ff96125e3565b61ffff909116600090815260036020526040902055565b6060600061101d8361266c565b9050805160000361103e575050604080516020810190915260008152919050565b604080518082019091526001808252602f60f81b60209092018290528251839161106791614e31565b8151811061107757611077614e05565b01602001516001600160f81b031916146110915792915050565b8061109b84612700565b6040516020016110ac929190614e44565b604051602081830303815290604052915050919050565b6110cb6125e3565b6040516310ddb13760e01b815261ffff821660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906310ddb13790602401610fbc565b6111236125e3565b600e8190556040518181527fe88c0dceb4580b0cf5f21e0a37479f1a0e6ed1b064a0521381934a246d0fa77d906020015b60405180910390a150565b846001600160a01b03811633146111795761117933612792565b6111868686868686612854565b505050505050565b61ffff8316600090815260016020526040812080548291906111af90614dbb565b80601f01602080910402602001604051908101604052809291908181526020018280546111db90614dbb565b80156112285780601f106111fd57610100808354040283529160200191611228565b820191906000526020600020905b81548152906001019060200180831161120b57829003601f168201915b50505050509050838360405161123f929190614df5565b60405180910390208180519060200120149150509392505050565b6112626128ab565b600087815260116020908152604091829020825160808101845281546001600160a01b039081168083526001840154821694830194909452600283015481169482019490945260039091015490921660608301526112fb5760405163eac0d38960e01b81526020600482015260156024820152746e667444657374696e6174696f6e4164647265737360581b6044820152606401610c56565b341561137b57600081602001516001600160a01b03163460405160006040518083038185875af1925050503d8060008114611352576040519150601f19603f3d011682016040523d82523d6000602084013e611357565b606091505b5050905080611379576040516313ff771f60e21b815260040160405180910390fd5b505b82156113a5576113a561138c612520565b6040830151600d546001600160a01b0316919086612904565b8515611433576114336113b6612520565b826000015189898080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020808d0282810182019093528c82529093508c92508b918291850190849080828437600092018290525060408051602081019091529081529250612964915050565b80606001516001600160a01b031663b2df0c9161144e612520565b8360000151846020015185604001518d8d8d8d8d348e8e6040518d63ffffffff1660e01b815260040161148c9c9b9a99989796959493929190614ea5565b600060405180830381600087803b1580156114a657600080fd5b505af11580156114ba573d6000803e3d6000fd5b505050506114c6612520565b6001600160a01b03167f22d5a12109c94604d2deb36dacfb8c60c2dab29e45b43db333bc3dc5628b508c8260000151836020015184604001518c8c8c8c8c348d8d60405161151e9b9a99989796959493929190614f32565b60405180910390a250610e0a6001600a55565b6115396125e3565b6040516342d65a8d60e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906342d65a8d9061158990869086908690600401614fe0565b600060405180830381600087803b1580156115a357600080fd5b505af1158015610e0a573d6000803e3d6000fd5b6115c78888888888888888612b06565b5050505050505050565b6115c78888886115e089612ced565b6115e989612ced565b888888612b06565b606081518351146116565760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e677468604482015268040dad2e6dac2e8c6d60bb1b6064820152608401610c56565b600083516001600160401b0381111561167157611671614268565b60405190808252806020026020018201604052801561169a578160200160208202803683370190505b50905060005b8451811015611712576116e58582815181106116be576116be614e05565b60200260200101518583815181106116d8576116d8614e05565b6020026020010151610e13565b8282815181106116f7576116f7614e05565b602090810291909101015261170b81614ffe565b90506116a0565b509392505050565b6000546001600160a01b0316331461174557604051635fc483c560e01b815260040160405180910390fd5b600c54600160a01b900460ff161561177057604051631551a48f60e11b815260040160405180910390fd5b600c80546001600160a81b031916600160a01b1790556040517f51e2d870cc2e10853e38dc06fcdae46ad3c3f588f326608803dac6204541ad1690600090a1565b306117ba612520565b6001600160a01b03161461181f5760405162461bcd60e51b815260206004820152602660248201527f4e6f6e626c6f636b696e674c7a4170703a2063616c6c6572206d7573742062656044820152650204c7a4170760d41b6064820152608401610c56565b6111868686868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f890181900481028201810190925287815289935091508790879081908401838280828437600092019190915250612d3892505050565b61189d6125e3565b6118a76000612e85565b565b60016020526000908152604090208054610ee790614dbb565b6000806118e388886118d389612ced565b6118dc89612ced565b8888611abc565b91509150965096945050505050565b905090565b60108054610ee790614dbb565b61ffff811660009081526001602052604081208054606092919061192790614dbb565b80601f016020809104026020016040519081016040528092919081815260200182805461195390614dbb565b80156119a05780601f10611975576101008083540402835291602001916119a0565b820191906000526020600020905b81548152906001019060200180831161198357829003601f168201915b5050505050905080516000036119f85760405162461bcd60e51b815260206004820152601d60248201527f4c7a4170703a206e6f20747275737465642070617468207265636f72640000006044820152606401610c56565b611a13600060148351611a0b9190614e31565b839190612ed5565b9392505050565b81611a2481612792565b611a2e8383612fe2565b505050565b611a3b6125e3565b818130604051602001611a5093929190615017565b60408051601f1981840301815291815261ffff8516600090815260016020522090611a7b9082615083565b507f8c0400cfe2d1199b1a725c78960bcc2a344d869b80590d0f2bd005db15a572ce838383604051611aaf93929190614fe0565b60405180910390a1505050565b6000806000878787604051602001611ad693929190615142565b60408051601f198184030181529082905263040a7bb160e41b825291506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906340a7bb1090611b3a908c90309086908b908b90600401615185565b6040805180830381865afa158015611b56573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b7a91906151d9565b9250925050965096945050505050565b6000546001600160a01b03163314611bb557604051635fc483c560e01b815260040160405180910390fd5b600c54600160a01b900460ff1615611be057604051631551a48f60e11b815260040160405180910390fd5b600c80546001600160a01b0319166001600160a01b0383169081179091556040519081527f9f513fe86dc42fdbac355fa4d9b1d5be7b5e6cd2df67e30db8003766568de47690602001611154565b611c366125e3565b600480546001600160a01b0319166001600160a01b0383169081179091556040519081527f5db758e995a17ec1ad84bdef7e8c3293a0bd6179bcce400dff5d4c3d87db726b90602001611154565b611c8c6125e3565b6001600160a01b038416611cdc5760405163eac0d38960e01b81526020600482015260166024820152755f6e667444657374696e6174696f6e4164647265737360501b6044820152606401610c56565b6001600160a01b038316611d335760405163eac0d38960e01b815260206004820152601960248201527f5f6e617469766544657374696e6174696f6e41646472657373000000000000006044820152606401610c56565b6001600160a01b038216611d8a5760405163eac0d38960e01b815260206004820152601860248201527f5f7072696d6544657374696e6174696f6e4164647265737300000000000000006044820152606401610c56565b6001600160a01b038116611dd75760405163eac0d38960e01b81526020600482015260136024820152722fb4b73b37b5b2a9b832b7322430b7323632b960691b6044820152606401610c56565b6040805160808101825260008082526020820181905291810182905260608101919091526001600160a01b038086168252848116602080840191825285831660408086019182528685166060870181815260008d8152601190955293829020875181549088166001600160a01b031991821617825595516001820180549189169188169190911790559251600284018054918816918716919091179055925160039092018054929095169190931617909255517fc6585b715e4e4d65ba998b5d6d8b2939ef59234fddbef27f65da5760797d1db890611ed9908890889088906001600160a01b0393841681529183166020830152909116604082015260600190565b60405180910390a2505050505050565b611ef16125e3565b600d80546001600160a01b0319166001600160a01b0383169081179091556040519081527f28dc85adb866d4555dd543eee6402e166946866789393fc338106d346a15af3090602001611154565b611f476125e3565b6040516332fb62e760e21b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063cbed8b9c90611f9b90889088908890889088906004016151fd565b600060405180830381600087803b158015611fb557600080fd5b505af1158015611fc9573d6000803e3d6000fd5b505050505050505050565b61ffff86166000908152600560205260408082209051611ff79088908890614df5565b90815260408051602092819003830190206001600160401b038716600090815292529020549050806120775760405162461bcd60e51b815260206004820152602360248201527f4e6f6e626c6f636b696e674c7a4170703a206e6f2073746f726564206d65737360448201526261676560e81b6064820152608401610c56565b808383604051612088929190614df5565b6040518091039020146120e75760405162461bcd60e51b815260206004820152602160248201527f4e6f6e626c6f636b696e674c7a4170703a20696e76616c6964207061796c6f616044820152601960fa1b6064820152608401610c56565b61ffff8716600090815260056020526040808220905161210a9089908990614df5565b90815260408051602092819003830181206001600160401b038916600090815290845282902093909355601f880182900482028301820190528682526121a2918991899089908190840183828082843760009201919091525050604080516020601f8a018190048102820181019092528881528a935091508890889081908401838280828437600092019190915250612d3892505050565b7fc264d91f3adc5588250e1551f547752ca0cfa8f6b530d243b9f9f4cab10ea8e587878787856040516121d995949392919061522b565b60405180910390a150505050505050565b6121f26125e3565b600b80546001600160a01b0319166001600160a01b0383161790556040516001600160a01b03821681527fd91237492a9e30cd2faf361fc103998a382ff0ec2b1b07dc1cbebb76ae2f1ea290602001611154565b61224e6125e3565b600081116122965760405162461bcd60e51b81526020600482015260156024820152744c7a4170703a20696e76616c6964206d696e47617360581b6044820152606401610c56565b61ffff83811660008181526002602090815260408083209487168084529482529182902085905581519283528201929092529081018290527f9d5c7c0b934da8fefa9c7760c98383778a12dfbfc0c3b3106518f43fb9508ac090606001611aaf565b6123006125e3565b6006805460ff19168215159081179091556040519081527f1584ad594a70cbe1e6515592e1272a987d922b097ead875069cebe8b40c004a490602001611154565b6123496125e3565b61ffff83166000908152600160205260409020612367828483615266565b507ffa41487ad5d6728f0b19276fa1eddc16558578f5109fc39d2dc33c3230470dab838383604051611aaf93929190614fe0565b846001600160a01b03811633146123b5576123b533612792565b6111868686868686612ff4565b6123ca6125e3565b6001600160a01b03811661242f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610c56565b610ed781612e85565b604051633d7b2f6f60e21b815261ffff808616600483015284166024820152306044820152606481018290526060907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063f5ecbdbc90608401600060405180830381865afa1580156124b8573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526124e0919081019061537d565b90505b949350505050565b6000601436108015906125085750600b546001600160a01b031633145b1561251a575060131936013560601c90565b50335b90565b60006118f26124eb565b60008061258d5a60966366ad5c8a60e01b8989898960405160240161255294939291906153b1565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091523092919061304b565b91509150816111865761118686868686856130d5565b60006001600160e01b03198216636cdb3d1360e11b14806125d457506001600160e01b031982166303a24d0760e21b145b80610ea35750610ea382613172565b6125eb612520565b6001600160a01b03166126066000546001600160a01b031690565b6001600160a01b0316146118a75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610c56565b60096126688282615083565b5050565b60606009805461267b90614dbb565b80601f01602080910402602001604051908101604052809291908181526020018280546126a790614dbb565b80156126f45780601f106126c9576101008083540402835291602001916126f4565b820191906000526020600020905b8154815290600101906020018083116126d757829003601f168201915b50505050509050919050565b6060600061270d836131a7565b60010190506000816001600160401b0381111561272c5761272c614268565b6040519080825280601f01601f191660200182016040528015612756576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a850494508461276057509392505050565b600c546001600160a01b031680158015906127b757506000816001600160a01b03163b115b1561266857604051633185c44d60e21b81523060048201526001600160a01b03838116602483015282169063c617113490604401602060405180830381865afa158015612808573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061282c91906153ef565b61266857604051633b79c77360e21b81526001600160a01b0383166004820152602401610c56565b61285c612520565b6001600160a01b0316856001600160a01b03161480612882575061288285610ac9612520565b61289e5760405162461bcd60e51b8152600401610c569061540c565b610fea8585858585612964565b6002600a54036128fd5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610c56565b6002600a55565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261295e90859061327f565b50505050565b81518351146129855760405162461bcd60e51b8152600401610c569061545a565b6001600160a01b0384166129ab5760405162461bcd60e51b8152600401610c56906154a2565b60006129b5612520565b905060005b8451811015612aa05760008582815181106129d7576129d7614e05565b6020026020010151905060008583815181106129f5576129f5614e05565b60209081029190910181015160008481526007835260408082206001600160a01b038e168352909352919091205490915081811015612a465760405162461bcd60e51b8152600401610c56906154e7565b60008381526007602090815260408083206001600160a01b038e8116855292528083208585039055908b16825281208054849290612a85908490615531565b9250508190555050505080612a9990614ffe565b90506129ba565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051612af0929190615544565b60405180910390a4611186818787878787613351565b612b1388888888886134ac565b6000868686604051602001612b2a93929190615142565b60405160208183030381529060405290508551600103612c2f5760065460ff1615612b6257612b5d8860018460006134dd565b612b81565b815115612b815760405162461bcd60e51b8152600401610c5690615569565b612b8f8882868686346135bc565b86604051612b9d91906155ad565b6040518091039020896001600160a01b03168961ffff167f968b0d61ebcf43e5d76ed87bd2c4ee2f22b4969b9f4ca49e3373c025eddd5eeb89600081518110612be857612be8614e05565b602002602001015189600081518110612c0357612c03614e05565b6020026020010151604051612c22929190918252602082015260400190565b60405180910390a4611fc9565b600186511115611fc95760065460ff1615612c5757612c528860028460006134dd565b612c76565b815115612c765760405162461bcd60e51b8152600401610c5690615569565b612c848882868686346135bc565b86604051612c9291906155ad565b6040518091039020896001600160a01b03168961ffff167fddd15f7cfbd674ac2096d598f1650367f8a8bd72b4e3abd85591099ea3b57e338989604051612cda929190615544565b60405180910390a4505050505050505050565b60408051600180825281830190925260609160009190602080830190803683370190505090508281600081518110612d2757612d27614e05565b602090810291909101015292915050565b600080600083806020019051810190612d51919061562f565b60148301519295509093509150612d6a88828585613761565b8251600103612e1357806001600160a01b031687604051612d8b91906155ad565b60405180910390208961ffff167f1bf64e58d19fc43de4c44b3d1bb1fae313979af831a7a39f3297564294329f0f86600081518110612dcc57612dcc614e05565b602002602001015186600081518110612de757612de7614e05565b6020026020010151604051612e06929190918252602082015260400190565b60405180910390a46115c7565b6001835111156115c757806001600160a01b031687604051612e3591906155ad565b60405180910390208961ffff167f1ae08edbbcd7baa8d064835de8593ce16b313414525ac89534e349f4da7926e48686604051612e73929190615544565b60405180910390a45050505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b606081612ee381601f615531565b1015612f225760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b6044820152606401610c56565b612f2c8284615531565b84511015612f705760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b6044820152606401610c56565b606082158015612f8f5760405191506000825260208201604052612fd9565b6040519150601f8416801560200281840101858101878315602002848b0101015b81831015612fc8578051835260209283019201612fb0565b5050858452601f01601f1916604052505b50949350505050565b612668612fed612520565b838361377c565b612ffc612520565b6001600160a01b0316856001600160a01b03161480613022575061302285610ac9612520565b61303e5760405162461bcd60e51b8152600401610c569061540c565b610fea858585858561385c565b6000606060008060008661ffff166001600160401b0381111561307057613070614268565b6040519080825280601f01601f19166020018201604052801561309a576020820181803683370190505b50905060008087516020890160008d8df191503d9250868311156130bc578692505b828152826000602083013e909890975095505050505050565b8180519060200120600560008761ffff1661ffff1681526020019081526020016000208560405161310691906155ad565b9081526040805191829003602090810183206001600160401b0388166000908152915220919091557fe183f33de2837795525b4792ca4cd60535bd77c53b7e7030060bfcf5734d6b0c9061316390879087908790879087906156b6565b60405180910390a15050505050565b60006001600160e01b031982166319abbbbb60e11b1480610ea357506301ffc9a760e01b6001600160e01b0319831614610ea3565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106131e65772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310613212576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061323057662386f26fc10000830492506010015b6305f5e1008310613248576305f5e100830492506008015b612710831061325c57612710830492506004015b6064831061326e576064830492506002015b600a8310610ea35760010192915050565b60006132d4826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661398a9092919063ffffffff16565b805190915015611a2e57808060200190518101906132f291906153ef565b611a2e5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610c56565b6001600160a01b0384163b156111865760405163bc197c8160e01b81526001600160a01b0385169063bc197c81906133959089908990889088908890600401615708565b6020604051808303816000875af19250505080156133d0575060408051601f3d908101601f191682019092526133cd91810190615746565b60015b61347c576133dc615763565b806308c379a00361341557506133f061577e565b806133fb5750613417565b8060405162461bcd60e51b8152600401610c5691906143af565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e2d455243313135356044820152732932b1b2b4bb32b91034b6b83632b6b2b73a32b960611b6064820152608401610c56565b6001600160e01b0319811663bc197c8160e01b14610e0a5760405162461bcd60e51b8152600401610c5690615807565b600e54825111156134d057604051633550b5c160e21b815260040160405180910390fd5b610fea8585858585613999565b60006134e883613a59565b61ffff80871660009081526002602090815260408083209389168352929052908120549192509061351a908490615531565b90506000811161356c5760405162461bcd60e51b815260206004820152601a60248201527f4c7a4170703a206d696e4761734c696d6974206e6f74207365740000000000006044820152606401610c56565b808210156111865760405162461bcd60e51b815260206004820152601b60248201527f4c7a4170703a20676173206c696d697420697320746f6f206c6f7700000000006044820152606401610c56565b61ffff8616600090815260016020526040812080546135da90614dbb565b80601f016020809104026020016040519081016040528092919081815260200182805461360690614dbb565b80156136535780601f1061362857610100808354040283529160200191613653565b820191906000526020600020905b81548152906001019060200180831161363657829003601f168201915b5050505050905080516000036136c45760405162461bcd60e51b815260206004820152603060248201527f4c7a4170703a2064657374696e6174696f6e20636861696e206973206e6f742060448201526f61207472757374656420736f7572636560801b6064820152608401610c56565b6136cf878751613ab5565b60405162c5803160e81b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c5803100908490613726908b9086908c908c908c908c9060040161584f565b6000604051808303818588803b15801561373f57600080fd5b505af1158015613753573d6000803e3d6000fd5b505050505050505050505050565b61295e83838360405180602001604052806000815250613b26565b816001600160a01b0316836001600160a01b0316036137ef5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c20737461747573604482015268103337b91039b2b63360b91b6064820152608401610c56565b6001600160a01b03838116600081815260086020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b0384166138825760405162461bcd60e51b8152600401610c56906154a2565b600061388c612520565b9050600061389985612ced565b905060006138a685612ced565b905060008681526007602090815260408083206001600160a01b038c168452909152902054858110156138eb5760405162461bcd60e51b8152600401610c56906154e7565b60008781526007602090815260408083206001600160a01b038d8116855292528083208985039055908a1682528120805488929061392a908490615531565b909155505060408051888152602081018890526001600160a01b03808b16928c821692918816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4611fc9848a8a8a8a8a613cb7565b60606124e38484600085613d72565b60006139a3612520565b9050856001600160a01b0316816001600160a01b031614806139ea57506001600160a01b0380871660009081526008602090815260408083209385168352929052205460ff165b613a4e5760405162461bcd60e51b815260206004820152602f60248201527f4f4e4654313135353a2073656e642063616c6c6572206973206e6f74206f776e60448201526e195c881b9bdc88185c1c1c9bdd9959608a1b6064820152608401610c56565b611186868484613e4d565b6000602282511015613aad5760405162461bcd60e51b815260206004820152601c60248201527f4c7a4170703a20696e76616c69642061646170746572506172616d73000000006044820152606401610c56565b506022015190565b61ffff821660009081526003602052604081205490819003613ad657506127105b80821115611a2e5760405162461bcd60e51b815260206004820181905260248201527f4c7a4170703a207061796c6f61642073697a6520697320746f6f206c617267656044820152606401610c56565b6001600160a01b038416613b865760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f206164647265736044820152607360f81b6064820152608401610c56565b8151835114613ba75760405162461bcd60e51b8152600401610c569061545a565b6000613bb1612520565b905060005b8451811015613c4f57838181518110613bd157613bd1614e05565b602002602001015160076000878481518110613bef57613bef614e05565b602002602001015181526020019081526020016000206000886001600160a01b03166001600160a01b031681526020019081526020016000206000828254613c379190615531565b90915550819050613c4781614ffe565b915050613bb6565b50846001600160a01b031660006001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051613ca0929190615544565b60405180910390a4610fea81600087878787613351565b6001600160a01b0384163b156111865760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e6190613cfb90899089908890889088906004016158b6565b6020604051808303816000875af1925050508015613d36575060408051601f3d908101601f19168201909252613d3391810190615746565b60015b613d42576133dc615763565b6001600160e01b0319811663f23a6e6160e01b14610e0a5760405162461bcd60e51b8152600401610c5690615807565b606082471015613dd35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610c56565b600080866001600160a01b03168587604051613def91906155ad565b60006040518083038185875af1925050503d8060008114613e2c576040519150601f19603f3d011682016040523d82523d6000602084013e613e31565b606091505b5091509150613e428783838761405c565b979650505050505050565b6001600160a01b038316613eaf5760405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201526265737360e81b6064820152608401610c56565b8051825114613ed05760405162461bcd60e51b8152600401610c569061545a565b6000613eda612520565b604080516020810190915260009052905060005b8351811015613fef576000848281518110613f0b57613f0b614e05565b602002602001015190506000848381518110613f2957613f29614e05565b60209081029190910181015160008481526007835260408082206001600160a01b038c168352909352919091205490915081811015613fb65760405162461bcd60e51b8152602060048201526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c604482015263616e636560e01b6064820152608401610c56565b60009283526007602090815260408085206001600160a01b038b1686529091529092209103905580613fe781614ffe565b915050613eee565b5060006001600160a01b0316846001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8686604051614040929190615544565b60405180910390a460408051602081019091526000905261295e565b606083156140cb5782516000036140c4576001600160a01b0385163b6140c45760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610c56565b50816124e3565b6124e383838151156133fb5781518083602001fd5b803561ffff811681146140f257600080fd5b919050565b60008083601f84011261410957600080fd5b5081356001600160401b0381111561412057600080fd5b60208301915083602082850101111561413857600080fd5b9250929050565b80356001600160401b03811681146140f257600080fd5b6000806000806000806080878903121561416f57600080fd5b614178876140e0565b955060208701356001600160401b038082111561419457600080fd5b6141a08a838b016140f7565b90975095508591506141b460408a0161413f565b945060608901359150808211156141ca57600080fd5b506141d789828a016140f7565b979a9699509497509295939492505050565b6001600160a01b0381168114610ed757600080fd5b80356140f2816141e9565b6000806040838503121561421c57600080fd5b8235614227816141e9565b946020939093013593505050565b6001600160e01b031981168114610ed757600080fd5b60006020828403121561425d57600080fd5b8135611a1381614235565b634e487b7160e01b600052604160045260246000fd5b601f8201601f191681016001600160401b03811182821017156142a3576142a3614268565b6040525050565b60006001600160401b038211156142c3576142c3614268565b50601f01601f191660200190565b60006142dc836142aa565b6040516142e9828261427e565b8092508481528585850111156142fe57600080fd5b8484602083013760006020868301015250509392505050565b60006020828403121561432957600080fd5b81356001600160401b0381111561433f57600080fd5b8201601f8101841361435057600080fd5b6124e3848235602084016142d1565b60005b8381101561437a578181015183820152602001614362565b50506000910152565b6000815180845261439b81602086016020860161435f565b601f01601f19169290920160200192915050565b602081526000611a136020830184614383565b6000602082840312156143d457600080fd5b611a13826140e0565b600080604083850312156143f057600080fd5b614227836140e0565b60006020828403121561440b57600080fd5b5035919050565b60006001600160401b0382111561442b5761442b614268565b5060051b60200190565b600082601f83011261444657600080fd5b8135602061445382614412565b604051614460828261427e565b83815260059390931b850182019282810191508684111561448057600080fd5b8286015b8481101561449b5780358352918301918301614484565b509695505050505050565b600082601f8301126144b757600080fd5b611a13838335602085016142d1565b600080600080600060a086880312156144de57600080fd5b85356144e9816141e9565b945060208601356144f9816141e9565b935060408601356001600160401b038082111561451557600080fd5b61452189838a01614435565b9450606088013591508082111561453757600080fd5b61454389838a01614435565b9350608088013591508082111561455957600080fd5b50614566888289016144a6565b9150509295509295909350565b60008060006040848603121561458857600080fd5b614591846140e0565b925060208401356001600160401b038111156145ac57600080fd5b6145b8868287016140f7565b9497909650939450505050565b60008083601f8401126145d757600080fd5b5081356001600160401b038111156145ee57600080fd5b6020830191508360208260051b850101111561413857600080fd5b600080600080600080600060a0888a03121561462457600080fd5b8735965060208801356001600160401b038082111561464257600080fd5b61464e8b838c016145c5565b909850965060408a013591508082111561466757600080fd5b6146738b838c016145c5565b909650945060608a0135935060808a013591508082111561469357600080fd5b506146a08a828b016144a6565b91505092959891949750929550565b600080600080600080600080610100898b0312156146cc57600080fd5b6146d5896141fe565b97506146e360208a016140e0565b965060408901356001600160401b03808211156146ff57600080fd5b61470b8c838d016144a6565b975060608b013591508082111561472157600080fd5b61472d8c838d01614435565b965060808b013591508082111561474357600080fd5b61474f8c838d01614435565b955061475d60a08c016141fe565b945061476b60c08c016141fe565b935060e08b013591508082111561478157600080fd5b5061478e8b828c016144a6565b9150509295985092959890939650565b600080600080600080600080610100898b0312156147bb57600080fd5b88356147c6816141e9565b97506147d460208a016140e0565b965060408901356001600160401b03808211156147f057600080fd5b6147fc8c838d016144a6565b975060608b0135965060808b0135955060a08b0135915061481c826141e9565b90935060c08a01359061482e826141e9565b90925060e08a0135908082111561478157600080fd5b6000806040838503121561485757600080fd5b82356001600160401b038082111561486e57600080fd5b818501915085601f83011261488257600080fd5b8135602061488f82614412565b60405161489c828261427e565b83815260059390931b85018201928281019150898411156148bc57600080fd5b948201945b838610156148e35785356148d4816141e9565b825294820194908201906148c1565b965050860135925050808211156148f957600080fd5b5061490685828601614435565b9150509250929050565b600081518084526020808501945080840160005b8381101561494057815187529582019590820190600101614924565b509495945050505050565b602081526000611a136020830184614910565b60006020828403121561497057600080fd5b8135611a13816141e9565b60008060006060848603121561499057600080fd5b614999846140e0565b925060208401356001600160401b038111156149b457600080fd5b6149c0868287016144a6565b9250506149cf6040850161413f565b90509250925092565b8015158114610ed757600080fd5b80356140f2816149d8565b60008060008060008060c08789031215614a0a57600080fd5b614a13876140e0565b955060208701356001600160401b0380821115614a2f57600080fd5b614a3b8a838b016144a6565b9650604089013595506060890135945060808901359150614a5b826149d8565b90925060a08801359080821115614a7157600080fd5b50614a7e89828a016144a6565b9150509295509295509295565b60008060408385031215614a9e57600080fd5b614aa7836140e0565b9150614ab5602084016140e0565b90509250929050565b60008060408385031215614ad157600080fd5b8235614adc816141e9565b91506020830135614aec816149d8565b809150509250929050565b60008060008060008060c08789031215614b1057600080fd5b614b19876140e0565b955060208701356001600160401b0380821115614b3557600080fd5b614b418a838b016144a6565b96506040890135915080821115614b5757600080fd5b614b638a838b01614435565b95506060890135915080821115614b7957600080fd5b614b858a838b01614435565b9450614b9360808a016149e6565b935060a0890135915080821115614a7157600080fd5b600080600080600060a08688031215614bc157600080fd5b853594506020860135614bd3816141e9565b93506040860135614be3816141e9565b92506060860135614bf3816141e9565b91506080860135614c03816141e9565b809150509295509295909350565b600080600080600060808688031215614c2957600080fd5b614c32866140e0565b9450614c40602087016140e0565b93506040860135925060608601356001600160401b03811115614c6257600080fd5b614c6e888289016140f7565b969995985093965092949392505050565b600080600060608486031215614c9457600080fd5b614c9d846140e0565b9250614cab602085016140e0565b9150604084013590509250925092565b60008060408385031215614cce57600080fd5b8235614cd9816141e9565b91506020830135614aec816141e9565b600060208284031215614cfb57600080fd5b8135611a13816149d8565b600080600080600060a08688031215614d1e57600080fd5b8535614d29816141e9565b94506020860135614d39816141e9565b9350604086013592506060860135915060808601356001600160401b03811115614d6257600080fd5b614566888289016144a6565b60008060008060808587031215614d8457600080fd5b614d8d856140e0565b9350614d9b602086016140e0565b92506040850135614dab816141e9565b9396929550929360600135925050565b600181811c90821680614dcf57607f821691505b602082108103614def57634e487b7160e01b600052602260045260246000fd5b50919050565b8183823760009101908152919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b81810381811115610ea357610ea3614e1b565b60008351614e5681846020880161435f565b835190830190614e6a81836020880161435f565b01949350505050565b81835260006001600160fb1b03831115614e8c57600080fd5b8260051b80836020870137939093016020019392505050565b6001600160a01b038d811682528c811660208301528b811660408301528a1660608201526080810189905261014060a08201819052600090614eea908301898b614e73565b82810360c0840152614efd81888a614e73565b90508560e084015284610100840152828103610120840152614f1f8185614383565b9f9e505050505050505050505050505050565b6001600160a01b038c811682528b811660208301528a1660408201526060810189905261012060808201819052600090614f6f8382018a8c614e73565b905082810360a0840152614f8481888a614e73565b90508560c08401528460e0840152828103610100840152614fa58185614383565b9e9d5050505050505050505050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b61ffff841681526040602082015260006124e0604083018486614fb7565b60006001820161501057615010614e1b565b5060010190565b8284823760609190911b6bffffffffffffffffffffffff19169101908152601401919050565b601f821115611a2e57600081815260208120601f850160051c810160208610156150645750805b601f850160051c820191505b8181101561118657828155600101615070565b81516001600160401b0381111561509c5761509c614268565b6150b0816150aa8454614dbb565b8461503d565b602080601f8311600181146150e557600084156150cd5750858301515b600019600386901b1c1916600185901b178555611186565b600085815260208120601f198616915b82811015615114578886015182559484019460019091019084016150f5565b50858210156151325787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6060815260006151556060830186614383565b82810360208401526151678186614910565b9050828103604084015261517b8185614910565b9695505050505050565b61ffff861681526001600160a01b038516602082015260a0604082018190526000906151b390830186614383565b841515606084015282810360808401526151cd8185614383565b98975050505050505050565b600080604083850312156151ec57600080fd5b505080516020909101519092909150565b600061ffff808816835280871660208401525084604083015260806060830152613e42608083018486614fb7565b61ffff86168152608060208201526000615249608083018688614fb7565b6001600160401b0394909416604083015250606001529392505050565b6001600160401b0383111561527d5761527d614268565b6152918361528b8354614dbb565b8361503d565b6000601f8411600181146152c557600085156152ad5750838201355b600019600387901b1c1916600186901b178355610fea565b600083815260209020601f19861690835b828110156152f657868501358255602094850194600190920191016152d6565b50868210156153135760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b600082601f83011261533657600080fd5b8151615341816142aa565b60405161534e828261427e565b82815285602084870101111561536357600080fd5b61537483602083016020880161435f565b95945050505050565b60006020828403121561538f57600080fd5b81516001600160401b038111156153a557600080fd5b6124e384828501615325565b61ffff851681526080602082015260006153ce6080830186614383565b6001600160401b03851660408401528281036060840152613e428185614383565b60006020828403121561540157600080fd5b8151611a13816149d8565b6020808252602e908201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60408201526d195c881bdc88185c1c1c9bdd995960921b606082015260800190565b60208082526028908201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206040820152670dad2e6dac2e8c6d60c31b606082015260800190565b60208082526025908201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604082015264647265737360d81b606082015260800190565b6020808252602a908201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60408201526939103a3930b739b332b960b11b606082015260800190565b80820180821115610ea357610ea3614e1b565b6040815260006155576040830185614910565b82810360208401526153748185614910565b60208082526024908201527f4c7a4170703a205f61646170746572506172616d73206d75737420626520656d604082015263383a3c9760e11b606082015260800190565b600082516155bf81846020870161435f565b9190910192915050565b600082601f8301126155da57600080fd5b815160206155e782614412565b6040516155f4828261427e565b83815260059390931b850182019282810191508684111561561457600080fd5b8286015b8481101561449b5780518352918301918301615618565b60008060006060848603121561564457600080fd5b83516001600160401b038082111561565b57600080fd5b61566787838801615325565b9450602086015191508082111561567d57600080fd5b615689878388016155c9565b9350604086015191508082111561569f57600080fd5b506156ac868287016155c9565b9150509250925092565b61ffff8616815260a0602082015260006156d360a0830187614383565b6001600160401b038616604084015282810360608401526156f48186614383565b905082810360808401526151cd8185614383565b6001600160a01b0386811682528516602082015260a06040820181905260009061573490830186614910565b82810360608401526156f48186614910565b60006020828403121561575857600080fd5b8151611a1381614235565b600060033d111561251d5760046000803e5060005160e01c90565b600060443d101561578c5790565b6040516003193d81016004833e81513d6001600160401b0381602484011181841117156157bb57505050505090565b82850191508151818111156157d35750505050505090565b843d87010160208285010111156157ed5750505050505090565b6157fc6020828601018761427e565b509095945050505050565b60208082526028908201527f455243313135353a204552433131353552656365697665722072656a656374656040820152676420746f6b656e7360c01b606082015260800190565b61ffff8716815260c06020820152600061586c60c0830188614383565b828103604084015261587e8188614383565b6001600160a01b0387811660608601528616608085015283810360a085015290506158a98185614383565b9998505050505050505050565b6001600160a01b03868116825285166020820152604081018490526060810183905260a060808201819052600090613e429083018461438356fea2646970667358221220f4dd4093debae72276ef17fb67b5e51c1c5af634bfa47f37c8075b28c8f132df64736f6c6343000811003368747470733a2f2f6e6674646174612e706172616c6c656c6e66742e636f6d2f6170692f746f6b656e732f706172616c6c656c2d616c7068612f697066732f7b69647d000000000000000000000000b6319cc6c8c27a8f5daf0dd3df91ea35c4720dd700000000000000000000000023b9e4193419981bee723741be305a590078217d
Deployed Bytecode
0x60806040526004361061038a5760003560e01c80638cfd8f5c116101dc578063c92daad611610102578063e985e9c5116100a0578063ed629c5c1161006f578063ed629c5c14610b58578063f242432a14610b72578063f2fde38b14610b92578063f5ecbdbc14610bb257600080fd5b8063e985e9c514610aae578063eab45d9c14610af7578063eb8d72b714610b17578063ecba222a14610b3757600080fd5b8063ce1b815f116100dc578063ce1b815f14610a3d578063d1deba1f14610a5b578063da74222814610a6e578063df2a5b3b14610a8e57600080fd5b8063c92daad6146109dd578063c9e18c6f146109fd578063cbed8b9c14610a1d57600080fd5b8063af3fb21c1161017a578063b8d1e53211610149578063b8d1e53214610967578063baf3292d14610987578063c4461834146109a7578063c7ee005e146109bd57600080fd5b8063af3fb21c146108de578063b0ccc31e146108f3578063b253566314610913578063b353aaa71461093357600080fd5b806395d89b41116101b657806395d89b41146108695780639f38369a1461087e578063a22cb4651461089e578063a6c3d165146108be57600080fd5b80638cfd8f5c146107df5780638da5cb5b14610817578063950c8a741461084957600080fd5b80633d8b38f6116102c15780634e1273f41161025f57806366ad5c8a1161022e57806366ad5c8a14610755578063715018a6146107755780637533d7881461078a5780638608e5f8146107aa57600080fd5b80634e1273f414610695578063572b6c05146106c25780635b8c41e6146106f15780635ef9432a1461074057600080fd5b806342d65a8d1161029b57806342d65a8d1461063a578063447705151461065a5780634ab4e6871461066f5780634db8226a1461068257600080fd5b80633d8b38f6146105da5780633e112e57146105fa5780633f1f4fa41461060d57600080fd5b80630e89341c1161032e578063149e3e1f11610308578063149e3e1f1461055c578063161e6e561461058457806324e4c043146105a45780632eb2c2d6146105ba57600080fd5b80630e89341c1461049657806310ddb137146104b6578063111cdc90146104d657600080fd5b806302fe53051161036a57806302fe53051461041457806306fdde031461043457806307e0db17146104565780630df374831461047657600080fd5b80621d35671461038f578062fdd58e146103b157806301ffc9a7146103e4575b600080fd5b34801561039b57600080fd5b506103af6103aa366004614156565b610bd2565b005b3480156103bd57600080fd5b506103d16103cc366004614209565b610e13565b6040519081526020015b60405180910390f35b3480156103f057600080fd5b506104046103ff36600461424b565b610ea9565b60405190151581526020016103db565b34801561042057600080fd5b506103af61042f366004614317565b610ec6565b34801561044057600080fd5b50610449610eda565b6040516103db91906143af565b34801561046257600080fd5b506103af6104713660046143c2565b610f68565b34801561048257600080fd5b506103af6104913660046143dd565b610ff1565b3480156104a257600080fd5b506104496104b13660046143f9565b611010565b3480156104c257600080fd5b506103af6104d13660046143c2565b6110c3565b3480156104e257600080fd5b506105296104f13660046143f9565b60116020526000908152604090208054600182015460028301546003909301546001600160a01b039283169391831692918216911684565b604080516001600160a01b03958616815293851660208501529184169183019190915290911660608201526080016103db565b34801561056857600080fd5b50610571600281565b60405161ffff90911681526020016103db565b34801561059057600080fd5b506103af61059f3660046143f9565b61111b565b3480156105b057600080fd5b506103d1600e5481565b3480156105c657600080fd5b506103af6105d53660046144c6565b61115f565b3480156105e657600080fd5b506104046105f5366004614573565b61118e565b6103af610608366004614609565b61125a565b34801561061957600080fd5b506103d16106283660046143c2565b60036020526000908152604090205481565b34801561064657600080fd5b506103af610655366004614573565b611531565b34801561066657600080fd5b506103d1600081565b6103af61067d3660046146af565b6115b7565b6103af61069036600461479e565b6115d1565b3480156106a157600080fd5b506106b56106b0366004614844565b6115f1565b6040516103db919061494b565b3480156106ce57600080fd5b506104046106dd36600461495e565b600b546001600160a01b0391821691161490565b3480156106fd57600080fd5b506103d161070c36600461497b565b6005602090815260009384526040808520845180860184018051928152908401958401959095209452929052825290205481565b34801561074c57600080fd5b506103af61171a565b34801561076157600080fd5b506103af610770366004614156565b6117b1565b34801561078157600080fd5b506103af611895565b34801561079657600080fd5b506104496107a53660046143c2565b6118a9565b3480156107b657600080fd5b506107ca6107c53660046149f1565b6118c2565b604080519283526020830191909152016103db565b3480156107eb57600080fd5b506103d16107fa366004614a8b565b600260209081526000928352604080842090915290825290205481565b34801561082357600080fd5b506000546001600160a01b03165b6040516001600160a01b0390911681526020016103db565b34801561085557600080fd5b50600454610831906001600160a01b031681565b34801561087557600080fd5b506104496118f7565b34801561088a57600080fd5b506104496108993660046143c2565b611904565b3480156108aa57600080fd5b506103af6108b9366004614abe565b611a1a565b3480156108ca57600080fd5b506103af6108d9366004614573565b611a33565b3480156108ea57600080fd5b50610571600181565b3480156108ff57600080fd5b50600c54610831906001600160a01b031681565b34801561091f57600080fd5b506107ca61092e366004614af7565b611abc565b34801561093f57600080fd5b506108317f000000000000000000000000b6319cc6c8c27a8f5daf0dd3df91ea35c4720dd781565b34801561097357600080fd5b506103af61098236600461495e565b611b8a565b34801561099357600080fd5b506103af6109a236600461495e565b611c2e565b3480156109b357600080fd5b506103d161271081565b3480156109c957600080fd5b50600d54610831906001600160a01b031681565b3480156109e957600080fd5b506103af6109f8366004614ba9565b611c84565b348015610a0957600080fd5b506103af610a1836600461495e565b611ee9565b348015610a2957600080fd5b506103af610a38366004614c11565b611f3f565b348015610a4957600080fd5b50600b546001600160a01b0316610831565b6103af610a69366004614156565b611fd4565b348015610a7a57600080fd5b506103af610a8936600461495e565b6121ea565b348015610a9a57600080fd5b506103af610aa9366004614c7f565b612246565b348015610aba57600080fd5b50610404610ac9366004614cbb565b6001600160a01b03918216600090815260086020908152604080832093909416825291909152205460ff1690565b348015610b0357600080fd5b506103af610b12366004614ce9565b6122f8565b348015610b2357600080fd5b506103af610b32366004614573565b612341565b348015610b4357600080fd5b50600c5461040490600160a01b900460ff1681565b348015610b6457600080fd5b506006546104049060ff1681565b348015610b7e57600080fd5b506103af610b8d366004614d06565b61239b565b348015610b9e57600080fd5b506103af610bad36600461495e565b6123c2565b348015610bbe57600080fd5b50610449610bcd366004614d6e565b612438565b7f000000000000000000000000b6319cc6c8c27a8f5daf0dd3df91ea35c4720dd76001600160a01b0316610c04612520565b6001600160a01b031614610c5f5760405162461bcd60e51b815260206004820152601e60248201527f4c7a4170703a20696e76616c696420656e64706f696e742063616c6c6572000060448201526064015b60405180910390fd5b61ffff861660009081526001602052604081208054610c7d90614dbb565b80601f0160208091040260200160405190810160405280929190818152602001828054610ca990614dbb565b8015610cf65780601f10610ccb57610100808354040283529160200191610cf6565b820191906000526020600020905b815481529060010190602001808311610cd957829003601f168201915b50505050509050805186869050148015610d11575060008151115b8015610d39575080516020820120604051610d2f9088908890614df5565b6040518091039020145b610d945760405162461bcd60e51b815260206004820152602660248201527f4c7a4170703a20696e76616c696420736f757263652073656e64696e6720636f6044820152651b9d1c9858dd60d21b6064820152608401610c56565b610e0a8787878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8a018190048102820181019092528881528a93509150889088908190840183828082843760009201919091525061252a92505050565b50505050505050565b60006001600160a01b038316610e7e5760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a2061646472657373207a65726f206973206e6f742061207660448201526930b634b21037bbb732b960b11b6064820152608401610c56565b5060008181526007602090815260408083206001600160a01b03861684529091529020545b92915050565b60006001600160e01b031982161580610ea35750610ea3826125a3565b610ece6125e3565b610ed78161265c565b50565b600f8054610ee790614dbb565b80601f0160208091040260200160405190810160405280929190818152602001828054610f1390614dbb565b8015610f605780601f10610f3557610100808354040283529160200191610f60565b820191906000526020600020905b815481529060010190602001808311610f4357829003601f168201915b505050505081565b610f706125e3565b6040516307e0db1760e01b815261ffff821660048201527f000000000000000000000000b6319cc6c8c27a8f5daf0dd3df91ea35c4720dd76001600160a01b0316906307e0db17906024015b600060405180830381600087803b158015610fd657600080fd5b505af1158015610fea573d6000803e3d6000fd5b5050505050565b610ff96125e3565b61ffff909116600090815260036020526040902055565b6060600061101d8361266c565b9050805160000361103e575050604080516020810190915260008152919050565b604080518082019091526001808252602f60f81b60209092018290528251839161106791614e31565b8151811061107757611077614e05565b01602001516001600160f81b031916146110915792915050565b8061109b84612700565b6040516020016110ac929190614e44565b604051602081830303815290604052915050919050565b6110cb6125e3565b6040516310ddb13760e01b815261ffff821660048201527f000000000000000000000000b6319cc6c8c27a8f5daf0dd3df91ea35c4720dd76001600160a01b0316906310ddb13790602401610fbc565b6111236125e3565b600e8190556040518181527fe88c0dceb4580b0cf5f21e0a37479f1a0e6ed1b064a0521381934a246d0fa77d906020015b60405180910390a150565b846001600160a01b03811633146111795761117933612792565b6111868686868686612854565b505050505050565b61ffff8316600090815260016020526040812080548291906111af90614dbb565b80601f01602080910402602001604051908101604052809291908181526020018280546111db90614dbb565b80156112285780601f106111fd57610100808354040283529160200191611228565b820191906000526020600020905b81548152906001019060200180831161120b57829003601f168201915b50505050509050838360405161123f929190614df5565b60405180910390208180519060200120149150509392505050565b6112626128ab565b600087815260116020908152604091829020825160808101845281546001600160a01b039081168083526001840154821694830194909452600283015481169482019490945260039091015490921660608301526112fb5760405163eac0d38960e01b81526020600482015260156024820152746e667444657374696e6174696f6e4164647265737360581b6044820152606401610c56565b341561137b57600081602001516001600160a01b03163460405160006040518083038185875af1925050503d8060008114611352576040519150601f19603f3d011682016040523d82523d6000602084013e611357565b606091505b5050905080611379576040516313ff771f60e21b815260040160405180910390fd5b505b82156113a5576113a561138c612520565b6040830151600d546001600160a01b0316919086612904565b8515611433576114336113b6612520565b826000015189898080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020808d0282810182019093528c82529093508c92508b918291850190849080828437600092018290525060408051602081019091529081529250612964915050565b80606001516001600160a01b031663b2df0c9161144e612520565b8360000151846020015185604001518d8d8d8d8d348e8e6040518d63ffffffff1660e01b815260040161148c9c9b9a99989796959493929190614ea5565b600060405180830381600087803b1580156114a657600080fd5b505af11580156114ba573d6000803e3d6000fd5b505050506114c6612520565b6001600160a01b03167f22d5a12109c94604d2deb36dacfb8c60c2dab29e45b43db333bc3dc5628b508c8260000151836020015184604001518c8c8c8c8c348d8d60405161151e9b9a99989796959493929190614f32565b60405180910390a250610e0a6001600a55565b6115396125e3565b6040516342d65a8d60e01b81526001600160a01b037f000000000000000000000000b6319cc6c8c27a8f5daf0dd3df91ea35c4720dd716906342d65a8d9061158990869086908690600401614fe0565b600060405180830381600087803b1580156115a357600080fd5b505af1158015610e0a573d6000803e3d6000fd5b6115c78888888888888888612b06565b5050505050505050565b6115c78888886115e089612ced565b6115e989612ced565b888888612b06565b606081518351146116565760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e677468604482015268040dad2e6dac2e8c6d60bb1b6064820152608401610c56565b600083516001600160401b0381111561167157611671614268565b60405190808252806020026020018201604052801561169a578160200160208202803683370190505b50905060005b8451811015611712576116e58582815181106116be576116be614e05565b60200260200101518583815181106116d8576116d8614e05565b6020026020010151610e13565b8282815181106116f7576116f7614e05565b602090810291909101015261170b81614ffe565b90506116a0565b509392505050565b6000546001600160a01b0316331461174557604051635fc483c560e01b815260040160405180910390fd5b600c54600160a01b900460ff161561177057604051631551a48f60e11b815260040160405180910390fd5b600c80546001600160a81b031916600160a01b1790556040517f51e2d870cc2e10853e38dc06fcdae46ad3c3f588f326608803dac6204541ad1690600090a1565b306117ba612520565b6001600160a01b03161461181f5760405162461bcd60e51b815260206004820152602660248201527f4e6f6e626c6f636b696e674c7a4170703a2063616c6c6572206d7573742062656044820152650204c7a4170760d41b6064820152608401610c56565b6111868686868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f890181900481028201810190925287815289935091508790879081908401838280828437600092019190915250612d3892505050565b61189d6125e3565b6118a76000612e85565b565b60016020526000908152604090208054610ee790614dbb565b6000806118e388886118d389612ced565b6118dc89612ced565b8888611abc565b91509150965096945050505050565b905090565b60108054610ee790614dbb565b61ffff811660009081526001602052604081208054606092919061192790614dbb565b80601f016020809104026020016040519081016040528092919081815260200182805461195390614dbb565b80156119a05780601f10611975576101008083540402835291602001916119a0565b820191906000526020600020905b81548152906001019060200180831161198357829003601f168201915b5050505050905080516000036119f85760405162461bcd60e51b815260206004820152601d60248201527f4c7a4170703a206e6f20747275737465642070617468207265636f72640000006044820152606401610c56565b611a13600060148351611a0b9190614e31565b839190612ed5565b9392505050565b81611a2481612792565b611a2e8383612fe2565b505050565b611a3b6125e3565b818130604051602001611a5093929190615017565b60408051601f1981840301815291815261ffff8516600090815260016020522090611a7b9082615083565b507f8c0400cfe2d1199b1a725c78960bcc2a344d869b80590d0f2bd005db15a572ce838383604051611aaf93929190614fe0565b60405180910390a1505050565b6000806000878787604051602001611ad693929190615142565b60408051601f198184030181529082905263040a7bb160e41b825291506001600160a01b037f000000000000000000000000b6319cc6c8c27a8f5daf0dd3df91ea35c4720dd716906340a7bb1090611b3a908c90309086908b908b90600401615185565b6040805180830381865afa158015611b56573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b7a91906151d9565b9250925050965096945050505050565b6000546001600160a01b03163314611bb557604051635fc483c560e01b815260040160405180910390fd5b600c54600160a01b900460ff1615611be057604051631551a48f60e11b815260040160405180910390fd5b600c80546001600160a01b0319166001600160a01b0383169081179091556040519081527f9f513fe86dc42fdbac355fa4d9b1d5be7b5e6cd2df67e30db8003766568de47690602001611154565b611c366125e3565b600480546001600160a01b0319166001600160a01b0383169081179091556040519081527f5db758e995a17ec1ad84bdef7e8c3293a0bd6179bcce400dff5d4c3d87db726b90602001611154565b611c8c6125e3565b6001600160a01b038416611cdc5760405163eac0d38960e01b81526020600482015260166024820152755f6e667444657374696e6174696f6e4164647265737360501b6044820152606401610c56565b6001600160a01b038316611d335760405163eac0d38960e01b815260206004820152601960248201527f5f6e617469766544657374696e6174696f6e41646472657373000000000000006044820152606401610c56565b6001600160a01b038216611d8a5760405163eac0d38960e01b815260206004820152601860248201527f5f7072696d6544657374696e6174696f6e4164647265737300000000000000006044820152606401610c56565b6001600160a01b038116611dd75760405163eac0d38960e01b81526020600482015260136024820152722fb4b73b37b5b2a9b832b7322430b7323632b960691b6044820152606401610c56565b6040805160808101825260008082526020820181905291810182905260608101919091526001600160a01b038086168252848116602080840191825285831660408086019182528685166060870181815260008d8152601190955293829020875181549088166001600160a01b031991821617825595516001820180549189169188169190911790559251600284018054918816918716919091179055925160039092018054929095169190931617909255517fc6585b715e4e4d65ba998b5d6d8b2939ef59234fddbef27f65da5760797d1db890611ed9908890889088906001600160a01b0393841681529183166020830152909116604082015260600190565b60405180910390a2505050505050565b611ef16125e3565b600d80546001600160a01b0319166001600160a01b0383169081179091556040519081527f28dc85adb866d4555dd543eee6402e166946866789393fc338106d346a15af3090602001611154565b611f476125e3565b6040516332fb62e760e21b81526001600160a01b037f000000000000000000000000b6319cc6c8c27a8f5daf0dd3df91ea35c4720dd7169063cbed8b9c90611f9b90889088908890889088906004016151fd565b600060405180830381600087803b158015611fb557600080fd5b505af1158015611fc9573d6000803e3d6000fd5b505050505050505050565b61ffff86166000908152600560205260408082209051611ff79088908890614df5565b90815260408051602092819003830190206001600160401b038716600090815292529020549050806120775760405162461bcd60e51b815260206004820152602360248201527f4e6f6e626c6f636b696e674c7a4170703a206e6f2073746f726564206d65737360448201526261676560e81b6064820152608401610c56565b808383604051612088929190614df5565b6040518091039020146120e75760405162461bcd60e51b815260206004820152602160248201527f4e6f6e626c6f636b696e674c7a4170703a20696e76616c6964207061796c6f616044820152601960fa1b6064820152608401610c56565b61ffff8716600090815260056020526040808220905161210a9089908990614df5565b90815260408051602092819003830181206001600160401b038916600090815290845282902093909355601f880182900482028301820190528682526121a2918991899089908190840183828082843760009201919091525050604080516020601f8a018190048102820181019092528881528a935091508890889081908401838280828437600092019190915250612d3892505050565b7fc264d91f3adc5588250e1551f547752ca0cfa8f6b530d243b9f9f4cab10ea8e587878787856040516121d995949392919061522b565b60405180910390a150505050505050565b6121f26125e3565b600b80546001600160a01b0319166001600160a01b0383161790556040516001600160a01b03821681527fd91237492a9e30cd2faf361fc103998a382ff0ec2b1b07dc1cbebb76ae2f1ea290602001611154565b61224e6125e3565b600081116122965760405162461bcd60e51b81526020600482015260156024820152744c7a4170703a20696e76616c6964206d696e47617360581b6044820152606401610c56565b61ffff83811660008181526002602090815260408083209487168084529482529182902085905581519283528201929092529081018290527f9d5c7c0b934da8fefa9c7760c98383778a12dfbfc0c3b3106518f43fb9508ac090606001611aaf565b6123006125e3565b6006805460ff19168215159081179091556040519081527f1584ad594a70cbe1e6515592e1272a987d922b097ead875069cebe8b40c004a490602001611154565b6123496125e3565b61ffff83166000908152600160205260409020612367828483615266565b507ffa41487ad5d6728f0b19276fa1eddc16558578f5109fc39d2dc33c3230470dab838383604051611aaf93929190614fe0565b846001600160a01b03811633146123b5576123b533612792565b6111868686868686612ff4565b6123ca6125e3565b6001600160a01b03811661242f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610c56565b610ed781612e85565b604051633d7b2f6f60e21b815261ffff808616600483015284166024820152306044820152606481018290526060907f000000000000000000000000b6319cc6c8c27a8f5daf0dd3df91ea35c4720dd76001600160a01b03169063f5ecbdbc90608401600060405180830381865afa1580156124b8573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526124e0919081019061537d565b90505b949350505050565b6000601436108015906125085750600b546001600160a01b031633145b1561251a575060131936013560601c90565b50335b90565b60006118f26124eb565b60008061258d5a60966366ad5c8a60e01b8989898960405160240161255294939291906153b1565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091523092919061304b565b91509150816111865761118686868686856130d5565b60006001600160e01b03198216636cdb3d1360e11b14806125d457506001600160e01b031982166303a24d0760e21b145b80610ea35750610ea382613172565b6125eb612520565b6001600160a01b03166126066000546001600160a01b031690565b6001600160a01b0316146118a75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610c56565b60096126688282615083565b5050565b60606009805461267b90614dbb565b80601f01602080910402602001604051908101604052809291908181526020018280546126a790614dbb565b80156126f45780601f106126c9576101008083540402835291602001916126f4565b820191906000526020600020905b8154815290600101906020018083116126d757829003601f168201915b50505050509050919050565b6060600061270d836131a7565b60010190506000816001600160401b0381111561272c5761272c614268565b6040519080825280601f01601f191660200182016040528015612756576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a850494508461276057509392505050565b600c546001600160a01b031680158015906127b757506000816001600160a01b03163b115b1561266857604051633185c44d60e21b81523060048201526001600160a01b03838116602483015282169063c617113490604401602060405180830381865afa158015612808573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061282c91906153ef565b61266857604051633b79c77360e21b81526001600160a01b0383166004820152602401610c56565b61285c612520565b6001600160a01b0316856001600160a01b03161480612882575061288285610ac9612520565b61289e5760405162461bcd60e51b8152600401610c569061540c565b610fea8585858585612964565b6002600a54036128fd5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610c56565b6002600a55565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261295e90859061327f565b50505050565b81518351146129855760405162461bcd60e51b8152600401610c569061545a565b6001600160a01b0384166129ab5760405162461bcd60e51b8152600401610c56906154a2565b60006129b5612520565b905060005b8451811015612aa05760008582815181106129d7576129d7614e05565b6020026020010151905060008583815181106129f5576129f5614e05565b60209081029190910181015160008481526007835260408082206001600160a01b038e168352909352919091205490915081811015612a465760405162461bcd60e51b8152600401610c56906154e7565b60008381526007602090815260408083206001600160a01b038e8116855292528083208585039055908b16825281208054849290612a85908490615531565b9250508190555050505080612a9990614ffe565b90506129ba565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051612af0929190615544565b60405180910390a4611186818787878787613351565b612b1388888888886134ac565b6000868686604051602001612b2a93929190615142565b60405160208183030381529060405290508551600103612c2f5760065460ff1615612b6257612b5d8860018460006134dd565b612b81565b815115612b815760405162461bcd60e51b8152600401610c5690615569565b612b8f8882868686346135bc565b86604051612b9d91906155ad565b6040518091039020896001600160a01b03168961ffff167f968b0d61ebcf43e5d76ed87bd2c4ee2f22b4969b9f4ca49e3373c025eddd5eeb89600081518110612be857612be8614e05565b602002602001015189600081518110612c0357612c03614e05565b6020026020010151604051612c22929190918252602082015260400190565b60405180910390a4611fc9565b600186511115611fc95760065460ff1615612c5757612c528860028460006134dd565b612c76565b815115612c765760405162461bcd60e51b8152600401610c5690615569565b612c848882868686346135bc565b86604051612c9291906155ad565b6040518091039020896001600160a01b03168961ffff167fddd15f7cfbd674ac2096d598f1650367f8a8bd72b4e3abd85591099ea3b57e338989604051612cda929190615544565b60405180910390a4505050505050505050565b60408051600180825281830190925260609160009190602080830190803683370190505090508281600081518110612d2757612d27614e05565b602090810291909101015292915050565b600080600083806020019051810190612d51919061562f565b60148301519295509093509150612d6a88828585613761565b8251600103612e1357806001600160a01b031687604051612d8b91906155ad565b60405180910390208961ffff167f1bf64e58d19fc43de4c44b3d1bb1fae313979af831a7a39f3297564294329f0f86600081518110612dcc57612dcc614e05565b602002602001015186600081518110612de757612de7614e05565b6020026020010151604051612e06929190918252602082015260400190565b60405180910390a46115c7565b6001835111156115c757806001600160a01b031687604051612e3591906155ad565b60405180910390208961ffff167f1ae08edbbcd7baa8d064835de8593ce16b313414525ac89534e349f4da7926e48686604051612e73929190615544565b60405180910390a45050505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b606081612ee381601f615531565b1015612f225760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b6044820152606401610c56565b612f2c8284615531565b84511015612f705760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b6044820152606401610c56565b606082158015612f8f5760405191506000825260208201604052612fd9565b6040519150601f8416801560200281840101858101878315602002848b0101015b81831015612fc8578051835260209283019201612fb0565b5050858452601f01601f1916604052505b50949350505050565b612668612fed612520565b838361377c565b612ffc612520565b6001600160a01b0316856001600160a01b03161480613022575061302285610ac9612520565b61303e5760405162461bcd60e51b8152600401610c569061540c565b610fea858585858561385c565b6000606060008060008661ffff166001600160401b0381111561307057613070614268565b6040519080825280601f01601f19166020018201604052801561309a576020820181803683370190505b50905060008087516020890160008d8df191503d9250868311156130bc578692505b828152826000602083013e909890975095505050505050565b8180519060200120600560008761ffff1661ffff1681526020019081526020016000208560405161310691906155ad565b9081526040805191829003602090810183206001600160401b0388166000908152915220919091557fe183f33de2837795525b4792ca4cd60535bd77c53b7e7030060bfcf5734d6b0c9061316390879087908790879087906156b6565b60405180910390a15050505050565b60006001600160e01b031982166319abbbbb60e11b1480610ea357506301ffc9a760e01b6001600160e01b0319831614610ea3565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106131e65772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310613212576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061323057662386f26fc10000830492506010015b6305f5e1008310613248576305f5e100830492506008015b612710831061325c57612710830492506004015b6064831061326e576064830492506002015b600a8310610ea35760010192915050565b60006132d4826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661398a9092919063ffffffff16565b805190915015611a2e57808060200190518101906132f291906153ef565b611a2e5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610c56565b6001600160a01b0384163b156111865760405163bc197c8160e01b81526001600160a01b0385169063bc197c81906133959089908990889088908890600401615708565b6020604051808303816000875af19250505080156133d0575060408051601f3d908101601f191682019092526133cd91810190615746565b60015b61347c576133dc615763565b806308c379a00361341557506133f061577e565b806133fb5750613417565b8060405162461bcd60e51b8152600401610c5691906143af565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e2d455243313135356044820152732932b1b2b4bb32b91034b6b83632b6b2b73a32b960611b6064820152608401610c56565b6001600160e01b0319811663bc197c8160e01b14610e0a5760405162461bcd60e51b8152600401610c5690615807565b600e54825111156134d057604051633550b5c160e21b815260040160405180910390fd5b610fea8585858585613999565b60006134e883613a59565b61ffff80871660009081526002602090815260408083209389168352929052908120549192509061351a908490615531565b90506000811161356c5760405162461bcd60e51b815260206004820152601a60248201527f4c7a4170703a206d696e4761734c696d6974206e6f74207365740000000000006044820152606401610c56565b808210156111865760405162461bcd60e51b815260206004820152601b60248201527f4c7a4170703a20676173206c696d697420697320746f6f206c6f7700000000006044820152606401610c56565b61ffff8616600090815260016020526040812080546135da90614dbb565b80601f016020809104026020016040519081016040528092919081815260200182805461360690614dbb565b80156136535780601f1061362857610100808354040283529160200191613653565b820191906000526020600020905b81548152906001019060200180831161363657829003601f168201915b5050505050905080516000036136c45760405162461bcd60e51b815260206004820152603060248201527f4c7a4170703a2064657374696e6174696f6e20636861696e206973206e6f742060448201526f61207472757374656420736f7572636560801b6064820152608401610c56565b6136cf878751613ab5565b60405162c5803160e81b81526001600160a01b037f000000000000000000000000b6319cc6c8c27a8f5daf0dd3df91ea35c4720dd7169063c5803100908490613726908b9086908c908c908c908c9060040161584f565b6000604051808303818588803b15801561373f57600080fd5b505af1158015613753573d6000803e3d6000fd5b505050505050505050505050565b61295e83838360405180602001604052806000815250613b26565b816001600160a01b0316836001600160a01b0316036137ef5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c20737461747573604482015268103337b91039b2b63360b91b6064820152608401610c56565b6001600160a01b03838116600081815260086020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b0384166138825760405162461bcd60e51b8152600401610c56906154a2565b600061388c612520565b9050600061389985612ced565b905060006138a685612ced565b905060008681526007602090815260408083206001600160a01b038c168452909152902054858110156138eb5760405162461bcd60e51b8152600401610c56906154e7565b60008781526007602090815260408083206001600160a01b038d8116855292528083208985039055908a1682528120805488929061392a908490615531565b909155505060408051888152602081018890526001600160a01b03808b16928c821692918816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4611fc9848a8a8a8a8a613cb7565b60606124e38484600085613d72565b60006139a3612520565b9050856001600160a01b0316816001600160a01b031614806139ea57506001600160a01b0380871660009081526008602090815260408083209385168352929052205460ff165b613a4e5760405162461bcd60e51b815260206004820152602f60248201527f4f4e4654313135353a2073656e642063616c6c6572206973206e6f74206f776e60448201526e195c881b9bdc88185c1c1c9bdd9959608a1b6064820152608401610c56565b611186868484613e4d565b6000602282511015613aad5760405162461bcd60e51b815260206004820152601c60248201527f4c7a4170703a20696e76616c69642061646170746572506172616d73000000006044820152606401610c56565b506022015190565b61ffff821660009081526003602052604081205490819003613ad657506127105b80821115611a2e5760405162461bcd60e51b815260206004820181905260248201527f4c7a4170703a207061796c6f61642073697a6520697320746f6f206c617267656044820152606401610c56565b6001600160a01b038416613b865760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f206164647265736044820152607360f81b6064820152608401610c56565b8151835114613ba75760405162461bcd60e51b8152600401610c569061545a565b6000613bb1612520565b905060005b8451811015613c4f57838181518110613bd157613bd1614e05565b602002602001015160076000878481518110613bef57613bef614e05565b602002602001015181526020019081526020016000206000886001600160a01b03166001600160a01b031681526020019081526020016000206000828254613c379190615531565b90915550819050613c4781614ffe565b915050613bb6565b50846001600160a01b031660006001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051613ca0929190615544565b60405180910390a4610fea81600087878787613351565b6001600160a01b0384163b156111865760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e6190613cfb90899089908890889088906004016158b6565b6020604051808303816000875af1925050508015613d36575060408051601f3d908101601f19168201909252613d3391810190615746565b60015b613d42576133dc615763565b6001600160e01b0319811663f23a6e6160e01b14610e0a5760405162461bcd60e51b8152600401610c5690615807565b606082471015613dd35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610c56565b600080866001600160a01b03168587604051613def91906155ad565b60006040518083038185875af1925050503d8060008114613e2c576040519150601f19603f3d011682016040523d82523d6000602084013e613e31565b606091505b5091509150613e428783838761405c565b979650505050505050565b6001600160a01b038316613eaf5760405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201526265737360e81b6064820152608401610c56565b8051825114613ed05760405162461bcd60e51b8152600401610c569061545a565b6000613eda612520565b604080516020810190915260009052905060005b8351811015613fef576000848281518110613f0b57613f0b614e05565b602002602001015190506000848381518110613f2957613f29614e05565b60209081029190910181015160008481526007835260408082206001600160a01b038c168352909352919091205490915081811015613fb65760405162461bcd60e51b8152602060048201526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c604482015263616e636560e01b6064820152608401610c56565b60009283526007602090815260408085206001600160a01b038b1686529091529092209103905580613fe781614ffe565b915050613eee565b5060006001600160a01b0316846001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8686604051614040929190615544565b60405180910390a460408051602081019091526000905261295e565b606083156140cb5782516000036140c4576001600160a01b0385163b6140c45760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610c56565b50816124e3565b6124e383838151156133fb5781518083602001fd5b803561ffff811681146140f257600080fd5b919050565b60008083601f84011261410957600080fd5b5081356001600160401b0381111561412057600080fd5b60208301915083602082850101111561413857600080fd5b9250929050565b80356001600160401b03811681146140f257600080fd5b6000806000806000806080878903121561416f57600080fd5b614178876140e0565b955060208701356001600160401b038082111561419457600080fd5b6141a08a838b016140f7565b90975095508591506141b460408a0161413f565b945060608901359150808211156141ca57600080fd5b506141d789828a016140f7565b979a9699509497509295939492505050565b6001600160a01b0381168114610ed757600080fd5b80356140f2816141e9565b6000806040838503121561421c57600080fd5b8235614227816141e9565b946020939093013593505050565b6001600160e01b031981168114610ed757600080fd5b60006020828403121561425d57600080fd5b8135611a1381614235565b634e487b7160e01b600052604160045260246000fd5b601f8201601f191681016001600160401b03811182821017156142a3576142a3614268565b6040525050565b60006001600160401b038211156142c3576142c3614268565b50601f01601f191660200190565b60006142dc836142aa565b6040516142e9828261427e565b8092508481528585850111156142fe57600080fd5b8484602083013760006020868301015250509392505050565b60006020828403121561432957600080fd5b81356001600160401b0381111561433f57600080fd5b8201601f8101841361435057600080fd5b6124e3848235602084016142d1565b60005b8381101561437a578181015183820152602001614362565b50506000910152565b6000815180845261439b81602086016020860161435f565b601f01601f19169290920160200192915050565b602081526000611a136020830184614383565b6000602082840312156143d457600080fd5b611a13826140e0565b600080604083850312156143f057600080fd5b614227836140e0565b60006020828403121561440b57600080fd5b5035919050565b60006001600160401b0382111561442b5761442b614268565b5060051b60200190565b600082601f83011261444657600080fd5b8135602061445382614412565b604051614460828261427e565b83815260059390931b850182019282810191508684111561448057600080fd5b8286015b8481101561449b5780358352918301918301614484565b509695505050505050565b600082601f8301126144b757600080fd5b611a13838335602085016142d1565b600080600080600060a086880312156144de57600080fd5b85356144e9816141e9565b945060208601356144f9816141e9565b935060408601356001600160401b038082111561451557600080fd5b61452189838a01614435565b9450606088013591508082111561453757600080fd5b61454389838a01614435565b9350608088013591508082111561455957600080fd5b50614566888289016144a6565b9150509295509295909350565b60008060006040848603121561458857600080fd5b614591846140e0565b925060208401356001600160401b038111156145ac57600080fd5b6145b8868287016140f7565b9497909650939450505050565b60008083601f8401126145d757600080fd5b5081356001600160401b038111156145ee57600080fd5b6020830191508360208260051b850101111561413857600080fd5b600080600080600080600060a0888a03121561462457600080fd5b8735965060208801356001600160401b038082111561464257600080fd5b61464e8b838c016145c5565b909850965060408a013591508082111561466757600080fd5b6146738b838c016145c5565b909650945060608a0135935060808a013591508082111561469357600080fd5b506146a08a828b016144a6565b91505092959891949750929550565b600080600080600080600080610100898b0312156146cc57600080fd5b6146d5896141fe565b97506146e360208a016140e0565b965060408901356001600160401b03808211156146ff57600080fd5b61470b8c838d016144a6565b975060608b013591508082111561472157600080fd5b61472d8c838d01614435565b965060808b013591508082111561474357600080fd5b61474f8c838d01614435565b955061475d60a08c016141fe565b945061476b60c08c016141fe565b935060e08b013591508082111561478157600080fd5b5061478e8b828c016144a6565b9150509295985092959890939650565b600080600080600080600080610100898b0312156147bb57600080fd5b88356147c6816141e9565b97506147d460208a016140e0565b965060408901356001600160401b03808211156147f057600080fd5b6147fc8c838d016144a6565b975060608b0135965060808b0135955060a08b0135915061481c826141e9565b90935060c08a01359061482e826141e9565b90925060e08a0135908082111561478157600080fd5b6000806040838503121561485757600080fd5b82356001600160401b038082111561486e57600080fd5b818501915085601f83011261488257600080fd5b8135602061488f82614412565b60405161489c828261427e565b83815260059390931b85018201928281019150898411156148bc57600080fd5b948201945b838610156148e35785356148d4816141e9565b825294820194908201906148c1565b965050860135925050808211156148f957600080fd5b5061490685828601614435565b9150509250929050565b600081518084526020808501945080840160005b8381101561494057815187529582019590820190600101614924565b509495945050505050565b602081526000611a136020830184614910565b60006020828403121561497057600080fd5b8135611a13816141e9565b60008060006060848603121561499057600080fd5b614999846140e0565b925060208401356001600160401b038111156149b457600080fd5b6149c0868287016144a6565b9250506149cf6040850161413f565b90509250925092565b8015158114610ed757600080fd5b80356140f2816149d8565b60008060008060008060c08789031215614a0a57600080fd5b614a13876140e0565b955060208701356001600160401b0380821115614a2f57600080fd5b614a3b8a838b016144a6565b9650604089013595506060890135945060808901359150614a5b826149d8565b90925060a08801359080821115614a7157600080fd5b50614a7e89828a016144a6565b9150509295509295509295565b60008060408385031215614a9e57600080fd5b614aa7836140e0565b9150614ab5602084016140e0565b90509250929050565b60008060408385031215614ad157600080fd5b8235614adc816141e9565b91506020830135614aec816149d8565b809150509250929050565b60008060008060008060c08789031215614b1057600080fd5b614b19876140e0565b955060208701356001600160401b0380821115614b3557600080fd5b614b418a838b016144a6565b96506040890135915080821115614b5757600080fd5b614b638a838b01614435565b95506060890135915080821115614b7957600080fd5b614b858a838b01614435565b9450614b9360808a016149e6565b935060a0890135915080821115614a7157600080fd5b600080600080600060a08688031215614bc157600080fd5b853594506020860135614bd3816141e9565b93506040860135614be3816141e9565b92506060860135614bf3816141e9565b91506080860135614c03816141e9565b809150509295509295909350565b600080600080600060808688031215614c2957600080fd5b614c32866140e0565b9450614c40602087016140e0565b93506040860135925060608601356001600160401b03811115614c6257600080fd5b614c6e888289016140f7565b969995985093965092949392505050565b600080600060608486031215614c9457600080fd5b614c9d846140e0565b9250614cab602085016140e0565b9150604084013590509250925092565b60008060408385031215614cce57600080fd5b8235614cd9816141e9565b91506020830135614aec816141e9565b600060208284031215614cfb57600080fd5b8135611a13816149d8565b600080600080600060a08688031215614d1e57600080fd5b8535614d29816141e9565b94506020860135614d39816141e9565b9350604086013592506060860135915060808601356001600160401b03811115614d6257600080fd5b614566888289016144a6565b60008060008060808587031215614d8457600080fd5b614d8d856140e0565b9350614d9b602086016140e0565b92506040850135614dab816141e9565b9396929550929360600135925050565b600181811c90821680614dcf57607f821691505b602082108103614def57634e487b7160e01b600052602260045260246000fd5b50919050565b8183823760009101908152919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b81810381811115610ea357610ea3614e1b565b60008351614e5681846020880161435f565b835190830190614e6a81836020880161435f565b01949350505050565b81835260006001600160fb1b03831115614e8c57600080fd5b8260051b80836020870137939093016020019392505050565b6001600160a01b038d811682528c811660208301528b811660408301528a1660608201526080810189905261014060a08201819052600090614eea908301898b614e73565b82810360c0840152614efd81888a614e73565b90508560e084015284610100840152828103610120840152614f1f8185614383565b9f9e505050505050505050505050505050565b6001600160a01b038c811682528b811660208301528a1660408201526060810189905261012060808201819052600090614f6f8382018a8c614e73565b905082810360a0840152614f8481888a614e73565b90508560c08401528460e0840152828103610100840152614fa58185614383565b9e9d5050505050505050505050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b61ffff841681526040602082015260006124e0604083018486614fb7565b60006001820161501057615010614e1b565b5060010190565b8284823760609190911b6bffffffffffffffffffffffff19169101908152601401919050565b601f821115611a2e57600081815260208120601f850160051c810160208610156150645750805b601f850160051c820191505b8181101561118657828155600101615070565b81516001600160401b0381111561509c5761509c614268565b6150b0816150aa8454614dbb565b8461503d565b602080601f8311600181146150e557600084156150cd5750858301515b600019600386901b1c1916600185901b178555611186565b600085815260208120601f198616915b82811015615114578886015182559484019460019091019084016150f5565b50858210156151325787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6060815260006151556060830186614383565b82810360208401526151678186614910565b9050828103604084015261517b8185614910565b9695505050505050565b61ffff861681526001600160a01b038516602082015260a0604082018190526000906151b390830186614383565b841515606084015282810360808401526151cd8185614383565b98975050505050505050565b600080604083850312156151ec57600080fd5b505080516020909101519092909150565b600061ffff808816835280871660208401525084604083015260806060830152613e42608083018486614fb7565b61ffff86168152608060208201526000615249608083018688614fb7565b6001600160401b0394909416604083015250606001529392505050565b6001600160401b0383111561527d5761527d614268565b6152918361528b8354614dbb565b8361503d565b6000601f8411600181146152c557600085156152ad5750838201355b600019600387901b1c1916600186901b178355610fea565b600083815260209020601f19861690835b828110156152f657868501358255602094850194600190920191016152d6565b50868210156153135760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b600082601f83011261533657600080fd5b8151615341816142aa565b60405161534e828261427e565b82815285602084870101111561536357600080fd5b61537483602083016020880161435f565b95945050505050565b60006020828403121561538f57600080fd5b81516001600160401b038111156153a557600080fd5b6124e384828501615325565b61ffff851681526080602082015260006153ce6080830186614383565b6001600160401b03851660408401528281036060840152613e428185614383565b60006020828403121561540157600080fd5b8151611a13816149d8565b6020808252602e908201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60408201526d195c881bdc88185c1c1c9bdd995960921b606082015260800190565b60208082526028908201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206040820152670dad2e6dac2e8c6d60c31b606082015260800190565b60208082526025908201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604082015264647265737360d81b606082015260800190565b6020808252602a908201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60408201526939103a3930b739b332b960b11b606082015260800190565b80820180821115610ea357610ea3614e1b565b6040815260006155576040830185614910565b82810360208401526153748185614910565b60208082526024908201527f4c7a4170703a205f61646170746572506172616d73206d75737420626520656d604082015263383a3c9760e11b606082015260800190565b600082516155bf81846020870161435f565b9190910192915050565b600082601f8301126155da57600080fd5b815160206155e782614412565b6040516155f4828261427e565b83815260059390931b850182019282810191508684111561561457600080fd5b8286015b8481101561449b5780518352918301918301615618565b60008060006060848603121561564457600080fd5b83516001600160401b038082111561565b57600080fd5b61566787838801615325565b9450602086015191508082111561567d57600080fd5b615689878388016155c9565b9350604086015191508082111561569f57600080fd5b506156ac868287016155c9565b9150509250925092565b61ffff8616815260a0602082015260006156d360a0830187614383565b6001600160401b038616604084015282810360608401526156f48186614383565b905082810360808401526151cd8185614383565b6001600160a01b0386811682528516602082015260a06040820181905260009061573490830186614910565b82810360608401526156f48186614910565b60006020828403121561575857600080fd5b8151611a1381614235565b600060033d111561251d5760046000803e5060005160e01c90565b600060443d101561578c5790565b6040516003193d81016004833e81513d6001600160401b0381602484011181841117156157bb57505050505090565b82850191508151818111156157d35750505050505090565b843d87010160208285010111156157ed5750505050505090565b6157fc6020828601018761427e565b509095945050505050565b60208082526028908201527f455243313135353a204552433131353552656365697665722072656a656374656040820152676420746f6b656e7360c01b606082015260800190565b61ffff8716815260c06020820152600061586c60c0830188614383565b828103604084015261587e8188614383565b6001600160a01b0387811660608601528616608085015283810360a085015290506158a98185614383565b9998505050505050505050565b6001600160a01b03868116825285166020820152604081018490526060810183905260a060808201819052600090613e429083018461438356fea2646970667358221220f4dd4093debae72276ef17fb67b5e51c1c5af634bfa47f37c8075b28c8f132df64736f6c63430008110033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000b6319cc6c8c27a8f5daf0dd3df91ea35c4720dd700000000000000000000000023b9e4193419981bee723741be305a590078217d
-----Decoded View---------------
Arg [0] : _lzEndpoint (address): 0xb6319cC6c8c27A8F5dAF0dD3DF91EA35C4720dd7
Arg [1] : _forwarder (address): 0x23B9e4193419981bEE723741bE305a590078217D
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000b6319cc6c8c27a8f5daf0dd3df91ea35c4720dd7
Arg [1] : 00000000000000000000000023b9e4193419981bee723741be305a590078217d