ERC-721
Overview
Max Total Supply
1,276 NUT
Holders
458
Market
Volume (24H)
0.0309 ETH
Min Price (24H)
$87.25 @ 0.030900 ETH
Max Price (24H)
$87.25 @ 0.030900 ETH
Other Info
Token Contract
Balance
1 NUTLoading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
MafiaNuts
Compiler Version
v0.8.13+commit.abaa5c0e
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 { ONFT721A, IERC721 } from "./layerzero/ONFT721A.sol"; import { MerkleProof } from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; /** * @title MafiaNuts smart contract. brought to you by nftperp! * @author n0ah <https://twitter.com/nftn0ah> * @author aster <https://twitter.com/aster2709> */ contract MafiaNuts is ONFT721A { enum Phase { INACTIVE, PHASE_1, PHASE_2, PUBLIC } struct PhaseInfo { bytes32 merkleRoot; } // // STORAGE // uint256 public constant MAX_SUPPLY = 1500; uint256 public constant JAILBREAK_SUPPLY = 224; uint public constant MINT_SUPPLY = MAX_SUPPLY - JAILBREAK_SUPPLY; string private uri; Phase public phase; mapping(Phase => PhaseInfo) public phaseInfoMap; mapping(address => mapping(Phase => uint)) public nutMap; // // EVENTS // event Deploy(address deployer, uint timestamp); event Nut(address indexed nutter, uint256 indexed tokenId, Phase indexed phase); event Jailbreak(address indexed nutter, uint256 indexed tokenId); event PhaseChange(Phase indexed phase); constructor( string memory _name, string memory _symbol, uint256 _minGasToTransfer, address _lzEndpoint, address _team ) ONFT721A(_name, _symbol, _minGasToTransfer, _lzEndpoint) { _mint(_team, 277); emit Deploy(msg.sender, block.timestamp); } /** * @notice mint mafia nut * @param _proof merkle proof */ function nut(bytes32[] calldata _proof) external { address nutter = msg.sender; uint supply = totalSupply(); // validation require(phase != Phase.INACTIVE, "!active"); require(_isNutWl(nutter, _proof), "!wl"); require(supply < MINT_SUPPLY, "> mint supply"); require(nutter == tx.origin, "!bot"); uint nutCount = nutMap[nutter][phase]; require(nutCount == 0, "nut cap"); // mint _mint(nutter, 1); nutMap[nutter][phase] = nutCount + 1; emit Nut(nutter, supply + 1, phase); } /** * @notice mint nuts for giveaways or trading competition rewards. * @dev only owner */ function jailbreak(address _nutter) external onlyOwner { uint supply = totalSupply(); require(supply >= MINT_SUPPLY && supply < MAX_SUPPLY, "back to jail"); _mint(_nutter, 1); emit Jailbreak(_nutter, supply + 1); } /** * @notice set active phase * @dev only owner */ function setPhase(Phase _phase) external onlyOwner { phase = _phase; emit PhaseChange(_phase); } /** * @notice set phase info * @dev only owner */ function setPhaseInfo(Phase _phase, PhaseInfo memory _phaseInfo) external onlyOwner { phaseInfoMap[_phase] = _phaseInfo; } /** * @notice set uri * @dev only owner */ function setURI(string memory _uri) external onlyOwner { uri = _uri; } /** * @notice recover stuck erc20 tokens, contact team * @dev only owner can call, sends tokens to owner */ function recoverFT(address _token, uint _amount) external onlyOwner { IERC20(_token).transfer(owner(), _amount); } /** * @notice recover stuck erc721 tokens, contact team * @dev only owner can call, sends tokens to owner */ function recoverNFT(address _token, uint _tokenId) external onlyOwner { IERC721(_token).transferFrom(address(this), owner(), _tokenId); } function _isNutWl(address _nutter, bytes32[] calldata _proof) private view returns (bool) { bytes32 leaf = keccak256(abi.encodePacked(_nutter)); bytes32 root = phaseInfoMap[phase].merkleRoot; if (root == bytes32(0)) return true; return MerkleProof.verify(_proof, root, leaf); } // // OVERRIDES // function _baseURI() internal view override returns (string memory) { return uri; } function _startTokenId() internal pure override returns (uint256) { return 1; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.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.9.0) (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.0; /** * @dev These functions deal with verification of Merkle Tree proofs. * * The tree and the proofs can be generated using our * https://github.com/OpenZeppelin/merkle-tree[JavaScript library]. * You will find a quickstart guide in the readme. * * 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. * OpenZeppelin's JavaScript library generates merkle trees that are safe * against this attack out of the box. */ 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 simultaneously proven to be a part of a merkle tree defined by * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}. * * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details. * * _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} * * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details. * * _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 sibling nodes in `proof`. The reconstruction * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false * respectively. * * CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer). * * _Available since v4.7._ */ function processMultiProof( bytes32[] memory proof, bool[] memory proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuilds 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 from 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) { unchecked { return hashes[totalHashes - 1]; } } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } /** * @dev Calldata version of {processMultiProof}. * * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details. * * _Available since v4.7._ */ function processMultiProofCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuilds 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 from 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) { unchecked { 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) } } }
// Sources flattened with hardhat v2.14.0 https://hardhat.org // File @openzeppelin/contracts/utils/[email protected] // 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; } } // File @openzeppelin/contracts/access/[email protected] // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.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); } } // File @openzeppelin/contracts/utils/introspection/[email protected] // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); } // File @openzeppelin/contracts/token/ERC721/[email protected] // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.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: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * 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); } // File @openzeppelin/contracts/utils/introspection/[email protected] // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.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; } } // File erc721a/contracts/[email protected] // ERC721A Contracts v4.2.3 // Creator: Chiru Labs /** * @dev Interface of ERC721A. */ interface IERC721A { /** * The caller must own the token or be an approved operator. */ error ApprovalCallerNotOwnerNorApproved(); /** * The token does not exist. */ error ApprovalQueryForNonexistentToken(); /** * Cannot query the balance for the zero address. */ error BalanceQueryForZeroAddress(); /** * Cannot mint to the zero address. */ error MintToZeroAddress(); /** * The quantity of tokens minted must be more than zero. */ error MintZeroQuantity(); /** * The token does not exist. */ error OwnerQueryForNonexistentToken(); /** * The caller must own the token or be an approved operator. */ error TransferCallerNotOwnerNorApproved(); /** * The token must be owned by `from`. */ error TransferFromIncorrectOwner(); /** * Cannot safely transfer to a contract that does not implement the * ERC721Receiver interface. */ error TransferToNonERC721ReceiverImplementer(); /** * Cannot transfer to the zero address. */ error TransferToZeroAddress(); /** * The token does not exist. */ error URIQueryForNonexistentToken(); /** * The `quantity` minted with ERC2309 exceeds the safety limit. */ error MintERC2309QuantityExceedsLimit(); /** * The `extraData` cannot be set on an unintialized ownership slot. */ error OwnershipNotInitializedForExtraData(); // ============================================================= // STRUCTS // ============================================================= struct TokenOwnership { // The address of the owner. address addr; // Stores the start time of ownership with minimal overhead for tokenomics. uint64 startTimestamp; // Whether the token has been burned. bool burned; // Arbitrary data similar to `startTimestamp` that can be set via {_extraData}. uint24 extraData; } // ============================================================= // TOKEN COUNTERS // ============================================================= /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() external view returns (uint256); // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); // ============================================================= // IERC721 // ============================================================= /** * @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`, * 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 be 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, bytes calldata data) external payable; /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom(address from, address to, uint256 tokenId) external payable; /** * @dev Transfers `tokenId` 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 payable; /** * @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 payable; /** * @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); // ============================================================= // IERC721Metadata // ============================================================= /** * @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); // ============================================================= // IERC2309 // ============================================================= /** * @dev Emitted when tokens in `fromTokenId` to `toTokenId` * (inclusive) is transferred from `from` to `to`, as defined in the * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard. * * See {_mintERC2309} for more details. */ event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to); } // File erc721a/contracts/[email protected] // ERC721A Contracts v4.2.3 // Creator: Chiru Labs /** * @dev Interface of ERC721 token receiver. */ interface ERC721A__IERC721Receiver { function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } /** * @title ERC721A * * @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721) * Non-Fungible Token Standard, including the Metadata extension. * Optimized for lower gas during batch mints. * * Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...) * starting from `_startTokenId()`. * * Assumptions: * * - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply. * - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256). */ contract ERC721A is IERC721A { // Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364). struct TokenApprovalRef { address value; } // ============================================================= // CONSTANTS // ============================================================= // Mask of an entry in packed address data. uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1; // The bit position of `numberMinted` in packed address data. uint256 private constant _BITPOS_NUMBER_MINTED = 64; // The bit position of `numberBurned` in packed address data. uint256 private constant _BITPOS_NUMBER_BURNED = 128; // The bit position of `aux` in packed address data. uint256 private constant _BITPOS_AUX = 192; // Mask of all 256 bits in packed address data except the 64 bits for `aux`. uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1; // The bit position of `startTimestamp` in packed ownership. uint256 private constant _BITPOS_START_TIMESTAMP = 160; // The bit mask of the `burned` bit in packed ownership. uint256 private constant _BITMASK_BURNED = 1 << 224; // The bit position of the `nextInitialized` bit in packed ownership. uint256 private constant _BITPOS_NEXT_INITIALIZED = 225; // The bit mask of the `nextInitialized` bit in packed ownership. uint256 private constant _BITMASK_NEXT_INITIALIZED = 1 << 225; // The bit position of `extraData` in packed ownership. uint256 private constant _BITPOS_EXTRA_DATA = 232; // Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`. uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1; // The mask of the lower 160 bits for addresses. uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1; // The maximum `quantity` that can be minted with {_mintERC2309}. // This limit is to prevent overflows on the address data entries. // For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309} // is required to cause an overflow, which is unrealistic. uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000; // The `Transfer` event signature is given by: // `keccak256(bytes("Transfer(address,address,uint256)"))`. bytes32 private constant _TRANSFER_EVENT_SIGNATURE = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef; // ============================================================= // STORAGE // ============================================================= // The next token ID to be minted. uint256 private _currentIndex; // The number of tokens burned. uint256 private _burnCounter; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to ownership details // An empty struct value does not necessarily mean the token is unowned. // See {_packedOwnershipOf} implementation for details. // // Bits Layout: // - [0..159] `addr` // - [160..223] `startTimestamp` // - [224] `burned` // - [225] `nextInitialized` // - [232..255] `extraData` mapping(uint256 => uint256) private _packedOwnerships; // Mapping owner address to address data. // // Bits Layout: // - [0..63] `balance` // - [64..127] `numberMinted` // - [128..191] `numberBurned` // - [192..255] `aux` mapping(address => uint256) private _packedAddressData; // Mapping from token ID to approved address. mapping(uint256 => TokenApprovalRef) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; // ============================================================= // CONSTRUCTOR // ============================================================= constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; _currentIndex = _startTokenId(); } // ============================================================= // TOKEN COUNTING OPERATIONS // ============================================================= /** * @dev Returns the starting token ID. * To change the starting token ID, please override this function. */ function _startTokenId() internal view virtual returns (uint256) { return 0; } /** * @dev Returns the next token ID to be minted. */ function _nextTokenId() internal view virtual returns (uint256) { return _currentIndex; } /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() public view virtual override returns (uint256) { // Counter underflow is impossible as _burnCounter cannot be incremented // more than `_currentIndex - _startTokenId()` times. unchecked { return _currentIndex - _burnCounter - _startTokenId(); } } /** * @dev Returns the total amount of tokens minted in the contract. */ function _totalMinted() internal view virtual returns (uint256) { // Counter underflow is impossible as `_currentIndex` does not decrement, // and it is initialized to `_startTokenId()`. unchecked { return _currentIndex - _startTokenId(); } } /** * @dev Returns the total number of tokens burned. */ function _totalBurned() internal view virtual returns (uint256) { return _burnCounter; } // ============================================================= // ADDRESS DATA OPERATIONS // ============================================================= /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) public view virtual override returns (uint256) { if (owner == address(0)) revert BalanceQueryForZeroAddress(); return _packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens minted by `owner`. */ function _numberMinted(address owner) internal view returns (uint256) { return (_packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens burned by or on behalf of `owner`. */ function _numberBurned(address owner) internal view returns (uint256) { return (_packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). */ function _getAux(address owner) internal view returns (uint64) { return uint64(_packedAddressData[owner] >> _BITPOS_AUX); } /** * Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). * If there are multiple variables, please pack them into a uint64. */ function _setAux(address owner, uint64 aux) internal virtual { uint256 packed = _packedAddressData[owner]; uint256 auxCasted; // Cast `aux` with assembly to avoid redundant masking. assembly { auxCasted := aux } packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX); _packedAddressData[owner] = packed; } // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { // The interface IDs are constants representing the first 4 bytes // of the XOR of all function selectors in the interface. // See: [ERC165](https://eips.ethereum.org/EIPS/eip-165) // (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`) return interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165. interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721. interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata. } // ============================================================= // IERC721Metadata // ============================================================= /** * @dev Returns the token collection name. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the token collection symbol. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : ""; } /** * @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, it can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } // ============================================================= // OWNERSHIPS OPERATIONS // ============================================================= /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { return address(uint160(_packedOwnershipOf(tokenId))); } /** * @dev Gas spent here starts off proportional to the maximum mint batch size. * It gradually moves to O(1) as tokens get transferred around over time. */ function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnershipOf(tokenId)); } /** * @dev Returns the unpacked `TokenOwnership` struct at `index`. */ function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnerships[index]); } /** * @dev Initializes the ownership slot minted at `index` for efficiency purposes. */ function _initializeOwnershipAt(uint256 index) internal virtual { if (_packedOwnerships[index] == 0) { _packedOwnerships[index] = _packedOwnershipOf(index); } } /** * Returns the packed ownership data of `tokenId`. */ function _packedOwnershipOf(uint256 tokenId) private view returns (uint256) { uint256 curr = tokenId; unchecked { if (_startTokenId() <= curr) if (curr < _currentIndex) { uint256 packed = _packedOwnerships[curr]; // If not burned. if (packed & _BITMASK_BURNED == 0) { // Invariant: // There will always be an initialized ownership slot // (i.e. `ownership.addr != address(0) && ownership.burned == false`) // before an unintialized ownership slot // (i.e. `ownership.addr == address(0) && ownership.burned == false`) // Hence, `curr` will not underflow. // // We can directly compare the packed value. // If the address is zero, packed will be zero. while (packed == 0) { packed = _packedOwnerships[--curr]; } return packed; } } } revert OwnerQueryForNonexistentToken(); } /** * @dev Returns the unpacked `TokenOwnership` struct from `packed`. */ function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) { ownership.addr = address(uint160(packed)); ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP); ownership.burned = packed & _BITMASK_BURNED != 0; ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA); } /** * @dev Packs ownership data into a single uint256. */ function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`. result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags)) } } /** * @dev Returns the `nextInitialized` flag set if `quantity` equals 1. */ function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) { // For branchless setting of the `nextInitialized` flag. assembly { // `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`. result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1)) } } // ============================================================= // APPROVAL OPERATIONS // ============================================================= /** * @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) public payable virtual override { address owner = ownerOf(tokenId); if (_msgSenderERC721A() != owner) if (!isApprovedForAll(owner, _msgSenderERC721A())) { revert ApprovalCallerNotOwnerNorApproved(); } _tokenApprovals[tokenId].value = to; emit Approval(owner, to, tokenId); } /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken(); return _tokenApprovals[tokenId].value; } /** * @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) public virtual override { _operatorApprovals[_msgSenderERC721A()][operator] = approved; emit ApprovalForAll(_msgSenderERC721A(), operator, approved); } /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @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. See {_mint}. */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _startTokenId() <= tokenId && tokenId < _currentIndex && // If within bounds, _packedOwnerships[tokenId] & _BITMASK_BURNED == 0; // and not burned. } /** * @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`. */ function _isSenderApprovedOrOwner( address approvedAddress, address owner, address msgSender ) private pure returns (bool result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean. msgSender := and(msgSender, _BITMASK_ADDRESS) // `msgSender == owner || msgSender == approvedAddress`. result := or(eq(msgSender, owner), eq(msgSender, approvedAddress)) } } /** * @dev Returns the storage slot and value for the approved address of `tokenId`. */ function _getApprovedSlotAndAddress( uint256 tokenId ) private view returns (uint256 approvedAddressSlot, address approvedAddress) { TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId]; // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`. assembly { approvedAddressSlot := tokenApproval.slot approvedAddress := sload(approvedAddressSlot) } } // ============================================================= // TRANSFER OPERATIONS // ============================================================= /** * @dev Transfers `tokenId` from `from` to `to`. * * 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) public payable virtual override { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner(); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved(); if (to == address(0)) revert TransferToZeroAddress(); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // We can directly increment and decrement the balances. --_packedAddressData[from]; // Updates: `balance -= 1`. ++_packedAddressData[to]; // Updates: `balance += 1`. // Updates: // - `address` to the next owner. // - `startTimestamp` to the timestamp of transfering. // - `burned` to `false`. // - `nextInitialized` to `true`. _packedOwnerships[tokenId] = _packOwnershipData( to, _BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, to, tokenId); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom(address from, address to, uint256 tokenId) public payable virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @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 memory _data ) public payable virtual override { transferFrom(from, to, tokenId); if (to.code.length != 0) if (!_checkContractOnERC721Received(from, to, tokenId, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } /** * @dev Hook that is called before a set of serially-ordered token IDs * are about to be transferred. This includes minting. * And also called before burning one token. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * 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, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _beforeTokenTransfers(address from, address to, uint256 startTokenId, uint256 quantity) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token IDs * have been transferred. This includes minting. * And also called after one token has been burned. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been * transferred to `to`. * - When `from` is zero, `tokenId` has been minted for `to`. * - When `to` is zero, `tokenId` has been burned by `from`. * - `from` and `to` are never both zero. */ function _afterTokenTransfers(address from, address to, uint256 startTokenId, uint256 quantity) internal virtual {} /** * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract. * * `from` - Previous owner of the given token ID. * `to` - Target address that will receive the token. * `tokenId` - Token ID to be transferred. * `_data` - Optional data to send along with the call. * * Returns whether the call correctly returned the expected magic value. */ function _checkContractOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns ( bytes4 retval ) { return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert TransferToNonERC721ReceiverImplementer(); } else { assembly { revert(add(32, reason), mload(reason)) } } } } // ============================================================= // MINT OPERATIONS // ============================================================= /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {Transfer} event for each mint. */ function _mint(address to, uint256 quantity) internal virtual { uint256 startTokenId = _currentIndex; if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // `balance` and `numberMinted` have a maximum limit of 2**64. // `tokenId` has a maximum limit of 2**256. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. _packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); uint256 toMasked; uint256 end = startTokenId + quantity; // Use assembly to loop and emit the `Transfer` event for gas savings. // The duplicated `log4` removes an extra check and reduces stack juggling. // The assembly, together with the surrounding Solidity code, have been // delicately arranged to nudge the compiler into producing optimized opcodes. assembly { // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean. toMasked := and(to, _BITMASK_ADDRESS) // Emit the `Transfer` event. log4( 0, // Start of data (0, since no data). 0, // End of data (0, since no data). _TRANSFER_EVENT_SIGNATURE, // Signature. 0, // `address(0)`. toMasked, // `to`. startTokenId // `tokenId`. ) // The `iszero(eq(,))` check ensures that large values of `quantity` // that overflows uint256 will make the loop run out of gas. // The compiler will optimize the `iszero` away for performance. for { let tokenId := add(startTokenId, 1) } iszero(eq(tokenId, end)) { tokenId := add(tokenId, 1) } { // Emit the `Transfer` event. Similar to above. log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId) } } if (toMasked == 0) revert MintToZeroAddress(); _currentIndex = end; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * This function is intended for efficient minting only during contract creation. * * It emits only one {ConsecutiveTransfer} as defined in * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309), * instead of a sequence of {Transfer} event(s). * * Calling this function outside of contract creation WILL make your contract * non-compliant with the ERC721 standard. * For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309 * {ConsecutiveTransfer} event is only permissible during contract creation. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {ConsecutiveTransfer} event. */ function _mintERC2309(address to, uint256 quantity) internal virtual { uint256 startTokenId = _currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are unrealistic due to the above check for `quantity` to be below the limit. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. _packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to); _currentIndex = startTokenId + quantity; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Safely mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called for each safe transfer. * - `quantity` must be greater than 0. * * See {_mint}. * * Emits a {Transfer} event for each mint. */ function _safeMint(address to, uint256 quantity, bytes memory _data) internal virtual { _mint(to, quantity); unchecked { if (to.code.length != 0) { uint256 end = _currentIndex; uint256 index = end - quantity; do { if (!_checkContractOnERC721Received(address(0), to, index++, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } while (index < end); // Reentrancy protection. if (_currentIndex != end) revert(); } } } /** * @dev Equivalent to `_safeMint(to, quantity, '')`. */ function _safeMint(address to, uint256 quantity) internal virtual { _safeMint(to, quantity, ""); } // ============================================================= // BURN OPERATIONS // ============================================================= /** * @dev Equivalent to `_burn(tokenId, false)`. */ function _burn(uint256 tokenId) internal virtual { _burn(tokenId, false); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId, bool approvalCheck) internal virtual { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); address from = address(uint160(prevOwnershipPacked)); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); if (approvalCheck) { // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved(); } _beforeTokenTransfers(from, address(0), tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // Updates: // - `balance -= 1`. // - `numberBurned += 1`. // // We can directly decrement the balance, and increment the number burned. // This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`. _packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1; // Updates: // - `address` to the last owner. // - `startTimestamp` to the timestamp of burning. // - `burned` to `true`. // - `nextInitialized` to `true`. _packedOwnerships[tokenId] = _packOwnershipData( from, (_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, address(0), tokenId); _afterTokenTransfers(from, address(0), tokenId, 1); // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times. unchecked { _burnCounter++; } } // ============================================================= // EXTRA DATA OPERATIONS // ============================================================= /** * @dev Directly sets the extra data for the ownership data `index`. */ function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual { uint256 packed = _packedOwnerships[index]; if (packed == 0) revert OwnershipNotInitializedForExtraData(); uint256 extraDataCasted; // Cast `extraData` with assembly to avoid redundant masking. assembly { extraDataCasted := extraData } packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA); _packedOwnerships[index] = packed; } /** * @dev Called during each token transfer to set the 24bit `extraData` field. * Intended to be overridden by the cosumer contract. * * `previousExtraData` - the value of `extraData` before transfer. * * 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, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _extraData(address from, address to, uint24 previousExtraData) internal view virtual returns (uint24) {} /** * @dev Returns the next extra data for the packed ownership data. * The returned result is shifted into position. */ function _nextExtraData(address from, address to, uint256 prevOwnershipPacked) private view returns (uint256) { uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA); return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA; } // ============================================================= // OTHER OPERATIONS // ============================================================= /** * @dev Returns the message sender (defaults to `msg.sender`). * * If you are writing GSN compatible contracts, you need to override this function. */ function _msgSenderERC721A() internal view virtual returns (address) { return msg.sender; } /** * @dev Converts a uint256 to its ASCII string decimal representation. */ function _toString(uint256 value) internal pure virtual returns (string memory str) { assembly { // The maximum value of a uint256 contains 78 digits (1 byte per digit), but // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned. // We will need 1 word for the trailing zeros padding, 1 word for the length, // and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0. let m := add(mload(0x40), 0xa0) // Update the free memory pointer to allocate. mstore(0x40, m) // Assign the `str` to the end. str := sub(m, 0x20) // Zeroize the slot after the string. mstore(str, 0) // Cache the end of the memory to calculate the length later. let end := str // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. // prettier-ignore for { let temp := value } 1 {} { str := sub(str, 1) // Write the character to the pointer. // The ASCII index of the '0' character is 48. mstore8(str, add(48, mod(temp, 10))) // Keep dividing `temp` until zero. temp := div(temp, 10) // prettier-ignore if iszero(temp) { break } } let length := sub(end, str) // Move the pointer 32 bytes leftwards to make room for the length. str := sub(str, 0x20) // Store the length. mstore(str, length) } } } // File layerzero/contracts/interfaces/ILayerZeroUserApplicationConfig.sol 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; } // File layerzero/contracts/interfaces/ILayerZeroEndpoint.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); } // File layerzero/contracts/interfaces/ILayerZeroReceiver.sol 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; } // File layerzero/contracts/util/BytesLib.sol /* * @title Solidity Bytes Arrays Utils * @author Gonçalo Sá <[email protected]> * * @dev Bytes tightly packed arrays utility library for ethereum contracts written in Solidity. * The library lets you concatenate, slice and type cast bytes arrays both in memory and storage. */ library BytesLib { function concat(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bytes memory) { bytes memory tempBytes; assembly { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(0x40) // Store the length of the first bytes array at the beginning of // the memory for tempBytes. let length := mload(_preBytes) mstore(tempBytes, length) // Maintain a memory counter for the current write location in the // temp bytes array by adding the 32 bytes for the array length to // the starting location. let mc := add(tempBytes, 0x20) // Stop copying when the memory counter reaches the length of the // first bytes array. let end := add(mc, length) for { // Initialize a copy counter to the start of the _preBytes data, // 32 bytes into its memory. let cc := add(_preBytes, 0x20) } lt(mc, end) { // Increase both counters by 32 bytes each iteration. mc := add(mc, 0x20) cc := add(cc, 0x20) } { // Write the _preBytes data into the tempBytes memory 32 bytes // at a time. mstore(mc, mload(cc)) } // Add the length of _postBytes to the current length of tempBytes // and store it as the new length in the first 32 bytes of the // tempBytes memory. length := mload(_postBytes) mstore(tempBytes, add(length, mload(tempBytes))) // Move the memory counter back from a multiple of 0x20 to the // actual end of the _preBytes data. mc := end // Stop copying when the memory counter reaches the new combined // length of the arrays. end := add(mc, length) for { let cc := add(_postBytes, 0x20) } lt(mc, end) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { mstore(mc, mload(cc)) } // Update the free-memory pointer by padding our last write location // to 32 bytes: add 31 bytes to the end of tempBytes to move to the // next 32 byte block, then round down to the nearest multiple of // 32. If the sum of the length of the two arrays is zero then add // one before rounding down to leave a blank 32 bytes (the length block with 0). mstore( 0x40, and( add(add(end, iszero(add(length, mload(_preBytes)))), 31), not(31) // Round down to the nearest 32 bytes. ) ) } return tempBytes; } function concatStorage(bytes storage _preBytes, bytes memory _postBytes) internal { assembly { // Read the first 32 bytes of _preBytes storage, which is the length // of the array. (We don't need to use the offset into the slot // because arrays use the entire slot.) let fslot := sload(_preBytes.slot) // Arrays of 31 bytes or less have an even value in their slot, // while longer arrays have an odd value. The actual length is // the slot divided by two for odd values, and the lowest order // byte divided by two for even values. // If the slot is even, bitwise and the slot with 255 and divide by // two to get the length. If the slot is odd, bitwise and the slot // with -1 and divide by two. let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2) let mlength := mload(_postBytes) let newlength := add(slength, mlength) // slength can contain both the length and contents of the array // if length < 32 bytes so let's prepare for that // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage switch add(lt(slength, 32), lt(newlength, 32)) case 2 { // Since the new array still fits in the slot, we just need to // update the contents of the slot. // uint256(bytes_storage) = uint256(bytes_storage) + uint256(bytes_memory) + new_length sstore( _preBytes.slot, // all the modifications to the slot are inside this // next block add( // we can just add to the slot contents because the // bytes we want to change are the LSBs fslot, add( mul( div( // load the bytes from memory mload(add(_postBytes, 0x20)), // zero all bytes to the right exp(0x100, sub(32, mlength)) ), // and now shift left the number of bytes to // leave space for the length in the slot exp(0x100, sub(32, newlength)) ), // increase length by the double of the memory // bytes length mul(mlength, 2) ) ) ) } case 1 { // The stored value fits in the slot, but the combined value // will exceed it. // get the keccak hash to get the contents of the array mstore(0x0, _preBytes.slot) let sc := add(keccak256(0x0, 0x20), div(slength, 32)) // save new length sstore(_preBytes.slot, add(mul(newlength, 2), 1)) // The contents of the _postBytes array start 32 bytes into // the structure. Our first read should obtain the `submod` // bytes that can fit into the unused space in the last word // of the stored array. To get this, we read 32 bytes starting // from `submod`, so the data we read overlaps with the array // contents by `submod` bytes. Masking the lowest-order // `submod` bytes allows us to add that value directly to the // stored value. let submod := sub(32, slength) let mc := add(_postBytes, submod) let end := add(_postBytes, mlength) let mask := sub(exp(0x100, submod), 1) sstore( sc, add( and(fslot, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00), and(mload(mc), mask) ) ) for { mc := add(mc, 0x20) sc := add(sc, 1) } lt(mc, end) { sc := add(sc, 1) mc := add(mc, 0x20) } { sstore(sc, mload(mc)) } mask := exp(0x100, sub(mc, end)) sstore(sc, mul(div(mload(mc), mask), mask)) } default { // get the keccak hash to get the contents of the array mstore(0x0, _preBytes.slot) // Start copying to the last used word of the stored array. let sc := add(keccak256(0x0, 0x20), div(slength, 32)) // save new length sstore(_preBytes.slot, add(mul(newlength, 2), 1)) // Copy over the first `submod` bytes of the new data as in // case 1 above. let slengthmod := mod(slength, 32) let mlengthmod := mod(mlength, 32) let submod := sub(32, slengthmod) let mc := add(_postBytes, submod) let end := add(_postBytes, mlength) let mask := sub(exp(0x100, submod), 1) sstore(sc, add(sload(sc), and(mload(mc), mask))) for { sc := add(sc, 1) mc := add(mc, 0x20) } lt(mc, end) { sc := add(sc, 1) mc := add(mc, 0x20) } { sstore(sc, mload(mc)) } mask := exp(0x100, sub(mc, end)) sstore(sc, mul(div(mload(mc), mask), mask)) } } } function slice(bytes memory _bytes, uint256 _start, uint256 _length) internal pure returns (bytes memory) { require(_length + 31 >= _length, "slice_overflow"); require(_bytes.length >= _start + _length, "slice_outOfBounds"); bytes memory tempBytes; assembly { switch iszero(_length) case 0 { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(0x40) // The first word of the slice result is potentially a partial // word read from the original array. To read it, we calculate // the length of that partial word and start copying that many // bytes into the array. The first word we copy will start with // data we don't care about, but the last `lengthmod` bytes will // land at the beginning of the contents of the new array. When // we're done copying, we overwrite the full first word with // the actual length of the slice. let lengthmod := and(_length, 31) // The multiplication in the next line is necessary // because when slicing multiples of 32 bytes (lengthmod == 0) // the following copy loop was copying the origin's length // and then ending prematurely not copying everything it should. let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod))) let end := add(mc, _length) for { // The multiplication in the next line has the same exact purpose // as the one above. let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start) } lt(mc, end) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { mstore(mc, mload(cc)) } mstore(tempBytes, _length) //update free-memory pointer //allocating the array padded to 32 bytes like the compiler does now mstore(0x40, and(add(mc, 31), not(31))) } //if we want a zero-length slice let's just return a zero-length array default { tempBytes := mload(0x40) //zero out the 32 bytes slice we are about to return //we need to do it because Solidity does not garbage collect mstore(tempBytes, 0) mstore(0x40, add(tempBytes, 0x20)) } } return tempBytes; } function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) { require(_bytes.length >= _start + 20, "toAddress_outOfBounds"); address tempAddress; assembly { tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000) } return tempAddress; } function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) { require(_bytes.length >= _start + 1, "toUint8_outOfBounds"); uint8 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x1), _start)) } return tempUint; } function toUint16(bytes memory _bytes, uint256 _start) internal pure returns (uint16) { require(_bytes.length >= _start + 2, "toUint16_outOfBounds"); uint16 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x2), _start)) } return tempUint; } function toUint32(bytes memory _bytes, uint256 _start) internal pure returns (uint32) { require(_bytes.length >= _start + 4, "toUint32_outOfBounds"); uint32 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x4), _start)) } return tempUint; } function toUint64(bytes memory _bytes, uint256 _start) internal pure returns (uint64) { require(_bytes.length >= _start + 8, "toUint64_outOfBounds"); uint64 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x8), _start)) } return tempUint; } function toUint96(bytes memory _bytes, uint256 _start) internal pure returns (uint96) { require(_bytes.length >= _start + 12, "toUint96_outOfBounds"); uint96 tempUint; assembly { tempUint := mload(add(add(_bytes, 0xc), _start)) } return tempUint; } function toUint128(bytes memory _bytes, uint256 _start) internal pure returns (uint128) { require(_bytes.length >= _start + 16, "toUint128_outOfBounds"); uint128 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x10), _start)) } return tempUint; } function toUint256(bytes memory _bytes, uint256 _start) internal pure returns (uint256) { require(_bytes.length >= _start + 32, "toUint256_outOfBounds"); uint256 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x20), _start)) } return tempUint; } function toBytes32(bytes memory _bytes, uint256 _start) internal pure returns (bytes32) { require(_bytes.length >= _start + 32, "toBytes32_outOfBounds"); bytes32 tempBytes32; assembly { tempBytes32 := mload(add(add(_bytes, 0x20), _start)) } return tempBytes32; } function equal(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bool) { bool success = true; assembly { let length := mload(_preBytes) // if lengths don't match the arrays are not equal switch eq(length, mload(_postBytes)) case 1 { // cb is a circuit breaker in the for loop since there's // no said feature for inline assembly loops // cb = 1 - don't breaker // cb = 0 - break let cb := 1 let mc := add(_preBytes, 0x20) let end := add(mc, length) for { let cc := add(_postBytes, 0x20) // the next line is the loop condition: // while(uint256(mc < end) + cb == 2) } eq(add(lt(mc, end), cb), 2) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { // if any of these checks fails then arrays are not equal if iszero(eq(mload(mc), mload(cc))) { // unsuccess: success := 0 cb := 0 } } } default { // unsuccess: success := 0 } } return success; } function equalStorage(bytes storage _preBytes, bytes memory _postBytes) internal view returns (bool) { bool success = true; assembly { // we know _preBytes_offset is 0 let fslot := sload(_preBytes.slot) // Decode the length of the stored array like in concatStorage(). let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2) let mlength := mload(_postBytes) // if lengths don't match the arrays are not equal switch eq(slength, mlength) case 1 { // slength can contain both the length and contents of the array // if length < 32 bytes so let's prepare for that // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage if iszero(iszero(slength)) { switch lt(slength, 32) case 1 { // blank the last byte which is the length fslot := mul(div(fslot, 0x100), 0x100) if iszero(eq(fslot, mload(add(_postBytes, 0x20)))) { // unsuccess: success := 0 } } default { // cb is a circuit breaker in the for loop since there's // no said feature for inline assembly loops // cb = 1 - don't breaker // cb = 0 - break let cb := 1 // get the keccak hash to get the contents of the array mstore(0x0, _preBytes.slot) let sc := keccak256(0x0, 0x20) let mc := add(_postBytes, 0x20) let end := add(mc, mlength) // the next line is the loop condition: // while(uint256(mc < end) + cb == 2) for { } eq(add(lt(mc, end), cb), 2) { sc := add(sc, 1) mc := add(mc, 0x20) } { if iszero(eq(sload(sc), mload(mc))) { // unsuccess: success := 0 cb := 0 } } } } } default { // unsuccess: success := 0 } } return success; } } // File layerzero/contracts/lzApp/LzApp.sol /* * a generic LzReceiver implementation */ abstract contract LzApp is Ownable, ILayerZeroReceiver, ILayerZeroUserApplicationConfig { using BytesLib for bytes; // ua can not send payload larger than this by default, but it can be changed by the ua owner uint public constant DEFAULT_PAYLOAD_SIZE_LIMIT = 10000; ILayerZeroEndpoint public immutable lzEndpoint; mapping(uint16 => bytes) public trustedRemoteLookup; mapping(uint16 => mapping(uint16 => uint)) public minDstGasLookup; mapping(uint16 => uint) public payloadSizeLimitLookup; address public precrime; event SetPrecrime(address precrime); event SetTrustedRemote(uint16 _remoteChainId, bytes _path); event SetTrustedRemoteAddress(uint16 _remoteChainId, bytes _remoteAddress); event SetMinDstGas(uint16 _dstChainId, uint16 _type, uint _minDstGas); constructor(address _endpoint) { lzEndpoint = ILayerZeroEndpoint(_endpoint); } function lzReceive( uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload ) public virtual override { // lzReceive must be called by the endpoint for security require(_msgSender() == address(lzEndpoint), "LzApp: invalid endpoint caller"); bytes memory trustedRemote = trustedRemoteLookup[_srcChainId]; // if will still block the message pathway from (srcChainId, srcAddress). should not receive message from untrusted remote. require( _srcAddress.length == trustedRemote.length && trustedRemote.length > 0 && keccak256(_srcAddress) == keccak256(trustedRemote), "LzApp: invalid source sending contract" ); _blockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload); } // abstract function - the default behaviour of LayerZero is blocking. See: NonblockingLzApp if you dont need to enforce ordered messaging function _blockingLzReceive( uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload ) internal virtual; function _lzSend( uint16 _dstChainId, bytes memory _payload, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams, uint _nativeFee ) internal virtual { bytes memory trustedRemote = trustedRemoteLookup[_dstChainId]; require(trustedRemote.length != 0, "LzApp: destination chain is not a trusted source"); _checkPayloadSize(_dstChainId, _payload.length); lzEndpoint.send{ value: _nativeFee }( _dstChainId, trustedRemote, _payload, _refundAddress, _zroPaymentAddress, _adapterParams ); } function _checkGasLimit( uint16 _dstChainId, uint16 _type, bytes memory _adapterParams, uint _extraGas ) internal view virtual { uint providedGasLimit = _getGasLimit(_adapterParams); uint minGasLimit = minDstGasLookup[_dstChainId][_type] + _extraGas; require(minGasLimit > 0, "LzApp: minGasLimit not set"); require(providedGasLimit >= minGasLimit, "LzApp: gas limit is too low"); } function _getGasLimit(bytes memory _adapterParams) internal pure virtual returns (uint gasLimit) { require(_adapterParams.length >= 34, "LzApp: invalid adapterParams"); assembly { gasLimit := mload(add(_adapterParams, 34)) } } function _checkPayloadSize(uint16 _dstChainId, uint _payloadSize) internal view virtual { uint payloadSizeLimit = payloadSizeLimitLookup[_dstChainId]; if (payloadSizeLimit == 0) { // use default if not set payloadSizeLimit = DEFAULT_PAYLOAD_SIZE_LIMIT; } require(_payloadSize <= payloadSizeLimit, "LzApp: payload size is too large"); } //---------------------------UserApplication config---------------------------------------- function getConfig( uint16 _version, uint16 _chainId, address, uint _configType ) external view returns (bytes memory) { return lzEndpoint.getConfig(_version, _chainId, address(this), _configType); } // generic config for LayerZero user Application function setConfig( uint16 _version, uint16 _chainId, uint _configType, bytes calldata _config ) external override onlyOwner { lzEndpoint.setConfig(_version, _chainId, _configType, _config); } function setSendVersion(uint16 _version) external override onlyOwner { lzEndpoint.setSendVersion(_version); } function setReceiveVersion(uint16 _version) external override onlyOwner { lzEndpoint.setReceiveVersion(_version); } function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) external override onlyOwner { lzEndpoint.forceResumeReceive(_srcChainId, _srcAddress); } // _path = abi.encodePacked(remoteAddress, localAddress) // this function set the trusted path for the cross-chain communication function setTrustedRemote(uint16 _remoteChainId, bytes calldata _path) external onlyOwner { trustedRemoteLookup[_remoteChainId] = _path; emit SetTrustedRemote(_remoteChainId, _path); } function setTrustedRemoteAddress(uint16 _remoteChainId, bytes calldata _remoteAddress) external onlyOwner { trustedRemoteLookup[_remoteChainId] = abi.encodePacked(_remoteAddress, address(this)); emit SetTrustedRemoteAddress(_remoteChainId, _remoteAddress); } function getTrustedRemoteAddress(uint16 _remoteChainId) external view returns (bytes memory) { bytes memory path = trustedRemoteLookup[_remoteChainId]; require(path.length != 0, "LzApp: no trusted path record"); return path.slice(0, path.length - 20); // the last 20 bytes should be address(this) } function setPrecrime(address _precrime) external onlyOwner { precrime = _precrime; emit SetPrecrime(_precrime); } function setMinDstGas(uint16 _dstChainId, uint16 _packetType, uint _minGas) external onlyOwner { require(_minGas > 0, "LzApp: invalid minGas"); minDstGasLookup[_dstChainId][_packetType] = _minGas; emit SetMinDstGas(_dstChainId, _packetType, _minGas); } // if the size is 0, it means default size limit function setPayloadSizeLimit(uint16 _dstChainId, uint _size) external onlyOwner { payloadSizeLimitLookup[_dstChainId] = _size; } //--------------------------- VIEW FUNCTION ---------------------------------------- function isTrustedRemote(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (bool) { bytes memory trustedSource = trustedRemoteLookup[_srcChainId]; return keccak256(trustedSource) == keccak256(_srcAddress); } } // File layerzero/contracts/util/ExcessivelySafeCall.sol library ExcessivelySafeCall { uint256 constant LOW_28_MASK = 0x00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff; /// @notice Use when you _really_ really _really_ don't trust the called /// contract. This prevents the called contract from causing reversion of /// the caller in as many ways as we can. /// @dev The main difference between this and a solidity low-level call is /// that we limit the number of bytes that the callee can cause to be /// copied to caller memory. This prevents stupid things like malicious /// contracts returning 10,000,000 bytes causing a local OOG when copying /// to memory. /// @param _target The address to call /// @param _gas The amount of gas to forward to the remote contract /// @param _maxCopy The maximum number of bytes of returndata to copy /// to memory. /// @param _calldata The data to send to the remote contract /// @return success and returndata, as `.call()`. Returndata is capped to /// `_maxCopy` bytes. function excessivelySafeCall( address _target, uint256 _gas, uint16 _maxCopy, bytes memory _calldata ) internal returns (bool, bytes memory) { // set up for assembly call uint256 _toCopy; bool _success; bytes memory _returnData = new bytes(_maxCopy); // dispatch message to recipient // by assembly calling "handle" function // we call via assembly to avoid memcopying a very large returndata // returned by a malicious contract assembly { _success := call( _gas, // gas _target, // recipient 0, // ether value add(_calldata, 0x20), // inloc mload(_calldata), // inlen 0, // outloc 0 // outlen ) // limit our copy to 256 bytes _toCopy := returndatasize() if gt(_toCopy, _maxCopy) { _toCopy := _maxCopy } // Store the length of the copied bytes mstore(_returnData, _toCopy) // copy the bytes from returndata[0:_toCopy] returndatacopy(add(_returnData, 0x20), 0, _toCopy) } return (_success, _returnData); } /// @notice Use when you _really_ really _really_ don't trust the called /// contract. This prevents the called contract from causing reversion of /// the caller in as many ways as we can. /// @dev The main difference between this and a solidity low-level call is /// that we limit the number of bytes that the callee can cause to be /// copied to caller memory. This prevents stupid things like malicious /// contracts returning 10,000,000 bytes causing a local OOG when copying /// to memory. /// @param _target The address to call /// @param _gas The amount of gas to forward to the remote contract /// @param _maxCopy The maximum number of bytes of returndata to copy /// to memory. /// @param _calldata The data to send to the remote contract /// @return success and returndata, as `.call()`. Returndata is capped to /// `_maxCopy` bytes. function excessivelySafeStaticCall( address _target, uint256 _gas, uint16 _maxCopy, bytes memory _calldata ) internal view returns (bool, bytes memory) { // set up for assembly call uint256 _toCopy; bool _success; bytes memory _returnData = new bytes(_maxCopy); // dispatch message to recipient // by assembly calling "handle" function // we call via assembly to avoid memcopying a very large returndata // returned by a malicious contract assembly { _success := staticcall( _gas, // gas _target, // recipient add(_calldata, 0x20), // inloc mload(_calldata), // inlen 0, // outloc 0 // outlen ) // limit our copy to 256 bytes _toCopy := returndatasize() if gt(_toCopy, _maxCopy) { _toCopy := _maxCopy } // Store the length of the copied bytes mstore(_returnData, _toCopy) // copy the bytes from returndata[0:_toCopy] returndatacopy(add(_returnData, 0x20), 0, _toCopy) } return (_success, _returnData); } /** * @notice Swaps function selectors in encoded contract calls * @dev Allows reuse of encoded calldata for functions with identical * argument types but different names. It simply swaps out the first 4 bytes * for the new selector. This function modifies memory in place, and should * only be used with caution. * @param _newSelector The new 4-byte selector * @param _buf The encoded contract args */ function swapSelector(bytes4 _newSelector, bytes memory _buf) internal pure { require(_buf.length >= 4); uint256 _mask = LOW_28_MASK; assembly { // load the first word of let _word := mload(add(_buf, 0x20)) // mask out the top 4 bytes // /x _word := and(_word, _mask) _word := or(_newSelector, _word) mstore(add(_buf, 0x20), _word) } } } // File layerzero/contracts/lzApp/NonblockingLzApp.sol /* * the default LayerZero messaging behaviour is blocking, i.e. any failed message will block the channel * this abstract class try-catch all fail messages and store locally for future retry. hence, non-blocking * NOTE: if the srcAddress is not configured properly, it will still block the message pathway from (srcChainId, srcAddress) */ abstract contract NonblockingLzApp is LzApp { using ExcessivelySafeCall for address; constructor(address _endpoint) LzApp(_endpoint) {} mapping(uint16 => mapping(bytes => mapping(uint64 => bytes32))) public failedMessages; event MessageFailed(uint16 _srcChainId, bytes _srcAddress, uint64 _nonce, bytes _payload, bytes _reason); event RetryMessageSuccess(uint16 _srcChainId, bytes _srcAddress, uint64 _nonce, bytes32 _payloadHash); // overriding the virtual function in LzReceiver function _blockingLzReceive( uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload ) internal virtual override { (bool success, bytes memory reason) = address(this).excessivelySafeCall( gasleft(), 150, abi.encodeWithSelector(this.nonblockingLzReceive.selector, _srcChainId, _srcAddress, _nonce, _payload) ); // try-catch all errors/exceptions if (!success) { _storeFailedMessage(_srcChainId, _srcAddress, _nonce, _payload, reason); } } function _storeFailedMessage( uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload, bytes memory _reason ) internal virtual { failedMessages[_srcChainId][_srcAddress][_nonce] = keccak256(_payload); emit MessageFailed(_srcChainId, _srcAddress, _nonce, _payload, _reason); } function nonblockingLzReceive( uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload ) public virtual { // only internal transaction require(_msgSender() == address(this), "NonblockingLzApp: caller must be LzApp"); _nonblockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload); } //@notice override this function function _nonblockingLzReceive( uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload ) internal virtual; function retryMessage( uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload ) public payable virtual { // assert there is message to retry bytes32 payloadHash = failedMessages[_srcChainId][_srcAddress][_nonce]; require(payloadHash != bytes32(0), "NonblockingLzApp: no stored message"); require(keccak256(_payload) == payloadHash, "NonblockingLzApp: invalid payload"); // clear the stored message failedMessages[_srcChainId][_srcAddress][_nonce] = bytes32(0); // execute the message. revert if it fails again _nonblockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload); emit RetryMessageSuccess(_srcChainId, _srcAddress, _nonce, payloadHash); } } // File layerzero/contracts/token/onft/IONFT721Core.sol /** * @dev Interface of the ONFT Core standard */ interface IONFT721Core is IERC165 { /** * @dev Emitted when `_tokenIds[]` are moved from the `_sender` to (`_dstChainId`, `_toAddress`) * `_nonce` is the outbound nonce from */ event SendToChain(uint16 indexed _dstChainId, address indexed _from, bytes indexed _toAddress, uint[] _tokenIds); event ReceiveFromChain( uint16 indexed _srcChainId, bytes indexed _srcAddress, address indexed _toAddress, uint[] _tokenIds ); event SetMinGasToTransferAndStore(uint256 _minGasToTransferAndStore); event SetDstChainIdToTransferGas(uint16 _dstChainId, uint256 _dstChainIdToTransferGas); event SetDstChainIdToBatchLimit(uint16 _dstChainId, uint256 _dstChainIdToBatchLimit); /** * @dev Emitted when `_payload` was received from lz, but not enough gas to deliver all tokenIds */ event CreditStored(bytes32 _hashedPayload, bytes _payload); /** * @dev Emitted when `_hashedPayload` has been completely delivered */ event CreditCleared(bytes32 _hashedPayload); /** * @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 sendFrom( address _from, uint16 _dstChainId, bytes calldata _toAddress, uint _tokenId, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams ) external payable; /** * @dev send tokens `_tokenIds[]` 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 sendBatchFrom( address _from, uint16 _dstChainId, bytes calldata _toAddress, uint[] calldata _tokenIds, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams ) external payable; /** * @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 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 * _tokenIds[] - token Ids to transfer * _useZro - indicates to use zro to pay L0 fees * _adapterParams - flexible bytes array to indicate messaging adapter services in L0 */ function estimateSendBatchFee( uint16 _dstChainId, bytes calldata _toAddress, uint[] calldata _tokenIds, bool _useZro, bytes calldata _adapterParams ) external view returns (uint nativeFee, uint zroFee); } // File layerzero/contracts/token/onft/IONFT721.sol /** * @dev Interface of the ONFT standard */ interface IONFT721 is IONFT721Core, IERC721 { } // File layerzero/contracts/token/onft/ONFT721Core.sol abstract contract ONFT721Core is NonblockingLzApp, ERC165, IONFT721Core { uint16 public constant FUNCTION_TYPE_SEND = 1; struct StoredCredit { uint16 srcChainId; address toAddress; uint256 index; // which index of the tokenIds remain bool creditsRemain; } uint256 public minGasToTransferAndStore; // min amount of gas required to transfer, and also store the payload mapping(uint16 => uint256) public dstChainIdToBatchLimit; mapping(uint16 => uint256) public dstChainIdToTransferGas; // per transfer amount of gas required to mint/transfer on the dst mapping(bytes32 => StoredCredit) public storedCredits; constructor(uint256 _minGasToTransferAndStore, address _lzEndpoint) NonblockingLzApp(_lzEndpoint) { require(_minGasToTransferAndStore > 0, "minGasToTransferAndStore must be > 0"); minGasToTransferAndStore = _minGasToTransferAndStore; } 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) { return estimateSendBatchFee(_dstChainId, _toAddress, _toSingletonArray(_tokenId), _useZro, _adapterParams); } function estimateSendBatchFee( uint16 _dstChainId, bytes memory _toAddress, uint[] memory _tokenIds, bool _useZro, bytes memory _adapterParams ) public view virtual override returns (uint nativeFee, uint zroFee) { bytes memory payload = abi.encode(_toAddress, _tokenIds); return lzEndpoint.estimateFees(_dstChainId, address(this), payload, _useZro, _adapterParams); } function sendFrom( address _from, uint16 _dstChainId, bytes memory _toAddress, uint _tokenId, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams ) public payable virtual override { _send( _from, _dstChainId, _toAddress, _toSingletonArray(_tokenId), _refundAddress, _zroPaymentAddress, _adapterParams ); } function sendBatchFrom( address _from, uint16 _dstChainId, bytes memory _toAddress, uint[] memory _tokenIds, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams ) public payable virtual override { _send(_from, _dstChainId, _toAddress, _tokenIds, _refundAddress, _zroPaymentAddress, _adapterParams); } function _send( address _from, uint16 _dstChainId, bytes memory _toAddress, uint[] memory _tokenIds, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams ) internal virtual { // allow 1 by default require(_tokenIds.length > 0, "tokenIds[] is empty"); require( _tokenIds.length == 1 || _tokenIds.length <= dstChainIdToBatchLimit[_dstChainId], "batch size exceeds dst batch limit" ); for (uint i = 0; i < _tokenIds.length; i++) { _debitFrom(_from, _dstChainId, _toAddress, _tokenIds[i]); } bytes memory payload = abi.encode(_toAddress, _tokenIds); _checkGasLimit( _dstChainId, FUNCTION_TYPE_SEND, _adapterParams, dstChainIdToTransferGas[_dstChainId] * _tokenIds.length ); _lzSend(_dstChainId, payload, _refundAddress, _zroPaymentAddress, _adapterParams, msg.value); emit SendToChain(_dstChainId, _from, _toAddress, _tokenIds); } function _nonblockingLzReceive( uint16 _srcChainId, bytes memory _srcAddress, uint64 /*_nonce*/, bytes memory _payload ) internal virtual override { // decode and load the toAddress (bytes memory toAddressBytes, uint[] memory tokenIds) = abi.decode(_payload, (bytes, uint[])); address toAddress; assembly { toAddress := mload(add(toAddressBytes, 20)) } uint nextIndex = _creditTill(_srcChainId, toAddress, 0, tokenIds); if (nextIndex < tokenIds.length) { // not enough gas to complete transfers, store to be cleared in another tx bytes32 hashedPayload = keccak256(_payload); storedCredits[hashedPayload] = StoredCredit(_srcChainId, toAddress, nextIndex, true); emit CreditStored(hashedPayload, _payload); } emit ReceiveFromChain(_srcChainId, _srcAddress, toAddress, tokenIds); } // Public function for anyone to clear and deliver the remaining batch sent tokenIds function clearCredits(bytes memory _payload) external virtual { bytes32 hashedPayload = keccak256(_payload); require(storedCredits[hashedPayload].creditsRemain, "no credits stored"); (, uint[] memory tokenIds) = abi.decode(_payload, (bytes, uint[])); uint nextIndex = _creditTill( storedCredits[hashedPayload].srcChainId, storedCredits[hashedPayload].toAddress, storedCredits[hashedPayload].index, tokenIds ); require(nextIndex > storedCredits[hashedPayload].index, "not enough gas to process credit transfer"); if (nextIndex == tokenIds.length) { // cleared the credits, delete the element delete storedCredits[hashedPayload]; emit CreditCleared(hashedPayload); } else { // store the next index to mint storedCredits[hashedPayload] = StoredCredit( storedCredits[hashedPayload].srcChainId, storedCredits[hashedPayload].toAddress, nextIndex, true ); } } // When a srcChain has the ability to transfer more chainIds in a single tx than the dst can do. // Needs the ability to iterate and stop if the minGasToTransferAndStore is not met function _creditTill( uint16 _srcChainId, address _toAddress, uint _startIndex, uint[] memory _tokenIds ) internal returns (uint256) { uint i = _startIndex; while (i < _tokenIds.length) { // if not enough gas to process, store this index for next loop if (gasleft() < minGasToTransferAndStore) break; _creditTo(_srcChainId, _toAddress, _tokenIds[i]); i++; } // indicates the next index to send of tokenIds, // if i == tokenIds.length, we are finished return i; } function setMinGasToTransferAndStore(uint256 _minGasToTransferAndStore) external onlyOwner { require(_minGasToTransferAndStore > 0, "minGasToTransferAndStore must be > 0"); minGasToTransferAndStore = _minGasToTransferAndStore; emit SetMinGasToTransferAndStore(_minGasToTransferAndStore); } // ensures enough gas in adapter params to handle batch transfer gas amounts on the dst function setDstChainIdToTransferGas(uint16 _dstChainId, uint256 _dstChainIdToTransferGas) external onlyOwner { require(_dstChainIdToTransferGas > 0, "dstChainIdToTransferGas must be > 0"); dstChainIdToTransferGas[_dstChainId] = _dstChainIdToTransferGas; emit SetDstChainIdToTransferGas(_dstChainId, _dstChainIdToTransferGas); } // limit on src the amount of tokens to batch send function setDstChainIdToBatchLimit(uint16 _dstChainId, uint256 _dstChainIdToBatchLimit) external onlyOwner { require(_dstChainIdToBatchLimit > 0, "dstChainIdToBatchLimit must be > 0"); dstChainIdToBatchLimit[_dstChainId] = _dstChainIdToBatchLimit; emit SetDstChainIdToBatchLimit(_dstChainId, _dstChainIdToBatchLimit); } function _debitFrom(address _from, uint16 _dstChainId, bytes memory _toAddress, uint _tokenId) internal virtual; function _creditTo(uint16 _srcChainId, address _toAddress, uint _tokenId) internal virtual; function _toSingletonArray(uint element) internal pure returns (uint[] memory) { uint[] memory array = new uint[](1); array[0] = element; return array; } } // File layerzero/contracts/token/onft/extension/ONFT721A.sol // DISCLAIMER: // This contract can only be deployed on one chain and must be the first minter of each token id! // This is because ERC721A does not have the ability to mint a specific token id. // Other chains must have ONFT721 deployed. // NOTE: this ONFT contract has no public minting logic. // must implement your own minting logic in child contract contract ONFT721A is ONFT721Core, ERC721A, ERC721A__IERC721Receiver { constructor( string memory _name, string memory _symbol, uint256 _minGasToTransferAndStore, address _lzEndpoint ) ERC721A(_name, _symbol) ONFT721Core(_minGasToTransferAndStore, _lzEndpoint) {} function supportsInterface(bytes4 interfaceId) public view virtual override(ONFT721Core, ERC721A) returns (bool) { return interfaceId == type(IONFT721Core).interfaceId || super.supportsInterface(interfaceId); } function _debitFrom(address _from, uint16, bytes memory, uint _tokenId) internal virtual override(ONFT721Core) { safeTransferFrom(_from, address(this), _tokenId); } function _creditTo(uint16, address _toAddress, uint _tokenId) internal virtual override(ONFT721Core) { require(_exists(_tokenId) && ERC721A.ownerOf(_tokenId) == address(this)); safeTransferFrom(address(this), _toAddress, _tokenId); } function onERC721Received(address, address, uint, bytes memory) public virtual override returns (bytes4) { return ERC721A__IERC721Receiver.onERC721Received.selector; } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "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":"uint256","name":"_minGasToTransfer","type":"uint256"},{"internalType":"address","name":"_lzEndpoint","type":"address"},{"internalType":"address","name":"_team","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","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":"fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"ConsecutiveTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"_hashedPayload","type":"bytes32"}],"name":"CreditCleared","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"_hashedPayload","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"_payload","type":"bytes"}],"name":"CreditStored","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"deployer","type":"address"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"Deploy","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"nutter","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Jailbreak","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"indexed":false,"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"indexed":false,"internalType":"uint64","name":"_nonce","type":"uint64"},{"indexed":false,"internalType":"bytes","name":"_payload","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"_reason","type":"bytes"}],"name":"MessageFailed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"nutter","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"enum MafiaNuts.Phase","name":"phase","type":"uint8"}],"name":"Nut","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":"enum MafiaNuts.Phase","name":"phase","type":"uint8"}],"name":"PhaseChange","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"indexed":true,"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"indexed":true,"internalType":"address","name":"_toAddress","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"}],"name":"ReceiveFromChain","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"indexed":false,"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"indexed":false,"internalType":"uint64","name":"_nonce","type":"uint64"},{"indexed":false,"internalType":"bytes32","name":"_payloadHash","type":"bytes32"}],"name":"RetryMessageSuccess","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"bytes","name":"_toAddress","type":"bytes"},{"indexed":false,"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"}],"name":"SendToChain","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"indexed":false,"internalType":"uint256","name":"_dstChainIdToBatchLimit","type":"uint256"}],"name":"SetDstChainIdToBatchLimit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"indexed":false,"internalType":"uint256","name":"_dstChainIdToTransferGas","type":"uint256"}],"name":"SetDstChainIdToTransferGas","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"_type","type":"uint16"},{"indexed":false,"internalType":"uint256","name":"_minDstGas","type":"uint256"}],"name":"SetMinDstGas","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_minGasToTransferAndStore","type":"uint256"}],"name":"SetMinGasToTransferAndStore","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"precrime","type":"address"}],"name":"SetPrecrime","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_remoteChainId","type":"uint16"},{"indexed":false,"internalType":"bytes","name":"_path","type":"bytes"}],"name":"SetTrustedRemote","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_remoteChainId","type":"uint16"},{"indexed":false,"internalType":"bytes","name":"_remoteAddress","type":"bytes"}],"name":"SetTrustedRemoteAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":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":"DEFAULT_PAYLOAD_SIZE_LIMIT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FUNCTION_TYPE_SEND","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"JAILBREAK_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINT_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"_payload","type":"bytes"}],"name":"clearCredits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"}],"name":"dstChainIdToBatchLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"}],"name":"dstChainIdToTransferGas","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes","name":"_toAddress","type":"bytes"},{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"internalType":"bool","name":"_useZro","type":"bool"},{"internalType":"bytes","name":"_adapterParams","type":"bytes"}],"name":"estimateSendBatchFee","outputs":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"zroFee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes","name":"_toAddress","type":"bytes"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"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":"uint16","name":"_remoteChainId","type":"uint16"}],"name":"getTrustedRemoteAddress","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"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":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"}],"name":"isTrustedRemote","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_nutter","type":"address"}],"name":"jailbreak","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lzEndpoint","outputs":[{"internalType":"contract ILayerZeroEndpoint","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"internalType":"uint64","name":"_nonce","type":"uint64"},{"internalType":"bytes","name":"_payload","type":"bytes"}],"name":"lzReceive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"},{"internalType":"uint16","name":"","type":"uint16"}],"name":"minDstGasLookup","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minGasToTransferAndStore","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"internalType":"uint64","name":"_nonce","type":"uint64"},{"internalType":"bytes","name":"_payload","type":"bytes"}],"name":"nonblockingLzReceive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"_proof","type":"bytes32[]"}],"name":"nut","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"enum MafiaNuts.Phase","name":"","type":"uint8"}],"name":"nutMap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","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":[{"internalType":"uint16","name":"","type":"uint16"}],"name":"payloadSizeLimitLookup","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"phase","outputs":[{"internalType":"enum MafiaNuts.Phase","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum MafiaNuts.Phase","name":"","type":"uint8"}],"name":"phaseInfoMap","outputs":[{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"precrime","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"recoverFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"recoverNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"internalType":"uint64","name":"_nonce","type":"uint64"},{"internalType":"bytes","name":"_payload","type":"bytes"}],"name":"retryMessage","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","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":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes","name":"_toAddress","type":"bytes"},{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"internalType":"address payable","name":"_refundAddress","type":"address"},{"internalType":"address","name":"_zroPaymentAddress","type":"address"},{"internalType":"bytes","name":"_adapterParams","type":"bytes"}],"name":"sendBatchFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes","name":"_toAddress","type":"bytes"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address payable","name":"_refundAddress","type":"address"},{"internalType":"address","name":"_zroPaymentAddress","type":"address"},{"internalType":"bytes","name":"_adapterParams","type":"bytes"}],"name":"sendFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_version","type":"uint16"},{"internalType":"uint16","name":"_chainId","type":"uint16"},{"internalType":"uint256","name":"_configType","type":"uint256"},{"internalType":"bytes","name":"_config","type":"bytes"}],"name":"setConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"uint256","name":"_dstChainIdToBatchLimit","type":"uint256"}],"name":"setDstChainIdToBatchLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"uint256","name":"_dstChainIdToTransferGas","type":"uint256"}],"name":"setDstChainIdToTransferGas","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"uint16","name":"_packetType","type":"uint16"},{"internalType":"uint256","name":"_minGas","type":"uint256"}],"name":"setMinDstGas","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minGasToTransferAndStore","type":"uint256"}],"name":"setMinGasToTransferAndStore","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"uint256","name":"_size","type":"uint256"}],"name":"setPayloadSizeLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum MafiaNuts.Phase","name":"_phase","type":"uint8"}],"name":"setPhase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum MafiaNuts.Phase","name":"_phase","type":"uint8"},{"components":[{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"internalType":"struct MafiaNuts.PhaseInfo","name":"_phaseInfo","type":"tuple"}],"name":"setPhaseInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_precrime","type":"address"}],"name":"setPrecrime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_version","type":"uint16"}],"name":"setReceiveVersion","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_version","type":"uint16"}],"name":"setSendVersion","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_remoteChainId","type":"uint16"},{"internalType":"bytes","name":"_path","type":"bytes"}],"name":"setTrustedRemote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_remoteChainId","type":"uint16"},{"internalType":"bytes","name":"_remoteAddress","type":"bytes"}],"name":"setTrustedRemoteAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_uri","type":"string"}],"name":"setURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"storedCredits","outputs":[{"internalType":"uint16","name":"srcChainId","type":"uint16"},{"internalType":"address","name":"toAddress","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"bool","name":"creditsRemain","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"payable","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"}]
Contract Creation Code
60a06040523480156200001157600080fd5b506040516200502838038062005028833981016040819052620000349162000404565b84848484838383838080620000493362000144565b6001600160a01b03166080525081620000b45760405162461bcd60e51b8152602060048201526024808201527f6d696e476173546f5472616e73666572416e6453746f7265206d7573742062656044820152630203e20360e41b606482015260840160405180910390fd5b506006558151620000cd90600c90602085019062000274565b508051620000e390600d90602084019062000274565b506001600a5550620001019450859350610115925050620001949050565b604080513381524260208201527faf354defc104ba9267634f156652b1f1cfbd10746c329e2bdd48abd4c9cff929910160405180910390a15050505050620004d9565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600a546000829003620001ba5760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b0383166000818152600f602090815260408083208054680100000000000000018802019055848352600e90915281206001851460e11b4260a01b17831790558284019083908390600080516020620050088339815191528180a4600183015b81811462000249578083600060008051602062005008833981519152600080a460010162000220565b50816000036200026b57604051622e076360e81b815260040160405180910390fd5b600a5550505050565b82805462000282906200049d565b90600052602060002090601f016020900481019282620002a65760008555620002f1565b82601f10620002c157805160ff1916838001178555620002f1565b82800160010185558215620002f1579182015b82811115620002f1578251825591602001919060010190620002d4565b50620002ff92915062000303565b5090565b5b80821115620002ff576000815560010162000304565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200034257600080fd5b81516001600160401b03808211156200035f576200035f6200031a565b604051601f8301601f19908116603f011681019082821181831017156200038a576200038a6200031a565b81604052838152602092508683858801011115620003a757600080fd5b600091505b83821015620003cb5785820183015181830184015290820190620003ac565b83821115620003dd5760008385830101525b9695505050505050565b80516001600160a01b0381168114620003ff57600080fd5b919050565b600080600080600060a086880312156200041d57600080fd5b85516001600160401b03808211156200043557600080fd5b6200044389838a0162000330565b965060208801519150808211156200045a57600080fd5b50620004698882890162000330565b945050604086015192506200048160608701620003e7565b91506200049160808701620003e7565b90509295509295909350565b600181811c90821680620004b257607f821691505b602082108103620004d357634e487b7160e01b600052602260045260246000fd5b50919050565b608051614adb6200052d60003960008181610a9d01528181610d210152818161104c01528181611278015281816116b2015281816120de015281816127e40152818161291a01526136cd0152614adb6000f3fe6080604052600436106103d85760003560e01c80638cfd8f5c116101fd578063baf3292d11610118578063d12473a5116100ab578063eb8d72b71161007a578063eb8d72b714610c71578063f235364114610c91578063f2fde38b14610cb1578063f5ecbdbc14610cd1578063fa25f9b614610cf157600080fd5b8063d12473a514610bd5578063d1deba1f14610bf5578063df2a5b3b14610c08578063e985e9c514610c2857600080fd5b8063c6291db0116100e7578063c6291db014610b48578063c87b56dd14610b75578063cbed8b9c14610b95578063ce3151a914610bb557600080fd5b8063baf3292d14610ad2578063beb12c9d14610af2578063c03afb5914610b12578063c446183414610b3257600080fd5b80639f38369a11610190578063af3fb21c1161015f578063af3fb21c14610a3c578063b1c9fe6e14610a64578063b353aaa714610a8b578063b88d4fde14610abf57600080fd5b80639f38369a146109c9578063a22cb465146109e9578063a6c3d16514610a09578063ab3ffb9314610a2957600080fd5b8063958f1170116101cc578063958f11701461096a57806395d89b411461097f5780639dfbcde8146109945780639ea5d6b1146109a957600080fd5b80638cfd8f5c146108d45780638da5cb5b1461090c5780638ffa1f2a1461092a578063950c8a741461094a57600080fd5b80633319a00d116102f8578063519056361161028b57806366ad5c8a1161025a57806366ad5c8a1461082757806370a0823114610847578063715018a6146108675780637533d7881461087c57806375b992e21461089c57600080fd5b8063519056361461078557806355b48e18146107985780635b8c41e6146107b85780636352211e1461080757600080fd5b806342842e0e116102c757806342842e0e1461070f57806342d65a8d1461072257806348288190146107425780634ac3f4ff1461075857600080fd5b80633319a00d14610682578063361b4c58146106a25780633d8b38f6146106c25780633f1f4fa4146106e257600080fd5b80630df374831161037057806322a3ecf91161033f57806322a3ecf9146105a157806323b872dd146106245780632a205e3d1461063757806332cb6b0c1461066c57600080fd5b80630df374831461050157806310ddb13714610521578063150b7a021461054157806318160ddd1461057a57600080fd5b806307e0db17116103ac57806307e0db1714610476578063081812fc14610496578063095ea7b3146104ce5780630b4cad4c146104e157600080fd5b80621d3567146103dd57806301ffc9a7146103ff57806302fe53051461043457806306fdde0314610454575b600080fd5b3480156103e957600080fd5b506103fd6103f8366004613a61565b610d1e565b005b34801561040b57600080fd5b5061041f61041a366004613b0a565b610f4f565b60405190151581526020015b60405180910390f35b34801561044057600080fd5b506103fd61044f366004613bd2565b610f7a565b34801561046057600080fd5b50610469610f99565b60405161042b9190613c72565b34801561048257600080fd5b506103fd610491366004613c85565b61102b565b3480156104a257600080fd5b506104b66104b1366004613ca0565b6110b4565b6040516001600160a01b03909116815260200161042b565b6103fd6104dc366004613cd9565b6110f8565b3480156104ed57600080fd5b506103fd6104fc366004613ca0565b611198565b34801561050d57600080fd5b506103fd61051c366004613d05565b611238565b34801561052d57600080fd5b506103fd61053c366004613c85565b611257565b34801561054d57600080fd5b5061056161055c366004613d41565b6112af565b6040516001600160e01b0319909116815260200161042b565b34801561058657600080fd5b50600b54600a5403600019015b60405190815260200161042b565b3480156105ad57600080fd5b506105f56105bc366004613ca0565b60096020526000908152604090208054600182015460029092015461ffff821692620100009092046001600160a01b0316919060ff1684565b6040805161ffff90951685526001600160a01b039093166020850152918301521515606082015260800161042b565b6103fd610632366004613dac565b6112c0565b34801561064357600080fd5b50610657610652366004613dfb565b611459565b6040805192835260208301919091520161042b565b34801561067857600080fd5b506105936105dc81565b34801561068e57600080fd5b506103fd61069d366004613cd9565b61147f565b3480156106ae57600080fd5b506103fd6106bd366004613cd9565b61150c565b3480156106ce57600080fd5b5061041f6106dd366004613e8d565b6115ab565b3480156106ee57600080fd5b506105936106fd366004613c85565b60036020526000908152604090205481565b6103fd61071d366004613dac565b611678565b34801561072e57600080fd5b506103fd61073d366004613e8d565b611693565b34801561074e57600080fd5b5061059360065481565b34801561076457600080fd5b50610593610773366004613c85565b60076020526000908152604090205481565b6103fd610793366004613edf565b611719565b3480156107a457600080fd5b506103fd6107b3366004613fa7565b611730565b3480156107c457600080fd5b506105936107d336600461400e565b6005602090815260009384526040808520845180860184018051928152908401958401959095209452929052825290205481565b34801561081357600080fd5b506104b6610822366004613ca0565b611778565b34801561083357600080fd5b506103fd610842366004613a61565b611783565b34801561085357600080fd5b5061059361086236600461406b565b611857565b34801561087357600080fd5b506103fd6118a5565b34801561088857600080fd5b50610469610897366004613c85565b6118b9565b3480156108a857600080fd5b506105936108b7366004614088565b601560209081526000928352604080842090915290825290205481565b3480156108e057600080fd5b506105936108ef3660046140bd565b600260209081526000928352604080842090915290825290205481565b34801561091857600080fd5b506000546001600160a01b03166104b6565b34801561093657600080fd5b506103fd6109453660046140e7565b611953565b34801561095657600080fd5b506004546104b6906001600160a01b031681565b34801561097657600080fd5b5061059360e081565b34801561098b57600080fd5b50610469611b8c565b3480156109a057600080fd5b50610593611b9b565b3480156109b557600080fd5b506103fd6109c4366004613d05565b611bab565b3480156109d557600080fd5b506104696109e4366004613c85565b611c62565b3480156109f557600080fd5b506103fd610a0436600461411b565b611d71565b348015610a1557600080fd5b506103fd610a24366004613e8d565b611ddd565b6103fd610a373660046141dd565b611e70565b348015610a4857600080fd5b50610a51600181565b60405161ffff909116815260200161042b565b348015610a7057600080fd5b50601354610a7e9060ff1681565b60405161042b91906142a8565b348015610a9757600080fd5b506104b67f000000000000000000000000000000000000000000000000000000000000000081565b6103fd610acd366004613d41565b611e7f565b348015610ade57600080fd5b506103fd610aed36600461406b565b611ec3565b348015610afe57600080fd5b506103fd610b0d36600461406b565b611f19565b348015610b1e57600080fd5b506103fd610b2d3660046142d0565b611fd2565b348015610b3e57600080fd5b5061059361271081565b348015610b5457600080fd5b50610593610b633660046142d0565b60146020526000908152604090205481565b348015610b8157600080fd5b50610469610b90366004613ca0565b61203c565b348015610ba157600080fd5b506103fd610bb03660046142eb565b6120bf565b348015610bc157600080fd5b506103fd610bd0366004614359565b612154565b348015610be157600080fd5b506103fd610bf0366004613d05565b6123d3565b6103fd610c03366004613a61565b612483565b348015610c1457600080fd5b506103fd610c233660046143cd565b612699565b348015610c3457600080fd5b5061041f610c43366004614409565b6001600160a01b03918216600090815260116020908152604080832093909416825291909152205460ff1690565b348015610c7d57600080fd5b506103fd610c8c366004613e8d565b61274b565b348015610c9d57600080fd5b50610657610cac366004614437565b6127a5565b348015610cbd57600080fd5b506103fd610ccc36600461406b565b612870565b348015610cdd57600080fd5b50610469610cec3660046144b4565b6128e9565b348015610cfd57600080fd5b50610593610d0c366004613c85565b60086020526000908152604090205481565b337f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031614610d9b5760405162461bcd60e51b815260206004820152601e60248201527f4c7a4170703a20696e76616c696420656e64706f696e742063616c6c6572000060448201526064015b60405180910390fd5b61ffff861660009081526001602052604081208054610db990614501565b80601f0160208091040260200160405190810160405280929190818152602001828054610de590614501565b8015610e325780601f10610e0757610100808354040283529160200191610e32565b820191906000526020600020905b815481529060010190602001808311610e1557829003601f168201915b50505050509050805186869050148015610e4d575060008151115b8015610e75575080516020820120604051610e6b908890889061453b565b6040518091039020145b610ed05760405162461bcd60e51b815260206004820152602660248201527f4c7a4170703a20696e76616c696420736f757263652073656e64696e6720636f6044820152651b9d1c9858dd60d21b6064820152608401610d92565b610f468787878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8a018190048102820181019092528881528a93509150889088908190840183828082843760009201919091525061299a92505050565b50505050505050565b60006001600160e01b031982166322bac5d960e01b1480610f745750610f7482612a13565b92915050565b610f82612a61565b8051610f959060129060208401906138de565b5050565b6060600c8054610fa890614501565b80601f0160208091040260200160405190810160405280929190818152602001828054610fd490614501565b80156110215780601f10610ff657610100808354040283529160200191611021565b820191906000526020600020905b81548152906001019060200180831161100457829003601f168201915b5050505050905090565b611033612a61565b6040516307e0db1760e01b815261ffff821660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906307e0db17906024015b600060405180830381600087803b15801561109957600080fd5b505af11580156110ad573d6000803e3d6000fd5b5050505050565b60006110bf82612abb565b6110dc576040516333d1c03960e21b815260040160405180910390fd5b506000908152601060205260409020546001600160a01b031690565b600061110382611778565b9050336001600160a01b0382161461113c5761111f8133610c43565b61113c576040516367d9dca160e11b815260040160405180910390fd5b60008281526010602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6111a0612a61565b600081116111fc5760405162461bcd60e51b8152602060048201526024808201527f6d696e476173546f5472616e73666572416e6453746f7265206d7573742062656044820152630203e20360e41b6064820152608401610d92565b60068190556040518181527ffebbc4f8bb9ec2313950c718d43123124b15778efda4c1f1d529de2995b4f34d906020015b60405180910390a150565b611240612a61565b61ffff909116600090815260036020526040902055565b61125f612a61565b6040516310ddb13760e01b815261ffff821660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906310ddb1379060240161107f565b630a85bd0160e11b5b949350505050565b60006112cb82612af0565b9050836001600160a01b0316816001600160a01b0316146112fe5760405162a1148160e81b815260040160405180910390fd5b60008281526010602052604090208054338082146001600160a01b0388169091141761134b5761132e8633610c43565b61134b57604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b03851661137257604051633a954ecd60e21b815260040160405180910390fd5b801561137d57600082555b6001600160a01b038681166000908152600f60205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b176000858152600e6020526040812091909155600160e11b8416900361140f57600184016000818152600e6020526040812054900361140d57600a54811461140d576000818152600e602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b505050505050565b600080611471878761146a88612b5f565b87876127a5565b915091509550959350505050565b611487612a61565b816001600160a01b03166323b872dd306114a96000546001600160a01b031690565b6040516001600160e01b031960e085901b1681526001600160a01b0392831660048201529116602482015260448101849052606401600060405180830381600087803b1580156114f857600080fd5b505af1158015611451573d6000803e3d6000fd5b611514612a61565b816001600160a01b031663a9059cbb6115356000546001600160a01b031690565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018490526044016020604051808303816000875af1158015611582573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115a6919061454b565b505050565b61ffff8316600090815260016020526040812080548291906115cc90614501565b80601f01602080910402602001604051908101604052809291908181526020018280546115f890614501565b80156116455780601f1061161a57610100808354040283529160200191611645565b820191906000526020600020905b81548152906001019060200180831161162857829003601f168201915b50505050509050838360405161165c92919061453b565b60405180910390208180519060200120149150505b9392505050565b6115a683838360405180602001604052806000815250611e7f565b61169b612a61565b6040516342d65a8d60e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906342d65a8d906116eb90869086908690600401614591565b600060405180830381600087803b15801561170557600080fd5b505af1158015610f46573d6000803e3d6000fd5b610f4687878761172888612b5f565b878787612baa565b611738612a61565b806014600084600381111561174f5761174f614292565b600381111561176057611760614292565b81526020810191909152604001600020905190555050565b6000610f7482612af0565b3330146117e15760405162461bcd60e51b815260206004820152602660248201527f4e6f6e626c6f636b696e674c7a4170703a2063616c6c6572206d7573742062656044820152650204c7a4170760d41b6064820152608401610d92565b6114518686868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f890181900481028201810190925287815289935091508790879081908401838280828437600092019190915250612d7e92505050565b60006001600160a01b038216611880576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600f60205260409020546001600160401b031690565b6118ad612a61565b6118b76000612ed5565b565b600160205260009081526040902080546118d290614501565b80601f01602080910402602001604051908101604052809291908181526020018280546118fe90614501565b801561194b5780601f106119205761010080835404028352916020019161194b565b820191906000526020600020905b81548152906001019060200180831161192e57829003601f168201915b505050505081565b80516020808301919091206000818152600990925260409091206002015460ff166119b45760405162461bcd60e51b81526020600482015260116024820152701b9bc818dc99591a5d1cc81cdd1bdc9959607a1b6044820152606401610d92565b6000828060200190518101906119ca91906145f4565b60008481526009602052604081208054600190910154929450909250611a069161ffff8216916201000090046001600160a01b03169085612f25565b6000848152600960205260409020600101549091508111611a7b5760405162461bcd60e51b815260206004820152602960248201527f6e6f7420656e6f7567682067617320746f2070726f6365737320637265646974604482015268103a3930b739b332b960b91b6064820152608401610d92565b81518103611af25760008381526009602052604080822080546001600160b01b031916815560018101929092556002909101805460ff19169055517fd7be02b8dd0d27bd0517a9cb4d7469ce27df4313821ae5ec1ff69acc594ba23390611ae59085815260200190565b60405180910390a1611b86565b60408051608081018252600085815260096020818152848320805461ffff80821687526001600160a01b03620100008084048216868a019081529989018b8152600160608b01818152998f90529790965297519851169096026001600160b01b03199091169690951695909517939093178455915191830191909155516002909101805491151560ff199092169190911790555b50505050565b6060600d8054610fa890614501565b611ba860e06105dc6146c4565b81565b611bb3612a61565b60008111611c0e5760405162461bcd60e51b815260206004820152602260248201527f647374436861696e4964546f42617463684c696d6974206d757374206265203e604482015261020360f41b6064820152608401610d92565b61ffff8216600081815260076020908152604091829020849055815192835282018390527f7315f7654d594ead24a30160ed9ba2d23247f543016b918343591e93d7afdb6d91015b60405180910390a15050565b61ffff8116600090815260016020526040812080546060929190611c8590614501565b80601f0160208091040260200160405190810160405280929190818152602001828054611cb190614501565b8015611cfe5780601f10611cd357610100808354040283529160200191611cfe565b820191906000526020600020905b815481529060010190602001808311611ce157829003601f168201915b505050505090508051600003611d565760405162461bcd60e51b815260206004820152601d60248201527f4c7a4170703a206e6f20747275737465642070617468207265636f72640000006044820152606401610d92565b611671600060148351611d6991906146c4565b839190612f71565b3360008181526011602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b611de5612a61565b818130604051602001611dfa939291906146db565b60408051601f1981840301815291815261ffff85166000908152600160209081529190208251611e2f939192909101906138de565b507f8c0400cfe2d1199b1a725c78960bcc2a344d869b80590d0f2bd005db15a572ce838383604051611e6393929190614591565b60405180910390a1505050565b610f4687878787878787612baa565b611e8a8484846112c0565b6001600160a01b0383163b15611b8657611ea68484848461307e565b611b86576040516368d2bf6b60e11b815260040160405180910390fd5b611ecb612a61565b600480546001600160a01b0319166001600160a01b0383169081179091556040519081527f5db758e995a17ec1ad84bdef7e8c3293a0bd6179bcce400dff5d4c3d87db726b9060200161122d565b611f21612a61565b600b54600a540360001901611f3960e06105dc6146c4565b8110158015611f4957506105dc81105b611f845760405162461bcd60e51b815260206004820152600c60248201526b189858dac81d1bc81a985a5b60a21b6044820152606401610d92565b611f8f826001613166565b611f9a816001614701565b6040516001600160a01b038416907f14ef1f17ccb0641bfc2ad74a52e62f06378248e6e01e392d2b5a8674afd33b6190600090a35050565b611fda612a61565b6013805482919060ff19166001836003811115611ff957611ff9614292565b021790555080600381111561201057612010614292565b6040517fed606d544c2202d032d2626c390923e6f260ca5d89625bba0cfe70d2bdda4e8f90600090a250565b606061204782612abb565b61206457604051630a14c4b560e41b815260040160405180910390fd5b600061206e613264565b9050805160000361208e5760405180602001604052806000815250611671565b8061209884613273565b6040516020016120a9929190614719565b6040516020818303038152906040529392505050565b6120c7612a61565b6040516332fb62e760e21b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063cbed8b9c9061211b9088908890889088908890600401614748565b600060405180830381600087803b15801561213557600080fd5b505af1158015612149573d6000803e3d6000fd5b505050505050505050565b600b54600a54339160009103600019019050600060135460ff16600381111561217f5761217f614292565b036121b65760405162461bcd60e51b81526020600482015260076024820152662161637469766560c81b6044820152606401610d92565b6121c18285856132b7565b6121f35760405162461bcd60e51b8152602060048201526003602482015262085ddb60ea1b6044820152606401610d92565b61220060e06105dc6146c4565b811061223e5760405162461bcd60e51b815260206004820152600d60248201526c3e206d696e7420737570706c7960981b6044820152606401610d92565b6001600160a01b038216321461227f5760405162461bcd60e51b8152600401610d929060208082526004908201526308589bdd60e21b604082015260600190565b6001600160a01b0382166000908152601560205260408120601354829060ff1660038111156122b0576122b0614292565b60038111156122c1576122c1614292565b81526020019081526020016000205490508060001461230c5760405162461bcd60e51b815260206004820152600760248201526606e7574206361760cc1b6044820152606401610d92565b612317836001613166565b612322816001614701565b6001600160a01b038416600090815260156020526040812060135490919060ff16600381111561235457612354614292565b600381111561236557612365614292565b815260208101919091526040016000205560135460ff16600381111561238d5761238d614292565b612398836001614701565b6040516001600160a01b038616907fda38589bd55f26501f10abeade560e06b0ccc88f007f2811d1288ea9725c342190600090a45050505050565b6123db612a61565b600081116124375760405162461bcd60e51b815260206004820152602360248201527f647374436861696e4964546f5472616e73666572476173206d7573742062652060448201526203e20360ec1b6064820152608401610d92565b61ffff8216600081815260086020908152604091829020849055815192835282018390527fc46df2983228ac2d9754e94a0d565e6671665dc8ad38602bc8e544f0685a29fb9101611c56565b61ffff861660009081526005602052604080822090516124a6908890889061453b565b90815260408051602092819003830190206001600160401b038716600090815292529020549050806125265760405162461bcd60e51b815260206004820152602360248201527f4e6f6e626c6f636b696e674c7a4170703a206e6f2073746f726564206d65737360448201526261676560e81b6064820152608401610d92565b80838360405161253792919061453b565b6040518091039020146125965760405162461bcd60e51b815260206004820152602160248201527f4e6f6e626c6f636b696e674c7a4170703a20696e76616c6964207061796c6f616044820152601960fa1b6064820152608401610d92565b61ffff871660009081526005602052604080822090516125b9908990899061453b565b90815260408051602092819003830181206001600160401b038916600090815290845282902093909355601f88018290048202830182019052868252612651918991899089908190840183828082843760009201919091525050604080516020601f8a018190048102820181019092528881528a935091508890889081908401838280828437600092019190915250612d7e92505050565b7fc264d91f3adc5588250e1551f547752ca0cfa8f6b530d243b9f9f4cab10ea8e58787878785604051612688959493929190614781565b60405180910390a150505050505050565b6126a1612a61565b600081116126e95760405162461bcd60e51b81526020600482015260156024820152744c7a4170703a20696e76616c6964206d696e47617360581b6044820152606401610d92565b61ffff83811660008181526002602090815260408083209487168084529482529182902085905581519283528201929092529081018290527f9d5c7c0b934da8fefa9c7760c98383778a12dfbfc0c3b3106518f43fb9508ac090606001611e63565b612753612a61565b61ffff83166000908152600160205260409020612771908383613962565b507ffa41487ad5d6728f0b19276fa1eddc16558578f5109fc39d2dc33c3230470dab838383604051611e6393929190614591565b600080600086866040516020016127bd9291906147f7565b60408051601f198184030181529082905263040a7bb160e41b825291506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906340a7bb1090612821908b90309086908b908b9060040161481c565b6040805180830381865afa15801561283d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128619190614870565b92509250509550959350505050565b612878612a61565b6001600160a01b0381166128dd5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610d92565b6128e681612ed5565b50565b604051633d7b2f6f60e21b815261ffff808616600483015284166024820152306044820152606481018290526060907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063f5ecbdbc90608401600060405180830381865afa158015612969573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526129919190810190614894565b95945050505050565b6000806129fd5a60966366ad5c8a60e01b898989896040516024016129c294939291906148c8565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915230929190613393565b915091508161145157611451868686868561341d565b60006301ffc9a760e01b6001600160e01b031983161480612a4457506380ac58cd60e01b6001600160e01b03198316145b80610f745750506001600160e01b031916635b5e139f60e01b1490565b6000546001600160a01b031633146118b75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610d92565b600081600111158015612acf5750600a5482105b8015610f745750506000908152600e6020526040902054600160e01b161590565b60008180600111612b4657600a54811015612b46576000818152600e602052604081205490600160e01b82169003612b44575b806000036116715750600019016000818152600e6020526040902054612b23565b505b604051636f96cda160e11b815260040160405180910390fd5b60408051600180825281830190925260609160009190602080830190803683370190505090508281600081518110612b9957612b99614906565b602090810291909101015292915050565b6000845111612bf15760405162461bcd60e51b8152602060048201526013602482015272746f6b656e4964735b5d20697320656d70747960681b6044820152606401610d92565b835160011480612c15575061ffff8616600090815260076020526040902054845111155b612c6c5760405162461bcd60e51b815260206004820152602260248201527f62617463682073697a65206578636565647320647374206261746368206c696d6044820152611a5d60f21b6064820152608401610d92565b60005b8451811015612caf57612c9d888888888581518110612c9057612c90614906565b60200260200101516134ba565b80612ca78161491c565b915050612c6f565b5060008585604051602001612cc59291906147f7565b6040516020818303038152906040529050612d0a876001848851600860008d61ffff1661ffff16815260200190815260200160002054612d059190614935565b6134c5565b612d188782868686346135a4565b85604051612d269190614954565b6040518091039020886001600160a01b03168861ffff167fe1b87c47fdeb4f9cbadbca9df3af7aba453bb6e501075d0440d88125b711522a88604051612d6c9190614970565b60405180910390a45050505050505050565b60008082806020019051810190612d9591906145f4565b601482015191935091506000612dad88838386612f25565b90508251811015612e815784516020808701919091206040805160808101825261ffff808d1682526001600160a01b0380881683870190815283850188815260016060860181815260008981526009909a529887902095518654935190941662010000026001600160b01b03199093169390941692909217178355519082015592516002909301805493151560ff199094169390931790925590517f10e0b70d256bccc84b7027506978bd8b68984a870788b93b479def144c839ad790612e779083908990614983565b60405180910390a1505b816001600160a01b031687604051612e999190614954565b60405180910390208961ffff167f5b821db8a46f8ecbe1941ba2f51cfeea9643268b56631f70d45e2a745d99026586604051612d6c9190614970565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000825b8251811015612991576006545a1061299157612f5f8686858481518110612f5257612f52614906565b6020026020010151613749565b80612f698161491c565b915050612f29565b606081612f7f81601f614701565b1015612fbe5760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b6044820152606401610d92565b612fc88284614701565b8451101561300c5760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b6044820152606401610d92565b60608215801561302b5760405191506000825260208201604052613075565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561306457805183526020928301920161304c565b5050858452601f01601f1916604052505b50949350505050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a02906130b390339089908890889060040161499c565b6020604051808303816000875af19250505080156130ee575060408051601f3d908101601f191682019092526130eb918101906149cf565b60015b61314c573d80801561311c576040519150601f19603f3d011682016040523d82523d6000602084013e613121565b606091505b508051600003613144576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506112b8565b600a54600082900361318b5760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b0383166000818152600f602090815260408083208054680100000000000000018802019055848352600e90915281206001851460e11b4260a01b178317905582840190839083907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4600183015b81811461323a57808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a4600101613202565b508160000361325b57604051622e076360e81b815260040160405180910390fd5b600a5550505050565b606060128054610fa890614501565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a90048061328d5750819003601f19909101908152919050565b6040516bffffffffffffffffffffffff19606085901b166020820152600090819060340160408051601f198184030181529190528051602090910120601354909150600090601490829060ff16600381111561331557613315614292565b600381111561332657613326614292565b815260208101919091526040016000205490508061334957600192505050611671565b6133898585808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508592508691506137829050565b9695505050505050565b6000606060008060008661ffff166001600160401b038111156133b8576133b8613b27565b6040519080825280601f01601f1916602001820160405280156133e2576020820181803683370190505b50905060008087516020890160008d8df191503d925086831115613404578692505b828152826000602083013e909890975095505050505050565b8180519060200120600560008761ffff1661ffff1681526020019081526020016000208560405161344e9190614954565b9081526040805191829003602090810183206001600160401b0388166000908152915220919091557fe183f33de2837795525b4792ca4cd60535bd77c53b7e7030060bfcf5734d6b0c906134ab90879087908790879087906149ec565b60405180910390a15050505050565b611b86843083611678565b60006134d083613798565b61ffff808716600090815260026020908152604080832093891683529290529081205491925090613502908490614701565b9050600081116135545760405162461bcd60e51b815260206004820152601a60248201527f4c7a4170703a206d696e4761734c696d6974206e6f74207365740000000000006044820152606401610d92565b808210156114515760405162461bcd60e51b815260206004820152601b60248201527f4c7a4170703a20676173206c696d697420697320746f6f206c6f7700000000006044820152606401610d92565b61ffff8616600090815260016020526040812080546135c290614501565b80601f01602080910402602001604051908101604052809291908181526020018280546135ee90614501565b801561363b5780601f106136105761010080835404028352916020019161363b565b820191906000526020600020905b81548152906001019060200180831161361e57829003601f168201915b5050505050905080516000036136ac5760405162461bcd60e51b815260206004820152603060248201527f4c7a4170703a2064657374696e6174696f6e20636861696e206973206e6f742060448201526f61207472757374656420736f7572636560801b6064820152608401610d92565b6136b78787516137f4565b60405162c5803160e81b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c580310090849061370e908b9086908c908c908c908c90600401614a3e565b6000604051808303818588803b15801561372757600080fd5b505af115801561373b573d6000803e3d6000fd5b505050505050505050505050565b61375281612abb565b801561376e57503061376382611778565b6001600160a01b0316145b61377757600080fd5b6115a6308383611678565b60008261378f8584613865565b14949350505050565b60006022825110156137ec5760405162461bcd60e51b815260206004820152601c60248201527f4c7a4170703a20696e76616c69642061646170746572506172616d73000000006044820152606401610d92565b506022015190565b61ffff82166000908152600360205260408120549081900361381557506127105b808211156115a65760405162461bcd60e51b815260206004820181905260248201527f4c7a4170703a207061796c6f61642073697a6520697320746f6f206c617267656044820152606401610d92565b600081815b84518110156138aa576138968286838151811061388957613889614906565b60200260200101516138b2565b9150806138a28161491c565b91505061386a565b509392505050565b60008183106138ce576000828152602084905260409020611671565b5060009182526020526040902090565b8280546138ea90614501565b90600052602060002090601f01602090048101928261390c5760008555613952565b82601f1061392557805160ff1916838001178555613952565b82800160010185558215613952579182015b82811115613952578251825591602001919060010190613937565b5061395e9291506139d6565b5090565b82805461396e90614501565b90600052602060002090601f0160209004810192826139905760008555613952565b82601f106139a95782800160ff19823516178555613952565b82800160010185558215613952579182015b828111156139525782358255916020019190600101906139bb565b5b8082111561395e57600081556001016139d7565b803561ffff811681146139fd57600080fd5b919050565b60008083601f840112613a1457600080fd5b5081356001600160401b03811115613a2b57600080fd5b602083019150836020828501011115613a4357600080fd5b9250929050565b80356001600160401b03811681146139fd57600080fd5b60008060008060008060808789031215613a7a57600080fd5b613a83876139eb565b955060208701356001600160401b0380821115613a9f57600080fd5b613aab8a838b01613a02565b9097509550859150613abf60408a01613a4a565b94506060890135915080821115613ad557600080fd5b50613ae289828a01613a02565b979a9699509497509295939492505050565b6001600160e01b0319811681146128e657600080fd5b600060208284031215613b1c57600080fd5b813561167181613af4565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715613b6557613b65613b27565b604052919050565b60006001600160401b03821115613b8657613b86613b27565b50601f01601f191660200190565b6000613ba7613ba284613b6d565b613b3d565b9050828152838383011115613bbb57600080fd5b828260208301376000602084830101529392505050565b600060208284031215613be457600080fd5b81356001600160401b03811115613bfa57600080fd5b8201601f81018413613c0b57600080fd5b6112b884823560208401613b94565b60005b83811015613c35578181015183820152602001613c1d565b83811115611b865750506000910152565b60008151808452613c5e816020860160208601613c1a565b601f01601f19169290920160200192915050565b6020815260006116716020830184613c46565b600060208284031215613c9757600080fd5b611671826139eb565b600060208284031215613cb257600080fd5b5035919050565b6001600160a01b03811681146128e657600080fd5b80356139fd81613cb9565b60008060408385031215613cec57600080fd5b8235613cf781613cb9565b946020939093013593505050565b60008060408385031215613d1857600080fd5b613cf7836139eb565b600082601f830112613d3257600080fd5b61167183833560208501613b94565b60008060008060808587031215613d5757600080fd5b8435613d6281613cb9565b93506020850135613d7281613cb9565b92506040850135915060608501356001600160401b03811115613d9457600080fd5b613da087828801613d21565b91505092959194509250565b600080600060608486031215613dc157600080fd5b8335613dcc81613cb9565b92506020840135613ddc81613cb9565b929592945050506040919091013590565b80151581146128e657600080fd5b600080600080600060a08688031215613e1357600080fd5b613e1c866139eb565b945060208601356001600160401b0380821115613e3857600080fd5b613e4489838a01613d21565b95506040880135945060608801359150613e5d82613ded565b90925060808701359080821115613e7357600080fd5b50613e8088828901613d21565b9150509295509295909350565b600080600060408486031215613ea257600080fd5b613eab846139eb565b925060208401356001600160401b03811115613ec657600080fd5b613ed286828701613a02565b9497909650939450505050565b600080600080600080600060e0888a031215613efa57600080fd5b8735613f0581613cb9565b9650613f13602089016139eb565b955060408801356001600160401b0380821115613f2f57600080fd5b613f3b8b838c01613d21565b965060608a0135955060808a01359150613f5482613cb9565b90935060a089013590613f6682613cb9565b90925060c08901359080821115613f7c57600080fd5b50613f898a828b01613d21565b91505092959891949750929550565b8035600481106139fd57600080fd5b6000808284036040811215613fbb57600080fd5b613fc484613f98565b92506020601f1982011215613fd857600080fd5b50604051602081018181106001600160401b0382111715613ffb57613ffb613b27565b6040526020939093013583525092909150565b60008060006060848603121561402357600080fd5b61402c846139eb565b925060208401356001600160401b0381111561404757600080fd5b61405386828701613d21565b92505061406260408501613a4a565b90509250925092565b60006020828403121561407d57600080fd5b813561167181613cb9565b6000806040838503121561409b57600080fd5b82356140a681613cb9565b91506140b460208401613f98565b90509250929050565b600080604083850312156140d057600080fd5b6140d9836139eb565b91506140b4602084016139eb565b6000602082840312156140f957600080fd5b81356001600160401b0381111561410f57600080fd5b6112b884828501613d21565b6000806040838503121561412e57600080fd5b823561413981613cb9565b9150602083013561414981613ded565b809150509250929050565b60006001600160401b0382111561416d5761416d613b27565b5060051b60200190565b600082601f83011261418857600080fd5b81356020614198613ba283614154565b82815260059290921b840181019181810190868411156141b757600080fd5b8286015b848110156141d257803583529183019183016141bb565b509695505050505050565b600080600080600080600060e0888a0312156141f857600080fd5b873561420381613cb9565b9650614211602089016139eb565b955060408801356001600160401b038082111561422d57600080fd5b6142398b838c01613d21565b965060608a013591508082111561424f57600080fd5b61425b8b838c01614177565b955060808a0135915061426d82613cb9565b81945061427c60a08b01613cce565b935060c08a0135915080821115613f7c57600080fd5b634e487b7160e01b600052602160045260246000fd5b60208101600483106142ca57634e487b7160e01b600052602160045260246000fd5b91905290565b6000602082840312156142e257600080fd5b61167182613f98565b60008060008060006080868803121561430357600080fd5b61430c866139eb565b945061431a602087016139eb565b93506040860135925060608601356001600160401b0381111561433c57600080fd5b61434888828901613a02565b969995985093965092949392505050565b6000806020838503121561436c57600080fd5b82356001600160401b038082111561438357600080fd5b818501915085601f83011261439757600080fd5b8135818111156143a657600080fd5b8660208260051b85010111156143bb57600080fd5b60209290920196919550909350505050565b6000806000606084860312156143e257600080fd5b6143eb846139eb565b92506143f9602085016139eb565b9150604084013590509250925092565b6000806040838503121561441c57600080fd5b823561442781613cb9565b9150602083013561414981613cb9565b600080600080600060a0868803121561444f57600080fd5b614458866139eb565b945060208601356001600160401b038082111561447457600080fd5b61448089838a01613d21565b9550604088013591508082111561449657600080fd5b6144a289838a01614177565b945060608801359150613e5d82613ded565b600080600080608085870312156144ca57600080fd5b6144d3856139eb565b93506144e1602086016139eb565b925060408501356144f181613cb9565b9396929550929360600135925050565b600181811c9082168061451557607f821691505b60208210810361453557634e487b7160e01b600052602260045260246000fd5b50919050565b8183823760009101908152919050565b60006020828403121561455d57600080fd5b815161167181613ded565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b61ffff84168152604060208201526000612991604083018486614568565b600082601f8301126145c057600080fd5b81516145ce613ba282613b6d565b8181528460208386010111156145e357600080fd5b6112b8826020830160208701613c1a565b6000806040838503121561460757600080fd5b82516001600160401b038082111561461e57600080fd5b61462a868387016145af565b935060209150818501518181111561464157600080fd5b85019050601f8101861361465457600080fd5b8051614662613ba282614154565b81815260059190911b8201830190838101908883111561468157600080fd5b928401925b8284101561469f57835182529284019290840190614686565b80955050505050509250929050565b634e487b7160e01b600052601160045260246000fd5b6000828210156146d6576146d66146ae565b500390565b8284823760609190911b6bffffffffffffffffffffffff19169101908152601401919050565b60008219821115614714576147146146ae565b500190565b6000835161472b818460208801613c1a565b83519083019061473f818360208801613c1a565b01949350505050565b600061ffff808816835280871660208401525084604083015260806060830152614776608083018486614568565b979650505050505050565b61ffff8616815260806020820152600061479f608083018688614568565b6001600160401b0394909416604083015250606001529392505050565b600081518084526020808501945080840160005b838110156147ec578151875295820195908201906001016147d0565b509495945050505050565b60408152600061480a6040830185613c46565b828103602084015261299181856147bc565b61ffff861681526001600160a01b038516602082015260a06040820181905260009061484a90830186613c46565b841515606084015282810360808401526148648185613c46565b98975050505050505050565b6000806040838503121561488357600080fd5b505080516020909101519092909150565b6000602082840312156148a657600080fd5b81516001600160401b038111156148bc57600080fd5b6112b8848285016145af565b61ffff851681526080602082015260006148e56080830186613c46565b6001600160401b038516604084015282810360608401526147768185613c46565b634e487b7160e01b600052603260045260246000fd5b60006001820161492e5761492e6146ae565b5060010190565b600081600019048311821515161561494f5761494f6146ae565b500290565b60008251614966818460208701613c1a565b9190910192915050565b60208152600061167160208301846147bc565b8281526040602082015260006112b86040830184613c46565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061338990830184613c46565b6000602082840312156149e157600080fd5b815161167181613af4565b61ffff8616815260a060208201526000614a0960a0830187613c46565b6001600160401b03861660408401528281036060840152614a2a8186613c46565b905082810360808401526148648185613c46565b61ffff8716815260c060208201526000614a5b60c0830188613c46565b8281036040840152614a6d8188613c46565b6001600160a01b0387811660608601528616608085015283810360a08501529050614a988185613c46565b999850505050505050505056fea26469706673582212206b57e81dd278bbbee0aab887ee725e52dbbd199ec15a1f4abff2b1d1a31a6f0864736f6c634300080d0033ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd67500000000000000000000000076905df68bad78bca25312b2a7619f9b43145262000000000000000000000000000000000000000000000000000000000000000a4d61666961204e7574730000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034e55540000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x6080604052600436106103d85760003560e01c80638cfd8f5c116101fd578063baf3292d11610118578063d12473a5116100ab578063eb8d72b71161007a578063eb8d72b714610c71578063f235364114610c91578063f2fde38b14610cb1578063f5ecbdbc14610cd1578063fa25f9b614610cf157600080fd5b8063d12473a514610bd5578063d1deba1f14610bf5578063df2a5b3b14610c08578063e985e9c514610c2857600080fd5b8063c6291db0116100e7578063c6291db014610b48578063c87b56dd14610b75578063cbed8b9c14610b95578063ce3151a914610bb557600080fd5b8063baf3292d14610ad2578063beb12c9d14610af2578063c03afb5914610b12578063c446183414610b3257600080fd5b80639f38369a11610190578063af3fb21c1161015f578063af3fb21c14610a3c578063b1c9fe6e14610a64578063b353aaa714610a8b578063b88d4fde14610abf57600080fd5b80639f38369a146109c9578063a22cb465146109e9578063a6c3d16514610a09578063ab3ffb9314610a2957600080fd5b8063958f1170116101cc578063958f11701461096a57806395d89b411461097f5780639dfbcde8146109945780639ea5d6b1146109a957600080fd5b80638cfd8f5c146108d45780638da5cb5b1461090c5780638ffa1f2a1461092a578063950c8a741461094a57600080fd5b80633319a00d116102f8578063519056361161028b57806366ad5c8a1161025a57806366ad5c8a1461082757806370a0823114610847578063715018a6146108675780637533d7881461087c57806375b992e21461089c57600080fd5b8063519056361461078557806355b48e18146107985780635b8c41e6146107b85780636352211e1461080757600080fd5b806342842e0e116102c757806342842e0e1461070f57806342d65a8d1461072257806348288190146107425780634ac3f4ff1461075857600080fd5b80633319a00d14610682578063361b4c58146106a25780633d8b38f6146106c25780633f1f4fa4146106e257600080fd5b80630df374831161037057806322a3ecf91161033f57806322a3ecf9146105a157806323b872dd146106245780632a205e3d1461063757806332cb6b0c1461066c57600080fd5b80630df374831461050157806310ddb13714610521578063150b7a021461054157806318160ddd1461057a57600080fd5b806307e0db17116103ac57806307e0db1714610476578063081812fc14610496578063095ea7b3146104ce5780630b4cad4c146104e157600080fd5b80621d3567146103dd57806301ffc9a7146103ff57806302fe53051461043457806306fdde0314610454575b600080fd5b3480156103e957600080fd5b506103fd6103f8366004613a61565b610d1e565b005b34801561040b57600080fd5b5061041f61041a366004613b0a565b610f4f565b60405190151581526020015b60405180910390f35b34801561044057600080fd5b506103fd61044f366004613bd2565b610f7a565b34801561046057600080fd5b50610469610f99565b60405161042b9190613c72565b34801561048257600080fd5b506103fd610491366004613c85565b61102b565b3480156104a257600080fd5b506104b66104b1366004613ca0565b6110b4565b6040516001600160a01b03909116815260200161042b565b6103fd6104dc366004613cd9565b6110f8565b3480156104ed57600080fd5b506103fd6104fc366004613ca0565b611198565b34801561050d57600080fd5b506103fd61051c366004613d05565b611238565b34801561052d57600080fd5b506103fd61053c366004613c85565b611257565b34801561054d57600080fd5b5061056161055c366004613d41565b6112af565b6040516001600160e01b0319909116815260200161042b565b34801561058657600080fd5b50600b54600a5403600019015b60405190815260200161042b565b3480156105ad57600080fd5b506105f56105bc366004613ca0565b60096020526000908152604090208054600182015460029092015461ffff821692620100009092046001600160a01b0316919060ff1684565b6040805161ffff90951685526001600160a01b039093166020850152918301521515606082015260800161042b565b6103fd610632366004613dac565b6112c0565b34801561064357600080fd5b50610657610652366004613dfb565b611459565b6040805192835260208301919091520161042b565b34801561067857600080fd5b506105936105dc81565b34801561068e57600080fd5b506103fd61069d366004613cd9565b61147f565b3480156106ae57600080fd5b506103fd6106bd366004613cd9565b61150c565b3480156106ce57600080fd5b5061041f6106dd366004613e8d565b6115ab565b3480156106ee57600080fd5b506105936106fd366004613c85565b60036020526000908152604090205481565b6103fd61071d366004613dac565b611678565b34801561072e57600080fd5b506103fd61073d366004613e8d565b611693565b34801561074e57600080fd5b5061059360065481565b34801561076457600080fd5b50610593610773366004613c85565b60076020526000908152604090205481565b6103fd610793366004613edf565b611719565b3480156107a457600080fd5b506103fd6107b3366004613fa7565b611730565b3480156107c457600080fd5b506105936107d336600461400e565b6005602090815260009384526040808520845180860184018051928152908401958401959095209452929052825290205481565b34801561081357600080fd5b506104b6610822366004613ca0565b611778565b34801561083357600080fd5b506103fd610842366004613a61565b611783565b34801561085357600080fd5b5061059361086236600461406b565b611857565b34801561087357600080fd5b506103fd6118a5565b34801561088857600080fd5b50610469610897366004613c85565b6118b9565b3480156108a857600080fd5b506105936108b7366004614088565b601560209081526000928352604080842090915290825290205481565b3480156108e057600080fd5b506105936108ef3660046140bd565b600260209081526000928352604080842090915290825290205481565b34801561091857600080fd5b506000546001600160a01b03166104b6565b34801561093657600080fd5b506103fd6109453660046140e7565b611953565b34801561095657600080fd5b506004546104b6906001600160a01b031681565b34801561097657600080fd5b5061059360e081565b34801561098b57600080fd5b50610469611b8c565b3480156109a057600080fd5b50610593611b9b565b3480156109b557600080fd5b506103fd6109c4366004613d05565b611bab565b3480156109d557600080fd5b506104696109e4366004613c85565b611c62565b3480156109f557600080fd5b506103fd610a0436600461411b565b611d71565b348015610a1557600080fd5b506103fd610a24366004613e8d565b611ddd565b6103fd610a373660046141dd565b611e70565b348015610a4857600080fd5b50610a51600181565b60405161ffff909116815260200161042b565b348015610a7057600080fd5b50601354610a7e9060ff1681565b60405161042b91906142a8565b348015610a9757600080fd5b506104b67f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd67581565b6103fd610acd366004613d41565b611e7f565b348015610ade57600080fd5b506103fd610aed36600461406b565b611ec3565b348015610afe57600080fd5b506103fd610b0d36600461406b565b611f19565b348015610b1e57600080fd5b506103fd610b2d3660046142d0565b611fd2565b348015610b3e57600080fd5b5061059361271081565b348015610b5457600080fd5b50610593610b633660046142d0565b60146020526000908152604090205481565b348015610b8157600080fd5b50610469610b90366004613ca0565b61203c565b348015610ba157600080fd5b506103fd610bb03660046142eb565b6120bf565b348015610bc157600080fd5b506103fd610bd0366004614359565b612154565b348015610be157600080fd5b506103fd610bf0366004613d05565b6123d3565b6103fd610c03366004613a61565b612483565b348015610c1457600080fd5b506103fd610c233660046143cd565b612699565b348015610c3457600080fd5b5061041f610c43366004614409565b6001600160a01b03918216600090815260116020908152604080832093909416825291909152205460ff1690565b348015610c7d57600080fd5b506103fd610c8c366004613e8d565b61274b565b348015610c9d57600080fd5b50610657610cac366004614437565b6127a5565b348015610cbd57600080fd5b506103fd610ccc36600461406b565b612870565b348015610cdd57600080fd5b50610469610cec3660046144b4565b6128e9565b348015610cfd57600080fd5b50610593610d0c366004613c85565b60086020526000908152604090205481565b337f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd6756001600160a01b031614610d9b5760405162461bcd60e51b815260206004820152601e60248201527f4c7a4170703a20696e76616c696420656e64706f696e742063616c6c6572000060448201526064015b60405180910390fd5b61ffff861660009081526001602052604081208054610db990614501565b80601f0160208091040260200160405190810160405280929190818152602001828054610de590614501565b8015610e325780601f10610e0757610100808354040283529160200191610e32565b820191906000526020600020905b815481529060010190602001808311610e1557829003601f168201915b50505050509050805186869050148015610e4d575060008151115b8015610e75575080516020820120604051610e6b908890889061453b565b6040518091039020145b610ed05760405162461bcd60e51b815260206004820152602660248201527f4c7a4170703a20696e76616c696420736f757263652073656e64696e6720636f6044820152651b9d1c9858dd60d21b6064820152608401610d92565b610f468787878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8a018190048102820181019092528881528a93509150889088908190840183828082843760009201919091525061299a92505050565b50505050505050565b60006001600160e01b031982166322bac5d960e01b1480610f745750610f7482612a13565b92915050565b610f82612a61565b8051610f959060129060208401906138de565b5050565b6060600c8054610fa890614501565b80601f0160208091040260200160405190810160405280929190818152602001828054610fd490614501565b80156110215780601f10610ff657610100808354040283529160200191611021565b820191906000526020600020905b81548152906001019060200180831161100457829003601f168201915b5050505050905090565b611033612a61565b6040516307e0db1760e01b815261ffff821660048201527f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd6756001600160a01b0316906307e0db17906024015b600060405180830381600087803b15801561109957600080fd5b505af11580156110ad573d6000803e3d6000fd5b5050505050565b60006110bf82612abb565b6110dc576040516333d1c03960e21b815260040160405180910390fd5b506000908152601060205260409020546001600160a01b031690565b600061110382611778565b9050336001600160a01b0382161461113c5761111f8133610c43565b61113c576040516367d9dca160e11b815260040160405180910390fd5b60008281526010602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6111a0612a61565b600081116111fc5760405162461bcd60e51b8152602060048201526024808201527f6d696e476173546f5472616e73666572416e6453746f7265206d7573742062656044820152630203e20360e41b6064820152608401610d92565b60068190556040518181527ffebbc4f8bb9ec2313950c718d43123124b15778efda4c1f1d529de2995b4f34d906020015b60405180910390a150565b611240612a61565b61ffff909116600090815260036020526040902055565b61125f612a61565b6040516310ddb13760e01b815261ffff821660048201527f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd6756001600160a01b0316906310ddb1379060240161107f565b630a85bd0160e11b5b949350505050565b60006112cb82612af0565b9050836001600160a01b0316816001600160a01b0316146112fe5760405162a1148160e81b815260040160405180910390fd5b60008281526010602052604090208054338082146001600160a01b0388169091141761134b5761132e8633610c43565b61134b57604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b03851661137257604051633a954ecd60e21b815260040160405180910390fd5b801561137d57600082555b6001600160a01b038681166000908152600f60205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b176000858152600e6020526040812091909155600160e11b8416900361140f57600184016000818152600e6020526040812054900361140d57600a54811461140d576000818152600e602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b505050505050565b600080611471878761146a88612b5f565b87876127a5565b915091509550959350505050565b611487612a61565b816001600160a01b03166323b872dd306114a96000546001600160a01b031690565b6040516001600160e01b031960e085901b1681526001600160a01b0392831660048201529116602482015260448101849052606401600060405180830381600087803b1580156114f857600080fd5b505af1158015611451573d6000803e3d6000fd5b611514612a61565b816001600160a01b031663a9059cbb6115356000546001600160a01b031690565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018490526044016020604051808303816000875af1158015611582573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115a6919061454b565b505050565b61ffff8316600090815260016020526040812080548291906115cc90614501565b80601f01602080910402602001604051908101604052809291908181526020018280546115f890614501565b80156116455780601f1061161a57610100808354040283529160200191611645565b820191906000526020600020905b81548152906001019060200180831161162857829003601f168201915b50505050509050838360405161165c92919061453b565b60405180910390208180519060200120149150505b9392505050565b6115a683838360405180602001604052806000815250611e7f565b61169b612a61565b6040516342d65a8d60e01b81526001600160a01b037f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd67516906342d65a8d906116eb90869086908690600401614591565b600060405180830381600087803b15801561170557600080fd5b505af1158015610f46573d6000803e3d6000fd5b610f4687878761172888612b5f565b878787612baa565b611738612a61565b806014600084600381111561174f5761174f614292565b600381111561176057611760614292565b81526020810191909152604001600020905190555050565b6000610f7482612af0565b3330146117e15760405162461bcd60e51b815260206004820152602660248201527f4e6f6e626c6f636b696e674c7a4170703a2063616c6c6572206d7573742062656044820152650204c7a4170760d41b6064820152608401610d92565b6114518686868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f890181900481028201810190925287815289935091508790879081908401838280828437600092019190915250612d7e92505050565b60006001600160a01b038216611880576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600f60205260409020546001600160401b031690565b6118ad612a61565b6118b76000612ed5565b565b600160205260009081526040902080546118d290614501565b80601f01602080910402602001604051908101604052809291908181526020018280546118fe90614501565b801561194b5780601f106119205761010080835404028352916020019161194b565b820191906000526020600020905b81548152906001019060200180831161192e57829003601f168201915b505050505081565b80516020808301919091206000818152600990925260409091206002015460ff166119b45760405162461bcd60e51b81526020600482015260116024820152701b9bc818dc99591a5d1cc81cdd1bdc9959607a1b6044820152606401610d92565b6000828060200190518101906119ca91906145f4565b60008481526009602052604081208054600190910154929450909250611a069161ffff8216916201000090046001600160a01b03169085612f25565b6000848152600960205260409020600101549091508111611a7b5760405162461bcd60e51b815260206004820152602960248201527f6e6f7420656e6f7567682067617320746f2070726f6365737320637265646974604482015268103a3930b739b332b960b91b6064820152608401610d92565b81518103611af25760008381526009602052604080822080546001600160b01b031916815560018101929092556002909101805460ff19169055517fd7be02b8dd0d27bd0517a9cb4d7469ce27df4313821ae5ec1ff69acc594ba23390611ae59085815260200190565b60405180910390a1611b86565b60408051608081018252600085815260096020818152848320805461ffff80821687526001600160a01b03620100008084048216868a019081529989018b8152600160608b01818152998f90529790965297519851169096026001600160b01b03199091169690951695909517939093178455915191830191909155516002909101805491151560ff199092169190911790555b50505050565b6060600d8054610fa890614501565b611ba860e06105dc6146c4565b81565b611bb3612a61565b60008111611c0e5760405162461bcd60e51b815260206004820152602260248201527f647374436861696e4964546f42617463684c696d6974206d757374206265203e604482015261020360f41b6064820152608401610d92565b61ffff8216600081815260076020908152604091829020849055815192835282018390527f7315f7654d594ead24a30160ed9ba2d23247f543016b918343591e93d7afdb6d91015b60405180910390a15050565b61ffff8116600090815260016020526040812080546060929190611c8590614501565b80601f0160208091040260200160405190810160405280929190818152602001828054611cb190614501565b8015611cfe5780601f10611cd357610100808354040283529160200191611cfe565b820191906000526020600020905b815481529060010190602001808311611ce157829003601f168201915b505050505090508051600003611d565760405162461bcd60e51b815260206004820152601d60248201527f4c7a4170703a206e6f20747275737465642070617468207265636f72640000006044820152606401610d92565b611671600060148351611d6991906146c4565b839190612f71565b3360008181526011602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b611de5612a61565b818130604051602001611dfa939291906146db565b60408051601f1981840301815291815261ffff85166000908152600160209081529190208251611e2f939192909101906138de565b507f8c0400cfe2d1199b1a725c78960bcc2a344d869b80590d0f2bd005db15a572ce838383604051611e6393929190614591565b60405180910390a1505050565b610f4687878787878787612baa565b611e8a8484846112c0565b6001600160a01b0383163b15611b8657611ea68484848461307e565b611b86576040516368d2bf6b60e11b815260040160405180910390fd5b611ecb612a61565b600480546001600160a01b0319166001600160a01b0383169081179091556040519081527f5db758e995a17ec1ad84bdef7e8c3293a0bd6179bcce400dff5d4c3d87db726b9060200161122d565b611f21612a61565b600b54600a540360001901611f3960e06105dc6146c4565b8110158015611f4957506105dc81105b611f845760405162461bcd60e51b815260206004820152600c60248201526b189858dac81d1bc81a985a5b60a21b6044820152606401610d92565b611f8f826001613166565b611f9a816001614701565b6040516001600160a01b038416907f14ef1f17ccb0641bfc2ad74a52e62f06378248e6e01e392d2b5a8674afd33b6190600090a35050565b611fda612a61565b6013805482919060ff19166001836003811115611ff957611ff9614292565b021790555080600381111561201057612010614292565b6040517fed606d544c2202d032d2626c390923e6f260ca5d89625bba0cfe70d2bdda4e8f90600090a250565b606061204782612abb565b61206457604051630a14c4b560e41b815260040160405180910390fd5b600061206e613264565b9050805160000361208e5760405180602001604052806000815250611671565b8061209884613273565b6040516020016120a9929190614719565b6040516020818303038152906040529392505050565b6120c7612a61565b6040516332fb62e760e21b81526001600160a01b037f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd675169063cbed8b9c9061211b9088908890889088908890600401614748565b600060405180830381600087803b15801561213557600080fd5b505af1158015612149573d6000803e3d6000fd5b505050505050505050565b600b54600a54339160009103600019019050600060135460ff16600381111561217f5761217f614292565b036121b65760405162461bcd60e51b81526020600482015260076024820152662161637469766560c81b6044820152606401610d92565b6121c18285856132b7565b6121f35760405162461bcd60e51b8152602060048201526003602482015262085ddb60ea1b6044820152606401610d92565b61220060e06105dc6146c4565b811061223e5760405162461bcd60e51b815260206004820152600d60248201526c3e206d696e7420737570706c7960981b6044820152606401610d92565b6001600160a01b038216321461227f5760405162461bcd60e51b8152600401610d929060208082526004908201526308589bdd60e21b604082015260600190565b6001600160a01b0382166000908152601560205260408120601354829060ff1660038111156122b0576122b0614292565b60038111156122c1576122c1614292565b81526020019081526020016000205490508060001461230c5760405162461bcd60e51b815260206004820152600760248201526606e7574206361760cc1b6044820152606401610d92565b612317836001613166565b612322816001614701565b6001600160a01b038416600090815260156020526040812060135490919060ff16600381111561235457612354614292565b600381111561236557612365614292565b815260208101919091526040016000205560135460ff16600381111561238d5761238d614292565b612398836001614701565b6040516001600160a01b038616907fda38589bd55f26501f10abeade560e06b0ccc88f007f2811d1288ea9725c342190600090a45050505050565b6123db612a61565b600081116124375760405162461bcd60e51b815260206004820152602360248201527f647374436861696e4964546f5472616e73666572476173206d7573742062652060448201526203e20360ec1b6064820152608401610d92565b61ffff8216600081815260086020908152604091829020849055815192835282018390527fc46df2983228ac2d9754e94a0d565e6671665dc8ad38602bc8e544f0685a29fb9101611c56565b61ffff861660009081526005602052604080822090516124a6908890889061453b565b90815260408051602092819003830190206001600160401b038716600090815292529020549050806125265760405162461bcd60e51b815260206004820152602360248201527f4e6f6e626c6f636b696e674c7a4170703a206e6f2073746f726564206d65737360448201526261676560e81b6064820152608401610d92565b80838360405161253792919061453b565b6040518091039020146125965760405162461bcd60e51b815260206004820152602160248201527f4e6f6e626c6f636b696e674c7a4170703a20696e76616c6964207061796c6f616044820152601960fa1b6064820152608401610d92565b61ffff871660009081526005602052604080822090516125b9908990899061453b565b90815260408051602092819003830181206001600160401b038916600090815290845282902093909355601f88018290048202830182019052868252612651918991899089908190840183828082843760009201919091525050604080516020601f8a018190048102820181019092528881528a935091508890889081908401838280828437600092019190915250612d7e92505050565b7fc264d91f3adc5588250e1551f547752ca0cfa8f6b530d243b9f9f4cab10ea8e58787878785604051612688959493929190614781565b60405180910390a150505050505050565b6126a1612a61565b600081116126e95760405162461bcd60e51b81526020600482015260156024820152744c7a4170703a20696e76616c6964206d696e47617360581b6044820152606401610d92565b61ffff83811660008181526002602090815260408083209487168084529482529182902085905581519283528201929092529081018290527f9d5c7c0b934da8fefa9c7760c98383778a12dfbfc0c3b3106518f43fb9508ac090606001611e63565b612753612a61565b61ffff83166000908152600160205260409020612771908383613962565b507ffa41487ad5d6728f0b19276fa1eddc16558578f5109fc39d2dc33c3230470dab838383604051611e6393929190614591565b600080600086866040516020016127bd9291906147f7565b60408051601f198184030181529082905263040a7bb160e41b825291506001600160a01b037f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd67516906340a7bb1090612821908b90309086908b908b9060040161481c565b6040805180830381865afa15801561283d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128619190614870565b92509250509550959350505050565b612878612a61565b6001600160a01b0381166128dd5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610d92565b6128e681612ed5565b50565b604051633d7b2f6f60e21b815261ffff808616600483015284166024820152306044820152606481018290526060907f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd6756001600160a01b03169063f5ecbdbc90608401600060405180830381865afa158015612969573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526129919190810190614894565b95945050505050565b6000806129fd5a60966366ad5c8a60e01b898989896040516024016129c294939291906148c8565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915230929190613393565b915091508161145157611451868686868561341d565b60006301ffc9a760e01b6001600160e01b031983161480612a4457506380ac58cd60e01b6001600160e01b03198316145b80610f745750506001600160e01b031916635b5e139f60e01b1490565b6000546001600160a01b031633146118b75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610d92565b600081600111158015612acf5750600a5482105b8015610f745750506000908152600e6020526040902054600160e01b161590565b60008180600111612b4657600a54811015612b46576000818152600e602052604081205490600160e01b82169003612b44575b806000036116715750600019016000818152600e6020526040902054612b23565b505b604051636f96cda160e11b815260040160405180910390fd5b60408051600180825281830190925260609160009190602080830190803683370190505090508281600081518110612b9957612b99614906565b602090810291909101015292915050565b6000845111612bf15760405162461bcd60e51b8152602060048201526013602482015272746f6b656e4964735b5d20697320656d70747960681b6044820152606401610d92565b835160011480612c15575061ffff8616600090815260076020526040902054845111155b612c6c5760405162461bcd60e51b815260206004820152602260248201527f62617463682073697a65206578636565647320647374206261746368206c696d6044820152611a5d60f21b6064820152608401610d92565b60005b8451811015612caf57612c9d888888888581518110612c9057612c90614906565b60200260200101516134ba565b80612ca78161491c565b915050612c6f565b5060008585604051602001612cc59291906147f7565b6040516020818303038152906040529050612d0a876001848851600860008d61ffff1661ffff16815260200190815260200160002054612d059190614935565b6134c5565b612d188782868686346135a4565b85604051612d269190614954565b6040518091039020886001600160a01b03168861ffff167fe1b87c47fdeb4f9cbadbca9df3af7aba453bb6e501075d0440d88125b711522a88604051612d6c9190614970565b60405180910390a45050505050505050565b60008082806020019051810190612d9591906145f4565b601482015191935091506000612dad88838386612f25565b90508251811015612e815784516020808701919091206040805160808101825261ffff808d1682526001600160a01b0380881683870190815283850188815260016060860181815260008981526009909a529887902095518654935190941662010000026001600160b01b03199093169390941692909217178355519082015592516002909301805493151560ff199094169390931790925590517f10e0b70d256bccc84b7027506978bd8b68984a870788b93b479def144c839ad790612e779083908990614983565b60405180910390a1505b816001600160a01b031687604051612e999190614954565b60405180910390208961ffff167f5b821db8a46f8ecbe1941ba2f51cfeea9643268b56631f70d45e2a745d99026586604051612d6c9190614970565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000825b8251811015612991576006545a1061299157612f5f8686858481518110612f5257612f52614906565b6020026020010151613749565b80612f698161491c565b915050612f29565b606081612f7f81601f614701565b1015612fbe5760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b6044820152606401610d92565b612fc88284614701565b8451101561300c5760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b6044820152606401610d92565b60608215801561302b5760405191506000825260208201604052613075565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561306457805183526020928301920161304c565b5050858452601f01601f1916604052505b50949350505050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a02906130b390339089908890889060040161499c565b6020604051808303816000875af19250505080156130ee575060408051601f3d908101601f191682019092526130eb918101906149cf565b60015b61314c573d80801561311c576040519150601f19603f3d011682016040523d82523d6000602084013e613121565b606091505b508051600003613144576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506112b8565b600a54600082900361318b5760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b0383166000818152600f602090815260408083208054680100000000000000018802019055848352600e90915281206001851460e11b4260a01b178317905582840190839083907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4600183015b81811461323a57808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a4600101613202565b508160000361325b57604051622e076360e81b815260040160405180910390fd5b600a5550505050565b606060128054610fa890614501565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a90048061328d5750819003601f19909101908152919050565b6040516bffffffffffffffffffffffff19606085901b166020820152600090819060340160408051601f198184030181529190528051602090910120601354909150600090601490829060ff16600381111561331557613315614292565b600381111561332657613326614292565b815260208101919091526040016000205490508061334957600192505050611671565b6133898585808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508592508691506137829050565b9695505050505050565b6000606060008060008661ffff166001600160401b038111156133b8576133b8613b27565b6040519080825280601f01601f1916602001820160405280156133e2576020820181803683370190505b50905060008087516020890160008d8df191503d925086831115613404578692505b828152826000602083013e909890975095505050505050565b8180519060200120600560008761ffff1661ffff1681526020019081526020016000208560405161344e9190614954565b9081526040805191829003602090810183206001600160401b0388166000908152915220919091557fe183f33de2837795525b4792ca4cd60535bd77c53b7e7030060bfcf5734d6b0c906134ab90879087908790879087906149ec565b60405180910390a15050505050565b611b86843083611678565b60006134d083613798565b61ffff808716600090815260026020908152604080832093891683529290529081205491925090613502908490614701565b9050600081116135545760405162461bcd60e51b815260206004820152601a60248201527f4c7a4170703a206d696e4761734c696d6974206e6f74207365740000000000006044820152606401610d92565b808210156114515760405162461bcd60e51b815260206004820152601b60248201527f4c7a4170703a20676173206c696d697420697320746f6f206c6f7700000000006044820152606401610d92565b61ffff8616600090815260016020526040812080546135c290614501565b80601f01602080910402602001604051908101604052809291908181526020018280546135ee90614501565b801561363b5780601f106136105761010080835404028352916020019161363b565b820191906000526020600020905b81548152906001019060200180831161361e57829003601f168201915b5050505050905080516000036136ac5760405162461bcd60e51b815260206004820152603060248201527f4c7a4170703a2064657374696e6174696f6e20636861696e206973206e6f742060448201526f61207472757374656420736f7572636560801b6064820152608401610d92565b6136b78787516137f4565b60405162c5803160e81b81526001600160a01b037f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd675169063c580310090849061370e908b9086908c908c908c908c90600401614a3e565b6000604051808303818588803b15801561372757600080fd5b505af115801561373b573d6000803e3d6000fd5b505050505050505050505050565b61375281612abb565b801561376e57503061376382611778565b6001600160a01b0316145b61377757600080fd5b6115a6308383611678565b60008261378f8584613865565b14949350505050565b60006022825110156137ec5760405162461bcd60e51b815260206004820152601c60248201527f4c7a4170703a20696e76616c69642061646170746572506172616d73000000006044820152606401610d92565b506022015190565b61ffff82166000908152600360205260408120549081900361381557506127105b808211156115a65760405162461bcd60e51b815260206004820181905260248201527f4c7a4170703a207061796c6f61642073697a6520697320746f6f206c617267656044820152606401610d92565b600081815b84518110156138aa576138968286838151811061388957613889614906565b60200260200101516138b2565b9150806138a28161491c565b91505061386a565b509392505050565b60008183106138ce576000828152602084905260409020611671565b5060009182526020526040902090565b8280546138ea90614501565b90600052602060002090601f01602090048101928261390c5760008555613952565b82601f1061392557805160ff1916838001178555613952565b82800160010185558215613952579182015b82811115613952578251825591602001919060010190613937565b5061395e9291506139d6565b5090565b82805461396e90614501565b90600052602060002090601f0160209004810192826139905760008555613952565b82601f106139a95782800160ff19823516178555613952565b82800160010185558215613952579182015b828111156139525782358255916020019190600101906139bb565b5b8082111561395e57600081556001016139d7565b803561ffff811681146139fd57600080fd5b919050565b60008083601f840112613a1457600080fd5b5081356001600160401b03811115613a2b57600080fd5b602083019150836020828501011115613a4357600080fd5b9250929050565b80356001600160401b03811681146139fd57600080fd5b60008060008060008060808789031215613a7a57600080fd5b613a83876139eb565b955060208701356001600160401b0380821115613a9f57600080fd5b613aab8a838b01613a02565b9097509550859150613abf60408a01613a4a565b94506060890135915080821115613ad557600080fd5b50613ae289828a01613a02565b979a9699509497509295939492505050565b6001600160e01b0319811681146128e657600080fd5b600060208284031215613b1c57600080fd5b813561167181613af4565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715613b6557613b65613b27565b604052919050565b60006001600160401b03821115613b8657613b86613b27565b50601f01601f191660200190565b6000613ba7613ba284613b6d565b613b3d565b9050828152838383011115613bbb57600080fd5b828260208301376000602084830101529392505050565b600060208284031215613be457600080fd5b81356001600160401b03811115613bfa57600080fd5b8201601f81018413613c0b57600080fd5b6112b884823560208401613b94565b60005b83811015613c35578181015183820152602001613c1d565b83811115611b865750506000910152565b60008151808452613c5e816020860160208601613c1a565b601f01601f19169290920160200192915050565b6020815260006116716020830184613c46565b600060208284031215613c9757600080fd5b611671826139eb565b600060208284031215613cb257600080fd5b5035919050565b6001600160a01b03811681146128e657600080fd5b80356139fd81613cb9565b60008060408385031215613cec57600080fd5b8235613cf781613cb9565b946020939093013593505050565b60008060408385031215613d1857600080fd5b613cf7836139eb565b600082601f830112613d3257600080fd5b61167183833560208501613b94565b60008060008060808587031215613d5757600080fd5b8435613d6281613cb9565b93506020850135613d7281613cb9565b92506040850135915060608501356001600160401b03811115613d9457600080fd5b613da087828801613d21565b91505092959194509250565b600080600060608486031215613dc157600080fd5b8335613dcc81613cb9565b92506020840135613ddc81613cb9565b929592945050506040919091013590565b80151581146128e657600080fd5b600080600080600060a08688031215613e1357600080fd5b613e1c866139eb565b945060208601356001600160401b0380821115613e3857600080fd5b613e4489838a01613d21565b95506040880135945060608801359150613e5d82613ded565b90925060808701359080821115613e7357600080fd5b50613e8088828901613d21565b9150509295509295909350565b600080600060408486031215613ea257600080fd5b613eab846139eb565b925060208401356001600160401b03811115613ec657600080fd5b613ed286828701613a02565b9497909650939450505050565b600080600080600080600060e0888a031215613efa57600080fd5b8735613f0581613cb9565b9650613f13602089016139eb565b955060408801356001600160401b0380821115613f2f57600080fd5b613f3b8b838c01613d21565b965060608a0135955060808a01359150613f5482613cb9565b90935060a089013590613f6682613cb9565b90925060c08901359080821115613f7c57600080fd5b50613f898a828b01613d21565b91505092959891949750929550565b8035600481106139fd57600080fd5b6000808284036040811215613fbb57600080fd5b613fc484613f98565b92506020601f1982011215613fd857600080fd5b50604051602081018181106001600160401b0382111715613ffb57613ffb613b27565b6040526020939093013583525092909150565b60008060006060848603121561402357600080fd5b61402c846139eb565b925060208401356001600160401b0381111561404757600080fd5b61405386828701613d21565b92505061406260408501613a4a565b90509250925092565b60006020828403121561407d57600080fd5b813561167181613cb9565b6000806040838503121561409b57600080fd5b82356140a681613cb9565b91506140b460208401613f98565b90509250929050565b600080604083850312156140d057600080fd5b6140d9836139eb565b91506140b4602084016139eb565b6000602082840312156140f957600080fd5b81356001600160401b0381111561410f57600080fd5b6112b884828501613d21565b6000806040838503121561412e57600080fd5b823561413981613cb9565b9150602083013561414981613ded565b809150509250929050565b60006001600160401b0382111561416d5761416d613b27565b5060051b60200190565b600082601f83011261418857600080fd5b81356020614198613ba283614154565b82815260059290921b840181019181810190868411156141b757600080fd5b8286015b848110156141d257803583529183019183016141bb565b509695505050505050565b600080600080600080600060e0888a0312156141f857600080fd5b873561420381613cb9565b9650614211602089016139eb565b955060408801356001600160401b038082111561422d57600080fd5b6142398b838c01613d21565b965060608a013591508082111561424f57600080fd5b61425b8b838c01614177565b955060808a0135915061426d82613cb9565b81945061427c60a08b01613cce565b935060c08a0135915080821115613f7c57600080fd5b634e487b7160e01b600052602160045260246000fd5b60208101600483106142ca57634e487b7160e01b600052602160045260246000fd5b91905290565b6000602082840312156142e257600080fd5b61167182613f98565b60008060008060006080868803121561430357600080fd5b61430c866139eb565b945061431a602087016139eb565b93506040860135925060608601356001600160401b0381111561433c57600080fd5b61434888828901613a02565b969995985093965092949392505050565b6000806020838503121561436c57600080fd5b82356001600160401b038082111561438357600080fd5b818501915085601f83011261439757600080fd5b8135818111156143a657600080fd5b8660208260051b85010111156143bb57600080fd5b60209290920196919550909350505050565b6000806000606084860312156143e257600080fd5b6143eb846139eb565b92506143f9602085016139eb565b9150604084013590509250925092565b6000806040838503121561441c57600080fd5b823561442781613cb9565b9150602083013561414981613cb9565b600080600080600060a0868803121561444f57600080fd5b614458866139eb565b945060208601356001600160401b038082111561447457600080fd5b61448089838a01613d21565b9550604088013591508082111561449657600080fd5b6144a289838a01614177565b945060608801359150613e5d82613ded565b600080600080608085870312156144ca57600080fd5b6144d3856139eb565b93506144e1602086016139eb565b925060408501356144f181613cb9565b9396929550929360600135925050565b600181811c9082168061451557607f821691505b60208210810361453557634e487b7160e01b600052602260045260246000fd5b50919050565b8183823760009101908152919050565b60006020828403121561455d57600080fd5b815161167181613ded565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b61ffff84168152604060208201526000612991604083018486614568565b600082601f8301126145c057600080fd5b81516145ce613ba282613b6d565b8181528460208386010111156145e357600080fd5b6112b8826020830160208701613c1a565b6000806040838503121561460757600080fd5b82516001600160401b038082111561461e57600080fd5b61462a868387016145af565b935060209150818501518181111561464157600080fd5b85019050601f8101861361465457600080fd5b8051614662613ba282614154565b81815260059190911b8201830190838101908883111561468157600080fd5b928401925b8284101561469f57835182529284019290840190614686565b80955050505050509250929050565b634e487b7160e01b600052601160045260246000fd5b6000828210156146d6576146d66146ae565b500390565b8284823760609190911b6bffffffffffffffffffffffff19169101908152601401919050565b60008219821115614714576147146146ae565b500190565b6000835161472b818460208801613c1a565b83519083019061473f818360208801613c1a565b01949350505050565b600061ffff808816835280871660208401525084604083015260806060830152614776608083018486614568565b979650505050505050565b61ffff8616815260806020820152600061479f608083018688614568565b6001600160401b0394909416604083015250606001529392505050565b600081518084526020808501945080840160005b838110156147ec578151875295820195908201906001016147d0565b509495945050505050565b60408152600061480a6040830185613c46565b828103602084015261299181856147bc565b61ffff861681526001600160a01b038516602082015260a06040820181905260009061484a90830186613c46565b841515606084015282810360808401526148648185613c46565b98975050505050505050565b6000806040838503121561488357600080fd5b505080516020909101519092909150565b6000602082840312156148a657600080fd5b81516001600160401b038111156148bc57600080fd5b6112b8848285016145af565b61ffff851681526080602082015260006148e56080830186613c46565b6001600160401b038516604084015282810360608401526147768185613c46565b634e487b7160e01b600052603260045260246000fd5b60006001820161492e5761492e6146ae565b5060010190565b600081600019048311821515161561494f5761494f6146ae565b500290565b60008251614966818460208701613c1a565b9190910192915050565b60208152600061167160208301846147bc565b8281526040602082015260006112b86040830184613c46565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061338990830184613c46565b6000602082840312156149e157600080fd5b815161167181613af4565b61ffff8616815260a060208201526000614a0960a0830187613c46565b6001600160401b03861660408401528281036060840152614a2a8186613c46565b905082810360808401526148648185613c46565b61ffff8716815260c060208201526000614a5b60c0830188613c46565b8281036040840152614a6d8188613c46565b6001600160a01b0387811660608601528616608085015283810360a08501529050614a988185613c46565b999850505050505050505056fea26469706673582212206b57e81dd278bbbee0aab887ee725e52dbbd199ec15a1f4abff2b1d1a31a6f0864736f6c634300080d0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd67500000000000000000000000076905df68bad78bca25312b2a7619f9b43145262000000000000000000000000000000000000000000000000000000000000000a4d61666961204e7574730000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034e55540000000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _name (string): Mafia Nuts
Arg [1] : _symbol (string): NUT
Arg [2] : _minGasToTransfer (uint256): 1
Arg [3] : _lzEndpoint (address): 0x66A71Dcef29A0fFBDBE3c6a460a3B5BC225Cd675
Arg [4] : _team (address): 0x76905DF68bAD78BcA25312B2a7619F9b43145262
-----Encoded View---------------
9 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000e0
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [3] : 00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd675
Arg [4] : 00000000000000000000000076905df68bad78bca25312b2a7619f9b43145262
Arg [5] : 000000000000000000000000000000000000000000000000000000000000000a
Arg [6] : 4d61666961204e75747300000000000000000000000000000000000000000000
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [8] : 4e55540000000000000000000000000000000000000000000000000000000000
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.