ERC-721
NFT
Overview
Max Total Supply
0 MONLAND
Holders
968
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Balance
0 MONLANDLoading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
DefimonsApartments
Compiler Version
v0.8.15+commit.e14f2714
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.8.13; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {MerkleProof} from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import {Math} from "@openzeppelin/contracts/utils/math/Math.sol"; import {ONFT721} from "../Omnichain/token/onft/ONFT721.sol"; /** .....::::::::.... .::^~~~~!!!!!!!!!~:. .:~!77?????JJ???JJJJJJJ???7!~^:. :~!???????777777777??JYJ7^ :7??7!~~~^^^^^^^^^^^^~~~~!!77?JJJJ?!:. :7J?!^::........::::::^~7JYY7:::::.. ~J?~:...................:::::^^^~!7?YYJ7^. :JJ~:...................:^7JY5YYYYYYJ7^. ... .^~~~~^. ..:::::.. ^Y?^...........................:::^^^~7?YY?^. .:^~!77??7777!~^:. .?J!.....................:^7JJ7!~~!?Y55YJ^ :!7??JJ?7~..~???7??JYY?^ ...:... .:^~~^:. .:^~~~~:. .^!7????JJJJJ??!^. 7Y?:...............................::^^~!JYY?: :~7??77!!~~!!!77?JJJJ?7Y?^.....................^7J7:.....:~JYYYY~7J7~^^~!?YYJJJ!:..:^~7JYY7. .^!7????JJJJ??!~: :!?????JYJ?~. .~??????JYJ77??!~^::::^^~!7?YYJ~ !YJ!:.................................:^^~?Y5J7J?~::..........::^~!7JYY?:........:^~~~~!!!!!!7JYY^.......:7YYYYYJ!.....:^!JYY7......^^7JY5! .~7??!~~^^^^^~!!?JYYJ!!J?^:.::^!?Y5J!. :?J!:..:^~7JY?^............:^7JY5! .?5Y?!~^^^^~~..........:~~^^:..........:^^~?YYJ~...........::.....:^~7J7:.......^^7JYYYYYYYYYYYYY?:.....:!YYYYYY7:......^^7J?:......:^~?YYJ^!J?!:..........::^^~7JYY?^......:^!?JYY!?Y7......:^?!:..............:!JYYJ: .!J5YYYYYYJ?........:^~?YYJJ7!^........:^^!JJ~.........:~7J?!.....:^~?7:.......^^~!!!!!!!!?JYYYYYJ!~~~!JYYYYYYJ~.......:^~?^........^^7JYYY?~................::^~7J?^........:^~7JYYY7......:^7:.......::::...:!?YY5?. .^7?JYYYY?........:^^7YYYYYY?^.......:^^!?7:........:^7JYY?:.....^^77:................::^~7YY?7~~^^~7?JYYYYY7:........:^^.........:^!?YY?^.........:::.......:^^7?^..........:^~7JY7......:^7:......:~7?????JYYYYJ: ..:?Y?........:^^7YYYYJ?~........:^^!?~.........:^7YYJ!.....:^~??:...................:!??!:.....:~7?YYYJ~......................^^7J?^........^7?JJ?!:.....:^^7^............::~77:.....:^7!........:^~7?JYYYY!. 7Y?:.......:^^7JJ?7~:.........^^~?J~.........:^~!~^.....:^~?Y?:...................:!??^.......:!?YYY7:......................:^!?!.......:!JYY5YYY?:.....^^!^...............:^......:^7?!:.........::^!?JYJ!: .^~!7JY?:.......:^^~~::...........:^~7JJ~..................:^~7JYY?^..................^!JJ?^.......^!?YYJ~........................^^?!.......^?YYY7:!YJ^.....:^~^......:^:..............:^7JY?~:..........:^~?Y5J~ :7??7!!~~~..........................^~?YYY!..............::~!7?JYYYYJ~.........^!!!777??JYYJ?^.......^7?YY7.......::................:^!!........!JY57~?J!:.....^^7^......^!?!^............:^7JYYYJ?!^:........:^7JYY~ !J?^:..............................:~7JYYYY?:..........^7?JJ7!~^^^!7J?~.........~JYYY5555YYYJ?^.......^7?Y?^.....:^~7:........^~.....:^^7^........^!7?7!^......:^~?~......^!?YJ7^..........:^7JYJ???J??7~:......:~?YYJ: ^Y?:..............................:~7JYY5YJYJ!...........!JJ!:.....:~?J~.........^?YYY7!~~~^YJ?^.......^7?J7......^^7?!.......:7?:.....:^!?^...................:^~??~......^!?YYYJ7^........:^7?!^::::^^^^:......:~?YYY^ ?Y7:..........................:^~7?YY55Y7^.?5J!:..........::.......^!JJ!.........^?YYY^ :YJ?:.......^7??^.....:^~?YJ!:...:^7JJ~.....:^^??!:................:~7JYJ~......^!JYYYYYJ7^......:^7!.................:7JYYY: !5J!:...................::^~!7?JYY55Y?!: .?5Y?!^...............:~7JYY?^.......:!JYYY^ :YJ?^.......~???^.....^^7JYYYJ??7?JYYY7:.....:^!JY?!^:...........^~7JYYYJ~......^!JYYY~7Y5J?~:..:~7J7:...............^7JYY57. .?5Y?!~^^:^^^^^^^~~!!77?JJYYY55YYJ7~: .!Y5YJ?!~~^^^:^^^~~!7JJYYY5YJ7~^^^^!?YYY57. .JYJ?~:::::~7JYY?~^::^~7JYYYJY55555YYYJ~.....^~7JYYYYJ7!~~^^~~!7?JYY55YYYJ!^:::~7JYY5J. :7Y5YJ??JJYYY?!^^:::::::::^!?JYYYY7. .!J55YYYYYYYYYYYYYY55555YYJJ7!^:. .~?YY5YYYYYYYYYYY5555YJ7~?Y5YYYYYY555J~. :?5YJJ????JYYY55YJJJJYYY5Y7.:^~~~^::J5J7!~~!7?YYYY?JY55YYYYYYY555YY?!:^J5YYJJJJYY5Y?: :!JYYYYYYJJ5YYYJJJJJJJJJYY55YY7^ .^!?JJJJJJJJJJJ??77!~~::. .^!7??JJJJJJJ??7!~:. :!?JJJJJ?!^. .~?YY555555YJ!~?JYYYYY?!: :7Y55YYYY55YJ~ .:~!7??JJ???7~^: .~?JYYYYYJ7^. .:::::..~7?JYYYY5YYYYYJ?7^. ........... ........ ..... :^~!!!!^:. .::::. :~7?JJ??!^. .. ..::::. ..:::^^^^::. */ contract DefimonsApartments is ONFT721 { // // Using Statements // using MerkleProof for bytes32[]; using SafeERC20 for IERC20; // // Constants // uint16 public constant MAX_MINT = 9500; // // Errors // error InvalidSaleInterval(uint256 start, uint256 finish); error InvalidWhitelistRoot(); error SaleNotFound(uint256 saleId); error ZeroMintQuantity(); error NotInSalePhase( uint256 saleId, uint256 start, uint256 finish, uint256 current ); error UserNotWhitelistedOrWrongProof( uint256 saleId, address user, bytes32[] proof ); error WrongValueSentForMint( uint256 saleId, uint256 value, uint256 price, uint8 quantity ); error MaximumSaleLimitReached(uint256 saleId, address user, uint8 limit); error MaximumSupplyReached(); // // Events // event LogSetURI(string newURI); event LogSaleCreated( uint256 indexed saleId, uint64 start, uint64 finish, uint8 limit, uint64 price, bool whitelist, bytes32 root ); event LogSaleEdited( uint256 indexed saleId, uint64 start, uint64 finish, uint8 limit, uint64 price, bool whitelist, bytes32 root ); event LogSale(uint256 indexed saleId, address indexed to, uint256 quantity); // // Structs // /// Defines the parameters for a sale period. /// This is created by the contract's Sale Admin. /// A sale period has a start time, finish time, mint price, mint limit and a merkle root. /// The root parameter indicates the current sale's merkle root (0 for public sales). /// The whitelist boolean is 'true' for all whitelist mint periods and 'false' for public mints. /// A sale is active when block.timestamp in interval [start, finish]. /// The price indicates how much a user has to pay for one NFT in this period. /// The limit specifies how many NFTs a user can mint during this period. struct Sale { bytes32 root; bool whitelist; uint64 start; uint64 finish; uint64 price; uint8 limit; } // // State // /// Base NFT metadata URI. string private _URI; /// Id of the next NFT id to mint (sequential id). uint256 public nextToMint = 1; /// List of sale phases. Sale[] private _sales; /// Mapping of the quantity of NFTs minted to each address. /// Used to track and cap how many tokens an address is allowed to mint per round. /// current sale id => user address => number of NFTs minted mapping(uint256 => mapping(address => uint256)) private _minted; // // ERC721 // /// @dev See {IERC721Metadata-tokenURI}. function _baseURI() internal view override returns (string memory) { return _URI; } // // Constructor // constructor( string memory _name, string memory _symbol, address _lzEndpoint, string memory _initialURI ) ONFT721(_name, _symbol, _lzEndpoint) { setURI(_initialURI); } // // Owner API // function setURI(string memory _newURI) public onlyOwner { _URI = _newURI; emit LogSetURI(_newURI); } /// @notice Adds a new sale period. /// @dev Can only be called by the contract owner. /// @param _start The start of the sale. /// @param _finish The end of the sale. /// @param _limit The maximum number of NFTs an account can mint during this period. /// @param _price The price of each NFT during this period. /// @param _whitelist Whether the sale is a whitelist sale /// @param _root When adding a whitelist sale, this parameter defines the merkle root to be used for verification. function addSale( uint64 _start, uint64 _finish, uint8 _limit, uint64 _price, bool _whitelist, bytes32 _root ) external onlyOwner { _validateSaleParams(_start, _finish, _whitelist, _root); Sale memory sale = Sale({ start: _start, finish: _finish, limit: _limit, price: _price, whitelist: _whitelist, root: _root }); _sales.push(sale); emit LogSaleCreated( _sales.length - 1, _start, _finish, _limit, _price, _whitelist, _root ); } /// @notice Edits a Sale Phase /// @dev Can only be called by the contract owner. /// @param _saleId The unique ID of the sale to be edited /// @param _start The new start time we want the sale to have /// @param _finish The new end time we want the sale to have /// @param _limit The new limit of NFTs we want the sale to have /// @param _price The new price we want the NFTs to have /// @param _whitelist Whether it is a whitelist sale. /// @param _root Defines the root to be used for whitelist verification. /// If we want any Sale parameter to stay unchanged, send the same value as a parameter to the function function editSale( uint256 _saleId, uint64 _start, uint64 _finish, uint8 _limit, uint64 _price, bool _whitelist, bytes32 _root ) external onlyOwner { _validateSaleParams(_start, _finish, _whitelist, _root); if (_saleId >= _sales.length) revert SaleNotFound(_saleId); Sale storage sale = _sales[_saleId]; sale.start = _start; sale.finish = _finish; sale.limit = _limit; sale.price = _price; sale.whitelist = _whitelist; sale.root = _root; emit LogSaleEdited( _saleId, _start, _finish, _limit, _price, _whitelist, _root ); } /// @notice Withdraws any ETH sent to this contract. /// @dev Only callable by this contract's owner. /// @param _to The address to withdraw to. /// @param _amount The amount of ETH (in Wei) to withdraw. function withdrawEther(address _to, uint256 _amount) external onlyOwner { payable(_to).transfer(_amount); } /// Withdraws any ERC20 tokens sent to the contract. /// @dev only callable by the owner. /// @param _token The ERC20 token to withdraw /// @param _to The address to withdraw to. /// @param _amount The amount to withdraw function withdrawERC20( address _token, address _to, uint256 _amount ) external onlyOwner { IERC20(_token).safeTransfer(_to, _amount); } // // Public Read API // function getSale(uint256 _saleId) external view returns (Sale memory) { return _sales[_saleId]; } function getSalesCount() external view returns (uint256) { return _sales.length; } function isSaleActive(uint256 _saleId) external view returns (bool) { Sale memory sale = _sales[_saleId]; return block.timestamp >= sale.start && block.timestamp <= sale.finish; } function getMintedAmount(uint256 _saleId, address _user) external view returns (uint256) { return _minted[_saleId][_user]; } // // Public Write API // function saleMint( uint256 _saleId, address _user, uint8 _quantity, bytes32[] calldata _proof ) external payable { // check if sale is registered and quantity is grater than zero if (_saleId >= _sales.length) revert SaleNotFound(_saleId); if (_quantity == 0) revert ZeroMintQuantity(); Sale memory sale = _sales[_saleId]; if (block.timestamp < sale.start || block.timestamp > sale.finish) revert NotInSalePhase( _saleId, sale.start, sale.finish, block.timestamp ); // validate whitelist if (sale.whitelist) { bytes32 leaf = keccak256(abi.encodePacked(_user)); if (!_verify(sale.root, _proof, leaf)) revert UserNotWhitelistedOrWrongProof(_saleId, _user, _proof); } // validate ETH amount send to contract if (msg.value != _quantity * sale.price) { revert WrongValueSentForMint( _saleId, msg.value, sale.price, _quantity ); } // validate individual mint limit uint256 availableUser = sale.limit - _minted[_saleId][_user]; if (availableUser < _quantity) { revert MaximumSaleLimitReached(_saleId, _user, sale.limit); } // validate total mint limit uint256 mintedBefore = nextToMint; uint256 availableTotal = 1 + MAX_MINT - mintedBefore; if (availableTotal == 0) { revert MaximumSupplyReached(); } // bound the quantity to mint and increase mint count uint256 quantityToMint = Math.min(availableTotal, _quantity); _minted[_saleId][_user] += quantityToMint; nextToMint += quantityToMint; // mint NFTs for (uint256 i = 0; i < quantityToMint; ) { _mint(_user, mintedBefore + i); unchecked { ++i; } } // emit sale event emit LogSale(_saleId, _user, quantityToMint); // refund leftover eth to buyer if (quantityToMint < _quantity) { // can fail when minting through a contract payable(msg.sender).transfer( sale.price * (_quantity - quantityToMint) ); } } // // Internal // function _validateSaleParams( uint64 _start, uint64 _finish, bool _whitelist, bytes32 _root ) internal pure { if (_start > _finish) revert InvalidSaleInterval(_start, _finish); if (_whitelist && _root == bytes32(0)) revert InvalidWhitelistRoot(); } /// @notice Internal merkle proof verification. /// @dev Verify that `proof` is valid and `leaf` occurs in the merkle tree with root hash `merkleRoot`. /// @param root The Merkle Tree Root to be used for verification /// @param proof The merkle proof. /// @param leaf The leaf node to find. function _verify( bytes32 root, bytes32[] calldata proof, bytes32 leaf ) internal pure returns (bool verified) { verified = proof.verify(root, leaf); } }
// 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.7.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.7.0) (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.0; /** * @dev These functions deal with verification of Merkle Tree proofs. * * The proofs can be generated using the JavaScript library * https://github.com/miguelmota/merkletreejs[merkletreejs]. * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled. * * See `test/utils/cryptography/MerkleProof.test.js` for some examples. * * WARNING: You should avoid using leaf values that are 64 bytes long prior to * hashing, or use a hash function other than keccak256 for hashing leaves. * This is because the concatenation of a sorted pair of internal nodes in * the merkle tree could be reinterpreted as a leaf value. */ library MerkleProof { /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify( bytes32[] memory proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProof(proof, leaf) == root; } /** * @dev Calldata version of {verify} * * _Available since v4.7._ */ function verifyCalldata( bytes32[] calldata proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProofCalldata(proof, leaf) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leafs & pre-images are assumed to be sorted. * * _Available since v4.4._ */ function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Calldata version of {processProof} * * _Available since v4.7._ */ function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Returns true if the `leaves` can be proved to be a part of a Merkle tree defined by * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}. * * _Available since v4.7._ */ function multiProofVerify( bytes32[] memory proof, bool[] memory proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProof(proof, proofFlags, leaves) == root; } /** * @dev Calldata version of {multiProofVerify} * * _Available since v4.7._ */ function multiProofVerifyCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProofCalldata(proof, proofFlags, leaves) == root; } /** * @dev Returns the root of a tree reconstructed from `leaves` and the sibling nodes in `proof`, * consuming from one or the other at each step according to the instructions given by * `proofFlags`. * * _Available since v4.7._ */ function processMultiProof( bytes32[] memory proof, bool[] memory proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the merkle tree. uint256 leavesLen = leaves.length; uint256 totalHashes = proofFlags.length; // Check proof validity. require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof"); // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { return hashes[totalHashes - 1]; } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } /** * @dev Calldata version of {processMultiProof} * * _Available since v4.7._ */ function processMultiProofCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the merkle tree. uint256 leavesLen = leaves.length; uint256 totalHashes = proofFlags.length; // Check proof validity. require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof"); // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { return hashes[totalHashes - 1]; } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) { return a < b ? _efficientHash(a, b) : _efficientHash(b, a); } function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) { /// @solidity memory-safe-assembly assembly { mstore(0x00, a) mstore(0x20, b) value := keccak256(0x00, 0x40) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.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)`. // We also know that `k`, the position of the most significant bit, is such that `msb(a) = 2**k`. // This gives `2**k < a <= 2**(k+1)` → `2**(k/2) <= sqrt(a) < 2 ** (k/2+1)`. // Using an algorithm similar to the msb computation, we are able to compute `result = 2**(k/2)` which is a // good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1; uint256 x = a; if (x >> 128 > 0) { x >>= 128; result <<= 64; } if (x >> 64 > 0) { x >>= 64; result <<= 32; } if (x >> 32 > 0) { x >>= 32; result <<= 16; } if (x >> 16 > 0) { x >>= 16; result <<= 8; } if (x >> 8 > 0) { x >>= 8; result <<= 4; } if (x >> 4 > 0) { x >>= 4; result <<= 2; } if (x >> 2 > 0) { result <<= 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) { uint256 result = sqrt(a); if (rounding == Rounding.Up && result * result < a) { result += 1; } return result; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IONFT721.sol"; import "./ONFT721Core.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; // NOTE: this ONFT contract has no public minting logic. // must implement your own minting logic in child classes contract ONFT721 is ONFT721Core, ERC721, IERC721Receiver, IONFT721 { constructor(string memory _name, string memory _symbol, address _lzEndpoint) ERC721(_name, _symbol) ONFT721Core(_lzEndpoint) {} function supportsInterface(bytes4 interfaceId) public view virtual override(ONFT721Core, ERC721, IERC165) returns (bool) { return interfaceId == type(IONFT721).interfaceId || super.supportsInterface(interfaceId); } function _debitFrom(address _from, uint16, bytes memory, uint _tokenId) internal virtual override { require(_isApprovedOrOwner(_msgSender(), _tokenId), "ONFT721: not owner nor approved"); require(ERC721.ownerOf(_tokenId) == _from, "ONFT721: incorrect owner"); _burn(_tokenId); } function _creditTo(uint16, address _toAddress, uint _tokenId) internal virtual override { _safeMint(_toAddress, _tokenId); } function onERC721Received(address _operator, address, uint, bytes memory) public virtual override returns (bytes4) { // only allow `this` to tranfser token from others if (_operator != address(this)) return bytes4(0); return IERC721Receiver.onERC721Received.selector; } /// @notice Checks if there is a payload waiting to be delivered. function hasStoredPayload(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (bool) { return lzEndpoint.hasStoredPayload(_srcChainId, _srcAddress); } /// @notice Retries to send a payload in case an error occurs on receiving chain. /// @dev In case an error occurs on receiving chain, the message is stuck in the pipeline until this function is called. /// Reason for message failing once contracts are stet up correctly is usually running out of gas. /// retry this message with a higher amount of gas. /// Info on retriving stored payload: https://layerzero.gitbook.io/docs/guides/error-messages/storedpayload-detection /// @param _srcChainId The source chain ID /// @param _srcAddress The source address /// @param _payload Message payload. THis can be retrieved from etherscan: function retryPayload( uint16 _srcChainId, bytes calldata _srcAddress, bytes calldata _payload) external payable { lzEndpoint.retryPayload(_srcChainId, _srcAddress, _payload); } }
// 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.7.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 pragma solidity ^0.8.0; import "./IONFT721Core.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; /** * @dev Interface of the ONFT standard */ interface IONFT721 is IONFT721Core, IERC721 { }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IONFT721Core.sol"; import "../../lzApp/NonblockingLzApp.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; abstract contract ONFT721Core is NonblockingLzApp, ERC165, IONFT721Core { constructor(address _lzEndpoint) NonblockingLzApp(_lzEndpoint) {} function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IONFT721Core).interfaceId || super.supportsInterface(interfaceId); } function estimateSendFee(uint16 _dstChainId, bytes memory _toAddress, uint _tokenId, bool _useZro, bytes memory _adapterParams) public view virtual override returns (uint nativeFee, uint zroFee) { // mock the payload for send() bytes memory payload = abi.encode(_toAddress, _tokenId); return lzEndpoint.estimateFees(_dstChainId, address(this), payload, _useZro, _adapterParams); } function send(uint16 _dstChainId, bytes memory _toAddress, uint _tokenId, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams) public payable virtual override { _send(msg.sender, _dstChainId, _toAddress, _tokenId, _refundAddress, _zroPaymentAddress, _adapterParams); } function _send(address _from, uint16 _dstChainId, bytes memory _toAddress, uint _tokenId, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams) internal virtual { _debitFrom(_from, _dstChainId, _toAddress, _tokenId); bytes memory payload = abi.encode(_toAddress, _tokenId); _lzSend(_dstChainId, payload, _refundAddress, _zroPaymentAddress, _adapterParams); uint64 nonce = lzEndpoint.getOutboundNonce(_dstChainId, address(this)); emit SendToChain(_from, _dstChainId, _toAddress, _tokenId, nonce); } function _nonblockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual override { // decode and load the toAddress (bytes memory toAddressBytes, uint tokenId) = abi.decode(_payload, (bytes, uint)); address toAddress; assembly { toAddress := mload(add(toAddressBytes, 20)) } _creditTo(_srcChainId, toAddress, tokenId); emit ReceiveFromChain(_srcChainId, _srcAddress, toAddress, tokenId, _nonce); } function _debitFrom(address _from, uint16 _dstChainId, bytes memory _toAddress, uint _tokenId) internal virtual; function _creditTo(uint16 _srcChainId, address _toAddress, uint _tokenId) internal virtual; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: address zero is not a valid owner"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: invalid token ID"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { _requireMinted(tokenId); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not token owner or approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { _requireMinted(tokenId); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved"); _safeTransfer(from, to, tokenId, data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { address owner = ERC721.ownerOf(tokenId); return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * This is an internal function that does not check if the sender is authorized to operate on the token. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals delete _tokenApprovals[tokenId]; _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); _afterTokenTransfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner delete _tokenApprovals[tokenId]; _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); _afterTokenTransfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits an {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @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, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Reverts if the `tokenId` has not been minted yet. */ function _requireMinted(uint256 tokenId) internal view virtual { require(_exists(tokenId), "ERC721: invalid token ID"); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { /// @solidity memory-safe-assembly assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; /** * @dev Interface of the ONFT Core standard */ interface IONFT721Core is IERC165 { /** * @dev estimate send token `_tokenId` to (`_dstChainId`, `_toAddress`) * _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 * _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, bool _useZro, bytes calldata _adapterParams) external view returns (uint nativeFee, uint zroFee); /** * @dev send token `_tokenId` to (`_dstChainId`, `_toAddress`) from `_from` * `_toAddress` can be any size depending on the `dstChainId`. * `_zroPaymentAddress` set to address(0x0) if not paying in ZRO (LayerZero Token) * `_adapterParams` is a flexible bytes array to indicate messaging adapter services */ function send(uint16 _dstChainId, bytes calldata _toAddress, uint _tokenId, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams) external payable; /** * @dev Emitted when `_tokenId` are moved from the `_sender` to (`_dstChainId`, `_toAddress`) * `_nonce` is the outbound nonce from */ event SendToChain(address indexed _sender, uint16 indexed _dstChainId, bytes indexed _toAddress, uint _tokenId, uint64 _nonce); /** * @dev Emitted when `_tokenId` are sent from `_srcChainId` to the `_toAddress` at this chain. `_nonce` is the inbound nonce. */ event ReceiveFromChain(uint16 indexed _srcChainId, bytes indexed _srcAddress, address indexed _toAddress, uint _tokenId, uint64 _nonce); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./LzApp.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 { constructor(address _endpoint) LzApp(_endpoint) {} mapping(uint16 => mapping(bytes => mapping(uint64 => bytes32))) public failedMessages; event MessageFailed(uint16 _srcChainId, bytes _srcAddress, uint64 _nonce, bytes _payload); // overriding the virtual function in LzReceiver function _blockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual override { // try-catch all errors/exceptions try this.nonblockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload) { // do nothing } catch { // error / exception failedMessages[_srcChainId][_srcAddress][_nonce] = keccak256(_payload); emit MessageFailed(_srcChainId, _srcAddress, _nonce, _payload); } } function nonblockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) public virtual { // only internal transaction require(_msgSender() == address(this), "LzReceiver: 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 memory _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), "LzReceiver: no stored message"); require(keccak256(_payload) == payloadHash, "LzReceiver: 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); } }
// 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 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// 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.7.0) (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_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) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @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] = _HEX_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 // 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 pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "../interfaces/ILayerZeroReceiver.sol"; import "../interfaces/ILayerZeroUserApplicationConfig.sol"; import "../interfaces/ILayerZeroEndpoint.sol"; /* * a generic LzReceiver implementation */ abstract contract LzApp is Ownable, ILayerZeroReceiver, ILayerZeroUserApplicationConfig { ILayerZeroEndpoint public immutable lzEndpoint; mapping(uint16 => bytes) public trustedRemoteLookup; event SetTrustedRemote(uint16 _srcChainId, bytes _srcAddress); constructor(address _endpoint) { lzEndpoint = ILayerZeroEndpoint(_endpoint); } function lzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) public virtual override { // lzReceive must be called by the endpoint for security require(_msgSender() == address(lzEndpoint), "LzReceiver: !endpoint"); 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 && keccak256(_srcAddress) == keccak256(trustedRemote), "LzReceiver: invalid source"); _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) internal virtual { bytes memory trustedRemote = trustedRemoteLookup[_dstChainId]; require(trustedRemote.length != 0, "LzSend: !trusted source."); lzEndpoint.send{value: msg.value}(_dstChainId, trustedRemote, _payload, _refundAddress, _zroPaymentAddress, _adapterParams); } //---------------------------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); } // allow owner to set it multiple times. function setTrustedRemote(uint16 _srcChainId, bytes calldata _srcAddress) external onlyOwner { trustedRemoteLookup[_srcChainId] = _srcAddress; emit SetTrustedRemote(_srcChainId, _srcAddress); } //--------------------------- 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 // 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 pragma solidity >=0.8.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.8.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 "./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); }
{ "remappings": [ "@openzeppelin/=lib/openzeppelin-contracts/", "@threesigma/=lib/threesigma-contracts/", "ds-test/=lib/forge-std/lib/ds-test/src/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "script/=script/", "src/=src/", "test/=test/", "threesigma-contracts/=lib/threesigma-contracts/contracts/", "src/=src/", "test/=test/", "script/=script/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "bytecodeHash": "ipfs" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"address","name":"_lzEndpoint","type":"address"},{"internalType":"string","name":"_initialURI","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"finish","type":"uint256"}],"name":"InvalidSaleInterval","type":"error"},{"inputs":[],"name":"InvalidWhitelistRoot","type":"error"},{"inputs":[{"internalType":"uint256","name":"saleId","type":"uint256"},{"internalType":"address","name":"user","type":"address"},{"internalType":"uint8","name":"limit","type":"uint8"}],"name":"MaximumSaleLimitReached","type":"error"},{"inputs":[],"name":"MaximumSupplyReached","type":"error"},{"inputs":[{"internalType":"uint256","name":"saleId","type":"uint256"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"finish","type":"uint256"},{"internalType":"uint256","name":"current","type":"uint256"}],"name":"NotInSalePhase","type":"error"},{"inputs":[{"internalType":"uint256","name":"saleId","type":"uint256"}],"name":"SaleNotFound","type":"error"},{"inputs":[{"internalType":"uint256","name":"saleId","type":"uint256"},{"internalType":"address","name":"user","type":"address"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"UserNotWhitelistedOrWrongProof","type":"error"},{"inputs":[{"internalType":"uint256","name":"saleId","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint8","name":"quantity","type":"uint8"}],"name":"WrongValueSentForMint","type":"error"},{"inputs":[],"name":"ZeroMintQuantity","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","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":true,"internalType":"uint256","name":"saleId","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"LogSale","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"saleId","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"start","type":"uint64"},{"indexed":false,"internalType":"uint64","name":"finish","type":"uint64"},{"indexed":false,"internalType":"uint8","name":"limit","type":"uint8"},{"indexed":false,"internalType":"uint64","name":"price","type":"uint64"},{"indexed":false,"internalType":"bool","name":"whitelist","type":"bool"},{"indexed":false,"internalType":"bytes32","name":"root","type":"bytes32"}],"name":"LogSaleCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"saleId","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"start","type":"uint64"},{"indexed":false,"internalType":"uint64","name":"finish","type":"uint64"},{"indexed":false,"internalType":"uint8","name":"limit","type":"uint8"},{"indexed":false,"internalType":"uint64","name":"price","type":"uint64"},{"indexed":false,"internalType":"bool","name":"whitelist","type":"bool"},{"indexed":false,"internalType":"bytes32","name":"root","type":"bytes32"}],"name":"LogSaleEdited","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"newURI","type":"string"}],"name":"LogSetURI","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"}],"name":"MessageFailed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"indexed":true,"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"indexed":true,"internalType":"address","name":"_toAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"_tokenId","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"_nonce","type":"uint64"}],"name":"ReceiveFromChain","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_sender","type":"address"},{"indexed":true,"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"indexed":true,"internalType":"bytes","name":"_toAddress","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"_tokenId","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"_nonce","type":"uint64"}],"name":"SendToChain","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"indexed":false,"internalType":"bytes","name":"_srcAddress","type":"bytes"}],"name":"SetTrustedRemote","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"MAX_MINT","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"_start","type":"uint64"},{"internalType":"uint64","name":"_finish","type":"uint64"},{"internalType":"uint8","name":"_limit","type":"uint8"},{"internalType":"uint64","name":"_price","type":"uint64"},{"internalType":"bool","name":"_whitelist","type":"bool"},{"internalType":"bytes32","name":"_root","type":"bytes32"}],"name":"addSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_saleId","type":"uint256"},{"internalType":"uint64","name":"_start","type":"uint64"},{"internalType":"uint64","name":"_finish","type":"uint64"},{"internalType":"uint8","name":"_limit","type":"uint8"},{"internalType":"uint64","name":"_price","type":"uint64"},{"internalType":"bool","name":"_whitelist","type":"bool"},{"internalType":"bytes32","name":"_root","type":"bytes32"}],"name":"editSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes","name":"_toAddress","type":"bytes"},{"internalType":"uint256","name":"_tokenId","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":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_version","type":"uint16"},{"internalType":"uint16","name":"_chainId","type":"uint16"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"_configType","type":"uint256"}],"name":"getConfig","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_saleId","type":"uint256"},{"internalType":"address","name":"_user","type":"address"}],"name":"getMintedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_saleId","type":"uint256"}],"name":"getSale","outputs":[{"components":[{"internalType":"bytes32","name":"root","type":"bytes32"},{"internalType":"bool","name":"whitelist","type":"bool"},{"internalType":"uint64","name":"start","type":"uint64"},{"internalType":"uint64","name":"finish","type":"uint64"},{"internalType":"uint64","name":"price","type":"uint64"},{"internalType":"uint8","name":"limit","type":"uint8"}],"internalType":"struct DefimonsApartments.Sale","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSalesCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"}],"name":"hasStoredPayload","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_saleId","type":"uint256"}],"name":"isSaleActive","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":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextToMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"internalType":"uint64","name":"_nonce","type":"uint64"},{"internalType":"bytes","name":"_payload","type":"bytes"}],"name":"nonblockingLzReceive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"internalType":"uint64","name":"_nonce","type":"uint64"},{"internalType":"bytes","name":"_payload","type":"bytes"}],"name":"retryMessage","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"internalType":"bytes","name":"_payload","type":"bytes"}],"name":"retryPayload","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","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":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_saleId","type":"uint256"},{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint8","name":"_quantity","type":"uint8"},{"internalType":"bytes32[]","name":"_proof","type":"bytes32[]"}],"name":"saleMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes","name":"_toAddress","type":"bytes"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address payable","name":"_refundAddress","type":"address"},{"internalType":"address","name":"_zroPaymentAddress","type":"address"},{"internalType":"bytes","name":"_adapterParams","type":"bytes"}],"name":"send","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":"uint16","name":"_version","type":"uint16"},{"internalType":"uint16","name":"_chainId","type":"uint16"},{"internalType":"uint256","name":"_configType","type":"uint256"},{"internalType":"bytes","name":"_config","type":"bytes"}],"name":"setConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_version","type":"uint16"}],"name":"setReceiveVersion","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_version","type":"uint16"}],"name":"setSendVersion","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"}],"name":"setTrustedRemote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_newURI","type":"string"}],"name":"setURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"}],"name":"trustedRemoteLookup","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawEther","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60a06040526001600a553480156200001657600080fd5b5060405162004a5938038062004a59833981016040819052620000399162000279565b83838382828280806200004c3362000099565b6001600160a01b03166080525060039050620000698382620003bb565b506004620000788282620003bb565b5050505050506200008f81620000e960201b60201c565b50505050620004bc565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b620000f36200013e565b6009620001018282620003bb565b507f71cabd649e93e2aa1fae6b5fa734ff133e12a99dc1c56024d99ee03072ef47308160405162000133919062000487565b60405180910390a150565b6000546001600160a01b031633146200019d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640160405180910390fd5b565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620001d2578181015183820152602001620001b8565b83811115620001e2576000848401525b50505050565b600082601f830112620001fa57600080fd5b81516001600160401b03808211156200021757620002176200019f565b604051601f8301601f19908116603f011681019082821181831017156200024257620002426200019f565b816040528381528660208588010111156200025c57600080fd5b6200026f846020830160208901620001b5565b9695505050505050565b600080600080608085870312156200029057600080fd5b84516001600160401b0380821115620002a857600080fd5b620002b688838901620001e8565b95506020870151915080821115620002cd57600080fd5b620002db88838901620001e8565b604088015190955091506001600160a01b0382168214620002fb57600080fd5b6060870151919350808211156200031157600080fd5b506200032087828801620001e8565b91505092959194509250565b600181811c908216806200034157607f821691505b6020821081036200036257634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620003b657600081815260208120601f850160051c81016020861015620003915750805b601f850160051c820191505b81811015620003b2578281556001016200039d565b5050505b505050565b81516001600160401b03811115620003d757620003d76200019f565b620003ef81620003e884546200032c565b8462000368565b602080601f8311600181146200042757600084156200040e5750858301515b600019600386901b1c1916600185901b178555620003b2565b600085815260208120601f198616915b82811015620004585788860151825594840194600190910190840162000437565b5085821015620004775787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6020815260008251806020840152620004a8816040850160208701620001b5565b601f01601f19169190910160400192915050565b60805161453462000525600039600081816107230152818161094a01528181610bfc01528181610db301528181610e5601528181610fd601528181611168015281816117cd015281816118fa01528181611cb2015281816129d9015261303701526145346000f3fe60806040526004361061027c5760003560e01c806370a082311161014f578063c87b56dd116100c1578063eb8d72b71161007a578063eb8d72b714610898578063eed33cef146108b8578063f0292a03146108cb578063f2fde38b146108f4578063f5ecbdbc14610914578063f95d5e8b1461093457600080fd5b8063c87b56dd14610765578063cbed8b9c14610785578063d1deba1f146107a5578063d8f6d596146107b8578063dd8027db1461083a578063e985e9c51461084f57600080fd5b80638dc0acb5116101135780638dc0acb5146106a957806395d89b41146106c9578063a22cb465146106de578063aaff5f16146106fe578063b353aaa714610711578063b88d4fde1461074557600080fd5b806370a0823114610616578063715018a6146106365780637533d7881461064b5780637a3cdf681461066b5780638da5cb5b1461068b57600080fd5b8063285f1239116101f3578063522f6815116101ac578063522f6815146105005780635b8c41e6146105205780635d55159e1461057d5780636352211e146105c057806366ad5c8a146105e05780636be78f761461060057600080fd5b8063285f12391461042b5780632a205e3d1461044b5780633d8b38f61461048057806342842e0e146104a057806342d65a8d146104c057806344004cc1146104e057600080fd5b8063081812fc11610245578063081812fc1461033a578063095ea7b3146103725780630eaf6ea61461039257806310ddb137146103b2578063150b7a02146103d257806323b872dd1461040b57600080fd5b80621d35671461028157806301ffc9a7146102a357806302fe5305146102d857806306fdde03146102f857806307e0db171461031a575b600080fd5b34801561028d57600080fd5b506102a161029c3660046134ad565b610947565b005b3480156102af57600080fd5b506102c36102be36600461354b565b610ad7565b60405190151581526020015b60405180910390f35b3480156102e457600080fd5b506102a16102f3366004613568565b610afa565b34801561030457600080fd5b5061030d610b49565b6040516102cf9190613608565b34801561032657600080fd5b506102a161033536600461361b565b610bdb565b34801561034657600080fd5b5061035a610355366004613636565b610c5d565b6040516001600160a01b0390911681526020016102cf565b34801561037e57600080fd5b506102a161038d366004613664565b610c84565b34801561039e57600080fd5b506102c36103ad3660046136d8565b610d99565b3480156103be57600080fd5b506102a16103cd36600461361b565b610e35565b3480156103de57600080fd5b506103f26103ed36600461372a565b610e8d565b6040516001600160e01b031990911681526020016102cf565b34801561041757600080fd5b506102a1610426366004613789565b610eb8565b34801561043757600080fd5b506102c3610446366004613636565b610eea565b34801561045757600080fd5b5061046b6104663660046137d8565b610f97565b604080519283526020830191909152016102cf565b34801561048c57600080fd5b506102c361049b3660046136d8565b611062565b3480156104ac57600080fd5b506102a16104bb366004613789565b61112e565b3480156104cc57600080fd5b506102a16104db3660046136d8565b611149565b3480156104ec57600080fd5b506102a16104fb366004613789565b6111d8565b34801561050c57600080fd5b506102a161051b366004613664565b6111f4565b34801561052c57600080fd5b5061056f61053b36600461386a565b6002602090815260009384526040808520845180860184018051928152908401958401959095209452929052825290205481565b6040519081526020016102cf565b34801561058957600080fd5b5061056f6105983660046138cb565b6000918252600c602090815260408084206001600160a01b0393909316845291905290205490565b3480156105cc57600080fd5b5061035a6105db366004613636565b611232565b3480156105ec57600080fd5b506102a16105fb3660046134ad565b611292565b34801561060c57600080fd5b5061056f600a5481565b34801561062257600080fd5b5061056f6106313660046138fb565b6112f3565b34801561064257600080fd5b506102a1611379565b34801561065757600080fd5b5061030d61066636600461361b565b61138d565b34801561067757600080fd5b506102a1610686366004613929565b611427565b34801561069757600080fd5b506000546001600160a01b031661035a565b3480156106b557600080fd5b506102a16106c43660046139ab565b6115c6565b3480156106d557600080fd5b5061030d611798565b3480156106ea57600080fd5b506102a16106f9366004613a22565b6117a7565b6102a161070c366004613a50565b6117b6565b34801561071d57600080fd5b5061035a7f000000000000000000000000000000000000000000000000000000000000000081565b34801561075157600080fd5b506102a161076036600461372a565b611843565b34801561077157600080fd5b5061030d610780366004613636565b611875565b34801561079157600080fd5b506102a16107a0366004613ad0565b6118db565b6102a16107b3366004613b2d565b611937565b3480156107c457600080fd5b506107d86107d3366004613636565b611ad2565b6040516102cf9190600060c0820190508251825260208301511515602083015260408301516001600160401b038082166040850152806060860151166060850152806080860151166080850152505060ff60a08401511660a083015292915050565b34801561084657600080fd5b50600b5461056f565b34801561085b57600080fd5b506102c361086a366004613b9e565b6001600160a01b03918216600090815260086020908152604080832093909416825291909152205460ff1690565b3480156108a457600080fd5b506102a16108b33660046136d8565b611b92565b6102a16108c6366004613bcc565b611bf9565b3480156108d757600080fd5b506108e161251c81565b60405161ffff90911681526020016102cf565b34801561090057600080fd5b506102a161090f3660046138fb565b611c08565b34801561092057600080fd5b5061030d61092f366004613c71565b611c81565b6102a1610942366004613cbe565b611d32565b337f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316146109bc5760405162461bcd60e51b8152602060048201526015602482015274131e949958d95a5d995c8e8808595b991c1bda5b9d605a1b60448201526064015b60405180910390fd5b61ffff8416600090815260016020526040812080546109da90613d5d565b80601f0160208091040260200160405190810160405280929190818152602001828054610a0690613d5d565b8015610a535780601f10610a2857610100808354040283529160200191610a53565b820191906000526020600020905b815481529060010190602001808311610a3657829003601f168201915b5050505050905080518451148015610a78575080805190602001208480519060200120145b610ac45760405162461bcd60e51b815260206004820152601a60248201527f4c7a52656365697665723a20696e76616c696420736f7572636500000000000060448201526064016109b3565b610ad08585858561213b565b5050505050565b60006001600160e01b031982161580610af45750610af48261222c565b92915050565b610b0261226c565b6009610b0e8282613ddd565b507f71cabd649e93e2aa1fae6b5fa734ff133e12a99dc1c56024d99ee03072ef473081604051610b3e9190613608565b60405180910390a150565b606060038054610b5890613d5d565b80601f0160208091040260200160405190810160405280929190818152602001828054610b8490613d5d565b8015610bd15780601f10610ba657610100808354040283529160200191610bd1565b820191906000526020600020905b815481529060010190602001808311610bb457829003601f168201915b5050505050905090565b610be361226c565b6040516307e0db1760e01b815261ffff821660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906307e0db17906024015b600060405180830381600087803b158015610c4957600080fd5b505af1158015610ad0573d6000803e3d6000fd5b6000610c68826122c6565b506000908152600760205260409020546001600160a01b031690565b6000610c8f82611232565b9050806001600160a01b0316836001600160a01b031603610cfc5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084016109b3565b336001600160a01b0382161480610d185750610d18813361086a565b610d8a5760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c00000060648201526084016109b3565b610d948383612325565b505050565b604051630757b75360e11b81526000906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690630eaf6ea690610dec90879087908790600401613ec5565b602060405180830381865afa158015610e09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2d9190613ee3565b949350505050565b610e3d61226c565b6040516310ddb13760e01b815261ffff821660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906310ddb13790602401610c2f565b60006001600160a01b0385163014610ea757506000610e2d565b50630a85bd0160e11b949350505050565b610ec3335b82612393565b610edf5760405162461bcd60e51b81526004016109b390613f00565b610d94838383612411565b600080600b8381548110610f0057610f00613f4d565b60009182526020918290206040805160c0810182526002909302909101805483526001015460ff8082161515948401949094526001600160401b0361010082048116928401839052600160481b820481166060850152600160881b8204166080840152600160c81b900490921660a082015291504210801590610f90575080606001516001600160401b03164211155b9392505050565b60008060008686604051602001610faf929190613f63565b60408051601f198184030181529082905263040a7bb160e41b825291506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906340a7bb1090611013908b90309086908b908b90600401613f85565b6040805180830381865afa15801561102f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110539190613fd9565b92509250509550959350505050565b61ffff83166000908152600160205260408120805482919061108390613d5d565b80601f01602080910402602001604051908101604052809291908181526020018280546110af90613d5d565b80156110fc5780601f106110d1576101008083540402835291602001916110fc565b820191906000526020600020905b8154815290600101906020018083116110df57829003601f168201915b505050505090508383604051611113929190613ffd565b60405180910390208180519060200120149150509392505050565b610d9483838360405180602001604052806000815250611843565b61115161226c565b6040516342d65a8d60e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906342d65a8d906111a190869086908690600401613ec5565b600060405180830381600087803b1580156111bb57600080fd5b505af11580156111cf573d6000803e3d6000fd5b50505050505050565b6111e061226c565b610d946001600160a01b03841683836125bc565b6111fc61226c565b6040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015610d94573d6000803e3d6000fd5b6000818152600560205260408120546001600160a01b031680610af45760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016109b3565b3330146112e15760405162461bcd60e51b815260206004820181905260248201527f4c7a52656365697665723a2063616c6c6572206d757374206265204c7a41707060448201526064016109b3565b6112ed8484848461260e565b50505050565b60006001600160a01b03821661135d5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b60648201526084016109b3565b506001600160a01b031660009081526006602052604090205490565b61138161226c565b61138b60006126a9565b565b600160205260009081526040902080546113a690613d5d565b80601f01602080910402602001604051908101604052809291908181526020018280546113d290613d5d565b801561141f5780601f106113f45761010080835404028352916020019161141f565b820191906000526020600020905b81548152906001019060200180831161140257829003601f168201915b505050505081565b61142f61226c565b61143b868684846126f9565b600b5487106114605760405163a893e97760e01b8152600481018890526024016109b3565b6000600b888154811061147557611475613f4d565b90600052602060002090600202019050868160010160016101000a8154816001600160401b0302191690836001600160401b03160217905550858160010160096101000a8154816001600160401b0302191690836001600160401b03160217905550848160010160196101000a81548160ff021916908360ff160217905550838160010160116101000a8154816001600160401b0302191690836001600160401b03160217905550828160010160006101000a81548160ff021916908315150217905550818160000181905550877f8f0f4ae106b88a53b8b504f019da56323c3ed412f78bfb802c7190234418bcdd8888888888886040516115b4969594939291906001600160401b039687168152948616602086015260ff93909316604085015293166060830152911515608082015260a081019190915260c00190565b60405180910390a25050505050505050565b6115ce61226c565b6115da868684846126f9565b6040805160c081018252828152831515602082019081526001600160401b03898116938301938452888116606084019081528782166080850190815260ff8a811660a08701908152600b805460018082018355600083905289517f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db960029093029283015597517f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01dba90910180549a5196519551935168ffffffffffffffffff19909b1691151568ffffffffffffffff00191691909117610100968816969096029590951778ffffffffffffffffffffffffffffffff0000000000000000001916600160481b9487169490940267ffffffffffffffff60881b191693909317600160881b91909516029390931760ff60c81b1916600160c81b96909316959095029190911790559154909161172c91614023565b604080516001600160401b038a81168252898116602083015260ff89168284015287166060820152851515608082015260a0810185905290517f0eb54f99ff1347f6bc16a41cc07672c766b6e2b9a5e1e3f19f9b9d5f1aa576a39181900360c00190a250505050505050565b606060048054610b5890613d5d565b6117b2338383612768565b5050565b60405163557faf8b60e11b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063aaff5f169061180a908890889088908890889060040161403a565b600060405180830381600087803b15801561182457600080fd5b505af1158015611838573d6000803e3d6000fd5b505050505050505050565b61184d3383612393565b6118695760405162461bcd60e51b81526004016109b390613f00565b6112ed84848484612836565b6060611880826122c6565b600061188a612869565b905060008151116118aa5760405180602001604052806000815250610f90565b806118b484612878565b6040516020016118c592919061406b565b6040516020818303038152906040529392505050565b6118e361226c565b6040516332fb62e760e21b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063cbed8b9c9061180a908890889088908890889060040161409a565b61ffff851660009081526002602052604080822090516119589087906140c8565b90815260408051602092819003830190206001600160401b038716600090815292529020549050806119cc5760405162461bcd60e51b815260206004820152601d60248201527f4c7a52656365697665723a206e6f2073746f726564206d65737361676500000060448201526064016109b3565b8083836040516119dd929190613ffd565b604051809103902014611a325760405162461bcd60e51b815260206004820152601b60248201527f4c7a52656365697665723a20696e76616c6964207061796c6f6164000000000060448201526064016109b3565b61ffff86166000908152600260205260408082209051611a539088906140c8565b90815260200160405180910390206000866001600160401b03166001600160401b0316815260200190815260200160002081905550611aca86868686868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061260e92505050565b505050505050565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a0810191909152600b8281548110611b1757611b17613f4d565b60009182526020918290206040805160c0810182526002909302909101805483526001015460ff8082161515948401949094526001600160401b036101008204811692840192909252600160481b810482166060840152600160881b81049091166080830152600160c81b900490911660a082015292915050565b611b9a61226c565b61ffff83166000908152600160205260409020611bb88284836140e4565b507ffa41487ad5d6728f0b19276fa1eddc16558578f5109fc39d2dc33c3230470dab838383604051611bec93929190613ec5565b60405180910390a1505050565b611aca33878787878787612978565b611c1061226c565b6001600160a01b038116611c755760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016109b3565b611c7e816126a9565b50565b604051633d7b2f6f60e21b815261ffff808616600483015284166024820152306044820152606481018290526060907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063f5ecbdbc90608401600060405180830381865afa158015611d01573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611d2991908101906141e8565b95945050505050565b600b548510611d575760405163a893e97760e01b8152600481018690526024016109b3565b8260ff16600003611d7b57604051630a5f366560e01b815260040160405180910390fd5b6000600b8681548110611d9057611d90613f4d565b60009182526020918290206040805160c0810182526002909302909101805483526001015460ff8082161515948401949094526001600160401b0361010082048116928401839052600160481b820481166060850152600160881b8204166080840152600160c81b900490921660a08201529150421080611e1d575080606001516001600160401b031642115b15611e65576040808201516060830151915163e298a8f760e01b8152600481018990526001600160401b039182166024820152911660448201524260648201526084016109b3565b806020015115611ee0576040516bffffffffffffffffffffffff19606087901b166020820152600090603401604051602081830303815290604052805190602001209050611eb98260000151858584612ac0565b611ede5786868585604051635d977ce760e11b81526004016109b3949392919061421c565b505b6080810151611ef29060ff8616614270565b6001600160401b03163414611f415760808101516040516311b66a1360e01b8152600481018890523460248201526001600160401b03909116604482015260ff851660648201526084016109b3565b6000868152600c602090815260408083206001600160a01b038916845290915281205460a0830151611f76919060ff16614023565b90508460ff16811015611fbd5760a082015160405163cc29b83760e01b8152600481018990526001600160a01b038816602482015260ff90911660448201526064016109b3565b600a54600081611fd061251c600161429f565b61ffff16611fde9190614023565b905080600003612001576040516335e6a0a160e11b815260040160405180910390fd5b6000612010828960ff16612b04565b60008b8152600c602090815260408083206001600160a01b038e1684529091528120805492935083929091906120479084906142bc565b9250508190555080600a600082825461206091906142bc565b90915550600090505b8181101561208c576120848a61207f83876142bc565b612b1a565b600101612069565b50886001600160a01b03168a7fdc331af4e71bb8ec56b1a0d719543254ff272f4f63e9ea61cea22c149f78ccb3836040516120c991815260200190565b60405180910390a38760ff1681101561212f57336108fc6120ed8360ff8c16614023565b87608001516001600160401b031661210591906142d4565b6040518115909202916000818181858888f1935050505015801561212d573d6000803e3d6000fd5b505b50505050505050505050565b604051633356ae4560e11b815230906366ad5c8a906121649087908790879087906004016142f3565b600060405180830381600087803b15801561217e57600080fd5b505af192505050801561218f575060015b6112ed578080519060200120600260008661ffff1661ffff168152602001908152602001600020846040516121c491906140c8565b9081526040805191829003602090810183206001600160401b0387166000908152915220919091557fe6f254030bcb01ffd20558175c13fcaed6d1520be7becee4c961b65f79243b0d9061221f9086908690869086906142f3565b60405180910390a16112ed565b60006001600160e01b031982166380ac58cd60e01b148061225d57506001600160e01b03198216635b5e139f60e01b145b80610af45750610af482612c5c565b6000546001600160a01b0316331461138b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016109b3565b6000818152600560205260409020546001600160a01b0316611c7e5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016109b3565b600081815260076020526040902080546001600160a01b0319166001600160a01b038416908117909155819061235a82611232565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60008061239f83611232565b9050806001600160a01b0316846001600160a01b031614806123e657506001600160a01b0380821660009081526008602090815260408083209388168352929052205460ff165b80610e2d5750836001600160a01b03166123ff84610c5d565b6001600160a01b031614949350505050565b826001600160a01b031661242482611232565b6001600160a01b0316146124885760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b60648201526084016109b3565b6001600160a01b0382166124ea5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016109b3565b600081815260076020908152604080832080546001600160a01b03191690556001600160a01b03861683526006909152812080546001929061252d908490614023565b90915550506001600160a01b038216600090815260066020526040812080546001929061255b9084906142bc565b909155505060008181526005602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610d94908490612c91565b600080828060200190518101906126259190614331565b6014820151919350915061263a878284612d63565b806001600160a01b03168660405161265291906140c8565b604080519182900382208583526001600160401b03891660208401529161ffff8b16917f64e10c37f404d128982dce114f5d233c14c5c7f6d8db93099e3d99dacb9e27ba910160405180910390a450505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b826001600160401b0316846001600160401b0316111561273f576040516311e38b4b60e31b81526001600160401b038086166004830152841660248201526044016109b3565b81801561274a575080155b156112ed576040516337b62bc560e01b815260040160405180910390fd5b816001600160a01b0316836001600160a01b0316036127c95760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016109b3565b6001600160a01b03838116600081815260086020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b612841848484612411565b61284d84848484612d6d565b6112ed5760405162461bcd60e51b81526004016109b390614377565b606060098054610b5890613d5d565b60608160000361289f5750506040805180820190915260018152600360fc1b602082015290565b8160005b81156128c957806128b3816143c9565b91506128c29050600a836143f8565b91506128a3565b6000816001600160401b038111156128e3576128e36133cd565b6040519080825280601f01601f19166020018201604052801561290d576020820181803683370190505b5090505b8415610e2d57612922600183614023565b915061292f600a8661440c565b61293a9060306142bc565b60f81b81838151811061294f5761294f613f4d565b60200101906001600160f81b031916908160001a905350612971600a866143f8565b9450612911565b61298487878787612e6b565b60008585604051602001612999929190613f63565b60405160208183030381529060405290506129b78782868686612f32565b604051630f428ae960e31b815261ffff881660048201523060248201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690637a14574890604401602060405180830381865afa158015612a28573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a4c9190614420565b905086604051612a5c91906140c8565b604080519182900382208883526001600160401b03841660208401529161ffff8b16916001600160a01b038d16917f024797cc77ce15dc717112d54fb1df125fdfd8c81344fb046c5e074427ce1543910160405180910390a4505050505050505050565b6000611d2985838686808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509294939250506130a59050565b6000818310612b135781610f90565b5090919050565b6001600160a01b038216612b705760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016109b3565b6000818152600560205260409020546001600160a01b031615612bd55760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016109b3565b6001600160a01b0382166000908152600660205260408120805460019290612bfe9084906142bc565b909155505060008181526005602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60006001600160e01b03198216636279b16960e11b1480610af457506301ffc9a760e01b6001600160e01b0319831614610af4565b6000612ce6826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166130bb9092919063ffffffff16565b805190915015610d945780806020019051810190612d049190613ee3565b610d945760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016109b3565b610d9482826130ca565b60006001600160a01b0384163b15612e6357604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612db190339089908890889060040161443d565b6020604051808303816000875af1925050508015612dec575060408051601f3d908101601f19168201909252612de99181019061447a565b60015b612e49573d808015612e1a576040519150601f19603f3d011682016040523d82523d6000602084013e612e1f565b606091505b508051600003612e415760405162461bcd60e51b81526004016109b390614377565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610e2d565b506001610e2d565b612e7433610ebd565b612ec05760405162461bcd60e51b815260206004820152601f60248201527f4f4e46543732313a206e6f74206f776e6572206e6f7220617070726f7665640060448201526064016109b3565b836001600160a01b0316612ed382611232565b6001600160a01b031614612f295760405162461bcd60e51b815260206004820152601860248201527f4f4e46543732313a20696e636f7272656374206f776e6572000000000000000060448201526064016109b3565b6112ed816130e4565b61ffff851660009081526001602052604081208054612f5090613d5d565b80601f0160208091040260200160405190810160405280929190818152602001828054612f7c90613d5d565b8015612fc95780601f10612f9e57610100808354040283529160200191612fc9565b820191906000526020600020905b815481529060010190602001808311612fac57829003601f168201915b5050505050905080516000036130215760405162461bcd60e51b815260206004820152601860248201527f4c7a53656e643a20217472757374656420736f757263652e000000000000000060448201526064016109b3565b60405162c5803160e81b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c5803100903490613078908a9086908b908b908b908b90600401614497565b6000604051808303818588803b15801561309157600080fd5b505af115801561212d573d6000803e3d6000fd5b6000826130b2858461318e565b14949350505050565b6060610e2d84846000856131db565b6117b28282604051806020016040528060008152506132b6565b60006130ef82611232565b9050600082815260076020908152604080832080546001600160a01b03191690556001600160a01b038416835260069091528120805460019290613134908490614023565b909155505060008281526005602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b600081815b84518110156131d3576131bf828683815181106131b2576131b2613f4d565b60200260200101516132e9565b9150806131cb816143c9565b915050613193565b509392505050565b60608247101561323c5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016109b3565b600080866001600160a01b0316858760405161325891906140c8565b60006040518083038185875af1925050503d8060008114613295576040519150601f19603f3d011682016040523d82523d6000602084013e61329a565b606091505b50915091506132ab87838387613318565b979650505050505050565b6132c08383612b1a565b6132cd6000848484612d6d565b610d945760405162461bcd60e51b81526004016109b390614377565b6000818310613305576000828152602084905260409020610f90565b6000838152602083905260409020610f90565b60608315613387578251600003613380576001600160a01b0385163b6133805760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016109b3565b5081610e2d565b610e2d838381511561339c5781518083602001fd5b8060405162461bcd60e51b81526004016109b39190613608565b803561ffff811681146133c857600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561340b5761340b6133cd565b604052919050565b60006001600160401b0382111561342c5761342c6133cd565b50601f01601f191660200190565b600061344d61344884613413565b6133e3565b905082815283838301111561346157600080fd5b828260208301376000602084830101529392505050565b600082601f83011261348957600080fd5b610f908383356020850161343a565b6001600160401b0381168114611c7e57600080fd5b600080600080608085870312156134c357600080fd5b6134cc856133b6565b935060208501356001600160401b03808211156134e857600080fd5b6134f488838901613478565b94506040870135915061350682613498565b9092506060860135908082111561351c57600080fd5b5061352987828801613478565b91505092959194509250565b6001600160e01b031981168114611c7e57600080fd5b60006020828403121561355d57600080fd5b8135610f9081613535565b60006020828403121561357a57600080fd5b81356001600160401b0381111561359057600080fd5b8201601f810184136135a157600080fd5b610e2d8482356020840161343a565b60005b838110156135cb5781810151838201526020016135b3565b838111156112ed5750506000910152565b600081518084526135f48160208601602086016135b0565b601f01601f19169290920160200192915050565b602081526000610f9060208301846135dc565b60006020828403121561362d57600080fd5b610f90826133b6565b60006020828403121561364857600080fd5b5035919050565b6001600160a01b0381168114611c7e57600080fd5b6000806040838503121561367757600080fd5b82356136828161364f565b946020939093013593505050565b60008083601f8401126136a257600080fd5b5081356001600160401b038111156136b957600080fd5b6020830191508360208285010111156136d157600080fd5b9250929050565b6000806000604084860312156136ed57600080fd5b6136f6846133b6565b925060208401356001600160401b0381111561371157600080fd5b61371d86828701613690565b9497909650939450505050565b6000806000806080858703121561374057600080fd5b843561374b8161364f565b9350602085013561375b8161364f565b92506040850135915060608501356001600160401b0381111561377d57600080fd5b61352987828801613478565b60008060006060848603121561379e57600080fd5b83356137a98161364f565b925060208401356137b98161364f565b929592945050506040919091013590565b8015158114611c7e57600080fd5b600080600080600060a086880312156137f057600080fd5b6137f9866133b6565b945060208601356001600160401b038082111561381557600080fd5b61382189838a01613478565b9550604088013594506060880135915061383a826137ca565b9092506080870135908082111561385057600080fd5b5061385d88828901613478565b9150509295509295909350565b60008060006060848603121561387f57600080fd5b613888846133b6565b925060208401356001600160401b038111156138a357600080fd5b6138af86828701613478565b92505060408401356138c081613498565b809150509250925092565b600080604083850312156138de57600080fd5b8235915060208301356138f08161364f565b809150509250929050565b60006020828403121561390d57600080fd5b8135610f908161364f565b803560ff811681146133c857600080fd5b600080600080600080600060e0888a03121561394457600080fd5b87359650602088013561395681613498565b9550604088013561396681613498565b945061397460608901613918565b9350608088013561398481613498565b925060a0880135613994816137ca565b8092505060c0880135905092959891949750929550565b60008060008060008060c087890312156139c457600080fd5b86356139cf81613498565b955060208701356139df81613498565b94506139ed60408801613918565b935060608701356139fd81613498565b92506080870135613a0d816137ca565b8092505060a087013590509295509295509295565b60008060408385031215613a3557600080fd5b8235613a408161364f565b915060208301356138f0816137ca565b600080600080600060608688031215613a6857600080fd5b613a71866133b6565b945060208601356001600160401b0380821115613a8d57600080fd5b613a9989838a01613690565b90965094506040880135915080821115613ab257600080fd5b50613abf88828901613690565b969995985093965092949392505050565b600080600080600060808688031215613ae857600080fd5b613af1866133b6565b9450613aff602087016133b6565b93506040860135925060608601356001600160401b03811115613b2157600080fd5b613abf88828901613690565b600080600080600060808688031215613b4557600080fd5b613b4e866133b6565b945060208601356001600160401b0380821115613b6a57600080fd5b613b7689838a01613478565b955060408801359150613b8882613498565b90935060608701359080821115613ab257600080fd5b60008060408385031215613bb157600080fd5b8235613bbc8161364f565b915060208301356138f08161364f565b60008060008060008060c08789031215613be557600080fd5b613bee876133b6565b955060208701356001600160401b0380821115613c0a57600080fd5b613c168a838b01613478565b96506040890135955060608901359150613c2f8261364f565b909350608088013590613c418261364f565b90925060a08801359080821115613c5757600080fd5b50613c6489828a01613478565b9150509295509295509295565b60008060008060808587031215613c8757600080fd5b613c90856133b6565b9350613c9e602086016133b6565b92506040850135613cae8161364f565b9396929550929360600135925050565b600080600080600060808688031215613cd657600080fd5b853594506020860135613ce88161364f565b9350613cf660408701613918565b925060608601356001600160401b0380821115613d1257600080fd5b818801915088601f830112613d2657600080fd5b813581811115613d3557600080fd5b8960208260051b8501011115613d4a57600080fd5b9699959850939650602001949392505050565b600181811c90821680613d7157607f821691505b602082108103613d9157634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115610d9457600081815260208120601f850160051c81016020861015613dbe5750805b601f850160051c820191505b81811015611aca57828155600101613dca565b81516001600160401b03811115613df657613df66133cd565b613e0a81613e048454613d5d565b84613d97565b602080601f831160018114613e3f5760008415613e275750858301515b600019600386901b1c1916600185901b178555611aca565b600085815260208120601f198616915b82811015613e6e57888601518255948401946001909101908401613e4f565b5085821015613e8c5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b61ffff84168152604060208201526000611d29604083018486613e9c565b600060208284031215613ef557600080fd5b8151610f90816137ca565b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b604081526000613f7660408301856135dc565b90508260208301529392505050565b61ffff861681526001600160a01b038516602082015260a060408201819052600090613fb3908301866135dc565b84151560608401528281036080840152613fcd81856135dc565b98975050505050505050565b60008060408385031215613fec57600080fd5b505080516020909101519092909150565b8183823760009101908152919050565b634e487b7160e01b600052601160045260246000fd5b6000828210156140355761403561400d565b500390565b61ffff86168152606060208201526000614058606083018688613e9c565b8281036040840152613fcd818587613e9c565b6000835161407d8184602088016135b0565b8351908301906140918183602088016135b0565b01949350505050565b600061ffff8088168352808716602084015250846040830152608060608301526132ab608083018486613e9c565b600082516140da8184602087016135b0565b9190910192915050565b6001600160401b038311156140fb576140fb6133cd565b61410f836141098354613d5d565b83613d97565b6000601f841160018114614143576000851561412b5750838201355b600019600387901b1c1916600186901b178355610ad0565b600083815260209020601f19861690835b828110156141745786850135825560209485019460019092019101614154565b50868210156141915760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b600082601f8301126141b457600080fd5b81516141c261344882613413565b8181528460208386010111156141d757600080fd5b610e2d8260208301602087016135b0565b6000602082840312156141fa57600080fd5b81516001600160401b0381111561421057600080fd5b610e2d848285016141a3565b8481526001600160a01b0384166020820152606060408201819052810182905260006001600160fb1b0383111561425257600080fd5b8260051b808560808501376000920160800191825250949350505050565b60006001600160401b03808316818516818304811182151516156142965761429661400d565b02949350505050565b600061ffff8083168185168083038211156140915761409161400d565b600082198211156142cf576142cf61400d565b500190565b60008160001904831182151516156142ee576142ee61400d565b500290565b61ffff8516815260806020820152600061431060808301866135dc565b6001600160401b038516604084015282810360608401526132ab81856135dc565b6000806040838503121561434457600080fd5b82516001600160401b0381111561435a57600080fd5b614366858286016141a3565b925050602083015190509250929050565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6000600182016143db576143db61400d565b5060010190565b634e487b7160e01b600052601260045260246000fd5b600082614407576144076143e2565b500490565b60008261441b5761441b6143e2565b500690565b60006020828403121561443257600080fd5b8151610f9081613498565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090614470908301846135dc565b9695505050505050565b60006020828403121561448c57600080fd5b8151610f9081613535565b61ffff8716815260c0602082015260006144b460c08301886135dc565b82810360408401526144c681886135dc565b6001600160a01b0387811660608601528616608085015283810360a085015290506144f181856135dc565b999850505050505050505056fea2646970667358221220233a5f543412728a5d34362626c5bab17acc6716a67ac557468d0ba01c16522564736f6c634300080f0033000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000093f54d755a063ce7bb9e6ac47eccc8e33411d70600000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000013446566696d6f6e732041706172746d656e74730000000000000000000000000000000000000000000000000000000000000000000000000000000000000000074d4f4e4c414e4400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002d68747470733a2f2f6170692e646566696d6f6e732e636f6d2f6d657461646174612f61706172746d656e74732f00000000000000000000000000000000000000
Deployed Bytecode
0x60806040526004361061027c5760003560e01c806370a082311161014f578063c87b56dd116100c1578063eb8d72b71161007a578063eb8d72b714610898578063eed33cef146108b8578063f0292a03146108cb578063f2fde38b146108f4578063f5ecbdbc14610914578063f95d5e8b1461093457600080fd5b8063c87b56dd14610765578063cbed8b9c14610785578063d1deba1f146107a5578063d8f6d596146107b8578063dd8027db1461083a578063e985e9c51461084f57600080fd5b80638dc0acb5116101135780638dc0acb5146106a957806395d89b41146106c9578063a22cb465146106de578063aaff5f16146106fe578063b353aaa714610711578063b88d4fde1461074557600080fd5b806370a0823114610616578063715018a6146106365780637533d7881461064b5780637a3cdf681461066b5780638da5cb5b1461068b57600080fd5b8063285f1239116101f3578063522f6815116101ac578063522f6815146105005780635b8c41e6146105205780635d55159e1461057d5780636352211e146105c057806366ad5c8a146105e05780636be78f761461060057600080fd5b8063285f12391461042b5780632a205e3d1461044b5780633d8b38f61461048057806342842e0e146104a057806342d65a8d146104c057806344004cc1146104e057600080fd5b8063081812fc11610245578063081812fc1461033a578063095ea7b3146103725780630eaf6ea61461039257806310ddb137146103b2578063150b7a02146103d257806323b872dd1461040b57600080fd5b80621d35671461028157806301ffc9a7146102a357806302fe5305146102d857806306fdde03146102f857806307e0db171461031a575b600080fd5b34801561028d57600080fd5b506102a161029c3660046134ad565b610947565b005b3480156102af57600080fd5b506102c36102be36600461354b565b610ad7565b60405190151581526020015b60405180910390f35b3480156102e457600080fd5b506102a16102f3366004613568565b610afa565b34801561030457600080fd5b5061030d610b49565b6040516102cf9190613608565b34801561032657600080fd5b506102a161033536600461361b565b610bdb565b34801561034657600080fd5b5061035a610355366004613636565b610c5d565b6040516001600160a01b0390911681526020016102cf565b34801561037e57600080fd5b506102a161038d366004613664565b610c84565b34801561039e57600080fd5b506102c36103ad3660046136d8565b610d99565b3480156103be57600080fd5b506102a16103cd36600461361b565b610e35565b3480156103de57600080fd5b506103f26103ed36600461372a565b610e8d565b6040516001600160e01b031990911681526020016102cf565b34801561041757600080fd5b506102a1610426366004613789565b610eb8565b34801561043757600080fd5b506102c3610446366004613636565b610eea565b34801561045757600080fd5b5061046b6104663660046137d8565b610f97565b604080519283526020830191909152016102cf565b34801561048c57600080fd5b506102c361049b3660046136d8565b611062565b3480156104ac57600080fd5b506102a16104bb366004613789565b61112e565b3480156104cc57600080fd5b506102a16104db3660046136d8565b611149565b3480156104ec57600080fd5b506102a16104fb366004613789565b6111d8565b34801561050c57600080fd5b506102a161051b366004613664565b6111f4565b34801561052c57600080fd5b5061056f61053b36600461386a565b6002602090815260009384526040808520845180860184018051928152908401958401959095209452929052825290205481565b6040519081526020016102cf565b34801561058957600080fd5b5061056f6105983660046138cb565b6000918252600c602090815260408084206001600160a01b0393909316845291905290205490565b3480156105cc57600080fd5b5061035a6105db366004613636565b611232565b3480156105ec57600080fd5b506102a16105fb3660046134ad565b611292565b34801561060c57600080fd5b5061056f600a5481565b34801561062257600080fd5b5061056f6106313660046138fb565b6112f3565b34801561064257600080fd5b506102a1611379565b34801561065757600080fd5b5061030d61066636600461361b565b61138d565b34801561067757600080fd5b506102a1610686366004613929565b611427565b34801561069757600080fd5b506000546001600160a01b031661035a565b3480156106b557600080fd5b506102a16106c43660046139ab565b6115c6565b3480156106d557600080fd5b5061030d611798565b3480156106ea57600080fd5b506102a16106f9366004613a22565b6117a7565b6102a161070c366004613a50565b6117b6565b34801561071d57600080fd5b5061035a7f00000000000000000000000093f54d755a063ce7bb9e6ac47eccc8e33411d70681565b34801561075157600080fd5b506102a161076036600461372a565b611843565b34801561077157600080fd5b5061030d610780366004613636565b611875565b34801561079157600080fd5b506102a16107a0366004613ad0565b6118db565b6102a16107b3366004613b2d565b611937565b3480156107c457600080fd5b506107d86107d3366004613636565b611ad2565b6040516102cf9190600060c0820190508251825260208301511515602083015260408301516001600160401b038082166040850152806060860151166060850152806080860151166080850152505060ff60a08401511660a083015292915050565b34801561084657600080fd5b50600b5461056f565b34801561085b57600080fd5b506102c361086a366004613b9e565b6001600160a01b03918216600090815260086020908152604080832093909416825291909152205460ff1690565b3480156108a457600080fd5b506102a16108b33660046136d8565b611b92565b6102a16108c6366004613bcc565b611bf9565b3480156108d757600080fd5b506108e161251c81565b60405161ffff90911681526020016102cf565b34801561090057600080fd5b506102a161090f3660046138fb565b611c08565b34801561092057600080fd5b5061030d61092f366004613c71565b611c81565b6102a1610942366004613cbe565b611d32565b337f00000000000000000000000093f54d755a063ce7bb9e6ac47eccc8e33411d7066001600160a01b0316146109bc5760405162461bcd60e51b8152602060048201526015602482015274131e949958d95a5d995c8e8808595b991c1bda5b9d605a1b60448201526064015b60405180910390fd5b61ffff8416600090815260016020526040812080546109da90613d5d565b80601f0160208091040260200160405190810160405280929190818152602001828054610a0690613d5d565b8015610a535780601f10610a2857610100808354040283529160200191610a53565b820191906000526020600020905b815481529060010190602001808311610a3657829003601f168201915b5050505050905080518451148015610a78575080805190602001208480519060200120145b610ac45760405162461bcd60e51b815260206004820152601a60248201527f4c7a52656365697665723a20696e76616c696420736f7572636500000000000060448201526064016109b3565b610ad08585858561213b565b5050505050565b60006001600160e01b031982161580610af45750610af48261222c565b92915050565b610b0261226c565b6009610b0e8282613ddd565b507f71cabd649e93e2aa1fae6b5fa734ff133e12a99dc1c56024d99ee03072ef473081604051610b3e9190613608565b60405180910390a150565b606060038054610b5890613d5d565b80601f0160208091040260200160405190810160405280929190818152602001828054610b8490613d5d565b8015610bd15780601f10610ba657610100808354040283529160200191610bd1565b820191906000526020600020905b815481529060010190602001808311610bb457829003601f168201915b5050505050905090565b610be361226c565b6040516307e0db1760e01b815261ffff821660048201527f00000000000000000000000093f54d755a063ce7bb9e6ac47eccc8e33411d7066001600160a01b0316906307e0db17906024015b600060405180830381600087803b158015610c4957600080fd5b505af1158015610ad0573d6000803e3d6000fd5b6000610c68826122c6565b506000908152600760205260409020546001600160a01b031690565b6000610c8f82611232565b9050806001600160a01b0316836001600160a01b031603610cfc5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084016109b3565b336001600160a01b0382161480610d185750610d18813361086a565b610d8a5760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c00000060648201526084016109b3565b610d948383612325565b505050565b604051630757b75360e11b81526000906001600160a01b037f00000000000000000000000093f54d755a063ce7bb9e6ac47eccc8e33411d7061690630eaf6ea690610dec90879087908790600401613ec5565b602060405180830381865afa158015610e09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2d9190613ee3565b949350505050565b610e3d61226c565b6040516310ddb13760e01b815261ffff821660048201527f00000000000000000000000093f54d755a063ce7bb9e6ac47eccc8e33411d7066001600160a01b0316906310ddb13790602401610c2f565b60006001600160a01b0385163014610ea757506000610e2d565b50630a85bd0160e11b949350505050565b610ec3335b82612393565b610edf5760405162461bcd60e51b81526004016109b390613f00565b610d94838383612411565b600080600b8381548110610f0057610f00613f4d565b60009182526020918290206040805160c0810182526002909302909101805483526001015460ff8082161515948401949094526001600160401b0361010082048116928401839052600160481b820481166060850152600160881b8204166080840152600160c81b900490921660a082015291504210801590610f90575080606001516001600160401b03164211155b9392505050565b60008060008686604051602001610faf929190613f63565b60408051601f198184030181529082905263040a7bb160e41b825291506001600160a01b037f00000000000000000000000093f54d755a063ce7bb9e6ac47eccc8e33411d70616906340a7bb1090611013908b90309086908b908b90600401613f85565b6040805180830381865afa15801561102f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110539190613fd9565b92509250509550959350505050565b61ffff83166000908152600160205260408120805482919061108390613d5d565b80601f01602080910402602001604051908101604052809291908181526020018280546110af90613d5d565b80156110fc5780601f106110d1576101008083540402835291602001916110fc565b820191906000526020600020905b8154815290600101906020018083116110df57829003601f168201915b505050505090508383604051611113929190613ffd565b60405180910390208180519060200120149150509392505050565b610d9483838360405180602001604052806000815250611843565b61115161226c565b6040516342d65a8d60e01b81526001600160a01b037f00000000000000000000000093f54d755a063ce7bb9e6ac47eccc8e33411d70616906342d65a8d906111a190869086908690600401613ec5565b600060405180830381600087803b1580156111bb57600080fd5b505af11580156111cf573d6000803e3d6000fd5b50505050505050565b6111e061226c565b610d946001600160a01b03841683836125bc565b6111fc61226c565b6040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015610d94573d6000803e3d6000fd5b6000818152600560205260408120546001600160a01b031680610af45760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016109b3565b3330146112e15760405162461bcd60e51b815260206004820181905260248201527f4c7a52656365697665723a2063616c6c6572206d757374206265204c7a41707060448201526064016109b3565b6112ed8484848461260e565b50505050565b60006001600160a01b03821661135d5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b60648201526084016109b3565b506001600160a01b031660009081526006602052604090205490565b61138161226c565b61138b60006126a9565b565b600160205260009081526040902080546113a690613d5d565b80601f01602080910402602001604051908101604052809291908181526020018280546113d290613d5d565b801561141f5780601f106113f45761010080835404028352916020019161141f565b820191906000526020600020905b81548152906001019060200180831161140257829003601f168201915b505050505081565b61142f61226c565b61143b868684846126f9565b600b5487106114605760405163a893e97760e01b8152600481018890526024016109b3565b6000600b888154811061147557611475613f4d565b90600052602060002090600202019050868160010160016101000a8154816001600160401b0302191690836001600160401b03160217905550858160010160096101000a8154816001600160401b0302191690836001600160401b03160217905550848160010160196101000a81548160ff021916908360ff160217905550838160010160116101000a8154816001600160401b0302191690836001600160401b03160217905550828160010160006101000a81548160ff021916908315150217905550818160000181905550877f8f0f4ae106b88a53b8b504f019da56323c3ed412f78bfb802c7190234418bcdd8888888888886040516115b4969594939291906001600160401b039687168152948616602086015260ff93909316604085015293166060830152911515608082015260a081019190915260c00190565b60405180910390a25050505050505050565b6115ce61226c565b6115da868684846126f9565b6040805160c081018252828152831515602082019081526001600160401b03898116938301938452888116606084019081528782166080850190815260ff8a811660a08701908152600b805460018082018355600083905289517f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db960029093029283015597517f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01dba90910180549a5196519551935168ffffffffffffffffff19909b1691151568ffffffffffffffff00191691909117610100968816969096029590951778ffffffffffffffffffffffffffffffff0000000000000000001916600160481b9487169490940267ffffffffffffffff60881b191693909317600160881b91909516029390931760ff60c81b1916600160c81b96909316959095029190911790559154909161172c91614023565b604080516001600160401b038a81168252898116602083015260ff89168284015287166060820152851515608082015260a0810185905290517f0eb54f99ff1347f6bc16a41cc07672c766b6e2b9a5e1e3f19f9b9d5f1aa576a39181900360c00190a250505050505050565b606060048054610b5890613d5d565b6117b2338383612768565b5050565b60405163557faf8b60e11b81526001600160a01b037f00000000000000000000000093f54d755a063ce7bb9e6ac47eccc8e33411d706169063aaff5f169061180a908890889088908890889060040161403a565b600060405180830381600087803b15801561182457600080fd5b505af1158015611838573d6000803e3d6000fd5b505050505050505050565b61184d3383612393565b6118695760405162461bcd60e51b81526004016109b390613f00565b6112ed84848484612836565b6060611880826122c6565b600061188a612869565b905060008151116118aa5760405180602001604052806000815250610f90565b806118b484612878565b6040516020016118c592919061406b565b6040516020818303038152906040529392505050565b6118e361226c565b6040516332fb62e760e21b81526001600160a01b037f00000000000000000000000093f54d755a063ce7bb9e6ac47eccc8e33411d706169063cbed8b9c9061180a908890889088908890889060040161409a565b61ffff851660009081526002602052604080822090516119589087906140c8565b90815260408051602092819003830190206001600160401b038716600090815292529020549050806119cc5760405162461bcd60e51b815260206004820152601d60248201527f4c7a52656365697665723a206e6f2073746f726564206d65737361676500000060448201526064016109b3565b8083836040516119dd929190613ffd565b604051809103902014611a325760405162461bcd60e51b815260206004820152601b60248201527f4c7a52656365697665723a20696e76616c6964207061796c6f6164000000000060448201526064016109b3565b61ffff86166000908152600260205260408082209051611a539088906140c8565b90815260200160405180910390206000866001600160401b03166001600160401b0316815260200190815260200160002081905550611aca86868686868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061260e92505050565b505050505050565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a0810191909152600b8281548110611b1757611b17613f4d565b60009182526020918290206040805160c0810182526002909302909101805483526001015460ff8082161515948401949094526001600160401b036101008204811692840192909252600160481b810482166060840152600160881b81049091166080830152600160c81b900490911660a082015292915050565b611b9a61226c565b61ffff83166000908152600160205260409020611bb88284836140e4565b507ffa41487ad5d6728f0b19276fa1eddc16558578f5109fc39d2dc33c3230470dab838383604051611bec93929190613ec5565b60405180910390a1505050565b611aca33878787878787612978565b611c1061226c565b6001600160a01b038116611c755760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016109b3565b611c7e816126a9565b50565b604051633d7b2f6f60e21b815261ffff808616600483015284166024820152306044820152606481018290526060907f00000000000000000000000093f54d755a063ce7bb9e6ac47eccc8e33411d7066001600160a01b03169063f5ecbdbc90608401600060405180830381865afa158015611d01573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611d2991908101906141e8565b95945050505050565b600b548510611d575760405163a893e97760e01b8152600481018690526024016109b3565b8260ff16600003611d7b57604051630a5f366560e01b815260040160405180910390fd5b6000600b8681548110611d9057611d90613f4d565b60009182526020918290206040805160c0810182526002909302909101805483526001015460ff8082161515948401949094526001600160401b0361010082048116928401839052600160481b820481166060850152600160881b8204166080840152600160c81b900490921660a08201529150421080611e1d575080606001516001600160401b031642115b15611e65576040808201516060830151915163e298a8f760e01b8152600481018990526001600160401b039182166024820152911660448201524260648201526084016109b3565b806020015115611ee0576040516bffffffffffffffffffffffff19606087901b166020820152600090603401604051602081830303815290604052805190602001209050611eb98260000151858584612ac0565b611ede5786868585604051635d977ce760e11b81526004016109b3949392919061421c565b505b6080810151611ef29060ff8616614270565b6001600160401b03163414611f415760808101516040516311b66a1360e01b8152600481018890523460248201526001600160401b03909116604482015260ff851660648201526084016109b3565b6000868152600c602090815260408083206001600160a01b038916845290915281205460a0830151611f76919060ff16614023565b90508460ff16811015611fbd5760a082015160405163cc29b83760e01b8152600481018990526001600160a01b038816602482015260ff90911660448201526064016109b3565b600a54600081611fd061251c600161429f565b61ffff16611fde9190614023565b905080600003612001576040516335e6a0a160e11b815260040160405180910390fd5b6000612010828960ff16612b04565b60008b8152600c602090815260408083206001600160a01b038e1684529091528120805492935083929091906120479084906142bc565b9250508190555080600a600082825461206091906142bc565b90915550600090505b8181101561208c576120848a61207f83876142bc565b612b1a565b600101612069565b50886001600160a01b03168a7fdc331af4e71bb8ec56b1a0d719543254ff272f4f63e9ea61cea22c149f78ccb3836040516120c991815260200190565b60405180910390a38760ff1681101561212f57336108fc6120ed8360ff8c16614023565b87608001516001600160401b031661210591906142d4565b6040518115909202916000818181858888f1935050505015801561212d573d6000803e3d6000fd5b505b50505050505050505050565b604051633356ae4560e11b815230906366ad5c8a906121649087908790879087906004016142f3565b600060405180830381600087803b15801561217e57600080fd5b505af192505050801561218f575060015b6112ed578080519060200120600260008661ffff1661ffff168152602001908152602001600020846040516121c491906140c8565b9081526040805191829003602090810183206001600160401b0387166000908152915220919091557fe6f254030bcb01ffd20558175c13fcaed6d1520be7becee4c961b65f79243b0d9061221f9086908690869086906142f3565b60405180910390a16112ed565b60006001600160e01b031982166380ac58cd60e01b148061225d57506001600160e01b03198216635b5e139f60e01b145b80610af45750610af482612c5c565b6000546001600160a01b0316331461138b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016109b3565b6000818152600560205260409020546001600160a01b0316611c7e5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016109b3565b600081815260076020526040902080546001600160a01b0319166001600160a01b038416908117909155819061235a82611232565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60008061239f83611232565b9050806001600160a01b0316846001600160a01b031614806123e657506001600160a01b0380821660009081526008602090815260408083209388168352929052205460ff165b80610e2d5750836001600160a01b03166123ff84610c5d565b6001600160a01b031614949350505050565b826001600160a01b031661242482611232565b6001600160a01b0316146124885760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b60648201526084016109b3565b6001600160a01b0382166124ea5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016109b3565b600081815260076020908152604080832080546001600160a01b03191690556001600160a01b03861683526006909152812080546001929061252d908490614023565b90915550506001600160a01b038216600090815260066020526040812080546001929061255b9084906142bc565b909155505060008181526005602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610d94908490612c91565b600080828060200190518101906126259190614331565b6014820151919350915061263a878284612d63565b806001600160a01b03168660405161265291906140c8565b604080519182900382208583526001600160401b03891660208401529161ffff8b16917f64e10c37f404d128982dce114f5d233c14c5c7f6d8db93099e3d99dacb9e27ba910160405180910390a450505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b826001600160401b0316846001600160401b0316111561273f576040516311e38b4b60e31b81526001600160401b038086166004830152841660248201526044016109b3565b81801561274a575080155b156112ed576040516337b62bc560e01b815260040160405180910390fd5b816001600160a01b0316836001600160a01b0316036127c95760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016109b3565b6001600160a01b03838116600081815260086020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b612841848484612411565b61284d84848484612d6d565b6112ed5760405162461bcd60e51b81526004016109b390614377565b606060098054610b5890613d5d565b60608160000361289f5750506040805180820190915260018152600360fc1b602082015290565b8160005b81156128c957806128b3816143c9565b91506128c29050600a836143f8565b91506128a3565b6000816001600160401b038111156128e3576128e36133cd565b6040519080825280601f01601f19166020018201604052801561290d576020820181803683370190505b5090505b8415610e2d57612922600183614023565b915061292f600a8661440c565b61293a9060306142bc565b60f81b81838151811061294f5761294f613f4d565b60200101906001600160f81b031916908160001a905350612971600a866143f8565b9450612911565b61298487878787612e6b565b60008585604051602001612999929190613f63565b60405160208183030381529060405290506129b78782868686612f32565b604051630f428ae960e31b815261ffff881660048201523060248201526000907f00000000000000000000000093f54d755a063ce7bb9e6ac47eccc8e33411d7066001600160a01b031690637a14574890604401602060405180830381865afa158015612a28573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a4c9190614420565b905086604051612a5c91906140c8565b604080519182900382208883526001600160401b03841660208401529161ffff8b16916001600160a01b038d16917f024797cc77ce15dc717112d54fb1df125fdfd8c81344fb046c5e074427ce1543910160405180910390a4505050505050505050565b6000611d2985838686808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509294939250506130a59050565b6000818310612b135781610f90565b5090919050565b6001600160a01b038216612b705760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016109b3565b6000818152600560205260409020546001600160a01b031615612bd55760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016109b3565b6001600160a01b0382166000908152600660205260408120805460019290612bfe9084906142bc565b909155505060008181526005602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60006001600160e01b03198216636279b16960e11b1480610af457506301ffc9a760e01b6001600160e01b0319831614610af4565b6000612ce6826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166130bb9092919063ffffffff16565b805190915015610d945780806020019051810190612d049190613ee3565b610d945760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016109b3565b610d9482826130ca565b60006001600160a01b0384163b15612e6357604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612db190339089908890889060040161443d565b6020604051808303816000875af1925050508015612dec575060408051601f3d908101601f19168201909252612de99181019061447a565b60015b612e49573d808015612e1a576040519150601f19603f3d011682016040523d82523d6000602084013e612e1f565b606091505b508051600003612e415760405162461bcd60e51b81526004016109b390614377565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610e2d565b506001610e2d565b612e7433610ebd565b612ec05760405162461bcd60e51b815260206004820152601f60248201527f4f4e46543732313a206e6f74206f776e6572206e6f7220617070726f7665640060448201526064016109b3565b836001600160a01b0316612ed382611232565b6001600160a01b031614612f295760405162461bcd60e51b815260206004820152601860248201527f4f4e46543732313a20696e636f7272656374206f776e6572000000000000000060448201526064016109b3565b6112ed816130e4565b61ffff851660009081526001602052604081208054612f5090613d5d565b80601f0160208091040260200160405190810160405280929190818152602001828054612f7c90613d5d565b8015612fc95780601f10612f9e57610100808354040283529160200191612fc9565b820191906000526020600020905b815481529060010190602001808311612fac57829003601f168201915b5050505050905080516000036130215760405162461bcd60e51b815260206004820152601860248201527f4c7a53656e643a20217472757374656420736f757263652e000000000000000060448201526064016109b3565b60405162c5803160e81b81526001600160a01b037f00000000000000000000000093f54d755a063ce7bb9e6ac47eccc8e33411d706169063c5803100903490613078908a9086908b908b908b908b90600401614497565b6000604051808303818588803b15801561309157600080fd5b505af115801561212d573d6000803e3d6000fd5b6000826130b2858461318e565b14949350505050565b6060610e2d84846000856131db565b6117b28282604051806020016040528060008152506132b6565b60006130ef82611232565b9050600082815260076020908152604080832080546001600160a01b03191690556001600160a01b038416835260069091528120805460019290613134908490614023565b909155505060008281526005602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b600081815b84518110156131d3576131bf828683815181106131b2576131b2613f4d565b60200260200101516132e9565b9150806131cb816143c9565b915050613193565b509392505050565b60608247101561323c5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016109b3565b600080866001600160a01b0316858760405161325891906140c8565b60006040518083038185875af1925050503d8060008114613295576040519150601f19603f3d011682016040523d82523d6000602084013e61329a565b606091505b50915091506132ab87838387613318565b979650505050505050565b6132c08383612b1a565b6132cd6000848484612d6d565b610d945760405162461bcd60e51b81526004016109b390614377565b6000818310613305576000828152602084905260409020610f90565b6000838152602083905260409020610f90565b60608315613387578251600003613380576001600160a01b0385163b6133805760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016109b3565b5081610e2d565b610e2d838381511561339c5781518083602001fd5b8060405162461bcd60e51b81526004016109b39190613608565b803561ffff811681146133c857600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561340b5761340b6133cd565b604052919050565b60006001600160401b0382111561342c5761342c6133cd565b50601f01601f191660200190565b600061344d61344884613413565b6133e3565b905082815283838301111561346157600080fd5b828260208301376000602084830101529392505050565b600082601f83011261348957600080fd5b610f908383356020850161343a565b6001600160401b0381168114611c7e57600080fd5b600080600080608085870312156134c357600080fd5b6134cc856133b6565b935060208501356001600160401b03808211156134e857600080fd5b6134f488838901613478565b94506040870135915061350682613498565b9092506060860135908082111561351c57600080fd5b5061352987828801613478565b91505092959194509250565b6001600160e01b031981168114611c7e57600080fd5b60006020828403121561355d57600080fd5b8135610f9081613535565b60006020828403121561357a57600080fd5b81356001600160401b0381111561359057600080fd5b8201601f810184136135a157600080fd5b610e2d8482356020840161343a565b60005b838110156135cb5781810151838201526020016135b3565b838111156112ed5750506000910152565b600081518084526135f48160208601602086016135b0565b601f01601f19169290920160200192915050565b602081526000610f9060208301846135dc565b60006020828403121561362d57600080fd5b610f90826133b6565b60006020828403121561364857600080fd5b5035919050565b6001600160a01b0381168114611c7e57600080fd5b6000806040838503121561367757600080fd5b82356136828161364f565b946020939093013593505050565b60008083601f8401126136a257600080fd5b5081356001600160401b038111156136b957600080fd5b6020830191508360208285010111156136d157600080fd5b9250929050565b6000806000604084860312156136ed57600080fd5b6136f6846133b6565b925060208401356001600160401b0381111561371157600080fd5b61371d86828701613690565b9497909650939450505050565b6000806000806080858703121561374057600080fd5b843561374b8161364f565b9350602085013561375b8161364f565b92506040850135915060608501356001600160401b0381111561377d57600080fd5b61352987828801613478565b60008060006060848603121561379e57600080fd5b83356137a98161364f565b925060208401356137b98161364f565b929592945050506040919091013590565b8015158114611c7e57600080fd5b600080600080600060a086880312156137f057600080fd5b6137f9866133b6565b945060208601356001600160401b038082111561381557600080fd5b61382189838a01613478565b9550604088013594506060880135915061383a826137ca565b9092506080870135908082111561385057600080fd5b5061385d88828901613478565b9150509295509295909350565b60008060006060848603121561387f57600080fd5b613888846133b6565b925060208401356001600160401b038111156138a357600080fd5b6138af86828701613478565b92505060408401356138c081613498565b809150509250925092565b600080604083850312156138de57600080fd5b8235915060208301356138f08161364f565b809150509250929050565b60006020828403121561390d57600080fd5b8135610f908161364f565b803560ff811681146133c857600080fd5b600080600080600080600060e0888a03121561394457600080fd5b87359650602088013561395681613498565b9550604088013561396681613498565b945061397460608901613918565b9350608088013561398481613498565b925060a0880135613994816137ca565b8092505060c0880135905092959891949750929550565b60008060008060008060c087890312156139c457600080fd5b86356139cf81613498565b955060208701356139df81613498565b94506139ed60408801613918565b935060608701356139fd81613498565b92506080870135613a0d816137ca565b8092505060a087013590509295509295509295565b60008060408385031215613a3557600080fd5b8235613a408161364f565b915060208301356138f0816137ca565b600080600080600060608688031215613a6857600080fd5b613a71866133b6565b945060208601356001600160401b0380821115613a8d57600080fd5b613a9989838a01613690565b90965094506040880135915080821115613ab257600080fd5b50613abf88828901613690565b969995985093965092949392505050565b600080600080600060808688031215613ae857600080fd5b613af1866133b6565b9450613aff602087016133b6565b93506040860135925060608601356001600160401b03811115613b2157600080fd5b613abf88828901613690565b600080600080600060808688031215613b4557600080fd5b613b4e866133b6565b945060208601356001600160401b0380821115613b6a57600080fd5b613b7689838a01613478565b955060408801359150613b8882613498565b90935060608701359080821115613ab257600080fd5b60008060408385031215613bb157600080fd5b8235613bbc8161364f565b915060208301356138f08161364f565b60008060008060008060c08789031215613be557600080fd5b613bee876133b6565b955060208701356001600160401b0380821115613c0a57600080fd5b613c168a838b01613478565b96506040890135955060608901359150613c2f8261364f565b909350608088013590613c418261364f565b90925060a08801359080821115613c5757600080fd5b50613c6489828a01613478565b9150509295509295509295565b60008060008060808587031215613c8757600080fd5b613c90856133b6565b9350613c9e602086016133b6565b92506040850135613cae8161364f565b9396929550929360600135925050565b600080600080600060808688031215613cd657600080fd5b853594506020860135613ce88161364f565b9350613cf660408701613918565b925060608601356001600160401b0380821115613d1257600080fd5b818801915088601f830112613d2657600080fd5b813581811115613d3557600080fd5b8960208260051b8501011115613d4a57600080fd5b9699959850939650602001949392505050565b600181811c90821680613d7157607f821691505b602082108103613d9157634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115610d9457600081815260208120601f850160051c81016020861015613dbe5750805b601f850160051c820191505b81811015611aca57828155600101613dca565b81516001600160401b03811115613df657613df66133cd565b613e0a81613e048454613d5d565b84613d97565b602080601f831160018114613e3f5760008415613e275750858301515b600019600386901b1c1916600185901b178555611aca565b600085815260208120601f198616915b82811015613e6e57888601518255948401946001909101908401613e4f565b5085821015613e8c5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b61ffff84168152604060208201526000611d29604083018486613e9c565b600060208284031215613ef557600080fd5b8151610f90816137ca565b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b604081526000613f7660408301856135dc565b90508260208301529392505050565b61ffff861681526001600160a01b038516602082015260a060408201819052600090613fb3908301866135dc565b84151560608401528281036080840152613fcd81856135dc565b98975050505050505050565b60008060408385031215613fec57600080fd5b505080516020909101519092909150565b8183823760009101908152919050565b634e487b7160e01b600052601160045260246000fd5b6000828210156140355761403561400d565b500390565b61ffff86168152606060208201526000614058606083018688613e9c565b8281036040840152613fcd818587613e9c565b6000835161407d8184602088016135b0565b8351908301906140918183602088016135b0565b01949350505050565b600061ffff8088168352808716602084015250846040830152608060608301526132ab608083018486613e9c565b600082516140da8184602087016135b0565b9190910192915050565b6001600160401b038311156140fb576140fb6133cd565b61410f836141098354613d5d565b83613d97565b6000601f841160018114614143576000851561412b5750838201355b600019600387901b1c1916600186901b178355610ad0565b600083815260209020601f19861690835b828110156141745786850135825560209485019460019092019101614154565b50868210156141915760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b600082601f8301126141b457600080fd5b81516141c261344882613413565b8181528460208386010111156141d757600080fd5b610e2d8260208301602087016135b0565b6000602082840312156141fa57600080fd5b81516001600160401b0381111561421057600080fd5b610e2d848285016141a3565b8481526001600160a01b0384166020820152606060408201819052810182905260006001600160fb1b0383111561425257600080fd5b8260051b808560808501376000920160800191825250949350505050565b60006001600160401b03808316818516818304811182151516156142965761429661400d565b02949350505050565b600061ffff8083168185168083038211156140915761409161400d565b600082198211156142cf576142cf61400d565b500190565b60008160001904831182151516156142ee576142ee61400d565b500290565b61ffff8516815260806020820152600061431060808301866135dc565b6001600160401b038516604084015282810360608401526132ab81856135dc565b6000806040838503121561434457600080fd5b82516001600160401b0381111561435a57600080fd5b614366858286016141a3565b925050602083015190509250929050565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6000600182016143db576143db61400d565b5060010190565b634e487b7160e01b600052601260045260246000fd5b600082614407576144076143e2565b500490565b60008261441b5761441b6143e2565b500690565b60006020828403121561443257600080fd5b8151610f9081613498565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090614470908301846135dc565b9695505050505050565b60006020828403121561448c57600080fd5b8151610f9081613535565b61ffff8716815260c0602082015260006144b460c08301886135dc565b82810360408401526144c681886135dc565b6001600160a01b0387811660608601528616608085015283810360a085015290506144f181856135dc565b999850505050505050505056fea2646970667358221220233a5f543412728a5d34362626c5bab17acc6716a67ac557468d0ba01c16522564736f6c634300080f0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000093f54d755a063ce7bb9e6ac47eccc8e33411d70600000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000013446566696d6f6e732041706172746d656e74730000000000000000000000000000000000000000000000000000000000000000000000000000000000000000074d4f4e4c414e4400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002d68747470733a2f2f6170692e646566696d6f6e732e636f6d2f6d657461646174612f61706172746d656e74732f00000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _name (string): Defimons Apartments
Arg [1] : _symbol (string): MONLAND
Arg [2] : _lzEndpoint (address): 0x93f54D755A063cE7bB9e6Ac47Eccc8e33411d706
Arg [3] : _initialURI (string): https://api.defimons.com/metadata/apartments/
-----Encoded View---------------
11 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [2] : 00000000000000000000000093f54d755a063ce7bb9e6ac47eccc8e33411d706
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000100
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000013
Arg [5] : 446566696d6f6e732041706172746d656e747300000000000000000000000000
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000007
Arg [7] : 4d4f4e4c414e4400000000000000000000000000000000000000000000000000
Arg [8] : 000000000000000000000000000000000000000000000000000000000000002d
Arg [9] : 68747470733a2f2f6170692e646566696d6f6e732e636f6d2f6d657461646174
Arg [10] : 612f61706172746d656e74732f00000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.