NFT
Pass
Overview
TokenID
5393
Total Transfers
-
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract
Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
PREMINTCollector
Compiler Version
v0.8.11+commit.d7f03943
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.10 <0.9.0; import "@divergencetech/ethier/contracts/crypto/SignatureChecker.sol"; import "@divergencetech/ethier/contracts/crypto/SignerManager.sol"; import "@divergencetech/ethier/contracts/erc721/BaseTokenURI.sol"; import "@divergencetech/ethier/contracts/erc721/ERC721CommonAutoIncrement.sol"; import "@divergencetech/ethier/contracts/sales/ArbitraryPriceSeller.sol"; import "@divergencetech/ethier/contracts/utils/Monotonic.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import "@openzeppelin/contracts/token/common/ERC2981.sol"; contract PREMINTCollector is ERC721CommonAutoIncrement, BaseTokenURI, ArbitraryPriceSeller, SignerManager, ERC2981 { using EnumerableSet for EnumerableSet.AddressSet; using Monotonic for Monotonic.Increaser; using SignatureChecker for EnumerableSet.AddressSet; constructor(address payable beneficiary, address royaltyReceiver) ERC721CommonAutoIncrement("PREMINT Collector", "PREMINTCOLL") BaseTokenURI("") ArbitraryPriceSeller( Seller.SellerConfig({ totalInventory: 10000, lockTotalInventory: false, maxPerAddress: 10, maxPerTx: 0, freeQuota: 930, lockFreeQuota: false, reserveFreeQuota: true }), beneficiary ) { _setDefaultRoyalty(royaltyReceiver, 750); } /** @dev Mint tokens purchased via the Seller. */ function _handlePurchase( address to, uint256 n, bool ) internal override { _safeMintN(to, n); } /** @dev Record of already-used signatures. */ mapping(bytes32 => bool) public usedMessages; /** @notice Mint as an address on one of the early-access lists. */ function mint( address to, uint256 price, bytes32 nonce, bytes calldata sig ) external payable { signers.requireValidSignature( signaturePayload(to, price, nonce), sig, usedMessages ); _purchase(to, 1, price); } /** @notice Returns whether the address has minted at the specified price with the particular nonce. If true, future calls to mint() with the same parameters will fail. */ function alreadyMinted( address to, uint256 price, bytes32 nonce ) external view returns (bool) { return usedMessages[ SignatureChecker.generateMessage( signaturePayload(to, price, nonce) ) ]; } /** @dev Constructs the buffer that is hashed for validation with a minting signature. */ function signaturePayload( address to, uint256 price, bytes32 nonce ) internal pure returns (bytes memory) { return abi.encodePacked(to, price, nonce); } /** @notice Flag indicating that public minting is open. */ bool public publicMinting; /** @notice Set the `publicMinting` flag. */ function setPublicMinting(bool _publicMinting) external onlyOwner { publicMinting = _publicMinting; } /** @notice Price to mint for the general public. */ uint256 public publicPrice = 0.25 ether; /** @notice Update the public-minting price. */ function setPublicPrice(uint256 price) external onlyOwner { publicPrice = price; } /** @notice Mint as a member of the public. */ function mintPublic(address to, uint256 n) external payable { require(publicMinting, "Minting closed"); _purchase(to, n, publicPrice); } /** @dev Required override to select the correct baseTokenURI. */ function _baseURI() internal view override(BaseTokenURI, ERC721) returns (string memory) { return BaseTokenURI._baseURI(); } /** @notice Sets the contract-wide royalty info. */ function setRoyaltyInfo(address receiver, uint96 feeBasisPoints) external onlyOwner { _setDefaultRoyalty(receiver, feeBasisPoints); } function supportsInterface(bytes4 interfaceId) public view override(ERC721Common, ERC2981) returns (bool) { return super.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol) pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { return _values(set._inner); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a / b + (a % b == 0 ? 0 : 1); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } else if (error == RecoverError.InvalidSignatureV) { revert("ECDSA: invalid signature 'v' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { // Check the signature length // - case 65: r,s,v signature (standard) // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._ if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else if (signature.length == 64) { bytes32 r; bytes32 vs; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) vs := mload(add(signature, 0x40)) } return tryRecover(hash, r, vs); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } if (v != 27 && v != 28) { return (address(0), RecoverError.InvalidSignatureV); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/common/ERC2981.sol) pragma solidity ^0.8.0; import "../../interfaces/IERC2981.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information. * * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first. * * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the * fee is specified in basis points by default. * * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported. * * _Available since v4.5._ */ abstract contract ERC2981 is IERC2981, ERC165 { struct RoyaltyInfo { address receiver; uint96 royaltyFraction; } RoyaltyInfo private _defaultRoyaltyInfo; mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) { return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId); } /** * @inheritdoc IERC2981 */ function royaltyInfo(uint256 _tokenId, uint256 _salePrice) external view virtual override returns (address, uint256) { RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId]; if (royalty.receiver == address(0)) { royalty = _defaultRoyaltyInfo; } uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator(); return (royalty.receiver, royaltyAmount); } /** * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an * override. */ function _feeDenominator() internal pure virtual returns (uint96) { return 10000; } /** * @dev Sets the royalty information that all ids in this contract will default to. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: invalid receiver"); _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Removes default royalty information. */ function _deleteDefaultRoyalty() internal virtual { delete _defaultRoyaltyInfo; } /** * @dev Sets the royalty information for a specific token id, overriding the global default. * * Requirements: * * - `tokenId` must be already minted. * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setTokenRoyalty( uint256 tokenId, address receiver, uint96 feeNumerator ) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: Invalid parameters"); _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Resets royalty information for the token id back to the global default. */ function _resetTokenRoyalty(uint256 tokenId) internal virtual { delete _tokenRoyaltyInfo[tokenId]; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Pausable.sol) pragma solidity ^0.8.0; import "../ERC721.sol"; import "../../../security/Pausable.sol"; /** * @dev ERC721 token with pausable token transfers, minting and burning. * * Useful for scenarios such as preventing trades until the end of an evaluation * period, or having an emergency switch for freezing all token transfers in the * event of a large bug. */ abstract contract ERC721Pausable is ERC721, Pausable { /** * @dev See {ERC721-_beforeTokenTransfer}. * * Requirements: * * - the contract must not be paused. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); require(!paused(), "ERC721Pausable: token transfer while paused"); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, 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 ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @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 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); /** * @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; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); _afterTokenTransfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); _afterTokenTransfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits a {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(paused(), "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Interface for the NFT Royalty Standard. * * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal * support for royalty payments across all NFT marketplaces and ecosystem participants. * * _Available since v4.5._ */ interface IERC2981 is IERC165 { /** * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of * exchange. The royalty amount is denominated and should be payed in that same unit of exchange. */ function royaltyInfo(uint256 tokenId, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // Copyright (c) 2021 the ethier authors (github.com/divergencetech/ethier) pragma solidity >=0.8.0 <0.9.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; /// @notice A Pausable contract that can only be toggled by the Owner. contract OwnerPausable is Ownable, Pausable { /// @notice Pauses the contract. function pause() public onlyOwner { Pausable._pause(); } /// @notice Unpauses the contract. function unpause() public onlyOwner { Pausable._unpause(); } }
// SPDX-License-Identifier: MIT // Copyright (c) 2021 the ethier authors (github.com/divergencetech/ethier) pragma solidity >=0.8.0 <0.9.0; /** @notice Provides monotonic increasing and decreasing values, similar to OpenZeppelin's Counter but (a) limited in direction, and (b) allowing for steps > 1. */ library Monotonic { /** @notice Holds a value that can only increase. @dev The internal value MUST NOT be accessed directly. Instead use current() and add(). */ struct Increaser { uint256 value; } /// @notice Returns the current value of the Increaser. function current(Increaser storage incr) internal view returns (uint256) { return incr.value; } /// @notice Adds x to the Increaser's value. function add(Increaser storage incr, uint256 x) internal { incr.value += x; } /** @notice Holds a value that can only decrease. @dev The internal value MUST NOT be accessed directly. Instead use current() and subtract(). */ struct Decreaser { uint256 value; } /// @notice Returns the current value of the Decreaser. function current(Decreaser storage decr) internal view returns (uint256) { return decr.value; } /// @notice Subtracts x from the Decreaser's value. function subtract(Decreaser storage decr, uint256 x) internal { decr.value -= x; } }
// SPDX-License-Identifier: MIT // Copyright (c) 2021 the ethier authors (github.com/divergencetech/ethier) pragma solidity >=0.8.0 <0.9.0; /// @notice A minimal interface describing OpenSea's Wyvern proxy registry. contract ProxyRegistry { mapping(address => OwnableDelegateProxy) public proxies; } /** @dev This pattern of using an empty contract is cargo-culted directly from OpenSea's example code. TODO: it's likely that the above mapping can be changed to address => address without affecting anything, but further investigation is needed (i.e. is there a subtle reason that OpenSea released it like this?). */ contract OwnableDelegateProxy { }
// SPDX-License-Identifier: MIT // Copyright (c) 2021 the ethier authors (github.com/divergencetech/ethier) pragma solidity >=0.8.0 <0.9.0; // Inspired by BaseOpenSea by Simon Fremaux (@dievardump) but without the need // to pass specific addresses depending on deployment network. // https://gist.github.com/dievardump/483eb43bc6ed30b14f01e01842e3339b/ import "./ProxyRegistry.sol"; /// @notice Library to achieve gas-free listings on OpenSea. library OpenSeaGasFreeListing { /** @notice Returns whether the operator is an OpenSea proxy for the owner, thus allowing it to list without the token owner paying gas. @dev ERC{721,1155}.isApprovedForAll should be overriden to also check if this function returns true. */ function isApprovedForAll(address owner, address operator) internal view returns (bool) { address proxy = proxyFor(owner); return proxy != address(0) && proxy == operator; } /** @notice Returns the OpenSea proxy address for the owner. */ function proxyFor(address owner) internal view returns (address) { address registry; uint256 chainId; assembly { chainId := chainid() switch chainId // Production networks are placed higher to minimise the number of // checks performed and therefore reduce gas. By the same rationale, // mainnet comes before Polygon as it's more expensive. case 1 { // mainnet registry := 0xa5409ec958c83c3f309868babaca7c86dcb077c1 } case 137 { // polygon registry := 0x58807baD0B376efc12F5AD86aAc70E78ed67deaE } case 4 { // rinkeby registry := 0xf57b2c51ded3a29e6891aba85459d600256cf317 } case 80001 { // mumbai registry := 0xff7Ca10aF37178BdD056628eF42fD7F799fAc77c } case 1337 { // The geth SimulatedBackend iff used with the ethier // openseatest package. This is mocked as a Wyvern proxy as it's // more complex than the 0x ones. registry := 0xE1a2bbc877b29ADBC56D2659DBcb0ae14ee62071 } } // Unlike Wyvern, the registry itself is the proxy for all owners on 0x // chains. if (registry == address(0) || chainId == 137 || chainId == 80001) { return registry; } return address(ProxyRegistry(registry).proxies(owner)); } }
// SPDX-License-Identifier: MIT // Copyright (c) 2021 the ethier authors (github.com/divergencetech/ethier) pragma solidity >=0.8.0 <0.9.0; import "../utils/Monotonic.sol"; import "../utils/OwnerPausable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/utils/math/Math.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; /** @notice An abstract contract providing the _purchase() function to: - Enforce per-wallet / per-transaction limits - Calculate required cost, forwarding to a beneficiary, and refunding extra */ abstract contract Seller is OwnerPausable, ReentrancyGuard { using Address for address payable; using Monotonic for Monotonic.Increaser; using Strings for uint256; /** @dev Note that the address limits are vulnerable to wallet farming. @param maxPerAddress Unlimited if zero. @param maxPerTex Unlimited if zero. @param freeQuota Maximum number that can be purchased free of charge by the contract owner. @param reserveFreeQuota Whether to excplitly reserve the freeQuota amount and not let it be eroded by regular purchases. @param lockFreeQuota If true, calls to setSellerConfig() will ignore changes to freeQuota. Can be locked after initial setting, but not unlocked. This allows a contract owner to commit to a maximum number of reserved items. @param lockTotalInventory Similar to lockFreeQuota but applied to totalInventory. */ struct SellerConfig { uint256 totalInventory; uint256 maxPerAddress; uint256 maxPerTx; uint248 freeQuota; bool reserveFreeQuota; bool lockFreeQuota; bool lockTotalInventory; } constructor(SellerConfig memory config, address payable _beneficiary) { setSellerConfig(config); setBeneficiary(_beneficiary); } /// @notice Configuration of purchase limits. SellerConfig public sellerConfig; /// @notice Sets the seller config. function setSellerConfig(SellerConfig memory config) public onlyOwner { require( config.totalInventory >= config.freeQuota, "Seller: excessive free quota" ); require( config.totalInventory >= _totalSold.current(), "Seller: inventory < already sold" ); require( config.freeQuota >= purchasedFreeOfCharge.current(), "Seller: free quota < already used" ); // Overriding the in-memory fields before copying the whole struct, as // against writing individual fields, gives a greater guarantee of // correctness as the code is simpler to read. if (sellerConfig.lockTotalInventory) { config.lockTotalInventory = true; config.totalInventory = sellerConfig.totalInventory; } if (sellerConfig.lockFreeQuota) { config.lockFreeQuota = true; config.freeQuota = sellerConfig.freeQuota; } sellerConfig = config; } /// @notice Recipient of revenues. address payable public beneficiary; /// @notice Sets the recipient of revenues. function setBeneficiary(address payable _beneficiary) public onlyOwner { beneficiary = _beneficiary; } /** @dev Must return the current cost of a batch of items. This may be constant or, for example, decreasing for a Dutch auction or increasing for a bonding curve. @param n The number of items being purchased. @param metadata Arbitrary data, propagated by the call to _purchase() that can be used to charge different prices. This value is a uint256 instead of bytes as this allows simple passing of a set cost (see ArbitraryPriceSeller). */ function cost(uint256 n, uint256 metadata) public view virtual returns (uint256); /** @dev Called by both _purchase() and purchaseFreeOfCharge() after all limits have been put in place; must perform all contract-specific sale logic, e.g. ERC721 minting. When _handlePurchase() is called, the value returned by Seller.totalSold() will be the pre-purchase amount. @param to The recipient of the item(s). @param n The number of items allowed to be purchased, which MAY be less than to the number passed to _purchase() but SHALL be greater than zero. @param freeOfCharge Indicates that the call originated from purchaseFreeOfCharge() and not _purchase(). */ function _handlePurchase( address to, uint256 n, bool freeOfCharge ) internal virtual; /** @notice Tracks total number of items sold by this contract, including those purchased free of charge by the contract owner. */ Monotonic.Increaser private _totalSold; /// @notice Returns the total number of items sold by this contract. function totalSold() public view returns (uint256) { return _totalSold.current(); } /** @notice Tracks the number of items already bought by an address, regardless of transferring out (in the case of ERC721). @dev This isn't public as it may be skewed due to differences in msg.sender and tx.origin, which it treats in the same way such that sum(_bought)>=totalSold(). */ mapping(address => uint256) private _bought; /** @notice Returns min(n, max(extra items addr can purchase)) and reverts if 0. @param zeroMsg The message with which to revert on 0 extra. */ function _capExtra( uint256 n, address addr, string memory zeroMsg ) internal view returns (uint256) { uint256 extra = sellerConfig.maxPerAddress - _bought[addr]; if (extra == 0) { revert(string(abi.encodePacked("Seller: ", zeroMsg))); } return Math.min(n, extra); } /// @notice Emitted when a buyer is refunded. event Refund(address indexed buyer, uint256 amount); /// @notice Emitted on all purchases of non-zero amount. event Revenue( address indexed beneficiary, uint256 numPurchased, uint256 amount ); /// @notice Tracks number of items purchased free of charge. Monotonic.Increaser private purchasedFreeOfCharge; /** @notice Allows the contract owner to purchase without payment, within the quota enforced by the SellerConfig. */ function purchaseFreeOfCharge(address to, uint256 n) public onlyOwner whenNotPaused { uint256 freeQuota = sellerConfig.freeQuota; n = Math.min(n, freeQuota - purchasedFreeOfCharge.current()); require(n > 0, "Seller: Free quota exceeded"); uint256 totalInventory = sellerConfig.totalInventory; n = Math.min(n, totalInventory - _totalSold.current()); require(n > 0, "Seller: Sold out"); _handlePurchase(to, n, true); _totalSold.add(n); purchasedFreeOfCharge.add(n); assert(_totalSold.current() <= totalInventory); assert(purchasedFreeOfCharge.current() <= freeQuota); } /** @notice Convenience function for calling _purchase() with empty costMetadata when unneeded. */ function _purchase(address to, uint256 requested) internal virtual { _purchase(to, requested, 0); } /** @notice Enforces all purchase limits (counts and costs) before calling _handlePurchase(), after which the received funds are disbursed to the beneficiary, less any required refunds. @param to The final recipient of the item(s). @param requested The number of items requested for purchase, which MAY be reduced when passed to _handlePurchase(). @param costMetadata Arbitrary data, propagated in the call to cost(), to be optionally used in determining the price. */ function _purchase( address to, uint256 requested, uint256 costMetadata ) internal nonReentrant whenNotPaused { /** * ##### CHECKS */ SellerConfig memory config = sellerConfig; uint256 n = config.maxPerTx == 0 ? requested : Math.min(requested, config.maxPerTx); uint256 maxAvailable; uint256 sold; if (config.reserveFreeQuota) { maxAvailable = config.totalInventory - config.freeQuota; sold = _totalSold.current() - purchasedFreeOfCharge.current(); } else { maxAvailable = config.totalInventory; sold = _totalSold.current(); } n = Math.min(n, maxAvailable - sold); require(n > 0, "Seller: Sold out"); if (config.maxPerAddress > 0) { bool alsoLimitSender = _msgSender() != to; bool alsoLimitOrigin = tx.origin != _msgSender() && tx.origin != to; n = _capExtra(n, to, "Buyer limit"); if (alsoLimitSender) { n = _capExtra(n, _msgSender(), "Sender limit"); } if (alsoLimitOrigin) { n = _capExtra(n, tx.origin, "Origin limit"); } _bought[to] += n; if (alsoLimitSender) { _bought[_msgSender()] += n; } if (alsoLimitOrigin) { _bought[tx.origin] += n; } } uint256 _cost = cost(n, costMetadata); if (msg.value < _cost) { revert( string( abi.encodePacked( "Seller: Costs ", (_cost / 1e9).toString(), " GWei" ) ) ); } /** * ##### EFFECTS */ _handlePurchase(to, n, false); _totalSold.add(n); assert(_totalSold.current() <= config.totalInventory); /** * ##### INTERACTIONS */ // Ideally we'd be using a PullPayment here, but the user experience is // poor when there's a variable cost or the number of items purchased // has been capped. We've addressed reentrancy with both a nonReentrant // modifier and the checks, effects, interactions pattern. if (_cost > 0) { beneficiary.sendValue(_cost); emit Revenue(beneficiary, n, _cost); } if (msg.value > _cost) { address payable reimburse = payable(_msgSender()); uint256 refund = msg.value - _cost; // Using Address.sendValue() here would mask the revertMsg upon // reentrancy, but we want to expose it to allow for more precise // testing. This otherwise uses the exact same pattern as // Address.sendValue(). (bool success, bytes memory returnData) = reimburse.call{ value: refund }(""); // Although `returnData` will have a spurious prefix, all we really // care about is that it contains the ReentrancyGuard reversion // message so we can check in the tests. require(success, string(returnData)); emit Refund(reimburse, refund); } } }
// SPDX-License-Identifier: MIT // Copyright (c) 2022 the ethier authors (github.com/divergencetech/ethier) pragma solidity >=0.8.0 <0.9.0; import "./Seller.sol"; /** @dev The Seller base contract has a convenience function _purchase(to,n) that calls the standard function as _purchase(to,n,0). This would result in a free purchase, to the convenience variant is overriden and always reverts with this error. */ error ImplicitFreePurchase(); /** @notice A Seller with an arbitrary price passed in externally. */ abstract contract ArbitraryPriceSeller is Seller { constructor( Seller.SellerConfig memory sellerConfig, address payable _beneficiary ) Seller(sellerConfig, _beneficiary) {} /** @notice Block accidental usage of the convenience function that would default to a free sale. */ function _purchase(address, uint256) internal pure override { revert ImplicitFreePurchase(); } /** @notice Override of Seller.cost() with price passed via metadata. @return n*costEach; */ function cost(uint256 n, uint256 costEach) public pure override returns (uint256) { return n * costEach; } }
// SPDX-License-Identifier: MIT // Copyright (c) 2021 the ethier authors (github.com/divergencetech/ethier) pragma solidity >=0.8.0 <0.9.0; import "../thirdparty/opensea/OpenSeaGasFreeListing.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; /// @notice Pre-approval of OpenSea proxies for gas-less listing /// @dev This wrapper allows users to revoke the pre-approval of their /// associated proxy and emits the corresponding events. This is necessary for /// external tools to index approvals correctly and inform the user. /// @dev The pre-approval is triggered on a per-wallet basis during the first /// transfer transactions. It will only be enabled for wallets with an existing /// proxy. Not having a proxy incurs a gas overhead. /// @dev This wrapper optimizes for the following scenario: /// - The majority of users already have a wyvern proxy /// - Most of them want to transfer tokens via wyvern exchanges abstract contract ERC721PreApproval is ERC721 { /// @dev It is important that Active remains at first position, since this /// is the scenario that we are trying to optimize for. enum State { Active, Inactive } /// @notice The state of the pre-approval for a given owner mapping(address => State) private state; /// @dev Returns true if either standard `isApprovedForAll()` or if the /// `operator` is the OpenSea proxy for the `owner` provided the /// pre-approval is active. function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { if (super.isApprovedForAll(owner, operator)) { return true; } return state[owner] == State.Active && OpenSeaGasFreeListing.isApprovedForAll(owner, operator); } /// @dev Uses the standard `setApprovalForAll` or toggles the pre-approval /// state if `operator` is the OpenSea proxy for the sender. function setApprovalForAll(address operator, bool approved) public virtual override { address owner = _msgSender(); if (operator == OpenSeaGasFreeListing.proxyFor(owner)) { state[owner] = approved ? State.Active : State.Inactive; emit ApprovalForAll(owner, operator, approved); } else { super._setApprovalForAll(owner, operator, approved); } } /// @dev Checks if the receiver has an existing proxy. If not, the /// pre-approval is disabled. function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); // Exclude burns and inactive pre-approvals if (to == address(0) || state[to] == State.Inactive) { return; } address operator = OpenSeaGasFreeListing.proxyFor(to); // Disable if `to` has no proxy if (operator == address(0)) { state[to] = State.Inactive; return; } // Avoid emitting unnecessary events. if (balanceOf(to) == 0) { emit ApprovalForAll(to, operator, true); } } }
// SPDX-License-Identifier: MIT // Copyright (c) 2022 the ethier authors (github.com/divergencetech/ethier) pragma solidity >=0.8.0 <0.9.0; import "./ERC721Common.sol"; import "../utils/Monotonic.sol"; /** @notice An extension of the ethier ERC721Common contract that auto-increments the next tokenId and exposes a totalSupply. */ contract ERC721CommonAutoIncrement is ERC721Common { using Monotonic for Monotonic.Increaser; constructor(string memory name, string memory symbol) ERC721Common(name, symbol) {} /** @notice Total number of tokens minted. */ Monotonic.Increaser public totalSupply; /** @dev _safeMint() n tokens to the specified address, only incrementing totalSupply once. */ function _safeMintN( address to, uint256 n, bytes memory data ) internal { uint256 tokenId = totalSupply.current(); uint256 end = tokenId + n; for (; tokenId < end; ++tokenId) { _safeMint(to, tokenId, data); } totalSupply.add(n); } /** @dev Alias for _safeMintN(address,uint,bytes) assuming an empty byte buffer. */ function _safeMintN(address to, uint256 n) internal { _safeMintN(to, n, ""); } }
// SPDX-License-Identifier: MIT // Copyright (c) 2021 the ethier authors (github.com/divergencetech/ethier) pragma solidity >=0.8.0 <0.9.0; import "./ERC721PreApproval.sol"; import "../utils/OwnerPausable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Pausable.sol"; /** @notice An ERC721 contract with common functionality: - OpenSea gas-free listings - OpenZeppelin Pausable - OpenZeppelin Pausable with functions exposed to Owner only */ contract ERC721Common is ERC721Pausable, ERC721PreApproval, OwnerPausable { constructor(string memory name, string memory symbol) ERC721(name, symbol) {} /// @notice Requires that the token exists. modifier tokenExists(uint256 tokenId) { require(ERC721._exists(tokenId), "ERC721Common: Token doesn't exist"); _; } /// @notice Requires that msg.sender owns or is approved for the token. modifier onlyApprovedOrOwner(uint256 tokenId) { require( _isApprovedOrOwner(_msgSender(), tokenId), "ERC721Common: Not approved nor owner" ); _; } function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override(ERC721Pausable, ERC721PreApproval) { super._beforeTokenTransfer(from, to, tokenId); } function setApprovalForAll(address operator, bool approved) public virtual override(ERC721, ERC721PreApproval) { ERC721PreApproval.setApprovalForAll(operator, approved); } function isApprovedForAll(address owner, address operator) public view virtual override(ERC721, ERC721PreApproval) returns (bool) { return ERC721PreApproval.isApprovedForAll(owner, operator); } /// @notice Overrides supportsInterface as required by inheritance. function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721) returns (bool) { return super.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: MIT // Copyright (c) 2021 the ethier authors (github.com/divergencetech/ethier) pragma solidity >=0.8.0 <0.9.0; import "@openzeppelin/contracts/access/Ownable.sol"; /** @notice ERC721 extension that overrides the OpenZeppelin _baseURI() function to return a prefix that can be set by the contract owner. */ contract BaseTokenURI is Ownable { /// @notice Base token URI used as a prefix by tokenURI(). string public baseTokenURI; constructor(string memory _baseTokenURI) { setBaseTokenURI(_baseTokenURI); } /// @notice Sets the base token URI prefix. function setBaseTokenURI(string memory _baseTokenURI) public onlyOwner { baseTokenURI = _baseTokenURI; } /** @notice Concatenates and returns the base token URI and the token ID without any additional characters (e.g. a slash). @dev This requires that an inheriting contract that also inherits from OZ's ERC721 will have to override both contracts; although we could simply require that users implement their own _baseURI() as here, this can easily be forgotten and the current approach guides them with compiler errors. This favours the latter half of "APIs should be easy to use and hard to misuse" from https://www.infoq.com/articles/API-Design-Joshua-Bloch/. */ function _baseURI() internal view virtual returns (string memory) { return baseTokenURI; } }
// SPDX-License-Identifier: MIT // Copyright (c) 2022 the ethier authors (github.com/divergencetech/ethier) pragma solidity >=0.8.0 <0.9.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; /** @title SignerManager @notice Manges addition and removal of a core set of addresses from which valid ECDSA signatures can be accepted; see SignatureChecker. */ contract SignerManager is Ownable { using EnumerableSet for EnumerableSet.AddressSet; /** @dev Addresses from which signatures can be accepted. */ EnumerableSet.AddressSet internal signers; /** @notice Add an address to the set of accepted signers. */ function addSigner(address signer) external onlyOwner { signers.add(signer); } /** @notice Remove an address previously added with addSigner(). */ function removeSigner(address signer) external onlyOwner { signers.remove(signer); } }
// SPDX-License-Identifier: MIT // Copyright (c) 2021 the ethier authors (github.com/divergencetech/ethier) pragma solidity >=0.8.0 <0.9.0; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; /** @title SignatureChecker @notice Additional functions for EnumerableSet.Addresset that require a valid ECDSA signature of a standardized message, signed by any member of the set. */ library SignatureChecker { using EnumerableSet for EnumerableSet.AddressSet; /** @notice Requires that the message has not been used previously and that the recovered signer is contained in the signers AddressSet. @dev Convenience wrapper for message generation + signature verification + marking message as used @param signers Set of addresses from which signatures are accepted. @param usedMessages Set of already-used messages. @param signature ECDSA signature of message. */ function requireValidSignature( EnumerableSet.AddressSet storage signers, bytes memory data, bytes calldata signature, mapping(bytes32 => bool) storage usedMessages ) internal { bytes32 message = generateMessage(data); require( !usedMessages[message], "SignatureChecker: Message already used" ); usedMessages[message] = true; requireValidSignature(signers, message, signature); } /** @notice Requires that the message has not been used previously and that the recovered signer is contained in the signers AddressSet. @dev Convenience wrapper for message generation + signature verification. */ function requireValidSignature( EnumerableSet.AddressSet storage signers, bytes memory data, bytes calldata signature ) internal view { bytes32 message = generateMessage(data); requireValidSignature(signers, message, signature); } /** @notice Requires that the message has not been used previously and that the recovered signer is contained in the signers AddressSet. @dev Convenience wrapper for message generation from address + signature verification. */ function requireValidSignature( EnumerableSet.AddressSet storage signers, address a, bytes calldata signature ) internal view { bytes32 message = generateMessage(abi.encodePacked(a)); requireValidSignature(signers, message, signature); } /** @notice Common validator logic, checking if the recovered signer is contained in the signers AddressSet. */ function validSignature( EnumerableSet.AddressSet storage signers, bytes32 message, bytes calldata signature ) internal view returns (bool) { return signers.contains(ECDSA.recover(message, signature)); } /** @notice Requires that the recovered signer is contained in the signers AddressSet. @dev Convenience wrapper that reverts if the signature validation fails. */ function requireValidSignature( EnumerableSet.AddressSet storage signers, bytes32 message, bytes calldata signature ) internal view { require( validSignature(signers, message, signature), "SignatureChecker: Invalid signature" ); } /** @notice Generates a message for a given data input that will be signed off-chain using ECDSA. @dev For multiple data fields, a standard concatenation using `abi.encodePacked` is commonly used to build data. */ function generateMessage(bytes memory data) internal pure returns (bytes32) { return ECDSA.toEthSignedMessageHash(data); } }
{ "remappings": [], "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "london", "libraries": {}, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address payable","name":"beneficiary","type":"address"},{"internalType":"address","name":"royaltyReceiver","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"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":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"buyer","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Refund","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beneficiary","type":"address"},{"indexed":false,"internalType":"uint256","name":"numPurchased","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Revenue","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"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[{"internalType":"address","name":"signer","type":"address"}],"name":"addSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"bytes32","name":"nonce","type":"bytes32"}],"name":"alreadyMinted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseTokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"beneficiary","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"n","type":"uint256"},{"internalType":"uint256","name":"costEach","type":"uint256"}],"name":"cost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"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":"address","name":"to","type":"address"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"bytes32","name":"nonce","type":"bytes32"},{"internalType":"bytes","name":"sig","type":"bytes"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"n","type":"uint256"}],"name":"mintPublic","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"publicMinting","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"publicPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"n","type":"uint256"}],"name":"purchaseFreeOfCharge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"signer","type":"address"}],"name":"removeSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"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":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sellerConfig","outputs":[{"internalType":"uint256","name":"totalInventory","type":"uint256"},{"internalType":"uint256","name":"maxPerAddress","type":"uint256"},{"internalType":"uint256","name":"maxPerTx","type":"uint256"},{"internalType":"uint248","name":"freeQuota","type":"uint248"},{"internalType":"bool","name":"reserveFreeQuota","type":"bool"},{"internalType":"bool","name":"lockFreeQuota","type":"bool"},{"internalType":"bool","name":"lockTotalInventory","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_baseTokenURI","type":"string"}],"name":"setBaseTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_beneficiary","type":"address"}],"name":"setBeneficiary","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_publicMinting","type":"bool"}],"name":"setPublicMinting","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"price","type":"uint256"}],"name":"setPublicPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint96","name":"feeBasisPoints","type":"uint96"}],"name":"setRoyaltyInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"totalInventory","type":"uint256"},{"internalType":"uint256","name":"maxPerAddress","type":"uint256"},{"internalType":"uint256","name":"maxPerTx","type":"uint256"},{"internalType":"uint248","name":"freeQuota","type":"uint248"},{"internalType":"bool","name":"reserveFreeQuota","type":"bool"},{"internalType":"bool","name":"lockFreeQuota","type":"bool"},{"internalType":"bool","name":"lockTotalInventory","type":"bool"}],"internalType":"struct Seller.SellerConfig","name":"config","type":"tuple"}],"name":"setSellerConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"value","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":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"usedMessages","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60806040526703782dace9d90000601a553480156200001d57600080fd5b5060405162004276380380620042768339810160408190526200004091620006c2565b6040518060e001604052806127108152602001600a8152602001600081526020016103a26001600160f81b03168152602001600115158152602001600015158152602001600015158152508281816040518060200160405280600081525060405180604001604052806011815260200170282922a6a4a72a1021b7b63632b1ba37b960791b8152506040518060400160405280600b81526020016a1414915352539510d3d31360aa1b8152508181818181600090805190602001906200010892919062000603565b5080516200011e90600190602084019062000603565b5050506200013b620001356200019460201b60201c565b62000198565b50506006805460ff60a01b191690555062000158905081620001ea565b506001600a55620001698262000252565b620001748162000491565b505050506200018c816102ee620004fe60201b60201c565b50506200073e565b3390565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6006546001600160a01b03163314620002395760405162461bcd60e51b815260206004820181905260248201526000805160206200425683398151915260448201526064015b60405180910390fd5b80516200024e90600990602084019062000603565b5050565b6006546001600160a01b031633146200029d5760405162461bcd60e51b8152602060048201819052602482015260008051602062004256833981519152604482015260640162000230565b80606001516001600160f81b031681600001511015620003005760405162461bcd60e51b815260206004820152601c60248201527f53656c6c65723a2065786365737369766520667265652071756f746100000000604482015260640162000230565b620003176011620005ff60201b620014e41760201c565b81511015620003695760405162461bcd60e51b815260206004820181905260248201527f53656c6c65723a20696e76656e746f7279203c20616c726561647920736f6c64604482015260640162000230565b620003806013620005ff60201b620014e41760201c565b81606001516001600160f81b03161015620003e85760405162461bcd60e51b815260206004820152602160248201527f53656c6c65723a20667265652071756f7461203c20616c7265616479207573656044820152601960fa1b606482015260840162000230565b600f54610100900460ff16156200040657600160c0820152600b5481525b600f5460ff16156200042b57600160a0820152600e546001600160f81b031660608201525b8051600b556020810151600c556040810151600d55606081015160808201511515600160f81b026001600160f81b0390911617600e5560a0810151600f805460c09093015115156101000261ff00199215159290921661ffff1990931692909217179055565b6006546001600160a01b03163314620004dc5760405162461bcd60e51b8152602060048201819052602482015260008051602062004256833981519152604482015260640162000230565b601080546001600160a01b0319166001600160a01b0392909216919091179055565b6127106001600160601b03821611156200056e5760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b606482015260840162000230565b6001600160a01b038216620005c65760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c696420726563656976657200000000000000604482015260640162000230565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217601655565b5490565b828054620006119062000701565b90600052602060002090601f01602090048101928262000635576000855562000680565b82601f106200065057805160ff191683800117855562000680565b8280016001018555821562000680579182015b828111156200068057825182559160200191906001019062000663565b506200068e92915062000692565b5090565b5b808211156200068e576000815560010162000693565b6001600160a01b0381168114620006bf57600080fd5b50565b60008060408385031215620006d657600080fd5b8251620006e381620006a9565b6020840151909250620006f681620006a9565b809150509250929050565b600181811c908216806200071657607f821691505b602082108114156200073857634e487b7160e01b600052602260045260246000fd5b50919050565b613b08806200074e6000396000f3fe6080604052600436106102465760003560e01c80636352211e11610139578063a22cb465116100b6578063c62752551161007a578063c627525514610717578063c87b56dd14610737578063d547cfb714610757578063e985e9c51461076c578063eb12d61e1461078c578063f2fde38b146107ac57600080fd5b8063a22cb46514610616578063a945bf8014610636578063b88d4fde1461064c578063bb69b7ef1461066c578063bf62e21d146106f757600080fd5b80639106d7ba116100fd5780639106d7ba146105a65780639437bfa0146105bb57806395d89b41146105db57806396d66de0146105f05780639f93f7791461060357600080fd5b80636352211e1461051e57806370a082311461053e578063715018a61461055e5780638456cb59146105735780638da5cb5b1461058857600080fd5b80632a55205a116101c75780633f4ba83a1161018b5780633f4ba83a1461048057806342842e0e1461049557806353ac010a146104b55780635a028400146104cf5780635c975abb146104ff57600080fd5b80632a55205a146103c15780632f274bd41461040057806330176e131461042057806338af3eed146104405780633ec02e141461046057600080fd5b80630e316ab71161020e5780630e316ab71461031c57806318160ddd1461033c5780631c31f7101461036157806323b872dd14610381578063254a4737146103a157600080fd5b806301ffc9a71461024b57806302fa7c471461028057806306fdde03146102a2578063081812fc146102c4578063095ea7b3146102fc575b600080fd5b34801561025757600080fd5b5061026b6102663660046131fc565b6107cc565b60405190151581526020015b60405180910390f35b34801561028c57600080fd5b506102a061029b36600461322e565b6107dd565b005b3480156102ae57600080fd5b506102b761081e565b60405161027791906132cb565b3480156102d057600080fd5b506102e46102df3660046132de565b6108b0565b6040516001600160a01b039091168152602001610277565b34801561030857600080fd5b506102a06103173660046132f7565b610945565b34801561032857600080fd5b506102a0610337366004613323565b610a5b565b34801561034857600080fd5b506008546103539081565b604051908152602001610277565b34801561036d57600080fd5b506102a061037c366004613323565b610a90565b34801561038d57600080fd5b506102a061039c366004613340565b610adc565b3480156103ad57600080fd5b506102a06103bc366004613396565b610b0d565b3480156103cd57600080fd5b506103e16103dc3660046133b1565b610b4a565b604080516001600160a01b039093168352602083019190915201610277565b34801561040c57600080fd5b506102a061041b366004613412565b610bf8565b34801561042c57600080fd5b506102a061043b366004613513565b610de6565b34801561044c57600080fd5b506010546102e4906001600160a01b031681565b34801561046c57600080fd5b5061035361047b3660046133b1565b610e23565b34801561048c57600080fd5b506102a0610e36565b3480156104a157600080fd5b506102a06104b0366004613340565b610e6a565b3480156104c157600080fd5b5060195461026b9060ff1681565b3480156104db57600080fd5b5061026b6104ea3660046132de565b60186020526000908152604090205460ff1681565b34801561050b57600080fd5b50600654600160a01b900460ff1661026b565b34801561052a57600080fd5b506102e46105393660046132de565b610e85565b34801561054a57600080fd5b50610353610559366004613323565b610efc565b34801561056a57600080fd5b506102a0610f83565b34801561057f57600080fd5b506102a0610fb7565b34801561059457600080fd5b506006546001600160a01b03166102e4565b3480156105b257600080fd5b50610353610fe9565b3480156105c757600080fd5b5061026b6105d636600461355c565b610ff9565b3480156105e757600080fd5b506102b761102e565b6102a06105fe366004613591565b61103d565b6102a06106113660046132f7565b61106a565b34801561062257600080fd5b506102a0610631366004613627565b6110ba565b34801561064257600080fd5b50610353601a5481565b34801561065857600080fd5b506102a061066736600461365c565b6110c4565b34801561067857600080fd5b50600b54600c54600d54600e54600f546106b4949392916001600160f81b0381169160ff600160f81b9092048216918181169161010090041687565b604080519788526020880196909652948601939093526001600160f81b03909116606085015215156080840152151560a0830152151560c082015260e001610277565b34801561070357600080fd5b506102a06107123660046132f7565b6110fc565b34801561072357600080fd5b506102a06107323660046132de565b611271565b34801561074357600080fd5b506102b76107523660046132de565b6112a0565b34801561076357600080fd5b506102b761137a565b34801561077857600080fd5b5061026b6107873660046136dc565b611408565b34801561079857600080fd5b506102a06107a7366004613323565b611414565b3480156107b857600080fd5b506102a06107c7366004613323565b611449565b60006107d7826114e8565b92915050565b6006546001600160a01b031633146108105760405162461bcd60e51b81526004016108079061370a565b60405180910390fd5b61081a828261150d565b5050565b60606000805461082d9061373f565b80601f01602080910402602001604051908101604052809291908181526020018280546108599061373f565b80156108a65780601f1061087b576101008083540402835291602001916108a6565b820191906000526020600020905b81548152906001019060200180831161088957829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b03166109295760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610807565b506000908152600460205260409020546001600160a01b031690565b600061095082610e85565b9050806001600160a01b0316836001600160a01b031614156109be5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610807565b336001600160a01b03821614806109da57506109da8133611408565b610a4c5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610807565b610a56838361160a565b505050565b6006546001600160a01b03163314610a855760405162461bcd60e51b81526004016108079061370a565b61081a601482611678565b6006546001600160a01b03163314610aba5760405162461bcd60e51b81526004016108079061370a565b601080546001600160a01b0319166001600160a01b0392909216919091179055565b610ae6338261168d565b610b025760405162461bcd60e51b81526004016108079061377a565b610a56838383611764565b6006546001600160a01b03163314610b375760405162461bcd60e51b81526004016108079061370a565b6019805460ff1916911515919091179055565b60008281526017602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b0316928201929092528291610bbf5750604080518082019091526016546001600160a01b0381168252600160a01b90046001600160601b031660208201525b602081015160009061271090610bde906001600160601b0316876137e1565b610be89190613816565b91519350909150505b9250929050565b6006546001600160a01b03163314610c225760405162461bcd60e51b81526004016108079061370a565b80606001516001600160f81b031681600001511015610c835760405162461bcd60e51b815260206004820152601c60248201527f53656c6c65723a2065786365737369766520667265652071756f7461000000006044820152606401610807565b60115481511015610cd65760405162461bcd60e51b815260206004820181905260248201527f53656c6c65723a20696e76656e746f7279203c20616c726561647920736f6c646044820152606401610807565b60135481606001516001600160f81b03161015610d3f5760405162461bcd60e51b815260206004820152602160248201527f53656c6c65723a20667265652071756f7461203c20616c7265616479207573656044820152601960fa1b6064820152608401610807565b600f54610100900460ff1615610d5c57600160c0820152600b5481525b600f5460ff1615610d8057600160a0820152600e546001600160f81b031660608201525b8051600b556020810151600c556040810151600d55606081015160808201511515600160f81b026001600160f81b0390911617600e5560a0810151600f805460c09093015115156101000261ff00199215159290921661ffff1990931692909217179055565b6006546001600160a01b03163314610e105760405162461bcd60e51b81526004016108079061370a565b805161081a90600990602084019061314d565b6000610e2f82846137e1565b9392505050565b6006546001600160a01b03163314610e605760405162461bcd60e51b81526004016108079061370a565b610e6861190b565b565b610a56838383604051806020016040528060008152506110c4565b6000818152600260205260408120546001600160a01b0316806107d75760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610807565b60006001600160a01b038216610f675760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610807565b506001600160a01b031660009081526003602052604090205490565b6006546001600160a01b03163314610fad5760405162461bcd60e51b81526004016108079061370a565b610e6860006119a8565b6006546001600160a01b03163314610fe15760405162461bcd60e51b81526004016108079061370a565b610e686119fa565b6000610ff460115490565b905090565b60006018600061101261100d878787611a5f565b611aa5565b815260208101919091526040016000205460ff16949350505050565b60606001805461082d9061373f565b61105761104b868686611a5f565b60149084846018611ab0565b61106385600186611b59565b5050505050565b60195460ff166110ad5760405162461bcd60e51b815260206004820152600e60248201526d135a5b9d1a5b99c818db1bdcd95960921b6044820152606401610807565b61081a8282601a54611b59565b61081a8282612037565b6110ce338361168d565b6110ea5760405162461bcd60e51b81526004016108079061377a565b6110f6848484846120fe565b50505050565b6006546001600160a01b031633146111265760405162461bcd60e51b81526004016108079061370a565b600654600160a01b900460ff16156111505760405162461bcd60e51b81526004016108079061382a565b600e546001600160f81b03166111788261116960135490565b6111739084613854565b612131565b9150600082116111ca5760405162461bcd60e51b815260206004820152601b60248201527f53656c6c65723a20467265652071756f746120657863656564656400000000006044820152606401610807565b600b546111da8361116960115490565b92506000831161121f5760405162461bcd60e51b815260206004820152601060248201526f14d95b1b195c8e8814dbdb19081bdd5d60821b6044820152606401610807565b61122b84846001612147565b611236601184612151565b611241601384612151565b8061124b60115490565b11156112595761125961386b565b8161126360135490565b11156110f6576110f661386b565b6006546001600160a01b0316331461129b5760405162461bcd60e51b81526004016108079061370a565b601a55565b6000818152600260205260409020546060906001600160a01b031661131f5760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610807565b600061132961216e565b905060008151116113495760405180602001604052806000815250610e2f565b8061135384612178565b604051602001611364929190613881565b6040516020818303038152906040529392505050565b600980546113879061373f565b80601f01602080910402602001604051908101604052809291908181526020018280546113b39061373f565b80156114005780601f106113d557610100808354040283529160200191611400565b820191906000526020600020905b8154815290600101906020018083116113e357829003601f168201915b505050505081565b6000610e2f8383612276565b6006546001600160a01b0316331461143e5760405162461bcd60e51b81526004016108079061370a565b61081a6014826122ed565b6006546001600160a01b031633146114735760405162461bcd60e51b81526004016108079061370a565b6001600160a01b0381166114d85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610807565b6114e1816119a8565b50565b5490565b60006001600160e01b0319821663152a902d60e11b14806107d757506107d782612302565b6127106001600160601b038216111561157b5760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401610807565b6001600160a01b0382166115d15760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401610807565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217601655565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061163f82610e85565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000610e2f836001600160a01b03841661230d565b6000818152600260205260408120546001600160a01b03166117065760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610807565b600061171183610e85565b9050806001600160a01b0316846001600160a01b0316148061174c5750836001600160a01b0316611741846108b0565b6001600160a01b0316145b8061175c575061175c8185611408565b949350505050565b826001600160a01b031661177782610e85565b6001600160a01b0316146117db5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610807565b6001600160a01b03821661183d5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610807565b611848838383612400565b61185360008261160a565b6001600160a01b038316600090815260036020526040812080546001929061187c908490613854565b90915550506001600160a01b03821660009081526003602052604081208054600192906118aa9084906138b0565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600654600160a01b900460ff1661195b5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610807565b6006805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600654600160a01b900460ff1615611a245760405162461bcd60e51b81526004016108079061382a565b6006805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861198b3390565b604051606084811b6bffffffffffffffffffffffff1916602083015260348201849052605482018390529060740160405160208183030381529060405290509392505050565b60006107d78261240b565b6000611abb85611aa5565b60008181526020849052604090205490915060ff1615611b2c5760405162461bcd60e51b815260206004820152602660248201527f5369676e6174757265436865636b65723a204d65737361676520616c726561646044820152651e481d5cd95960d21b6064820152608401610807565b6000818152602083905260409020805460ff19166001179055611b5186828686612446565b505050505050565b6002600a541415611bac5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610807565b6002600a55600654600160a01b900460ff1615611bdb5760405162461bcd60e51b81526004016108079061382a565b6040805160e081018252600b548152600c546020820152600d54918101829052600e546001600160f81b038116606083015260ff600160f81b909104811615156080830152600f54808216151560a0840152610100900416151560c08201529060009015611c5657611c51848360400151612131565b611c58565b835b9050600080836080015115611ca05760608401518451611c81916001600160f81b031690613854565b9150611c8c60135490565b601154611c999190613854565b9050611cb0565b83519150611cad60115490565b90505b611cbe836111738385613854565b925060008311611d035760405162461bcd60e51b815260206004820152601060248201526f14d95b1b195c8e8814dbdb19081bdd5d60821b6044820152606401610807565b602084015115611e5f57336001600160a01b038816811415906000903214801590611d375750326001600160a01b038a1614155b9050611d67858a6040518060400160405280600b81526020016a109d5e595c881b1a5b5a5d60aa1b8152506124aa565b94508115611da157611d9e85336040518060400160405280600c81526020016b14d95b99195c881b1a5b5a5d60a21b8152506124aa565b94505b8015611dd957611dd685326040518060400160405280600c81526020016b13dc9a59da5b881b1a5b5a5d60a21b8152506124aa565b94505b6001600160a01b03891660009081526012602052604081208054879290611e019084906138b0565b90915550508115611e31573360009081526012602052604081208054879290611e2b9084906138b0565b90915550505b8015611e5c573260009081526012602052604081208054879290611e569084906138b0565b90915550505b50505b6000611e6b8487610e23565b905080341015611ec157611e8b611e86633b9aca0083613816565b612178565b604051602001611e9b91906138c8565b60408051601f198184030181529082905262461bcd60e51b8252610807916004016132cb565b611ecd88856000612147565b611ed8601185612151565b84516011541115611eeb57611eeb61386b565b8015611f5057601054611f07906001600160a01b0316826124fc565b60105460408051868152602081018490526001600160a01b03909216917f01f51b99bd1c3cca301836178e5dee13aadfe44eff06dc3ddcbf3c9d058454f8910160405180910390a25b8034111561202857336000611f658334613854565b9050600080836001600160a01b03168360405160006040518083038185875af1925050503d8060008114611fb5576040519150601f19603f3d011682016040523d82523d6000602084013e611fba565b606091505b5091509150818190611fdf5760405162461bcd60e51b815260040161080791906132cb565b50836001600160a01b03167fbb28353e4598c3b9199101a66e0989549b659a59a54d2c27fbb183f1932c8e6d8460405161201b91815260200190565b60405180910390a2505050505b50506001600a55505050505050565b3361204181612615565b6001600160a01b0316836001600160a01b031614156120f35781612066576001612069565b60005b6001600160a01b0382166000908152600760205260409020805460ff19166001838181111561209a5761209a61390d565b0217905550826001600160a01b0316816001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31846040516120e6911515815260200190565b60405180910390a3505050565b610a5681848461276c565b612109848484611764565b61211584848484612833565b6110f65760405162461bcd60e51b815260040161080790613923565b60008183106121405781610e2f565b5090919050565b610a568383612931565b8082600001600082825461216591906138b0565b90915550505050565b6060610ff461294b565b60608161219c5750506040805180820190915260018152600360fc1b602082015290565b8160005b81156121c657806121b081613975565b91506121bf9050600a83613816565b91506121a0565b60008167ffffffffffffffff8111156121e1576121e16133d3565b6040519080825280601f01601f19166020018201604052801561220b576020820181803683370190505b5090505b841561175c57612220600183613854565b915061222d600a86613990565b6122389060306138b0565b60f81b81838151811061224d5761224d6139a4565b60200101906001600160f81b031916908160001a90535061226f600a86613816565b945061220f565b6001600160a01b03808316600090815260056020908152604080832093851683529290529081205460ff16156122ae575060016107d7565b6001600160a01b03831660009081526007602052604081205460ff1660018111156122db576122db61390d565b148015610e2f5750610e2f838361295a565b6000610e2f836001600160a01b038416612999565b60006107d7826129e8565b600081815260018301602052604081205480156123f6576000612331600183613854565b855490915060009061234590600190613854565b90508181146123aa576000866000018281548110612365576123656139a4565b9060005260206000200154905080876000018481548110612388576123886139a4565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806123bb576123bb6139ba565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506107d7565b60009150506107d7565b610a56838383612a38565b60006124178251612178565b826040516020016124299291906139d0565b604051602081830303815290604052805190602001209050919050565b61245284848484612b34565b6110f65760405162461bcd60e51b815260206004820152602360248201527f5369676e6174757265436865636b65723a20496e76616c6964207369676e617460448201526275726560e81b6064820152608401610807565b6001600160a01b038216600090815260126020526040812054600c5482916124d191613854565b9050806124e95782604051602001611e9b9190613a2b565b6124f38582612131565b95945050505050565b8047101561254c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610807565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612599576040519150601f19603f3d011682016040523d82523d6000602084013e61259e565b606091505b5050905080610a565760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610807565b60008046806001811461264a576089811461266657600481146126825762013881811461269e5761053981146126ba576126d2565b73a5409ec958c83c3f309868babaca7c86dcb077c192506126d2565b7358807bad0b376efc12f5ad86aac70e78ed67deae92506126d2565b73f57b2c51ded3a29e6891aba85459d600256cf31792506126d2565b73ff7ca10af37178bdd056628ef42fd7f799fac77c92506126d2565b73e1a2bbc877b29adbc56d2659dbcb0ae14ee6207192505b506001600160a01b03821615806126e95750806089145b806126f657508062013881145b15612702575092915050565b60405163c455279160e01b81526001600160a01b03858116600483015283169063c455279190602401602060405180830381865afa158015612748573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061175c9190613a5b565b816001600160a01b0316836001600160a01b031614156127ce5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610807565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3191016120e6565b60006001600160a01b0384163b1561292657604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612877903390899088908890600401613a78565b6020604051808303816000875af19250505080156128b2575060408051601f3d908101601f191682019092526128af91810190613ab5565b60015b61290c573d8080156128e0576040519150601f19603f3d011682016040523d82523d6000602084013e6128e5565b606091505b5080516129045760405162461bcd60e51b815260040161080790613923565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061175c565b506001949350505050565b61081a828260405180602001604052806000815250612b80565b60606009805461082d9061373f565b60008061296684612615565b90506001600160a01b0381161580159061175c5750826001600160a01b0316816001600160a01b03161491505092915050565b60008181526001830160205260408120546129e0575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556107d7565b5060006107d7565b60006001600160e01b031982166380ac58cd60e01b1480612a1957506001600160e01b03198216635b5e139f60e01b145b806107d757506301ffc9a760e01b6001600160e01b03198316146107d7565b612a43838383612bca565b6001600160a01b0382161580612a85575060016001600160a01b03831660009081526007602052604090205460ff166001811115612a8357612a8361390d565b145b15612a8f57505050565b6000612a9a83612615565b90506001600160a01b038116612ad15750506001600160a01b03166000908152600760205260409020805460ff1916600117905550565b612ada83610efc565b6110f657806001600160a01b0316836001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c316001604051612b26911515815260200190565b60405180910390a350505050565b60006124f3612b798585858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612c3892505050565b8690612c5c565b6000612b8b60085490565b90506000612b9984836138b0565b90505b80821015612bbf57612baf858385612c7e565b612bb882613975565b9150612b9c565b611063600885612151565b600654600160a01b900460ff1615610a565760405162461bcd60e51b815260206004820152602b60248201527f4552433732315061757361626c653a20746f6b656e207472616e73666572207760448201526a1a1a5b19481c185d5cd95960aa1b6064820152608401610807565b6000806000612c478585612cb1565b91509150612c5481612d1e565b509392505050565b6001600160a01b03811660009081526001830160205260408120541515610e2f565b612c888383612ed9565b612c956000848484612833565b610a565760405162461bcd60e51b815260040161080790613923565b600080825160411415612ce85760208301516040840151606085015160001a612cdc87828585613027565b94509450505050610bf1565b825160401415612d125760208301516040840151612d07868383613114565b935093505050610bf1565b50600090506002610bf1565b6000816004811115612d3257612d3261390d565b1415612d3b5750565b6001816004811115612d4f57612d4f61390d565b1415612d9d5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610807565b6002816004811115612db157612db161390d565b1415612dff5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610807565b6003816004811115612e1357612e1361390d565b1415612e6c5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610807565b6004816004811115612e8057612e8061390d565b14156114e15760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610807565b6001600160a01b038216612f2f5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610807565b6000818152600260205260409020546001600160a01b031615612f945760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610807565b612fa060008383612400565b6001600160a01b0382166000908152600360205260408120805460019290612fc99084906138b0565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561305e575060009050600361310b565b8460ff16601b1415801561307657508460ff16601c14155b15613087575060009050600461310b565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156130db573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166131045760006001925092505061310b565b9150600090505b94509492505050565b6000806001600160ff1b0383168161313160ff86901c601b6138b0565b905061313f87828885613027565b935093505050935093915050565b8280546131599061373f565b90600052602060002090601f01602090048101928261317b57600085556131c1565b82601f1061319457805160ff19168380011785556131c1565b828001600101855582156131c1579182015b828111156131c15782518255916020019190600101906131a6565b506131cd9291506131d1565b5090565b5b808211156131cd57600081556001016131d2565b6001600160e01b0319811681146114e157600080fd5b60006020828403121561320e57600080fd5b8135610e2f816131e6565b6001600160a01b03811681146114e157600080fd5b6000806040838503121561324157600080fd5b823561324c81613219565b915060208301356001600160601b038116811461326857600080fd5b809150509250929050565b60005b8381101561328e578181015183820152602001613276565b838111156110f65750506000910152565b600081518084526132b7816020860160208601613273565b601f01601f19169290920160200192915050565b602081526000610e2f602083018461329f565b6000602082840312156132f057600080fd5b5035919050565b6000806040838503121561330a57600080fd5b823561331581613219565b946020939093013593505050565b60006020828403121561333557600080fd5b8135610e2f81613219565b60008060006060848603121561335557600080fd5b833561336081613219565b9250602084013561337081613219565b929592945050506040919091013590565b8035801515811461339157600080fd5b919050565b6000602082840312156133a857600080fd5b610e2f82613381565b600080604083850312156133c457600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b60405160e0810167ffffffffffffffff8111828210171561340c5761340c6133d3565b60405290565b600060e0828403121561342457600080fd5b61342c6133e9565b82358152602080840135908201526040808401359082015260608301356001600160f81b038116811461345e57600080fd5b606082015261346f60808401613381565b608082015261348060a08401613381565b60a082015261349160c08401613381565b60c08201529392505050565b600067ffffffffffffffff808411156134b8576134b86133d3565b604051601f8501601f19908116603f011681019082821181831017156134e0576134e06133d3565b816040528093508581528686860111156134f957600080fd5b858560208301376000602087830101525050509392505050565b60006020828403121561352557600080fd5b813567ffffffffffffffff81111561353c57600080fd5b8201601f8101841361354d57600080fd5b61175c8482356020840161349d565b60008060006060848603121561357157600080fd5b833561357c81613219565b95602085013595506040909401359392505050565b6000806000806000608086880312156135a957600080fd5b85356135b481613219565b94506020860135935060408601359250606086013567ffffffffffffffff808211156135df57600080fd5b818801915088601f8301126135f357600080fd5b81358181111561360257600080fd5b89602082850101111561361457600080fd5b9699959850939650602001949392505050565b6000806040838503121561363a57600080fd5b823561364581613219565b915061365360208401613381565b90509250929050565b6000806000806080858703121561367257600080fd5b843561367d81613219565b9350602085013561368d81613219565b925060408501359150606085013567ffffffffffffffff8111156136b057600080fd5b8501601f810187136136c157600080fd5b6136d08782356020840161349d565b91505092959194509250565b600080604083850312156136ef57600080fd5b82356136fa81613219565b9150602083013561326881613219565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600181811c9082168061375357607f821691505b6020821081141561377457634e487b7160e01b600052602260045260246000fd5b50919050565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b60008160001904831182151516156137fb576137fb6137cb565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261382557613825613800565b500490565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b600082821015613866576138666137cb565b500390565b634e487b7160e01b600052600160045260246000fd5b60008351613893818460208801613273565b8351908301906138a7818360208801613273565b01949350505050565b600082198211156138c3576138c36137cb565b500190565b6d029b2b63632b91d1021b7b9ba39960951b8152600082516138f181600e850160208701613273565b64204757656960d81b600e939091019283015250601301919050565b634e487b7160e01b600052602160045260246000fd5b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6000600019821415613989576139896137cb565b5060010190565b60008261399f5761399f613800565b500690565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b7f19457468657265756d205369676e6564204d6573736167653a0a000000000000815260008351613a0881601a850160208801613273565b835190830190613a1f81601a840160208801613273565b01601a01949350505050565b67029b2b63632b91d160c51b815260008251613a4e816008850160208701613273565b9190910160080192915050565b600060208284031215613a6d57600080fd5b8151610e2f81613219565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090613aab9083018461329f565b9695505050505050565b600060208284031215613ac757600080fd5b8151610e2f816131e656fea2646970667358221220f38387089f3ca9cd9b6c296bf459a417c9697e23e4c99ed7929a8d40aed6413a64736f6c634300080b00334f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572000000000000000000000000ee8e538055cd3248880e52a1ae88d0dd42d8f38c0000000000000000000000008a95907dfa8bc631462f17d6ac731337e641a112
Deployed Bytecode
0x6080604052600436106102465760003560e01c80636352211e11610139578063a22cb465116100b6578063c62752551161007a578063c627525514610717578063c87b56dd14610737578063d547cfb714610757578063e985e9c51461076c578063eb12d61e1461078c578063f2fde38b146107ac57600080fd5b8063a22cb46514610616578063a945bf8014610636578063b88d4fde1461064c578063bb69b7ef1461066c578063bf62e21d146106f757600080fd5b80639106d7ba116100fd5780639106d7ba146105a65780639437bfa0146105bb57806395d89b41146105db57806396d66de0146105f05780639f93f7791461060357600080fd5b80636352211e1461051e57806370a082311461053e578063715018a61461055e5780638456cb59146105735780638da5cb5b1461058857600080fd5b80632a55205a116101c75780633f4ba83a1161018b5780633f4ba83a1461048057806342842e0e1461049557806353ac010a146104b55780635a028400146104cf5780635c975abb146104ff57600080fd5b80632a55205a146103c15780632f274bd41461040057806330176e131461042057806338af3eed146104405780633ec02e141461046057600080fd5b80630e316ab71161020e5780630e316ab71461031c57806318160ddd1461033c5780631c31f7101461036157806323b872dd14610381578063254a4737146103a157600080fd5b806301ffc9a71461024b57806302fa7c471461028057806306fdde03146102a2578063081812fc146102c4578063095ea7b3146102fc575b600080fd5b34801561025757600080fd5b5061026b6102663660046131fc565b6107cc565b60405190151581526020015b60405180910390f35b34801561028c57600080fd5b506102a061029b36600461322e565b6107dd565b005b3480156102ae57600080fd5b506102b761081e565b60405161027791906132cb565b3480156102d057600080fd5b506102e46102df3660046132de565b6108b0565b6040516001600160a01b039091168152602001610277565b34801561030857600080fd5b506102a06103173660046132f7565b610945565b34801561032857600080fd5b506102a0610337366004613323565b610a5b565b34801561034857600080fd5b506008546103539081565b604051908152602001610277565b34801561036d57600080fd5b506102a061037c366004613323565b610a90565b34801561038d57600080fd5b506102a061039c366004613340565b610adc565b3480156103ad57600080fd5b506102a06103bc366004613396565b610b0d565b3480156103cd57600080fd5b506103e16103dc3660046133b1565b610b4a565b604080516001600160a01b039093168352602083019190915201610277565b34801561040c57600080fd5b506102a061041b366004613412565b610bf8565b34801561042c57600080fd5b506102a061043b366004613513565b610de6565b34801561044c57600080fd5b506010546102e4906001600160a01b031681565b34801561046c57600080fd5b5061035361047b3660046133b1565b610e23565b34801561048c57600080fd5b506102a0610e36565b3480156104a157600080fd5b506102a06104b0366004613340565b610e6a565b3480156104c157600080fd5b5060195461026b9060ff1681565b3480156104db57600080fd5b5061026b6104ea3660046132de565b60186020526000908152604090205460ff1681565b34801561050b57600080fd5b50600654600160a01b900460ff1661026b565b34801561052a57600080fd5b506102e46105393660046132de565b610e85565b34801561054a57600080fd5b50610353610559366004613323565b610efc565b34801561056a57600080fd5b506102a0610f83565b34801561057f57600080fd5b506102a0610fb7565b34801561059457600080fd5b506006546001600160a01b03166102e4565b3480156105b257600080fd5b50610353610fe9565b3480156105c757600080fd5b5061026b6105d636600461355c565b610ff9565b3480156105e757600080fd5b506102b761102e565b6102a06105fe366004613591565b61103d565b6102a06106113660046132f7565b61106a565b34801561062257600080fd5b506102a0610631366004613627565b6110ba565b34801561064257600080fd5b50610353601a5481565b34801561065857600080fd5b506102a061066736600461365c565b6110c4565b34801561067857600080fd5b50600b54600c54600d54600e54600f546106b4949392916001600160f81b0381169160ff600160f81b9092048216918181169161010090041687565b604080519788526020880196909652948601939093526001600160f81b03909116606085015215156080840152151560a0830152151560c082015260e001610277565b34801561070357600080fd5b506102a06107123660046132f7565b6110fc565b34801561072357600080fd5b506102a06107323660046132de565b611271565b34801561074357600080fd5b506102b76107523660046132de565b6112a0565b34801561076357600080fd5b506102b761137a565b34801561077857600080fd5b5061026b6107873660046136dc565b611408565b34801561079857600080fd5b506102a06107a7366004613323565b611414565b3480156107b857600080fd5b506102a06107c7366004613323565b611449565b60006107d7826114e8565b92915050565b6006546001600160a01b031633146108105760405162461bcd60e51b81526004016108079061370a565b60405180910390fd5b61081a828261150d565b5050565b60606000805461082d9061373f565b80601f01602080910402602001604051908101604052809291908181526020018280546108599061373f565b80156108a65780601f1061087b576101008083540402835291602001916108a6565b820191906000526020600020905b81548152906001019060200180831161088957829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b03166109295760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610807565b506000908152600460205260409020546001600160a01b031690565b600061095082610e85565b9050806001600160a01b0316836001600160a01b031614156109be5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610807565b336001600160a01b03821614806109da57506109da8133611408565b610a4c5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610807565b610a56838361160a565b505050565b6006546001600160a01b03163314610a855760405162461bcd60e51b81526004016108079061370a565b61081a601482611678565b6006546001600160a01b03163314610aba5760405162461bcd60e51b81526004016108079061370a565b601080546001600160a01b0319166001600160a01b0392909216919091179055565b610ae6338261168d565b610b025760405162461bcd60e51b81526004016108079061377a565b610a56838383611764565b6006546001600160a01b03163314610b375760405162461bcd60e51b81526004016108079061370a565b6019805460ff1916911515919091179055565b60008281526017602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b0316928201929092528291610bbf5750604080518082019091526016546001600160a01b0381168252600160a01b90046001600160601b031660208201525b602081015160009061271090610bde906001600160601b0316876137e1565b610be89190613816565b91519350909150505b9250929050565b6006546001600160a01b03163314610c225760405162461bcd60e51b81526004016108079061370a565b80606001516001600160f81b031681600001511015610c835760405162461bcd60e51b815260206004820152601c60248201527f53656c6c65723a2065786365737369766520667265652071756f7461000000006044820152606401610807565b60115481511015610cd65760405162461bcd60e51b815260206004820181905260248201527f53656c6c65723a20696e76656e746f7279203c20616c726561647920736f6c646044820152606401610807565b60135481606001516001600160f81b03161015610d3f5760405162461bcd60e51b815260206004820152602160248201527f53656c6c65723a20667265652071756f7461203c20616c7265616479207573656044820152601960fa1b6064820152608401610807565b600f54610100900460ff1615610d5c57600160c0820152600b5481525b600f5460ff1615610d8057600160a0820152600e546001600160f81b031660608201525b8051600b556020810151600c556040810151600d55606081015160808201511515600160f81b026001600160f81b0390911617600e5560a0810151600f805460c09093015115156101000261ff00199215159290921661ffff1990931692909217179055565b6006546001600160a01b03163314610e105760405162461bcd60e51b81526004016108079061370a565b805161081a90600990602084019061314d565b6000610e2f82846137e1565b9392505050565b6006546001600160a01b03163314610e605760405162461bcd60e51b81526004016108079061370a565b610e6861190b565b565b610a56838383604051806020016040528060008152506110c4565b6000818152600260205260408120546001600160a01b0316806107d75760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610807565b60006001600160a01b038216610f675760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610807565b506001600160a01b031660009081526003602052604090205490565b6006546001600160a01b03163314610fad5760405162461bcd60e51b81526004016108079061370a565b610e6860006119a8565b6006546001600160a01b03163314610fe15760405162461bcd60e51b81526004016108079061370a565b610e686119fa565b6000610ff460115490565b905090565b60006018600061101261100d878787611a5f565b611aa5565b815260208101919091526040016000205460ff16949350505050565b60606001805461082d9061373f565b61105761104b868686611a5f565b60149084846018611ab0565b61106385600186611b59565b5050505050565b60195460ff166110ad5760405162461bcd60e51b815260206004820152600e60248201526d135a5b9d1a5b99c818db1bdcd95960921b6044820152606401610807565b61081a8282601a54611b59565b61081a8282612037565b6110ce338361168d565b6110ea5760405162461bcd60e51b81526004016108079061377a565b6110f6848484846120fe565b50505050565b6006546001600160a01b031633146111265760405162461bcd60e51b81526004016108079061370a565b600654600160a01b900460ff16156111505760405162461bcd60e51b81526004016108079061382a565b600e546001600160f81b03166111788261116960135490565b6111739084613854565b612131565b9150600082116111ca5760405162461bcd60e51b815260206004820152601b60248201527f53656c6c65723a20467265652071756f746120657863656564656400000000006044820152606401610807565b600b546111da8361116960115490565b92506000831161121f5760405162461bcd60e51b815260206004820152601060248201526f14d95b1b195c8e8814dbdb19081bdd5d60821b6044820152606401610807565b61122b84846001612147565b611236601184612151565b611241601384612151565b8061124b60115490565b11156112595761125961386b565b8161126360135490565b11156110f6576110f661386b565b6006546001600160a01b0316331461129b5760405162461bcd60e51b81526004016108079061370a565b601a55565b6000818152600260205260409020546060906001600160a01b031661131f5760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610807565b600061132961216e565b905060008151116113495760405180602001604052806000815250610e2f565b8061135384612178565b604051602001611364929190613881565b6040516020818303038152906040529392505050565b600980546113879061373f565b80601f01602080910402602001604051908101604052809291908181526020018280546113b39061373f565b80156114005780601f106113d557610100808354040283529160200191611400565b820191906000526020600020905b8154815290600101906020018083116113e357829003601f168201915b505050505081565b6000610e2f8383612276565b6006546001600160a01b0316331461143e5760405162461bcd60e51b81526004016108079061370a565b61081a6014826122ed565b6006546001600160a01b031633146114735760405162461bcd60e51b81526004016108079061370a565b6001600160a01b0381166114d85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610807565b6114e1816119a8565b50565b5490565b60006001600160e01b0319821663152a902d60e11b14806107d757506107d782612302565b6127106001600160601b038216111561157b5760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401610807565b6001600160a01b0382166115d15760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401610807565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217601655565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061163f82610e85565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000610e2f836001600160a01b03841661230d565b6000818152600260205260408120546001600160a01b03166117065760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610807565b600061171183610e85565b9050806001600160a01b0316846001600160a01b0316148061174c5750836001600160a01b0316611741846108b0565b6001600160a01b0316145b8061175c575061175c8185611408565b949350505050565b826001600160a01b031661177782610e85565b6001600160a01b0316146117db5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610807565b6001600160a01b03821661183d5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610807565b611848838383612400565b61185360008261160a565b6001600160a01b038316600090815260036020526040812080546001929061187c908490613854565b90915550506001600160a01b03821660009081526003602052604081208054600192906118aa9084906138b0565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600654600160a01b900460ff1661195b5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610807565b6006805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600654600160a01b900460ff1615611a245760405162461bcd60e51b81526004016108079061382a565b6006805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861198b3390565b604051606084811b6bffffffffffffffffffffffff1916602083015260348201849052605482018390529060740160405160208183030381529060405290509392505050565b60006107d78261240b565b6000611abb85611aa5565b60008181526020849052604090205490915060ff1615611b2c5760405162461bcd60e51b815260206004820152602660248201527f5369676e6174757265436865636b65723a204d65737361676520616c726561646044820152651e481d5cd95960d21b6064820152608401610807565b6000818152602083905260409020805460ff19166001179055611b5186828686612446565b505050505050565b6002600a541415611bac5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610807565b6002600a55600654600160a01b900460ff1615611bdb5760405162461bcd60e51b81526004016108079061382a565b6040805160e081018252600b548152600c546020820152600d54918101829052600e546001600160f81b038116606083015260ff600160f81b909104811615156080830152600f54808216151560a0840152610100900416151560c08201529060009015611c5657611c51848360400151612131565b611c58565b835b9050600080836080015115611ca05760608401518451611c81916001600160f81b031690613854565b9150611c8c60135490565b601154611c999190613854565b9050611cb0565b83519150611cad60115490565b90505b611cbe836111738385613854565b925060008311611d035760405162461bcd60e51b815260206004820152601060248201526f14d95b1b195c8e8814dbdb19081bdd5d60821b6044820152606401610807565b602084015115611e5f57336001600160a01b038816811415906000903214801590611d375750326001600160a01b038a1614155b9050611d67858a6040518060400160405280600b81526020016a109d5e595c881b1a5b5a5d60aa1b8152506124aa565b94508115611da157611d9e85336040518060400160405280600c81526020016b14d95b99195c881b1a5b5a5d60a21b8152506124aa565b94505b8015611dd957611dd685326040518060400160405280600c81526020016b13dc9a59da5b881b1a5b5a5d60a21b8152506124aa565b94505b6001600160a01b03891660009081526012602052604081208054879290611e019084906138b0565b90915550508115611e31573360009081526012602052604081208054879290611e2b9084906138b0565b90915550505b8015611e5c573260009081526012602052604081208054879290611e569084906138b0565b90915550505b50505b6000611e6b8487610e23565b905080341015611ec157611e8b611e86633b9aca0083613816565b612178565b604051602001611e9b91906138c8565b60408051601f198184030181529082905262461bcd60e51b8252610807916004016132cb565b611ecd88856000612147565b611ed8601185612151565b84516011541115611eeb57611eeb61386b565b8015611f5057601054611f07906001600160a01b0316826124fc565b60105460408051868152602081018490526001600160a01b03909216917f01f51b99bd1c3cca301836178e5dee13aadfe44eff06dc3ddcbf3c9d058454f8910160405180910390a25b8034111561202857336000611f658334613854565b9050600080836001600160a01b03168360405160006040518083038185875af1925050503d8060008114611fb5576040519150601f19603f3d011682016040523d82523d6000602084013e611fba565b606091505b5091509150818190611fdf5760405162461bcd60e51b815260040161080791906132cb565b50836001600160a01b03167fbb28353e4598c3b9199101a66e0989549b659a59a54d2c27fbb183f1932c8e6d8460405161201b91815260200190565b60405180910390a2505050505b50506001600a55505050505050565b3361204181612615565b6001600160a01b0316836001600160a01b031614156120f35781612066576001612069565b60005b6001600160a01b0382166000908152600760205260409020805460ff19166001838181111561209a5761209a61390d565b0217905550826001600160a01b0316816001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31846040516120e6911515815260200190565b60405180910390a3505050565b610a5681848461276c565b612109848484611764565b61211584848484612833565b6110f65760405162461bcd60e51b815260040161080790613923565b60008183106121405781610e2f565b5090919050565b610a568383612931565b8082600001600082825461216591906138b0565b90915550505050565b6060610ff461294b565b60608161219c5750506040805180820190915260018152600360fc1b602082015290565b8160005b81156121c657806121b081613975565b91506121bf9050600a83613816565b91506121a0565b60008167ffffffffffffffff8111156121e1576121e16133d3565b6040519080825280601f01601f19166020018201604052801561220b576020820181803683370190505b5090505b841561175c57612220600183613854565b915061222d600a86613990565b6122389060306138b0565b60f81b81838151811061224d5761224d6139a4565b60200101906001600160f81b031916908160001a90535061226f600a86613816565b945061220f565b6001600160a01b03808316600090815260056020908152604080832093851683529290529081205460ff16156122ae575060016107d7565b6001600160a01b03831660009081526007602052604081205460ff1660018111156122db576122db61390d565b148015610e2f5750610e2f838361295a565b6000610e2f836001600160a01b038416612999565b60006107d7826129e8565b600081815260018301602052604081205480156123f6576000612331600183613854565b855490915060009061234590600190613854565b90508181146123aa576000866000018281548110612365576123656139a4565b9060005260206000200154905080876000018481548110612388576123886139a4565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806123bb576123bb6139ba565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506107d7565b60009150506107d7565b610a56838383612a38565b60006124178251612178565b826040516020016124299291906139d0565b604051602081830303815290604052805190602001209050919050565b61245284848484612b34565b6110f65760405162461bcd60e51b815260206004820152602360248201527f5369676e6174757265436865636b65723a20496e76616c6964207369676e617460448201526275726560e81b6064820152608401610807565b6001600160a01b038216600090815260126020526040812054600c5482916124d191613854565b9050806124e95782604051602001611e9b9190613a2b565b6124f38582612131565b95945050505050565b8047101561254c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610807565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612599576040519150601f19603f3d011682016040523d82523d6000602084013e61259e565b606091505b5050905080610a565760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610807565b60008046806001811461264a576089811461266657600481146126825762013881811461269e5761053981146126ba576126d2565b73a5409ec958c83c3f309868babaca7c86dcb077c192506126d2565b7358807bad0b376efc12f5ad86aac70e78ed67deae92506126d2565b73f57b2c51ded3a29e6891aba85459d600256cf31792506126d2565b73ff7ca10af37178bdd056628ef42fd7f799fac77c92506126d2565b73e1a2bbc877b29adbc56d2659dbcb0ae14ee6207192505b506001600160a01b03821615806126e95750806089145b806126f657508062013881145b15612702575092915050565b60405163c455279160e01b81526001600160a01b03858116600483015283169063c455279190602401602060405180830381865afa158015612748573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061175c9190613a5b565b816001600160a01b0316836001600160a01b031614156127ce5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610807565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3191016120e6565b60006001600160a01b0384163b1561292657604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612877903390899088908890600401613a78565b6020604051808303816000875af19250505080156128b2575060408051601f3d908101601f191682019092526128af91810190613ab5565b60015b61290c573d8080156128e0576040519150601f19603f3d011682016040523d82523d6000602084013e6128e5565b606091505b5080516129045760405162461bcd60e51b815260040161080790613923565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061175c565b506001949350505050565b61081a828260405180602001604052806000815250612b80565b60606009805461082d9061373f565b60008061296684612615565b90506001600160a01b0381161580159061175c5750826001600160a01b0316816001600160a01b03161491505092915050565b60008181526001830160205260408120546129e0575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556107d7565b5060006107d7565b60006001600160e01b031982166380ac58cd60e01b1480612a1957506001600160e01b03198216635b5e139f60e01b145b806107d757506301ffc9a760e01b6001600160e01b03198316146107d7565b612a43838383612bca565b6001600160a01b0382161580612a85575060016001600160a01b03831660009081526007602052604090205460ff166001811115612a8357612a8361390d565b145b15612a8f57505050565b6000612a9a83612615565b90506001600160a01b038116612ad15750506001600160a01b03166000908152600760205260409020805460ff1916600117905550565b612ada83610efc565b6110f657806001600160a01b0316836001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c316001604051612b26911515815260200190565b60405180910390a350505050565b60006124f3612b798585858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612c3892505050565b8690612c5c565b6000612b8b60085490565b90506000612b9984836138b0565b90505b80821015612bbf57612baf858385612c7e565b612bb882613975565b9150612b9c565b611063600885612151565b600654600160a01b900460ff1615610a565760405162461bcd60e51b815260206004820152602b60248201527f4552433732315061757361626c653a20746f6b656e207472616e73666572207760448201526a1a1a5b19481c185d5cd95960aa1b6064820152608401610807565b6000806000612c478585612cb1565b91509150612c5481612d1e565b509392505050565b6001600160a01b03811660009081526001830160205260408120541515610e2f565b612c888383612ed9565b612c956000848484612833565b610a565760405162461bcd60e51b815260040161080790613923565b600080825160411415612ce85760208301516040840151606085015160001a612cdc87828585613027565b94509450505050610bf1565b825160401415612d125760208301516040840151612d07868383613114565b935093505050610bf1565b50600090506002610bf1565b6000816004811115612d3257612d3261390d565b1415612d3b5750565b6001816004811115612d4f57612d4f61390d565b1415612d9d5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610807565b6002816004811115612db157612db161390d565b1415612dff5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610807565b6003816004811115612e1357612e1361390d565b1415612e6c5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610807565b6004816004811115612e8057612e8061390d565b14156114e15760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610807565b6001600160a01b038216612f2f5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610807565b6000818152600260205260409020546001600160a01b031615612f945760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610807565b612fa060008383612400565b6001600160a01b0382166000908152600360205260408120805460019290612fc99084906138b0565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561305e575060009050600361310b565b8460ff16601b1415801561307657508460ff16601c14155b15613087575060009050600461310b565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156130db573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166131045760006001925092505061310b565b9150600090505b94509492505050565b6000806001600160ff1b0383168161313160ff86901c601b6138b0565b905061313f87828885613027565b935093505050935093915050565b8280546131599061373f565b90600052602060002090601f01602090048101928261317b57600085556131c1565b82601f1061319457805160ff19168380011785556131c1565b828001600101855582156131c1579182015b828111156131c15782518255916020019190600101906131a6565b506131cd9291506131d1565b5090565b5b808211156131cd57600081556001016131d2565b6001600160e01b0319811681146114e157600080fd5b60006020828403121561320e57600080fd5b8135610e2f816131e6565b6001600160a01b03811681146114e157600080fd5b6000806040838503121561324157600080fd5b823561324c81613219565b915060208301356001600160601b038116811461326857600080fd5b809150509250929050565b60005b8381101561328e578181015183820152602001613276565b838111156110f65750506000910152565b600081518084526132b7816020860160208601613273565b601f01601f19169290920160200192915050565b602081526000610e2f602083018461329f565b6000602082840312156132f057600080fd5b5035919050565b6000806040838503121561330a57600080fd5b823561331581613219565b946020939093013593505050565b60006020828403121561333557600080fd5b8135610e2f81613219565b60008060006060848603121561335557600080fd5b833561336081613219565b9250602084013561337081613219565b929592945050506040919091013590565b8035801515811461339157600080fd5b919050565b6000602082840312156133a857600080fd5b610e2f82613381565b600080604083850312156133c457600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b60405160e0810167ffffffffffffffff8111828210171561340c5761340c6133d3565b60405290565b600060e0828403121561342457600080fd5b61342c6133e9565b82358152602080840135908201526040808401359082015260608301356001600160f81b038116811461345e57600080fd5b606082015261346f60808401613381565b608082015261348060a08401613381565b60a082015261349160c08401613381565b60c08201529392505050565b600067ffffffffffffffff808411156134b8576134b86133d3565b604051601f8501601f19908116603f011681019082821181831017156134e0576134e06133d3565b816040528093508581528686860111156134f957600080fd5b858560208301376000602087830101525050509392505050565b60006020828403121561352557600080fd5b813567ffffffffffffffff81111561353c57600080fd5b8201601f8101841361354d57600080fd5b61175c8482356020840161349d565b60008060006060848603121561357157600080fd5b833561357c81613219565b95602085013595506040909401359392505050565b6000806000806000608086880312156135a957600080fd5b85356135b481613219565b94506020860135935060408601359250606086013567ffffffffffffffff808211156135df57600080fd5b818801915088601f8301126135f357600080fd5b81358181111561360257600080fd5b89602082850101111561361457600080fd5b9699959850939650602001949392505050565b6000806040838503121561363a57600080fd5b823561364581613219565b915061365360208401613381565b90509250929050565b6000806000806080858703121561367257600080fd5b843561367d81613219565b9350602085013561368d81613219565b925060408501359150606085013567ffffffffffffffff8111156136b057600080fd5b8501601f810187136136c157600080fd5b6136d08782356020840161349d565b91505092959194509250565b600080604083850312156136ef57600080fd5b82356136fa81613219565b9150602083013561326881613219565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600181811c9082168061375357607f821691505b6020821081141561377457634e487b7160e01b600052602260045260246000fd5b50919050565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b60008160001904831182151516156137fb576137fb6137cb565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261382557613825613800565b500490565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b600082821015613866576138666137cb565b500390565b634e487b7160e01b600052600160045260246000fd5b60008351613893818460208801613273565b8351908301906138a7818360208801613273565b01949350505050565b600082198211156138c3576138c36137cb565b500190565b6d029b2b63632b91d1021b7b9ba39960951b8152600082516138f181600e850160208701613273565b64204757656960d81b600e939091019283015250601301919050565b634e487b7160e01b600052602160045260246000fd5b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6000600019821415613989576139896137cb565b5060010190565b60008261399f5761399f613800565b500690565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b7f19457468657265756d205369676e6564204d6573736167653a0a000000000000815260008351613a0881601a850160208801613273565b835190830190613a1f81601a840160208801613273565b01601a01949350505050565b67029b2b63632b91d160c51b815260008251613a4e816008850160208701613273565b9190910160080192915050565b600060208284031215613a6d57600080fd5b8151610e2f81613219565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090613aab9083018461329f565b9695505050505050565b600060208284031215613ac757600080fd5b8151610e2f816131e656fea2646970667358221220f38387089f3ca9cd9b6c296bf459a417c9697e23e4c99ed7929a8d40aed6413a64736f6c634300080b0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000ee8e538055cd3248880e52a1ae88d0dd42d8f38c0000000000000000000000008a95907dfa8bc631462f17d6ac731337e641a112
-----Decoded View---------------
Arg [0] : beneficiary (address): 0xee8e538055Cd3248880e52a1ae88d0dD42d8f38C
Arg [1] : royaltyReceiver (address): 0x8a95907dfa8bC631462f17d6Ac731337e641A112
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000ee8e538055cd3248880e52a1ae88d0dd42d8f38c
Arg [1] : 0000000000000000000000008a95907dfa8bc631462f17d6ac731337e641a112
Loading...
Loading
Loading...
Loading
[ 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.