Feature Tip: Add private address tag to any address under My Name Tag !
ERC-721
NFT
Overview
Max Total Supply
0 OF
Holders
847
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Balance
1 OFLoading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
oFriend
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 5000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; pragma abicoder v2; import "./ERC721OperatorFilter.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "erc721a/contracts/extensions/ERC721AQueryable.sol"; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import "@openzeppelin/contracts/token/common/ERC2981.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol"; import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol"; error MismatchedInputs(); error HouseOpeningIsClosed(); error HouseClosingIsClosed(); error HouseAlreadyOpen(); error HouseAlreadyClosed(); error CannotOpenUnownedHouse(); error CannotCloseUnownedHouse(); error OfriendFactoryNotOpenYet(); error AddressIsNull(); error TransferFailed(); error PublicSaleClosed(); error NoContractMints(); error MaxMintExceeded(); error OnlyOfriendsBurnable(); error OnlyOfriendsLick(); error AlreadyMintedAddress(); error InvalidSignature(); error NotEnoughEth(); error OnlyOwnerCanDrop(); abstract contract OfriendFactory { function callOfTheWild(address to, uint256 oFriendTokenId) public virtual returns (uint256); } contract oFriend is Ownable, ReentrancyGuard, ERC721OperatorFilter, Pausable, EIP712, ERC2981, ERC721Burnable { using ECDSA for bytes32; event Licked(address indexed toLickContract, uint256 indexed toLickTokenId, uint256 indexed oFriendTokenId); mapping(address => mapping(uint256 => address)) private _licked; uint256 public constant MAX_HOUSES = 10_000; uint256 public constant MAX_PUPPIES = 20_000; uint256 public constant CLOSE_PRICE_BASE = 10_000000000; uint256 public publicClosePrice = 0; uint64 private _oHouseIdCounter = 1; uint64 private _oPuppyIdCounter = 20_000; uint256 private _closePriceRate = 1; address private oMoonContract; address public dogTrainer = 0x420d08165a51e5A14B4a35D37cECF1d5E3A3b79C; address public sigSigner = 0x420d08165a51e5A14B4a35D37cECF1d5E3A3b79C; bool public canOpenHouse; bool public canCloseHouse; bool public raffleMintOpen; bool public puppyMintOpen; bool public friskyMintOpen; uint256 public publicMintPrice; string private _baseTokenURI; constructor() ERC721("oFriend", "OF") EIP712("oFriend", "1") {} function lick(address toLickContract, uint256 toLickTokenId, uint256 oFriendTokenId) external { if (msg.sender != ownerOf(oFriendTokenId)) revert("Cannot lick"); if (oFriendTokenId <= MAX_HOUSES) revert OnlyOfriendsLick(); if (oFriendTokenId > MAX_PUPPIES) revert OnlyOfriendsLick(); _licked[toLickContract][toLickTokenId] = msg.sender; emit Licked(toLickContract, toLickTokenId, oFriendTokenId); } function isLicked(address toLickContract, uint256 toLickTokenId) public view virtual returns (address) { return _licked[toLickContract][toLickTokenId]; } function friskyOfriend(uint256 oFriendTokenId) public nonReentrant() returns (uint256) { if (!friskyMintOpen) { if (msg.sender != owner()) revert HouseOpeningIsClosed(); } if (oFriendTokenId <= MAX_HOUSES) revert OnlyOfriendsBurnable(); if (oFriendTokenId > MAX_PUPPIES) revert OnlyOfriendsBurnable(); address to = ownerOf(oFriendTokenId); if (to != msg.sender) { if (msg.sender != owner()) revert CannotOpenUnownedHouse(); } OfriendFactory factory = OfriendFactory(oMoonContract); _burn(oFriendTokenId); uint256 oMoonTicketId = factory.callOfTheWild(to, oFriendTokenId); return oMoonTicketId; } function openHouse(uint256 houseId) public nonReentrant() returns (uint256) { if (!canOpenHouse) { if (msg.sender != owner()) revert HouseOpeningIsClosed(); } if (houseId > MAX_HOUSES) revert HouseAlreadyOpen(); address to = ownerOf(houseId); if (to != msg.sender) { if (msg.sender != owner()) revert CannotOpenUnownedHouse(); } _burn(houseId); unchecked { houseId += MAX_HOUSES; } _safeMint(to, houseId); return houseId; } function closeHouse(uint256 oFriendTokenId) external payable nonReentrant() returns (uint256) { if (!canCloseHouse) { if (msg.sender != owner()) revert HouseClosingIsClosed(); } if (oFriendTokenId <= MAX_HOUSES) revert HouseAlreadyClosed(); if (oFriendTokenId > MAX_PUPPIES) revert HouseAlreadyClosed(); address to = ownerOf(oFriendTokenId); if (to != msg.sender) { if (msg.sender != owner()) revert CannotCloseUnownedHouse(); } _burn(oFriendTokenId); unchecked { oFriendTokenId -= MAX_HOUSES; _closePriceRate += 1; } _safeMint(to, oFriendTokenId); _refundOverPayment(publicClosePrice); if (publicClosePrice != 0) { uint256 closePriceIncrement; unchecked { closePriceIncrement = _closePriceRate * CLOSE_PRICE_BASE; publicClosePrice += closePriceIncrement; } } return oFriendTokenId; } // ======== oTreats ======== function spillOtreats(address[] calldata receivers) external { if (receivers.length == 0) revert MismatchedInputs(); if (msg.sender != dogTrainer) revert OnlyOwnerCanDrop(); for (uint256 i; i < receivers.length; ) { _mint(receivers[i], _oHouseIdCounter); unchecked { _oHouseIdCounter += 1; ++i; } } } function pause() external onlyOwner { _pause(); } function unpause() external onlyOwner { _unpause(); } // ======== Public Sale ======== function findPuppy(bytes calldata sig) external payable { if (tx.origin != msg.sender) revert NoContractMints(); if (_oPuppyIdCounter + 1 > MAX_PUPPIES) revert MaxMintExceeded(); bytes memory data; // once waitlist mint opens, only check waitlist signatures if (puppyMintOpen) { data = abi.encodePacked(msg.sender, uint256(1)); } else if (raffleMintOpen) { data = abi.encodePacked(msg.sender, uint256(0)); } else { revert PublicSaleClosed(); } address signedAddr = keccak256(data) .toEthSignedMessageHash() .recover(sig); if (sigSigner != signedAddr) revert InvalidSignature(); uint64 oPuppyTokenId = _oPuppyIdCounter; unchecked { _oPuppyIdCounter += 1; } _safeMint(msg.sender, oPuppyTokenId); _refundOverPayment(publicMintPrice); } function _refundOverPayment(uint256 amount) internal { if (msg.value < amount) revert NotEnoughEth(); if (msg.value > amount) { payable(msg.sender).transfer(msg.value - amount); } } // ======== Info ======== function _baseURI() internal view virtual override returns (string memory) { return _baseTokenURI; } // ======== Royalty ======== function setDefaultRoyalty(address receiver, uint96 feeNumerator) external onlyOwner { _setDefaultRoyalty(receiver, feeNumerator); } function deleteDefaultRoyalty() external onlyOwner { _deleteDefaultRoyalty(); } // ======== Admin ======== function toggleCanOpenHouse() external onlyOwner { canOpenHouse = !canOpenHouse; } function toggleCanCloseHouse() external onlyOwner { canCloseHouse = !canCloseHouse; } function setBaseURI(string calldata baseURI_) external onlyOwner { _baseTokenURI = baseURI_; } function setOmoonContract(address contractAddress) external onlyOwner { oMoonContract = contractAddress; } function setSigSigner(address signer) external onlyOwner { if (signer == address(0)) revert AddressIsNull(); sigSigner = signer; } function setDogTrainer(address addr) external onlyOwner { if (addr == address(0)) revert AddressIsNull(); dogTrainer = addr; } function toggleRaffleMint() external onlyOwner { raffleMintOpen = !raffleMintOpen; } function togglePuppyMint() external onlyOwner { puppyMintOpen = !puppyMintOpen; } function setPublicMintPrice(uint256 price) external onlyOwner { publicMintPrice = price; } function setPublicClosePrice(uint256 price) external onlyOwner { publicClosePrice = price; } function withdraw() external onlyOwner { (bool success, ) = msg.sender.call{value: address(this).balance}(""); if (!success) revert TransferFailed(); } function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal whenNotPaused override(ERC721, ERC721OperatorFilter) { super._beforeTokenTransfer(from, to, tokenId); } function supportsInterface(bytes4 interfaceId) public view override(ERC721, ERC2981) returns (bool) { return ERC721.supportsInterface(interfaceId) || ERC2981.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol) pragma solidity ^0.8.0; import "./ECDSA.sol"; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible, * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding * they need in their contracts using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * _Available since v3.4._ */ abstract contract EIP712 { /* solhint-disable var-name-mixedcase */ // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to // invalidate the cached domain separator if the chain id changes. bytes32 private immutable _CACHED_DOMAIN_SEPARATOR; uint256 private immutable _CACHED_CHAIN_ID; address private immutable _CACHED_THIS; bytes32 private immutable _HASHED_NAME; bytes32 private immutable _HASHED_VERSION; bytes32 private immutable _TYPE_HASH; /* solhint-enable var-name-mixedcase */ /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ constructor(string memory name, string memory version) { bytes32 hashedName = keccak256(bytes(name)); bytes32 hashedVersion = keccak256(bytes(version)); bytes32 typeHash = keccak256( "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" ); _HASHED_NAME = hashedName; _HASHED_VERSION = hashedVersion; _CACHED_CHAIN_ID = block.chainid; _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion); _CACHED_THIS = address(this); _TYPE_HASH = typeHash; } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) { return _CACHED_DOMAIN_SEPARATOR; } else { return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION); } } function _buildDomainSeparator( bytes32 typeHash, bytes32 nameHash, bytes32 versionHash ) private view returns (bytes32) { return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this))); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/extensions/ERC721Burnable.sol) pragma solidity ^0.8.0; import "../ERC721.sol"; import "../../../utils/Context.sol"; /** * @title ERC721 Burnable Token * @dev ERC721 Token that can be burned (destroyed). */ abstract contract ERC721Burnable is Context, ERC721 { /** * @dev Burns `tokenId`. See {ERC721-_burn}. * * Requirements: * * - The caller must own `tokenId` or be an approved operator. */ function burn(uint256 tokenId) public virtual { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner nor approved"); _burn(tokenId); } }
// 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 (last updated v4.7.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) public 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: * * - `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 (last updated v4.7.3) (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) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } if (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 // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721AQueryable.sol'; import '../ERC721A.sol'; /** * @title ERC721AQueryable. * * @dev ERC721A subclass with convenience query functions. */ abstract contract ERC721AQueryable is ERC721A, IERC721AQueryable { /** * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting. * * If the `tokenId` is out of bounds: * * - `addr = address(0)` * - `startTimestamp = 0` * - `burned = false` * - `extraData = 0` * * If the `tokenId` is burned: * * - `addr = <Address of owner before token was burned>` * - `startTimestamp = <Timestamp when token was burned>` * - `burned = true` * - `extraData = <Extra data when token was burned>` * * Otherwise: * * - `addr = <Address of owner>` * - `startTimestamp = <Timestamp of start of ownership>` * - `burned = false` * - `extraData = <Extra data at start of ownership>` */ function explicitOwnershipOf(uint256 tokenId) public view virtual override returns (TokenOwnership memory) { TokenOwnership memory ownership; if (tokenId < _startTokenId() || tokenId >= _nextTokenId()) { return ownership; } ownership = _ownershipAt(tokenId); if (ownership.burned) { return ownership; } return _ownershipOf(tokenId); } /** * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order. * See {ERC721AQueryable-explicitOwnershipOf} */ function explicitOwnershipsOf(uint256[] calldata tokenIds) external view virtual override returns (TokenOwnership[] memory) { unchecked { uint256 tokenIdsLength = tokenIds.length; TokenOwnership[] memory ownerships = new TokenOwnership[](tokenIdsLength); for (uint256 i; i != tokenIdsLength; ++i) { ownerships[i] = explicitOwnershipOf(tokenIds[i]); } return ownerships; } } /** * @dev Returns an array of token IDs owned by `owner`, * in the range [`start`, `stop`) * (i.e. `start <= tokenId < stop`). * * This function allows for tokens to be queried if the collection * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}. * * Requirements: * * - `start < stop` */ function tokensOfOwnerIn( address owner, uint256 start, uint256 stop ) external view virtual override returns (uint256[] memory) { unchecked { if (start >= stop) revert InvalidQueryRange(); uint256 tokenIdsIdx; uint256 stopLimit = _nextTokenId(); // Set `start = max(start, _startTokenId())`. if (start < _startTokenId()) { start = _startTokenId(); } // Set `stop = min(stop, stopLimit)`. if (stop > stopLimit) { stop = stopLimit; } uint256 tokenIdsMaxLength = balanceOf(owner); // Set `tokenIdsMaxLength = min(balanceOf(owner), stop - start)`, // to cater for cases where `balanceOf(owner)` is too big. if (start < stop) { uint256 rangeLength = stop - start; if (rangeLength < tokenIdsMaxLength) { tokenIdsMaxLength = rangeLength; } } else { tokenIdsMaxLength = 0; } uint256[] memory tokenIds = new uint256[](tokenIdsMaxLength); if (tokenIdsMaxLength == 0) { return tokenIds; } // We need to call `explicitOwnershipOf(start)`, // because the slot at `start` may not be initialized. TokenOwnership memory ownership = explicitOwnershipOf(start); address currOwnershipAddr; // If the starting slot exists (i.e. not burned), initialize `currOwnershipAddr`. // `ownership.address` will not be zero, as `start` is clamped to the valid token ID range. if (!ownership.burned) { currOwnershipAddr = ownership.addr; } for (uint256 i = start; i != stop && tokenIdsIdx != tokenIdsMaxLength; ++i) { ownership = _ownershipAt(i); if (ownership.burned) { continue; } if (ownership.addr != address(0)) { currOwnershipAddr = ownership.addr; } if (currOwnershipAddr == owner) { tokenIds[tokenIdsIdx++] = i; } } // Downsize the array to fit. assembly { mstore(tokenIds, tokenIdsIdx) } return tokenIds; } } /** * @dev Returns an array of token IDs owned by `owner`. * * This function scans the ownership mapping and is O(`totalSupply`) in complexity. * It is meant to be called off-chain. * * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into * multiple smaller scans if the collection is large enough to cause * an out-of-gas error (10K collections should be fine). */ function tokensOfOwner(address owner) external view virtual override returns (uint256[] memory) { unchecked { uint256 tokenIdsIdx; address currOwnershipAddr; uint256 tokenIdsLength = balanceOf(owner); uint256[] memory tokenIds = new uint256[](tokenIdsLength); TokenOwnership memory ownership; for (uint256 i = _startTokenId(); tokenIdsIdx != tokenIdsLength; ++i) { ownership = _ownershipAt(i); if (ownership.burned) { continue; } if (ownership.addr != address(0)) { currOwnershipAddr = ownership.addr; } if (currOwnershipAddr == owner) { tokenIds[tokenIdsIdx++] = i; } } return tokenIds; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (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 Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { 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 pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "./IOperatorFilter.sol"; abstract contract ERC721OperatorFilter is ERC721, Ownable { IOperatorFilter private operatorFilter_; mapping(address => bool) private groupFilter; function setOperatorFilter(IOperatorFilter filter) public onlyOwner { operatorFilter_ = filter; } function setGroupFilter(address filter) public onlyOwner { groupFilter[filter] = true; } function removeGroupFilter(address filter) public onlyOwner { groupFilter[filter] = false; } function getGroupFilter(address filter) public view returns (bool) { return !!groupFilter[filter]; } function operatorFilter() public view returns (IOperatorFilter) { return operatorFilter_; } function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override(ERC721) { if (groupFilter[from]) revert("ERC721OperatorFilter: illegal operator"); if (groupFilter[to]) revert("ERC721OperatorFilter: illegal operator"); if ( from != address(0) && to != address(0) && !_mayTransfer(msg.sender, tokenId) ) { revert("ERC721OperatorFilter: illegal operator"); } super._beforeTokenTransfer(from, to, tokenId); } function _mayTransfer(address operator, uint256 tokenId) private view returns (bool) { IOperatorFilter filter = operatorFilter_; if (address(filter) == address(0)) return true; if (operator == ownerOf(tokenId)) return true; return filter.mayTransfer(msg.sender); } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721A.sol'; /** * @dev Interface of ERC721 token receiver. */ interface ERC721A__IERC721Receiver { function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } /** * @title ERC721A * * @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721) * Non-Fungible Token Standard, including the Metadata extension. * Optimized for lower gas during batch mints. * * Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...) * starting from `_startTokenId()`. * * Assumptions: * * - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply. * - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256). */ contract ERC721A is IERC721A { // Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364). struct TokenApprovalRef { address value; } // ============================================================= // CONSTANTS // ============================================================= // Mask of an entry in packed address data. uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1; // The bit position of `numberMinted` in packed address data. uint256 private constant _BITPOS_NUMBER_MINTED = 64; // The bit position of `numberBurned` in packed address data. uint256 private constant _BITPOS_NUMBER_BURNED = 128; // The bit position of `aux` in packed address data. uint256 private constant _BITPOS_AUX = 192; // Mask of all 256 bits in packed address data except the 64 bits for `aux`. uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1; // The bit position of `startTimestamp` in packed ownership. uint256 private constant _BITPOS_START_TIMESTAMP = 160; // The bit mask of the `burned` bit in packed ownership. uint256 private constant _BITMASK_BURNED = 1 << 224; // The bit position of the `nextInitialized` bit in packed ownership. uint256 private constant _BITPOS_NEXT_INITIALIZED = 225; // The bit mask of the `nextInitialized` bit in packed ownership. uint256 private constant _BITMASK_NEXT_INITIALIZED = 1 << 225; // The bit position of `extraData` in packed ownership. uint256 private constant _BITPOS_EXTRA_DATA = 232; // Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`. uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1; // The mask of the lower 160 bits for addresses. uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1; // The maximum `quantity` that can be minted with {_mintERC2309}. // This limit is to prevent overflows on the address data entries. // For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309} // is required to cause an overflow, which is unrealistic. uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000; // The `Transfer` event signature is given by: // `keccak256(bytes("Transfer(address,address,uint256)"))`. bytes32 private constant _TRANSFER_EVENT_SIGNATURE = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef; // ============================================================= // STORAGE // ============================================================= // The next token ID to be minted. uint256 private _currentIndex; // The number of tokens burned. uint256 private _burnCounter; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to ownership details // An empty struct value does not necessarily mean the token is unowned. // See {_packedOwnershipOf} implementation for details. // // Bits Layout: // - [0..159] `addr` // - [160..223] `startTimestamp` // - [224] `burned` // - [225] `nextInitialized` // - [232..255] `extraData` mapping(uint256 => uint256) private _packedOwnerships; // Mapping owner address to address data. // // Bits Layout: // - [0..63] `balance` // - [64..127] `numberMinted` // - [128..191] `numberBurned` // - [192..255] `aux` mapping(address => uint256) private _packedAddressData; // Mapping from token ID to approved address. mapping(uint256 => TokenApprovalRef) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; // ============================================================= // CONSTRUCTOR // ============================================================= constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; _currentIndex = _startTokenId(); } // ============================================================= // TOKEN COUNTING OPERATIONS // ============================================================= /** * @dev Returns the starting token ID. * To change the starting token ID, please override this function. */ function _startTokenId() internal view virtual returns (uint256) { return 0; } /** * @dev Returns the next token ID to be minted. */ function _nextTokenId() internal view virtual returns (uint256) { return _currentIndex; } /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() public view virtual override returns (uint256) { // Counter underflow is impossible as _burnCounter cannot be incremented // more than `_currentIndex - _startTokenId()` times. unchecked { return _currentIndex - _burnCounter - _startTokenId(); } } /** * @dev Returns the total amount of tokens minted in the contract. */ function _totalMinted() internal view virtual returns (uint256) { // Counter underflow is impossible as `_currentIndex` does not decrement, // and it is initialized to `_startTokenId()`. unchecked { return _currentIndex - _startTokenId(); } } /** * @dev Returns the total number of tokens burned. */ function _totalBurned() internal view virtual returns (uint256) { return _burnCounter; } // ============================================================= // ADDRESS DATA OPERATIONS // ============================================================= /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) public view virtual override returns (uint256) { if (owner == address(0)) revert BalanceQueryForZeroAddress(); return _packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens minted by `owner`. */ function _numberMinted(address owner) internal view returns (uint256) { return (_packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens burned by or on behalf of `owner`. */ function _numberBurned(address owner) internal view returns (uint256) { return (_packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). */ function _getAux(address owner) internal view returns (uint64) { return uint64(_packedAddressData[owner] >> _BITPOS_AUX); } /** * Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). * If there are multiple variables, please pack them into a uint64. */ function _setAux(address owner, uint64 aux) internal virtual { uint256 packed = _packedAddressData[owner]; uint256 auxCasted; // Cast `aux` with assembly to avoid redundant masking. assembly { auxCasted := aux } packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX); _packedAddressData[owner] = packed; } // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { // The interface IDs are constants representing the first 4 bytes // of the XOR of all function selectors in the interface. // See: [ERC165](https://eips.ethereum.org/EIPS/eip-165) // (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`) return interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165. interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721. interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata. } // ============================================================= // IERC721Metadata // ============================================================= /** * @dev Returns the token collection name. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the token collection symbol. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : ''; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, it can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ''; } // ============================================================= // OWNERSHIPS OPERATIONS // ============================================================= /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { return address(uint160(_packedOwnershipOf(tokenId))); } /** * @dev Gas spent here starts off proportional to the maximum mint batch size. * It gradually moves to O(1) as tokens get transferred around over time. */ function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnershipOf(tokenId)); } /** * @dev Returns the unpacked `TokenOwnership` struct at `index`. */ function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnerships[index]); } /** * @dev Initializes the ownership slot minted at `index` for efficiency purposes. */ function _initializeOwnershipAt(uint256 index) internal virtual { if (_packedOwnerships[index] == 0) { _packedOwnerships[index] = _packedOwnershipOf(index); } } /** * Returns the packed ownership data of `tokenId`. */ function _packedOwnershipOf(uint256 tokenId) private view returns (uint256) { uint256 curr = tokenId; unchecked { if (_startTokenId() <= curr) if (curr < _currentIndex) { uint256 packed = _packedOwnerships[curr]; // If not burned. if (packed & _BITMASK_BURNED == 0) { // Invariant: // There will always be an initialized ownership slot // (i.e. `ownership.addr != address(0) && ownership.burned == false`) // before an unintialized ownership slot // (i.e. `ownership.addr == address(0) && ownership.burned == false`) // Hence, `curr` will not underflow. // // We can directly compare the packed value. // If the address is zero, packed will be zero. while (packed == 0) { packed = _packedOwnerships[--curr]; } return packed; } } } revert OwnerQueryForNonexistentToken(); } /** * @dev Returns the unpacked `TokenOwnership` struct from `packed`. */ function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) { ownership.addr = address(uint160(packed)); ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP); ownership.burned = packed & _BITMASK_BURNED != 0; ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA); } /** * @dev Packs ownership data into a single uint256. */ function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`. result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags)) } } /** * @dev Returns the `nextInitialized` flag set if `quantity` equals 1. */ function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) { // For branchless setting of the `nextInitialized` flag. assembly { // `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`. result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1)) } } // ============================================================= // APPROVAL OPERATIONS // ============================================================= /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the * zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) public payable virtual override { address owner = ownerOf(tokenId); if (_msgSenderERC721A() != owner) if (!isApprovedForAll(owner, _msgSenderERC721A())) { revert ApprovalCallerNotOwnerNorApproved(); } _tokenApprovals[tokenId].value = to; emit Approval(owner, to, tokenId); } /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken(); return _tokenApprovals[tokenId].value; } /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} * for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool approved) public virtual override { _operatorApprovals[_msgSenderERC721A()][operator] = approved; emit ApprovalForAll(_msgSenderERC721A(), operator, approved); } /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted. See {_mint}. */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _startTokenId() <= tokenId && tokenId < _currentIndex && // If within bounds, _packedOwnerships[tokenId] & _BITMASK_BURNED == 0; // and not burned. } /** * @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`. */ function _isSenderApprovedOrOwner( address approvedAddress, address owner, address msgSender ) private pure returns (bool result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean. msgSender := and(msgSender, _BITMASK_ADDRESS) // `msgSender == owner || msgSender == approvedAddress`. result := or(eq(msgSender, owner), eq(msgSender, approvedAddress)) } } /** * @dev Returns the storage slot and value for the approved address of `tokenId`. */ function _getApprovedSlotAndAddress(uint256 tokenId) private view returns (uint256 approvedAddressSlot, address approvedAddress) { TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId]; // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`. assembly { approvedAddressSlot := tokenApproval.slot approvedAddress := sload(approvedAddressSlot) } } // ============================================================= // TRANSFER OPERATIONS // ============================================================= /** * @dev Transfers `tokenId` from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) public payable virtual override { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner(); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved(); if (to == address(0)) revert TransferToZeroAddress(); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // We can directly increment and decrement the balances. --_packedAddressData[from]; // Updates: `balance -= 1`. ++_packedAddressData[to]; // Updates: `balance += 1`. // Updates: // - `address` to the next owner. // - `startTimestamp` to the timestamp of transfering. // - `burned` to `false`. // - `nextInitialized` to `true`. _packedOwnerships[tokenId] = _packOwnershipData( to, _BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, to, tokenId); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public payable virtual override { safeTransferFrom(from, to, tokenId, ''); } /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public payable virtual override { transferFrom(from, to, tokenId); if (to.code.length != 0) if (!_checkContractOnERC721Received(from, to, tokenId, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } /** * @dev Hook that is called before a set of serially-ordered token IDs * are about to be transferred. This includes minting. * And also called before burning one token. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token IDs * have been transferred. This includes minting. * And also called after one token has been burned. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been * transferred to `to`. * - When `from` is zero, `tokenId` has been minted for `to`. * - When `to` is zero, `tokenId` has been burned by `from`. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract. * * `from` - Previous owner of the given token ID. * `to` - Target address that will receive the token. * `tokenId` - Token ID to be transferred. * `_data` - Optional data to send along with the call. * * Returns whether the call correctly returned the expected magic value. */ function _checkContractOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns ( bytes4 retval ) { return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert TransferToNonERC721ReceiverImplementer(); } else { assembly { revert(add(32, reason), mload(reason)) } } } } // ============================================================= // MINT OPERATIONS // ============================================================= /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {Transfer} event for each mint. */ function _mint(address to, uint256 quantity) internal virtual { uint256 startTokenId = _currentIndex; if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // `balance` and `numberMinted` have a maximum limit of 2**64. // `tokenId` has a maximum limit of 2**256. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. _packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); uint256 toMasked; uint256 end = startTokenId + quantity; // Use assembly to loop and emit the `Transfer` event for gas savings. // The duplicated `log4` removes an extra check and reduces stack juggling. // The assembly, together with the surrounding Solidity code, have been // delicately arranged to nudge the compiler into producing optimized opcodes. assembly { // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean. toMasked := and(to, _BITMASK_ADDRESS) // Emit the `Transfer` event. log4( 0, // Start of data (0, since no data). 0, // End of data (0, since no data). _TRANSFER_EVENT_SIGNATURE, // Signature. 0, // `address(0)`. toMasked, // `to`. startTokenId // `tokenId`. ) // The `iszero(eq(,))` check ensures that large values of `quantity` // that overflows uint256 will make the loop run out of gas. // The compiler will optimize the `iszero` away for performance. for { let tokenId := add(startTokenId, 1) } iszero(eq(tokenId, end)) { tokenId := add(tokenId, 1) } { // Emit the `Transfer` event. Similar to above. log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId) } } if (toMasked == 0) revert MintToZeroAddress(); _currentIndex = end; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * This function is intended for efficient minting only during contract creation. * * It emits only one {ConsecutiveTransfer} as defined in * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309), * instead of a sequence of {Transfer} event(s). * * Calling this function outside of contract creation WILL make your contract * non-compliant with the ERC721 standard. * For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309 * {ConsecutiveTransfer} event is only permissible during contract creation. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {ConsecutiveTransfer} event. */ function _mintERC2309(address to, uint256 quantity) internal virtual { uint256 startTokenId = _currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are unrealistic due to the above check for `quantity` to be below the limit. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. _packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to); _currentIndex = startTokenId + quantity; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Safely mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called for each safe transfer. * - `quantity` must be greater than 0. * * See {_mint}. * * Emits a {Transfer} event for each mint. */ function _safeMint( address to, uint256 quantity, bytes memory _data ) internal virtual { _mint(to, quantity); unchecked { if (to.code.length != 0) { uint256 end = _currentIndex; uint256 index = end - quantity; do { if (!_checkContractOnERC721Received(address(0), to, index++, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } while (index < end); // Reentrancy protection. if (_currentIndex != end) revert(); } } } /** * @dev Equivalent to `_safeMint(to, quantity, '')`. */ function _safeMint(address to, uint256 quantity) internal virtual { _safeMint(to, quantity, ''); } // ============================================================= // BURN OPERATIONS // ============================================================= /** * @dev Equivalent to `_burn(tokenId, false)`. */ function _burn(uint256 tokenId) internal virtual { _burn(tokenId, false); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId, bool approvalCheck) internal virtual { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); address from = address(uint160(prevOwnershipPacked)); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); if (approvalCheck) { // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved(); } _beforeTokenTransfers(from, address(0), tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // Updates: // - `balance -= 1`. // - `numberBurned += 1`. // // We can directly decrement the balance, and increment the number burned. // This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`. _packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1; // Updates: // - `address` to the last owner. // - `startTimestamp` to the timestamp of burning. // - `burned` to `true`. // - `nextInitialized` to `true`. _packedOwnerships[tokenId] = _packOwnershipData( from, (_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, address(0), tokenId); _afterTokenTransfers(from, address(0), tokenId, 1); // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times. unchecked { _burnCounter++; } } // ============================================================= // EXTRA DATA OPERATIONS // ============================================================= /** * @dev Directly sets the extra data for the ownership data `index`. */ function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual { uint256 packed = _packedOwnerships[index]; if (packed == 0) revert OwnershipNotInitializedForExtraData(); uint256 extraDataCasted; // Cast `extraData` with assembly to avoid redundant masking. assembly { extraDataCasted := extraData } packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA); _packedOwnerships[index] = packed; } /** * @dev Called during each token transfer to set the 24bit `extraData` field. * Intended to be overridden by the cosumer contract. * * `previousExtraData` - the value of `extraData` before transfer. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _extraData( address from, address to, uint24 previousExtraData ) internal view virtual returns (uint24) {} /** * @dev Returns the next extra data for the packed ownership data. * The returned result is shifted into position. */ function _nextExtraData( address from, address to, uint256 prevOwnershipPacked ) private view returns (uint256) { uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA); return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA; } // ============================================================= // OTHER OPERATIONS // ============================================================= /** * @dev Returns the message sender (defaults to `msg.sender`). * * If you are writing GSN compatible contracts, you need to override this function. */ function _msgSenderERC721A() internal view virtual returns (address) { return msg.sender; } /** * @dev Converts a uint256 to its ASCII string decimal representation. */ function _toString(uint256 value) internal pure virtual returns (string memory str) { assembly { // The maximum value of a uint256 contains 78 digits (1 byte per digit), but // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned. // We will need 1 word for the trailing zeros padding, 1 word for the length, // and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0. let m := add(mload(0x40), 0xa0) // Update the free memory pointer to allocate. mstore(0x40, m) // Assign the `str` to the end. str := sub(m, 0x20) // Zeroize the slot after the string. mstore(str, 0) // Cache the end of the memory to calculate the length later. let end := str // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. // prettier-ignore for { let temp := value } 1 {} { str := sub(str, 1) // Write the character to the pointer. // The ASCII index of the '0' character is 48. mstore8(str, add(48, mod(temp, 10))) // Keep dividing `temp` until zero. temp := div(temp, 10) // prettier-ignore if iszero(temp) { break } } let length := sub(end, str) // Move the pointer 32 bytes leftwards to make room for the length. str := sub(str, 0x20) // Store the length. mstore(str, length) } } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; import '../IERC721A.sol'; /** * @dev Interface of ERC721AQueryable. */ interface IERC721AQueryable is IERC721A { /** * Invalid query range (`start` >= `stop`). */ error InvalidQueryRange(); /** * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting. * * If the `tokenId` is out of bounds: * * - `addr = address(0)` * - `startTimestamp = 0` * - `burned = false` * - `extraData = 0` * * If the `tokenId` is burned: * * - `addr = <Address of owner before token was burned>` * - `startTimestamp = <Timestamp when token was burned>` * - `burned = true` * - `extraData = <Extra data when token was burned>` * * Otherwise: * * - `addr = <Address of owner>` * - `startTimestamp = <Timestamp of start of ownership>` * - `burned = false` * - `extraData = <Extra data at start of ownership>` */ function explicitOwnershipOf(uint256 tokenId) external view returns (TokenOwnership memory); /** * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order. * See {ERC721AQueryable-explicitOwnershipOf} */ function explicitOwnershipsOf(uint256[] memory tokenIds) external view returns (TokenOwnership[] memory); /** * @dev Returns an array of token IDs owned by `owner`, * in the range [`start`, `stop`) * (i.e. `start <= tokenId < stop`). * * This function allows for tokens to be queried if the collection * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}. * * Requirements: * * - `start < stop` */ function tokensOfOwnerIn( address owner, uint256 start, uint256 stop ) external view returns (uint256[] memory); /** * @dev Returns an array of token IDs owned by `owner`. * * This function scans the ownership mapping and is O(`totalSupply`) in complexity. * It is meant to be called off-chain. * * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into * multiple smaller scans if the collection is large enough to cause * an out-of-gas error (10K collections should be fine). */ function tokensOfOwner(address owner) external view returns (uint256[] memory); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; interface IOperatorFilter { function mayTransfer(address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: address zero is not a valid owner"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: invalid token ID"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { _requireMinted(tokenId); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not token owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { _requireMinted(tokenId); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner 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: caller is not token 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) { address owner = ERC721.ownerOf(tokenId); return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * 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 an {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits an {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Reverts if the `tokenId` has not been minted yet. */ function _requireMinted(uint256 tokenId) internal view virtual { require(_exists(tokenId), "ERC721: invalid token ID"); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { /// @solidity memory-safe-assembly assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/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.6.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.0; import "../utils/introspection/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 paid 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 (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 // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; /** * @dev Interface of ERC721A. */ interface IERC721A { /** * The caller must own the token or be an approved operator. */ error ApprovalCallerNotOwnerNorApproved(); /** * The token does not exist. */ error ApprovalQueryForNonexistentToken(); /** * Cannot query the balance for the zero address. */ error BalanceQueryForZeroAddress(); /** * Cannot mint to the zero address. */ error MintToZeroAddress(); /** * The quantity of tokens minted must be more than zero. */ error MintZeroQuantity(); /** * The token does not exist. */ error OwnerQueryForNonexistentToken(); /** * The caller must own the token or be an approved operator. */ error TransferCallerNotOwnerNorApproved(); /** * The token must be owned by `from`. */ error TransferFromIncorrectOwner(); /** * Cannot safely transfer to a contract that does not implement the * ERC721Receiver interface. */ error TransferToNonERC721ReceiverImplementer(); /** * Cannot transfer to the zero address. */ error TransferToZeroAddress(); /** * The token does not exist. */ error URIQueryForNonexistentToken(); /** * The `quantity` minted with ERC2309 exceeds the safety limit. */ error MintERC2309QuantityExceedsLimit(); /** * The `extraData` cannot be set on an unintialized ownership slot. */ error OwnershipNotInitializedForExtraData(); // ============================================================= // STRUCTS // ============================================================= struct TokenOwnership { // The address of the owner. address addr; // Stores the start time of ownership with minimal overhead for tokenomics. uint64 startTimestamp; // Whether the token has been burned. bool burned; // Arbitrary data similar to `startTimestamp` that can be set via {_extraData}. uint24 extraData; } // ============================================================= // TOKEN COUNTERS // ============================================================= /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() external view returns (uint256); // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); // ============================================================= // IERC721 // ============================================================= /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables * (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, * checking first that contract recipients are aware of the ERC721 protocol * to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move * this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external payable; /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external payable; /** * @dev Transfers `tokenId` from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} * whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external payable; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the * zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external payable; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} * for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll}. */ function isApprovedForAll(address owner, address operator) external view returns (bool); // ============================================================= // IERC721Metadata // ============================================================= /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); // ============================================================= // IERC2309 // ============================================================= /** * @dev Emitted when tokens in `fromTokenId` to `toTokenId` * (inclusive) is transferred from `from` to `to`, as defined in the * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard. * * See {_mintERC2309} for more details. */ event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return 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 /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (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 (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
{ "optimizer": { "enabled": true, "runs": 5000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AddressIsNull","type":"error"},{"inputs":[],"name":"CannotCloseUnownedHouse","type":"error"},{"inputs":[],"name":"CannotOpenUnownedHouse","type":"error"},{"inputs":[],"name":"HouseAlreadyClosed","type":"error"},{"inputs":[],"name":"HouseAlreadyOpen","type":"error"},{"inputs":[],"name":"HouseClosingIsClosed","type":"error"},{"inputs":[],"name":"HouseOpeningIsClosed","type":"error"},{"inputs":[],"name":"InvalidSignature","type":"error"},{"inputs":[],"name":"MaxMintExceeded","type":"error"},{"inputs":[],"name":"MismatchedInputs","type":"error"},{"inputs":[],"name":"NoContractMints","type":"error"},{"inputs":[],"name":"NotEnoughEth","type":"error"},{"inputs":[],"name":"OnlyOfriendsBurnable","type":"error"},{"inputs":[],"name":"OnlyOfriendsLick","type":"error"},{"inputs":[],"name":"OnlyOwnerCanDrop","type":"error"},{"inputs":[],"name":"PublicSaleClosed","type":"error"},{"inputs":[],"name":"TransferFailed","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"toLickContract","type":"address"},{"indexed":true,"internalType":"uint256","name":"toLickTokenId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"oFriendTokenId","type":"uint256"}],"name":"Licked","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":"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":[],"name":"CLOSE_PRICE_BASE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_HOUSES","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_PUPPIES","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"canCloseHouse","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"canOpenHouse","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"oFriendTokenId","type":"uint256"}],"name":"closeHouse","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"deleteDefaultRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"dogTrainer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"sig","type":"bytes"}],"name":"findPuppy","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"friskyMintOpen","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"oFriendTokenId","type":"uint256"}],"name":"friskyOfriend","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"filter","type":"address"}],"name":"getGroupFilter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"toLickContract","type":"address"},{"internalType":"uint256","name":"toLickTokenId","type":"uint256"}],"name":"isLicked","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"toLickContract","type":"address"},{"internalType":"uint256","name":"toLickTokenId","type":"uint256"},{"internalType":"uint256","name":"oFriendTokenId","type":"uint256"}],"name":"lick","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"houseId","type":"uint256"}],"name":"openHouse","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"operatorFilter","outputs":[{"internalType":"contract IOperatorFilter","name":"","type":"address"}],"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":"publicClosePrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"publicMintPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"puppyMintOpen","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"raffleMintOpen","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"filter","type":"address"}],"name":"removeGroupFilter","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":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"baseURI_","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint96","name":"feeNumerator","type":"uint96"}],"name":"setDefaultRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"setDogTrainer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"filter","type":"address"}],"name":"setGroupFilter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"}],"name":"setOmoonContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IOperatorFilter","name":"filter","type":"address"}],"name":"setOperatorFilter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"price","type":"uint256"}],"name":"setPublicClosePrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"price","type":"uint256"}],"name":"setPublicMintPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"signer","type":"address"}],"name":"setSigSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sigSigner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"receivers","type":"address[]"}],"name":"spillOtreats","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"toggleCanCloseHouse","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"toggleCanOpenHouse","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"togglePuppyMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"toggleRaffleMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
6101406040526000600e55600f80546001600160801b031916694e20000000000000000117905560016010556012805473420d08165a51e5a14b4a35d37cecf1d5e3a3b79c6001600160a01b031991821681179092556013805490911690911790553480156200006e57600080fd5b506040805180820182526007808252661bd19c9a595b9960ca1b60208084018290528451808601865260018152603160f81b8183015285518087018752938452838201929092528451808601909552600285526127a360f11b9085015291926000620000db8382620002a6565b506001620000ea8282620002a6565b5050506200010762000101620001ab60201b60201c565b620001af565b6001600755600a805460ff19169055815160209283012081519183019190912060e08290526101008190524660a0818152604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f818801819052818301969096526060810194909452608080850193909352308483018190528151808603909301835260c0948501909152815191909501209052919091526101205262000372565b3390565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200022c57607f821691505b6020821081036200024d57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620002a157600081815260208120601f850160051c810160208610156200027c5750805b601f850160051c820191505b818110156200029d5782815560010162000288565b5050505b505050565b81516001600160401b03811115620002c257620002c262000201565b620002da81620002d3845462000217565b8462000253565b602080601f831160018114620003125760008415620002f95750858301515b600019600386901b1c1916600185901b1785556200029d565b600085815260208120601f198616915b82811015620003435788860151825594840194600190910190840162000322565b5085821015620003625787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c05160e0516101005161012051613e32620003b0600039600050506000505060005050600050506000505060005050613e326000f3fe6080604052600436106103815760003560e01c8063689843e0116101d1578063bbcca55611610102578063df93c58e116100a0578063f2fde38b1161006f578063f2fde38b14610a97578063f387c62914610ab7578063f87d111014610ad7578063fde04c1e14610b0c57600080fd5b8063df93c58e146109ca578063e3e151d514610a05578063e985e9c514610a39578063ecc64d8e14610a8257600080fd5b8063c383d002116100dc578063c383d00214610954578063c87b56dd14610974578063d783925b14610994578063dc53fd92146109b457600080fd5b8063bbcca556146108fa578063be1399de1461090d578063bedb0d421461093f57600080fd5b80638da5cb5b1161016f578063a22cb46511610149578063a22cb4651461088f578063a32c832a146108af578063aa1b103f146108c5578063b88d4fde146108da57600080fd5b80638da5cb5b1461084657806395d89b4114610864578063a1087f681461087957600080fd5b8063715018a6116101ab578063715018a6146107dc5780638456cb59146107f1578063891a85d8146108065780638953e7821461082657600080fd5b8063689843e01461077e5780636a34a2db1461079c57806370a08231146107bc57600080fd5b80632cf06b89116102b657806355a6d931116102545780635c975abb116102235780635c975abb146107065780635d82cf6e1461071e5780635db9a14f1461073e5780636352211e1461075e57600080fd5b806355a6d9311461067d57806355f804b314610693578063585f766c146106b35780635bfc7c0c146106d357600080fd5b8063410a328411610290578063410a3284146105fd57806342842e0e1461061d57806342966c681461063d57806347bf1bd11461065d57600080fd5b80632cf06b89146105c05780633ccfd60b146105d35780633f4ba83a146105e857600080fd5b80630ed90cc0116103235780632217d8d5116102fd5780632217d8d51461053357806323b872dd146105485780632a55205a146105685780632c1221e4146105a757600080fd5b80630ed90cc0146104a257806311dee7ca146104e5578063211f60581461051357600080fd5b806306fdde031161035f57806306fdde03146103f2578063081812fc14610414578063095ea7b31461044c5780630c0d15c91461046c57600080fd5b806301ffc9a71461038657806304634d8d146103bb578063067cb2f2146103dd575b600080fd5b34801561039257600080fd5b506103a66103a136600461362f565b610b2c565b60405190151581526020015b60405180910390f35b3480156103c757600080fd5b506103db6103d6366004613661565b610b4c565b005b3480156103e957600080fd5b506103db610b62565b3480156103fe57600080fd5b50610407610bb7565b6040516103b291906136fb565b34801561042057600080fd5b5061043461042f36600461370e565b610c49565b6040516001600160a01b0390911681526020016103b2565b34801561045857600080fd5b506103db610467366004613727565b610c70565b34801561047857600080fd5b506013546103a6907801000000000000000000000000000000000000000000000000900460ff1681565b3480156104ae57600080fd5b506104346104bd366004613727565b6001600160a01b039182166000908152600d6020908152604080832093835292905220541690565b3480156104f157600080fd5b5061050561050036600461370e565b610da6565b6040519081526020016103b2565b34801561051f57600080fd5b506103db61052e366004613753565b610ff4565b34801561053f57600080fd5b506103db611145565b34801561055457600080fd5b506103db610563366004613788565b61119c565b34801561057457600080fd5b506105886105833660046137c9565b611224565b604080516001600160a01b0390931683526020830191909152016103b2565b3480156105b357600080fd5b506105056402540be40081565b6105056105ce36600461370e565b611303565b3480156105df57600080fd5b506103db61150f565b3480156105f457600080fd5b506103db61159c565b34801561060957600080fd5b506103db6106183660046137eb565b6115ae565b34801561062957600080fd5b506103db610638366004613788565b6115e5565b34801561064957600080fd5b506103db61065836600461370e565b611600565b34801561066957600080fd5b506103db6106783660046137eb565b611684565b34801561068957600080fd5b50610505600e5481565b34801561069f57600080fd5b506103db6106ae36600461384a565b6116fb565b3480156106bf57600080fd5b506103db6106ce3660046137eb565b611710565b3480156106df57600080fd5b506013546103a6907501000000000000000000000000000000000000000000900460ff1681565b34801561071257600080fd5b50600a5460ff166103a6565b34801561072a57600080fd5b506103db61073936600461370e565b611787565b34801561074a57600080fd5b506103db6107593660046137eb565b611794565b34801561076a57600080fd5b5061043461077936600461370e565b6117c0565b34801561078a57600080fd5b506008546001600160a01b0316610434565b3480156107a857600080fd5b50601254610434906001600160a01b031681565b3480156107c857600080fd5b506105056107d73660046137eb565b611825565b3480156107e857600080fd5b506103db6118bf565b3480156107fd57600080fd5b506103db6118d1565b34801561081257600080fd5b5061050561082136600461370e565b6118e1565b34801561083257600080fd5b506103db61084136600461388c565b611a57565b34801561085257600080fd5b506006546001600160a01b0316610434565b34801561087057600080fd5b50610407611b61565b34801561088557600080fd5b5061050561271081565b34801561089b57600080fd5b506103db6108aa36600461390f565b611b70565b3480156108bb57600080fd5b50610505614e2081565b3480156108d157600080fd5b506103db611b7b565b3480156108e657600080fd5b506103db6108f536600461396c565b611b8d565b6103db61090836600461384a565b611c1b565b34801561091957600080fd5b506013546103a69074010000000000000000000000000000000000000000900460ff1681565b34801561094b57600080fd5b506103db611f18565b34801561096057600080fd5b50601354610434906001600160a01b031681565b34801561098057600080fd5b5061040761098f36600461370e565b611f70565b3480156109a057600080fd5b506103db6109af3660046137eb565b611fd7565b3480156109c057600080fd5b5061050560145481565b3480156109d657600080fd5b506103a66109e53660046137eb565b6001600160a01b031660009081526009602052604090205460ff16151590565b348015610a1157600080fd5b506013546103a690760100000000000000000000000000000000000000000000900460ff1681565b348015610a4557600080fd5b506103a6610a54366004613a4c565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b348015610a8e57600080fd5b506103db61200e565b348015610aa357600080fd5b506103db610ab23660046137eb565b612064565b348015610ac357600080fd5b506103db610ad236600461370e565b6120f1565b348015610ae357600080fd5b506013546103a69077010000000000000000000000000000000000000000000000900460ff1681565b348015610b1857600080fd5b506103db610b273660046137eb565b6120fe565b6000610b3782612127565b80610b465750610b468261220a565b92915050565b610b54612260565b610b5e82826122ba565b5050565b610b6a612260565b601380547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff8116740100000000000000000000000000000000000000009182900460ff1615909102179055565b606060008054610bc690613a7a565b80601f0160208091040260200160405190810160405280929190818152602001828054610bf290613a7a565b8015610c3f5780601f10610c1457610100808354040283529160200191610c3f565b820191906000526020600020905b815481529060010190602001808311610c2257829003601f168201915b5050505050905090565b6000610c54826123e5565b506000908152600460205260409020546001600160a01b031690565b6000610c7b826117c0565b9050806001600160a01b0316836001600160a01b031603610d095760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f720000000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b336001600160a01b0382161480610d255750610d258133610a54565b610d975760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c00006064820152608401610d00565b610da18383612449565b505050565b6000600260075403610dfa5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610d00565b60026007556013547801000000000000000000000000000000000000000000000000900460ff16610e69576006546001600160a01b03163314610e69576040517fd54ae92500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6127108211610ea4576040517f6e77a5fd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b614e20821115610ee0576040517f6e77a5fd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000610eeb836117c0565b90506001600160a01b0381163314610f41576006546001600160a01b03163314610f41576040517f1c0c7afb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6011546001600160a01b0316610f56846124c4565b6040517fab6624460000000000000000000000000000000000000000000000000000000081526001600160a01b038381166004830152602482018690526000919083169063ab662446906044016020604051808303816000875af1158015610fc2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fe69190613acd565b600160075595945050505050565b610ffd816117c0565b6001600160a01b0316336001600160a01b03161461105d5760405162461bcd60e51b815260206004820152600b60248201527f43616e6e6f74206c69636b0000000000000000000000000000000000000000006044820152606401610d00565b6127108111611098576040517f4c2e447b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b614e208111156110d4576040517f4c2e447b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0383166000818152600d60209081526040808320868452909152808220805473ffffffffffffffffffffffffffffffffffffffff191633179055518392859290917f6a8c2c891873ba83d8a3a139c10391cd0e3e6e1644db56685d7c1993d15768e09190a4505050565b61114d612260565b601380547fffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffff81167601000000000000000000000000000000000000000000009182900460ff1615909102179055565b6111a7335b82612578565b6112195760405162461bcd60e51b815260206004820152602e60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206e6f7220617070726f7665640000000000000000000000000000000000006064820152608401610d00565b610da18383836125f7565b6000828152600c602090815260408083208151808301909252546001600160a01b038116808352740100000000000000000000000000000000000000009091046bffffffffffffffffffffffff169282019290925282916112c5575060408051808201909152600b546001600160a01b03811682527401000000000000000000000000000000000000000090046bffffffffffffffffffffffff1660208201525b6020810151600090612710906112e9906bffffffffffffffffffffffff1687613b15565b6112f39190613b5b565b91519350909150505b9250929050565b60006002600754036113575760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610d00565b60026007556013547501000000000000000000000000000000000000000000900460ff166113c3576006546001600160a01b031633146113c3576040517f6cb4be4900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61271082116113fe576040517ff05c42fe00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b614e2082111561143a576040517ff05c42fe00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000611445836117c0565b90506001600160a01b038116331461149b576006546001600160a01b0316331461149b576040517f5c03bb8900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6114a4836124c4565b6010805460010190557fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd8f0909201916114dc81846127dc565b6114e7600e546127f6565b600e541561150557601054600e80546402540be40090920290910190555b5050600160075590565b611517612260565b604051600090339047908381818185875af1925050503d8060008114611559576040519150601f19603f3d011682016040523d82523d6000602084013e61155e565b606091505b5050905080611599576040517f90b8ec1800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50565b6115a4612260565b6115ac61286e565b565b6115b6612260565b6011805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b610da183838360405180602001604052806000815250611b8d565b611609336111a1565b61167b5760405162461bcd60e51b815260206004820152602e60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206e6f7220617070726f7665640000000000000000000000000000000000006064820152608401610d00565b611599816124c4565b61168c612260565b6001600160a01b0381166116cc576040517ffb7566d700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6012805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b611703612260565b6015610da1828483613bbd565b611718612260565b6001600160a01b038116611758576040517ffb7566d700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6013805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b61178f612260565b601455565b61179c612260565b6001600160a01b03166000908152600960205260409020805460ff19166001179055565b6000818152600260205260408120546001600160a01b031680610b465760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606401610d00565b60006001600160a01b0382166118a35760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f74206120766160448201527f6c6964206f776e657200000000000000000000000000000000000000000000006064820152608401610d00565b506001600160a01b031660009081526003602052604090205490565b6118c7612260565b6115ac60006128c0565b6118d9612260565b6115ac61291f565b60006002600754036119355760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610d00565b600260075560135474010000000000000000000000000000000000000000900460ff166119a0576006546001600160a01b031633146119a0576040517fd54ae92500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6127108211156119dc576040517f2d6005e900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006119e7836117c0565b90506001600160a01b0381163314611a3d576006546001600160a01b03163314611a3d576040517f1c0c7afb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611a46836124c4565b6127108301925061150581846127dc565b6000819003611a92576040517f469224f000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6012546001600160a01b03163314611ad6576040517f8a2af64c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b81811015610da157611b1d838383818110611af657611af6613c7d565b9050602002016020810190611b0b91906137eb565b600f5467ffffffffffffffff1661295c565b600f80547fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000008116600167ffffffffffffffff92831681019092161790915501611ad9565b606060018054610bc690613a7a565b610b5e338383612ab7565b611b83612260565b6115ac6000600b55565b611b973383612578565b611c095760405162461bcd60e51b815260206004820152602e60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206e6f7220617070726f7665640000000000000000000000000000000000006064820152608401610d00565b611c1584848484612b85565b50505050565b323314611c54576040517ff8f4c58800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600f54614e2090611c7c9068010000000000000000900467ffffffffffffffff166001613cac565b67ffffffffffffffff161115611cbe576040517f79d2bf0a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60135460609077010000000000000000000000000000000000000000000000900460ff1615611d36576040517fffffffffffffffffffffffffffffffffffffffff0000000000000000000000003360601b166020820152600160348201526054015b6040516020818303038152906040529050611dca565b601354760100000000000000000000000000000000000000000000900460ff1615611d98576040517fffffffffffffffffffffffffffffffffffffffff0000000000000000000000003360601b16602082015260006034820152605401611d20565b6040517fdd4e010600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000611e6384848080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250508551602080880191909120604080517f19457468657265756d205369676e6564204d6573736167653a0a33320000000081850152603c8082019390935281518082039093018352605c01905280519101209150611e5d9050565b90612c0e565b6013549091506001600160a01b03808316911614611ead576040517f8baa579f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600f80547fffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff8116680100000000000000009182900467ffffffffffffffff9081166001810190911690920217909155611f0633826127dc565b611f116014546127f6565b5050505050565b611f20612260565b601380547fffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffff8116770100000000000000000000000000000000000000000000009182900460ff1615909102179055565b6060611f7b826123e5565b6000611f85612c32565b90506000815111611fa55760405180602001604052806000815250611fd0565b80611faf84612c41565b604051602001611fc0929190613cd4565b6040516020818303038152906040525b9392505050565b611fdf612260565b6008805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b612016612260565b601380547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff811675010000000000000000000000000000000000000000009182900460ff1615909102179055565b61206c612260565b6001600160a01b0381166120e85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610d00565b611599816128c0565b6120f9612260565b600e55565b612106612260565b6001600160a01b03166000908152600960205260409020805460ff19169055565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f80ac58cd0000000000000000000000000000000000000000000000000000000014806121ba57507fffffffff0000000000000000000000000000000000000000000000000000000082167f5b5e139f00000000000000000000000000000000000000000000000000000000145b80610b4657507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610b46565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f2a55205a000000000000000000000000000000000000000000000000000000001480610b465750610b4682612127565b6006546001600160a01b031633146115ac5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610d00565b6127106bffffffffffffffffffffffff821611156123405760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c2065786365656460448201527f2073616c655072696365000000000000000000000000000000000000000000006064820152608401610d00565b6001600160a01b0382166123965760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401610d00565b604080518082019091526001600160a01b039092168083526bffffffffffffffffffffffff90911660209092018290527401000000000000000000000000000000000000000090910217600b55565b6000818152600260205260409020546001600160a01b03166115995760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606401610d00565b6000818152600460205260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038416908117909155819061248b826117c0565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60006124cf826117c0565b90506124dd81600084612d76565b6124e8600083612449565b6001600160a01b0381166000908152600360205260408120805460019290612511908490613d03565b9091555050600082815260026020526040808220805473ffffffffffffffffffffffffffffffffffffffff19169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b600080612584836117c0565b9050806001600160a01b0316846001600160a01b031614806125cb57506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b806125ef5750836001600160a01b03166125e484610c49565b6001600160a01b0316145b949350505050565b826001600160a01b031661260a826117c0565b6001600160a01b0316146126865760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201527f6f776e65720000000000000000000000000000000000000000000000000000006064820152608401610d00565b6001600160a01b0382166127015760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610d00565b61270c838383612d76565b612717600082612449565b6001600160a01b0383166000908152600360205260408120805460019290612740908490613d03565b90915550506001600160a01b038216600090815260036020526040812080546001929061276e908490613d16565b9091555050600081815260026020526040808220805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b610b5e828260405180602001604052806000815250612d89565b80341015612830576040517ff14a42b700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8034111561159957336108fc6128468334613d03565b6040518115909202916000818181858888f19350505050158015610b5e573d6000803e3d6000fd5b612876612e12565b600a805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600680546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b612927612e64565b600a805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586128a33390565b6001600160a01b0382166129b25760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610d00565b6000818152600260205260409020546001600160a01b031615612a175760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610d00565b612a2360008383612d76565b6001600160a01b0382166000908152600360205260408120805460019290612a4c908490613d16565b9091555050600081815260026020526040808220805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b816001600160a01b0316836001600160a01b031603612b185760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610d00565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b612b908484846125f7565b612b9c84848484612eb7565b611c155760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610d00565b6000806000612c1d8585613058565b91509150612c2a8161309a565b509392505050565b606060158054610bc690613a7a565b606081600003612c8457505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115612cae5780612c9881613d29565b9150612ca79050600a83613b5b565b9150612c88565b60008167ffffffffffffffff811115612cc957612cc961393d565b6040519080825280601f01601f191660200182016040528015612cf3576020820181803683370190505b5090505b84156125ef57612d08600183613d03565b9150612d15600a86613d43565b612d20906030613d16565b60f81b818381518110612d3557612d35613c7d565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350612d6f600a86613b5b565b9450612cf7565b612d7e612e64565b610da1838383613286565b612d93838361295c565b612da06000848484612eb7565b610da15760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610d00565b600a5460ff166115ac5760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610d00565b600a5460ff16156115ac5760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610d00565b60006001600160a01b0384163b1561304d576040517f150b7a020000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063150b7a0290612f14903390899088908890600401613d57565b6020604051808303816000875af1925050508015612f4f575060408051601f3d908101601f19168201909252612f4c91810190613d93565b60015b613002573d808015612f7d576040519150601f19603f3d011682016040523d82523d6000602084013e612f82565b606091505b508051600003612ffa5760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610d00565b805181602001fd5b7fffffffff00000000000000000000000000000000000000000000000000000000167f150b7a02000000000000000000000000000000000000000000000000000000001490506125ef565b506001949350505050565b600080825160410361308e5760208301516040840151606085015160001a6130828782858561344a565b945094505050506112fc565b506000905060026112fc565b60008160048111156130ae576130ae613db0565b036130b65750565b60018160048111156130ca576130ca613db0565b036131175760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610d00565b600281600481111561312b5761312b613db0565b036131785760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610d00565b600381600481111561318c5761318c613db0565b036131ff5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610d00565b600481600481111561321357613213613db0565b036115995760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610d00565b6001600160a01b03831660009081526009602052604090205460ff16156133155760405162461bcd60e51b815260206004820152602660248201527f4552433732314f70657261746f7246696c7465723a20696c6c6567616c206f7060448201527f657261746f7200000000000000000000000000000000000000000000000000006064820152608401610d00565b6001600160a01b03821660009081526009602052604090205460ff16156133a45760405162461bcd60e51b815260206004820152602660248201527f4552433732314f70657261746f7246696c7465723a20696c6c6567616c206f7060448201527f657261746f7200000000000000000000000000000000000000000000000000006064820152608401610d00565b6001600160a01b038316158015906133c457506001600160a01b03821615155b80156133d757506133d53382613537565b155b15610da15760405162461bcd60e51b815260206004820152602660248201527f4552433732314f70657261746f7246696c7465723a20696c6c6567616c206f7060448201527f657261746f7200000000000000000000000000000000000000000000000000006064820152608401610d00565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115613481575060009050600361352e565b8460ff16601b1415801561349957508460ff16601c14155b156134aa575060009050600461352e565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156134fe573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166135275760006001925092505061352e565b9150600090505b94509492505050565b6008546000906001600160a01b031680613555576001915050610b46565b61355e836117c0565b6001600160a01b0316846001600160a01b031603613580576001915050610b46565b6040517f192c596e0000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b0382169063192c596e90602401602060405180830381865afa1580156135dd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125ef9190613ddf565b7fffffffff000000000000000000000000000000000000000000000000000000008116811461159957600080fd5b60006020828403121561364157600080fd5b8135611fd081613601565b6001600160a01b038116811461159957600080fd5b6000806040838503121561367457600080fd5b823561367f8161364c565b915060208301356bffffffffffffffffffffffff811681146136a057600080fd5b809150509250929050565b60005b838110156136c65781810151838201526020016136ae565b50506000910152565b600081518084526136e78160208601602086016136ab565b601f01601f19169290920160200192915050565b602081526000611fd060208301846136cf565b60006020828403121561372057600080fd5b5035919050565b6000806040838503121561373a57600080fd5b82356137458161364c565b946020939093013593505050565b60008060006060848603121561376857600080fd5b83356137738161364c565b95602085013595506040909401359392505050565b60008060006060848603121561379d57600080fd5b83356137a88161364c565b925060208401356137b88161364c565b929592945050506040919091013590565b600080604083850312156137dc57600080fd5b50508035926020909101359150565b6000602082840312156137fd57600080fd5b8135611fd08161364c565b60008083601f84011261381a57600080fd5b50813567ffffffffffffffff81111561383257600080fd5b6020830191508360208285010111156112fc57600080fd5b6000806020838503121561385d57600080fd5b823567ffffffffffffffff81111561387457600080fd5b61388085828601613808565b90969095509350505050565b6000806020838503121561389f57600080fd5b823567ffffffffffffffff808211156138b757600080fd5b818501915085601f8301126138cb57600080fd5b8135818111156138da57600080fd5b8660208260051b85010111156138ef57600080fd5b60209290920196919550909350505050565b801515811461159957600080fd5b6000806040838503121561392257600080fd5b823561392d8161364c565b915060208301356136a081613901565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000806000806080858703121561398257600080fd5b843561398d8161364c565b9350602085013561399d8161364c565b925060408501359150606085013567ffffffffffffffff808211156139c157600080fd5b818701915087601f8301126139d557600080fd5b8135818111156139e7576139e761393d565b604051601f8201601f19908116603f01168101908382118183101715613a0f57613a0f61393d565b816040528281528a6020848701011115613a2857600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b60008060408385031215613a5f57600080fd5b8235613a6a8161364c565b915060208301356136a08161364c565b600181811c90821680613a8e57607f821691505b602082108103613ac7577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b600060208284031215613adf57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082028115828204841417610b4657610b46613ae6565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600082613b6a57613b6a613b2c565b500490565b601f821115610da157600081815260208120601f850160051c81016020861015613b965750805b601f850160051c820191505b81811015613bb557828155600101613ba2565b505050505050565b67ffffffffffffffff831115613bd557613bd561393d565b613be983613be38354613a7a565b83613b6f565b6000601f841160018114613c1d5760008515613c055750838201355b600019600387901b1c1916600186901b178355611f11565b600083815260209020601f19861690835b82811015613c4e5786850135825560209485019460019092019101613c2e565b5086821015613c6b5760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b67ffffffffffffffff818116838216019080821115613ccd57613ccd613ae6565b5092915050565b60008351613ce68184602088016136ab565b835190830190613cfa8183602088016136ab565b01949350505050565b81810381811115610b4657610b46613ae6565b80820180821115610b4657610b46613ae6565b60006000198203613d3c57613d3c613ae6565b5060010190565b600082613d5257613d52613b2c565b500690565b60006001600160a01b03808716835280861660208401525083604083015260806060830152613d8960808301846136cf565b9695505050505050565b600060208284031215613da557600080fd5b8151611fd081613601565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b600060208284031215613df157600080fd5b8151611fd08161390156fea2646970667358221220078b20e0adbf02cb81f36a592eac27597267f74d43318c57e6ffd95f1a8d7fd664736f6c63430008110033
Deployed Bytecode
0x6080604052600436106103815760003560e01c8063689843e0116101d1578063bbcca55611610102578063df93c58e116100a0578063f2fde38b1161006f578063f2fde38b14610a97578063f387c62914610ab7578063f87d111014610ad7578063fde04c1e14610b0c57600080fd5b8063df93c58e146109ca578063e3e151d514610a05578063e985e9c514610a39578063ecc64d8e14610a8257600080fd5b8063c383d002116100dc578063c383d00214610954578063c87b56dd14610974578063d783925b14610994578063dc53fd92146109b457600080fd5b8063bbcca556146108fa578063be1399de1461090d578063bedb0d421461093f57600080fd5b80638da5cb5b1161016f578063a22cb46511610149578063a22cb4651461088f578063a32c832a146108af578063aa1b103f146108c5578063b88d4fde146108da57600080fd5b80638da5cb5b1461084657806395d89b4114610864578063a1087f681461087957600080fd5b8063715018a6116101ab578063715018a6146107dc5780638456cb59146107f1578063891a85d8146108065780638953e7821461082657600080fd5b8063689843e01461077e5780636a34a2db1461079c57806370a08231146107bc57600080fd5b80632cf06b89116102b657806355a6d931116102545780635c975abb116102235780635c975abb146107065780635d82cf6e1461071e5780635db9a14f1461073e5780636352211e1461075e57600080fd5b806355a6d9311461067d57806355f804b314610693578063585f766c146106b35780635bfc7c0c146106d357600080fd5b8063410a328411610290578063410a3284146105fd57806342842e0e1461061d57806342966c681461063d57806347bf1bd11461065d57600080fd5b80632cf06b89146105c05780633ccfd60b146105d35780633f4ba83a146105e857600080fd5b80630ed90cc0116103235780632217d8d5116102fd5780632217d8d51461053357806323b872dd146105485780632a55205a146105685780632c1221e4146105a757600080fd5b80630ed90cc0146104a257806311dee7ca146104e5578063211f60581461051357600080fd5b806306fdde031161035f57806306fdde03146103f2578063081812fc14610414578063095ea7b31461044c5780630c0d15c91461046c57600080fd5b806301ffc9a71461038657806304634d8d146103bb578063067cb2f2146103dd575b600080fd5b34801561039257600080fd5b506103a66103a136600461362f565b610b2c565b60405190151581526020015b60405180910390f35b3480156103c757600080fd5b506103db6103d6366004613661565b610b4c565b005b3480156103e957600080fd5b506103db610b62565b3480156103fe57600080fd5b50610407610bb7565b6040516103b291906136fb565b34801561042057600080fd5b5061043461042f36600461370e565b610c49565b6040516001600160a01b0390911681526020016103b2565b34801561045857600080fd5b506103db610467366004613727565b610c70565b34801561047857600080fd5b506013546103a6907801000000000000000000000000000000000000000000000000900460ff1681565b3480156104ae57600080fd5b506104346104bd366004613727565b6001600160a01b039182166000908152600d6020908152604080832093835292905220541690565b3480156104f157600080fd5b5061050561050036600461370e565b610da6565b6040519081526020016103b2565b34801561051f57600080fd5b506103db61052e366004613753565b610ff4565b34801561053f57600080fd5b506103db611145565b34801561055457600080fd5b506103db610563366004613788565b61119c565b34801561057457600080fd5b506105886105833660046137c9565b611224565b604080516001600160a01b0390931683526020830191909152016103b2565b3480156105b357600080fd5b506105056402540be40081565b6105056105ce36600461370e565b611303565b3480156105df57600080fd5b506103db61150f565b3480156105f457600080fd5b506103db61159c565b34801561060957600080fd5b506103db6106183660046137eb565b6115ae565b34801561062957600080fd5b506103db610638366004613788565b6115e5565b34801561064957600080fd5b506103db61065836600461370e565b611600565b34801561066957600080fd5b506103db6106783660046137eb565b611684565b34801561068957600080fd5b50610505600e5481565b34801561069f57600080fd5b506103db6106ae36600461384a565b6116fb565b3480156106bf57600080fd5b506103db6106ce3660046137eb565b611710565b3480156106df57600080fd5b506013546103a6907501000000000000000000000000000000000000000000900460ff1681565b34801561071257600080fd5b50600a5460ff166103a6565b34801561072a57600080fd5b506103db61073936600461370e565b611787565b34801561074a57600080fd5b506103db6107593660046137eb565b611794565b34801561076a57600080fd5b5061043461077936600461370e565b6117c0565b34801561078a57600080fd5b506008546001600160a01b0316610434565b3480156107a857600080fd5b50601254610434906001600160a01b031681565b3480156107c857600080fd5b506105056107d73660046137eb565b611825565b3480156107e857600080fd5b506103db6118bf565b3480156107fd57600080fd5b506103db6118d1565b34801561081257600080fd5b5061050561082136600461370e565b6118e1565b34801561083257600080fd5b506103db61084136600461388c565b611a57565b34801561085257600080fd5b506006546001600160a01b0316610434565b34801561087057600080fd5b50610407611b61565b34801561088557600080fd5b5061050561271081565b34801561089b57600080fd5b506103db6108aa36600461390f565b611b70565b3480156108bb57600080fd5b50610505614e2081565b3480156108d157600080fd5b506103db611b7b565b3480156108e657600080fd5b506103db6108f536600461396c565b611b8d565b6103db61090836600461384a565b611c1b565b34801561091957600080fd5b506013546103a69074010000000000000000000000000000000000000000900460ff1681565b34801561094b57600080fd5b506103db611f18565b34801561096057600080fd5b50601354610434906001600160a01b031681565b34801561098057600080fd5b5061040761098f36600461370e565b611f70565b3480156109a057600080fd5b506103db6109af3660046137eb565b611fd7565b3480156109c057600080fd5b5061050560145481565b3480156109d657600080fd5b506103a66109e53660046137eb565b6001600160a01b031660009081526009602052604090205460ff16151590565b348015610a1157600080fd5b506013546103a690760100000000000000000000000000000000000000000000900460ff1681565b348015610a4557600080fd5b506103a6610a54366004613a4c565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b348015610a8e57600080fd5b506103db61200e565b348015610aa357600080fd5b506103db610ab23660046137eb565b612064565b348015610ac357600080fd5b506103db610ad236600461370e565b6120f1565b348015610ae357600080fd5b506013546103a69077010000000000000000000000000000000000000000000000900460ff1681565b348015610b1857600080fd5b506103db610b273660046137eb565b6120fe565b6000610b3782612127565b80610b465750610b468261220a565b92915050565b610b54612260565b610b5e82826122ba565b5050565b610b6a612260565b601380547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff8116740100000000000000000000000000000000000000009182900460ff1615909102179055565b606060008054610bc690613a7a565b80601f0160208091040260200160405190810160405280929190818152602001828054610bf290613a7a565b8015610c3f5780601f10610c1457610100808354040283529160200191610c3f565b820191906000526020600020905b815481529060010190602001808311610c2257829003601f168201915b5050505050905090565b6000610c54826123e5565b506000908152600460205260409020546001600160a01b031690565b6000610c7b826117c0565b9050806001600160a01b0316836001600160a01b031603610d095760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f720000000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b336001600160a01b0382161480610d255750610d258133610a54565b610d975760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c00006064820152608401610d00565b610da18383612449565b505050565b6000600260075403610dfa5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610d00565b60026007556013547801000000000000000000000000000000000000000000000000900460ff16610e69576006546001600160a01b03163314610e69576040517fd54ae92500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6127108211610ea4576040517f6e77a5fd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b614e20821115610ee0576040517f6e77a5fd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000610eeb836117c0565b90506001600160a01b0381163314610f41576006546001600160a01b03163314610f41576040517f1c0c7afb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6011546001600160a01b0316610f56846124c4565b6040517fab6624460000000000000000000000000000000000000000000000000000000081526001600160a01b038381166004830152602482018690526000919083169063ab662446906044016020604051808303816000875af1158015610fc2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fe69190613acd565b600160075595945050505050565b610ffd816117c0565b6001600160a01b0316336001600160a01b03161461105d5760405162461bcd60e51b815260206004820152600b60248201527f43616e6e6f74206c69636b0000000000000000000000000000000000000000006044820152606401610d00565b6127108111611098576040517f4c2e447b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b614e208111156110d4576040517f4c2e447b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0383166000818152600d60209081526040808320868452909152808220805473ffffffffffffffffffffffffffffffffffffffff191633179055518392859290917f6a8c2c891873ba83d8a3a139c10391cd0e3e6e1644db56685d7c1993d15768e09190a4505050565b61114d612260565b601380547fffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffff81167601000000000000000000000000000000000000000000009182900460ff1615909102179055565b6111a7335b82612578565b6112195760405162461bcd60e51b815260206004820152602e60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206e6f7220617070726f7665640000000000000000000000000000000000006064820152608401610d00565b610da18383836125f7565b6000828152600c602090815260408083208151808301909252546001600160a01b038116808352740100000000000000000000000000000000000000009091046bffffffffffffffffffffffff169282019290925282916112c5575060408051808201909152600b546001600160a01b03811682527401000000000000000000000000000000000000000090046bffffffffffffffffffffffff1660208201525b6020810151600090612710906112e9906bffffffffffffffffffffffff1687613b15565b6112f39190613b5b565b91519350909150505b9250929050565b60006002600754036113575760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610d00565b60026007556013547501000000000000000000000000000000000000000000900460ff166113c3576006546001600160a01b031633146113c3576040517f6cb4be4900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61271082116113fe576040517ff05c42fe00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b614e2082111561143a576040517ff05c42fe00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000611445836117c0565b90506001600160a01b038116331461149b576006546001600160a01b0316331461149b576040517f5c03bb8900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6114a4836124c4565b6010805460010190557fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd8f0909201916114dc81846127dc565b6114e7600e546127f6565b600e541561150557601054600e80546402540be40090920290910190555b5050600160075590565b611517612260565b604051600090339047908381818185875af1925050503d8060008114611559576040519150601f19603f3d011682016040523d82523d6000602084013e61155e565b606091505b5050905080611599576040517f90b8ec1800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50565b6115a4612260565b6115ac61286e565b565b6115b6612260565b6011805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b610da183838360405180602001604052806000815250611b8d565b611609336111a1565b61167b5760405162461bcd60e51b815260206004820152602e60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206e6f7220617070726f7665640000000000000000000000000000000000006064820152608401610d00565b611599816124c4565b61168c612260565b6001600160a01b0381166116cc576040517ffb7566d700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6012805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b611703612260565b6015610da1828483613bbd565b611718612260565b6001600160a01b038116611758576040517ffb7566d700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6013805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b61178f612260565b601455565b61179c612260565b6001600160a01b03166000908152600960205260409020805460ff19166001179055565b6000818152600260205260408120546001600160a01b031680610b465760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606401610d00565b60006001600160a01b0382166118a35760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f74206120766160448201527f6c6964206f776e657200000000000000000000000000000000000000000000006064820152608401610d00565b506001600160a01b031660009081526003602052604090205490565b6118c7612260565b6115ac60006128c0565b6118d9612260565b6115ac61291f565b60006002600754036119355760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610d00565b600260075560135474010000000000000000000000000000000000000000900460ff166119a0576006546001600160a01b031633146119a0576040517fd54ae92500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6127108211156119dc576040517f2d6005e900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006119e7836117c0565b90506001600160a01b0381163314611a3d576006546001600160a01b03163314611a3d576040517f1c0c7afb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611a46836124c4565b6127108301925061150581846127dc565b6000819003611a92576040517f469224f000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6012546001600160a01b03163314611ad6576040517f8a2af64c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b81811015610da157611b1d838383818110611af657611af6613c7d565b9050602002016020810190611b0b91906137eb565b600f5467ffffffffffffffff1661295c565b600f80547fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000008116600167ffffffffffffffff92831681019092161790915501611ad9565b606060018054610bc690613a7a565b610b5e338383612ab7565b611b83612260565b6115ac6000600b55565b611b973383612578565b611c095760405162461bcd60e51b815260206004820152602e60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206e6f7220617070726f7665640000000000000000000000000000000000006064820152608401610d00565b611c1584848484612b85565b50505050565b323314611c54576040517ff8f4c58800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600f54614e2090611c7c9068010000000000000000900467ffffffffffffffff166001613cac565b67ffffffffffffffff161115611cbe576040517f79d2bf0a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60135460609077010000000000000000000000000000000000000000000000900460ff1615611d36576040517fffffffffffffffffffffffffffffffffffffffff0000000000000000000000003360601b166020820152600160348201526054015b6040516020818303038152906040529050611dca565b601354760100000000000000000000000000000000000000000000900460ff1615611d98576040517fffffffffffffffffffffffffffffffffffffffff0000000000000000000000003360601b16602082015260006034820152605401611d20565b6040517fdd4e010600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000611e6384848080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250508551602080880191909120604080517f19457468657265756d205369676e6564204d6573736167653a0a33320000000081850152603c8082019390935281518082039093018352605c01905280519101209150611e5d9050565b90612c0e565b6013549091506001600160a01b03808316911614611ead576040517f8baa579f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600f80547fffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff8116680100000000000000009182900467ffffffffffffffff9081166001810190911690920217909155611f0633826127dc565b611f116014546127f6565b5050505050565b611f20612260565b601380547fffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffff8116770100000000000000000000000000000000000000000000009182900460ff1615909102179055565b6060611f7b826123e5565b6000611f85612c32565b90506000815111611fa55760405180602001604052806000815250611fd0565b80611faf84612c41565b604051602001611fc0929190613cd4565b6040516020818303038152906040525b9392505050565b611fdf612260565b6008805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b612016612260565b601380547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff811675010000000000000000000000000000000000000000009182900460ff1615909102179055565b61206c612260565b6001600160a01b0381166120e85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610d00565b611599816128c0565b6120f9612260565b600e55565b612106612260565b6001600160a01b03166000908152600960205260409020805460ff19169055565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f80ac58cd0000000000000000000000000000000000000000000000000000000014806121ba57507fffffffff0000000000000000000000000000000000000000000000000000000082167f5b5e139f00000000000000000000000000000000000000000000000000000000145b80610b4657507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610b46565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f2a55205a000000000000000000000000000000000000000000000000000000001480610b465750610b4682612127565b6006546001600160a01b031633146115ac5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610d00565b6127106bffffffffffffffffffffffff821611156123405760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c2065786365656460448201527f2073616c655072696365000000000000000000000000000000000000000000006064820152608401610d00565b6001600160a01b0382166123965760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401610d00565b604080518082019091526001600160a01b039092168083526bffffffffffffffffffffffff90911660209092018290527401000000000000000000000000000000000000000090910217600b55565b6000818152600260205260409020546001600160a01b03166115995760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606401610d00565b6000818152600460205260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038416908117909155819061248b826117c0565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60006124cf826117c0565b90506124dd81600084612d76565b6124e8600083612449565b6001600160a01b0381166000908152600360205260408120805460019290612511908490613d03565b9091555050600082815260026020526040808220805473ffffffffffffffffffffffffffffffffffffffff19169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b600080612584836117c0565b9050806001600160a01b0316846001600160a01b031614806125cb57506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b806125ef5750836001600160a01b03166125e484610c49565b6001600160a01b0316145b949350505050565b826001600160a01b031661260a826117c0565b6001600160a01b0316146126865760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201527f6f776e65720000000000000000000000000000000000000000000000000000006064820152608401610d00565b6001600160a01b0382166127015760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610d00565b61270c838383612d76565b612717600082612449565b6001600160a01b0383166000908152600360205260408120805460019290612740908490613d03565b90915550506001600160a01b038216600090815260036020526040812080546001929061276e908490613d16565b9091555050600081815260026020526040808220805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b610b5e828260405180602001604052806000815250612d89565b80341015612830576040517ff14a42b700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8034111561159957336108fc6128468334613d03565b6040518115909202916000818181858888f19350505050158015610b5e573d6000803e3d6000fd5b612876612e12565b600a805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600680546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b612927612e64565b600a805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586128a33390565b6001600160a01b0382166129b25760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610d00565b6000818152600260205260409020546001600160a01b031615612a175760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610d00565b612a2360008383612d76565b6001600160a01b0382166000908152600360205260408120805460019290612a4c908490613d16565b9091555050600081815260026020526040808220805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b816001600160a01b0316836001600160a01b031603612b185760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610d00565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b612b908484846125f7565b612b9c84848484612eb7565b611c155760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610d00565b6000806000612c1d8585613058565b91509150612c2a8161309a565b509392505050565b606060158054610bc690613a7a565b606081600003612c8457505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115612cae5780612c9881613d29565b9150612ca79050600a83613b5b565b9150612c88565b60008167ffffffffffffffff811115612cc957612cc961393d565b6040519080825280601f01601f191660200182016040528015612cf3576020820181803683370190505b5090505b84156125ef57612d08600183613d03565b9150612d15600a86613d43565b612d20906030613d16565b60f81b818381518110612d3557612d35613c7d565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350612d6f600a86613b5b565b9450612cf7565b612d7e612e64565b610da1838383613286565b612d93838361295c565b612da06000848484612eb7565b610da15760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610d00565b600a5460ff166115ac5760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610d00565b600a5460ff16156115ac5760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610d00565b60006001600160a01b0384163b1561304d576040517f150b7a020000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063150b7a0290612f14903390899088908890600401613d57565b6020604051808303816000875af1925050508015612f4f575060408051601f3d908101601f19168201909252612f4c91810190613d93565b60015b613002573d808015612f7d576040519150601f19603f3d011682016040523d82523d6000602084013e612f82565b606091505b508051600003612ffa5760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610d00565b805181602001fd5b7fffffffff00000000000000000000000000000000000000000000000000000000167f150b7a02000000000000000000000000000000000000000000000000000000001490506125ef565b506001949350505050565b600080825160410361308e5760208301516040840151606085015160001a6130828782858561344a565b945094505050506112fc565b506000905060026112fc565b60008160048111156130ae576130ae613db0565b036130b65750565b60018160048111156130ca576130ca613db0565b036131175760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610d00565b600281600481111561312b5761312b613db0565b036131785760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610d00565b600381600481111561318c5761318c613db0565b036131ff5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610d00565b600481600481111561321357613213613db0565b036115995760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610d00565b6001600160a01b03831660009081526009602052604090205460ff16156133155760405162461bcd60e51b815260206004820152602660248201527f4552433732314f70657261746f7246696c7465723a20696c6c6567616c206f7060448201527f657261746f7200000000000000000000000000000000000000000000000000006064820152608401610d00565b6001600160a01b03821660009081526009602052604090205460ff16156133a45760405162461bcd60e51b815260206004820152602660248201527f4552433732314f70657261746f7246696c7465723a20696c6c6567616c206f7060448201527f657261746f7200000000000000000000000000000000000000000000000000006064820152608401610d00565b6001600160a01b038316158015906133c457506001600160a01b03821615155b80156133d757506133d53382613537565b155b15610da15760405162461bcd60e51b815260206004820152602660248201527f4552433732314f70657261746f7246696c7465723a20696c6c6567616c206f7060448201527f657261746f7200000000000000000000000000000000000000000000000000006064820152608401610d00565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115613481575060009050600361352e565b8460ff16601b1415801561349957508460ff16601c14155b156134aa575060009050600461352e565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156134fe573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166135275760006001925092505061352e565b9150600090505b94509492505050565b6008546000906001600160a01b031680613555576001915050610b46565b61355e836117c0565b6001600160a01b0316846001600160a01b031603613580576001915050610b46565b6040517f192c596e0000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b0382169063192c596e90602401602060405180830381865afa1580156135dd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125ef9190613ddf565b7fffffffff000000000000000000000000000000000000000000000000000000008116811461159957600080fd5b60006020828403121561364157600080fd5b8135611fd081613601565b6001600160a01b038116811461159957600080fd5b6000806040838503121561367457600080fd5b823561367f8161364c565b915060208301356bffffffffffffffffffffffff811681146136a057600080fd5b809150509250929050565b60005b838110156136c65781810151838201526020016136ae565b50506000910152565b600081518084526136e78160208601602086016136ab565b601f01601f19169290920160200192915050565b602081526000611fd060208301846136cf565b60006020828403121561372057600080fd5b5035919050565b6000806040838503121561373a57600080fd5b82356137458161364c565b946020939093013593505050565b60008060006060848603121561376857600080fd5b83356137738161364c565b95602085013595506040909401359392505050565b60008060006060848603121561379d57600080fd5b83356137a88161364c565b925060208401356137b88161364c565b929592945050506040919091013590565b600080604083850312156137dc57600080fd5b50508035926020909101359150565b6000602082840312156137fd57600080fd5b8135611fd08161364c565b60008083601f84011261381a57600080fd5b50813567ffffffffffffffff81111561383257600080fd5b6020830191508360208285010111156112fc57600080fd5b6000806020838503121561385d57600080fd5b823567ffffffffffffffff81111561387457600080fd5b61388085828601613808565b90969095509350505050565b6000806020838503121561389f57600080fd5b823567ffffffffffffffff808211156138b757600080fd5b818501915085601f8301126138cb57600080fd5b8135818111156138da57600080fd5b8660208260051b85010111156138ef57600080fd5b60209290920196919550909350505050565b801515811461159957600080fd5b6000806040838503121561392257600080fd5b823561392d8161364c565b915060208301356136a081613901565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000806000806080858703121561398257600080fd5b843561398d8161364c565b9350602085013561399d8161364c565b925060408501359150606085013567ffffffffffffffff808211156139c157600080fd5b818701915087601f8301126139d557600080fd5b8135818111156139e7576139e761393d565b604051601f8201601f19908116603f01168101908382118183101715613a0f57613a0f61393d565b816040528281528a6020848701011115613a2857600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b60008060408385031215613a5f57600080fd5b8235613a6a8161364c565b915060208301356136a08161364c565b600181811c90821680613a8e57607f821691505b602082108103613ac7577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b600060208284031215613adf57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082028115828204841417610b4657610b46613ae6565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600082613b6a57613b6a613b2c565b500490565b601f821115610da157600081815260208120601f850160051c81016020861015613b965750805b601f850160051c820191505b81811015613bb557828155600101613ba2565b505050505050565b67ffffffffffffffff831115613bd557613bd561393d565b613be983613be38354613a7a565b83613b6f565b6000601f841160018114613c1d5760008515613c055750838201355b600019600387901b1c1916600186901b178355611f11565b600083815260209020601f19861690835b82811015613c4e5786850135825560209485019460019092019101613c2e565b5086821015613c6b5760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b67ffffffffffffffff818116838216019080821115613ccd57613ccd613ae6565b5092915050565b60008351613ce68184602088016136ab565b835190830190613cfa8183602088016136ab565b01949350505050565b81810381811115610b4657610b46613ae6565b80820180821115610b4657610b46613ae6565b60006000198203613d3c57613d3c613ae6565b5060010190565b600082613d5257613d52613b2c565b500690565b60006001600160a01b03808716835280861660208401525083604083015260806060830152613d8960808301846136cf565b9695505050505050565b600060208284031215613da557600080fd5b8151611fd081613601565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b600060208284031215613df157600080fd5b8151611fd08161390156fea2646970667358221220078b20e0adbf02cb81f36a592eac27597267f74d43318c57e6ffd95f1a8d7fd664736f6c63430008110033
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.