Feature Tip: Add private address tag to any address under My Name Tag !
ERC-721
Overview
Max Total Supply
250 CHONKYCHKNS
Holders
100
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Balance
0 CHONKYCHKNSLoading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Source Code Verified (Exact Match)
Contract Name:
ChonkyChkns
Compiler Version
v0.8.7+commit.e28d00a7
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT /** /\ _\/_ \__/ / \ ○ ○ / v \ / \ */ pragma solidity >=0.8.0 <0.9.0; import "erc721a/contracts/ERC721A.sol"; import "erc721a/contracts/extensions/ERC721AQueryable.sol"; import "@openzeppelin/contracts/utils/math/Math.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import {MerkleProof} from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import {IFeedToken} from "./FeedToken.sol"; import {ITokenURIManager} from "./TokenURIManager.sol"; import {ITraitsManager} from "./CustomTraitsManager.sol"; contract ChonkyChkns is ERC721A, ERC721AQueryable, Ownable, ReentrancyGuard { using MerkleProof for bytes32[]; // MINTING STATE enum MintState { PRESALE, PUBLIC, CLOSED } MintState public mintState; // MintState-based variables. Index 0 = PRESALE, 1 = PUBLIC. uint256[2] mintCosts; // Membership lists with restricted access enum ExclusiveList { GENESIS, CHONKLIST } // ExclusiveList-based variables. . Index 0 = GENESIS, 1 = CHONKLIST. bytes32[2] private merkleRoots; uint256 public MAX_GENESIS_MINT_AMOUNT_PER_WALLET; uint256 public MAX_CHONKLIST_MINT_AMOUNT_PER_WALLET; // Supply specs by token type uint256 public MAX_SUPPLY; uint256 public MAX_GENESIS_SUPPLY; // Records the number of genesis tokens that have been minted. uint256 public totalGenesisSupply; // Mapping of tokenId to whether it's a genesis token. mapping(uint256 => bool) public isGenesis; // Map of wallet address -> number of genesis/chonklist tokens minted. // Used to enforce max mints per wallet. mapping(address => uint256) public numGenesisMinted; mapping(address => uint256) public numChonklistMinted; // Maps of wallet addresses => number of Genesis/Standard NFTs they own. // Used for feed balance calculations. mapping(address => uint256) public numGenesisOwned; mapping(address => uint256) public numStandardOwned; // Related contracts, for FEED token generation, user-customized traits, // and tokenURI construction based on custom traits IFeedToken public feedToken; ITraitsManager public customTraitsManager; ITokenURIManager public tokenURIManager; constructor() ERC721A("ChonkyChkns", "CHONKYCHKNS") { MAX_SUPPLY = 4994; MAX_GENESIS_SUPPLY = 250; MAX_GENESIS_MINT_AMOUNT_PER_WALLET = 1; MAX_CHONKLIST_MINT_AMOUNT_PER_WALLET = 3; mintCosts = [0.03 ether, 0.03 ether]; mintState = MintState.CLOSED; } // GETTERS / QUERY FUNCTIONS function totalStandardSupply() external view returns (uint256) { // totalGenesisSupply will never exceed totalSupply minted. unchecked { return totalSupply() - totalGenesisSupply; } } function tokenURI(uint256 tokenId) public view override returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); // Role of determining tokenURI per token is delegated to tokenURIManager. // This allows the tokenURI format to flexibly change as new features // are added to the project, e.g. new traits that may affect metadata. return tokenURIManager.tokenURI(tokenId); } // CHECKS function mintPrechecks(uint256 _mintAmount, MintState _mintState) internal view { require(mintState == _mintState, "Mint stage not open"); require( msg.value >= mintCosts[uint256(_mintState)] * _mintAmount, "Insufficient funds" ); } function restrictedMintPrechecks( uint256 _mintAmount, MintState _mintState, ExclusiveList _exclusiveList, bytes32[] calldata proof ) internal view { mintPrechecks(_mintAmount, _mintState); require( proof.verify( merkleRoots[uint256(_exclusiveList)], keccak256(abi.encodePacked(_msgSender())) ), "Not authorized" ); } // MINT FUNCTIONS function genesisPresaleMint(uint256 _mintAmount, bytes32[] calldata proof) external payable nonReentrant { restrictedMintPrechecks( _mintAmount, MintState.PRESALE, ExclusiveList.GENESIS, proof ); uint256 genesisQty = _calculateAndRegisterGenesisQuantity(_mintAmount); _registerPresaleStandardQuantity(_mintAmount - genesisQty); _mintAndUpdateBalance(_mintAmount, genesisQty); } function presaleMint(uint256 _mintAmount, bytes32[] calldata proof) external payable nonReentrant { restrictedMintPrechecks( _mintAmount, MintState.PRESALE, ExclusiveList.CHONKLIST, proof ); _registerPresaleStandardQuantity(_mintAmount); _mintAndUpdateBalance(_mintAmount, 0); } // Call this function if/when MintState = PUBLIC and there are still remaining genesis tokens. // All users (including non-OG roles) will be able to mint up to the max per wallet of // genesis tokens on a first-come first-serve basis. // This function shouldn't be called after all genesis tokens have been minted - // it will function the same as publicMint but cost additional gas. function genesisPublicMint(uint256 _mintAmount) external payable nonReentrant { mintPrechecks(_mintAmount, MintState.PUBLIC); uint256 genesisQty = _calculateAndRegisterGenesisQuantity(_mintAmount); _mintAndUpdateBalance(_mintAmount, genesisQty); } function publicMint(uint256 _mintAmount) external payable nonReentrant { mintPrechecks(_mintAmount, MintState.PUBLIC); _mintAndUpdateBalance(_mintAmount, 0); } // TRANFER FUNCTION function transferFrom( address from, address to, uint256 tokenId ) public virtual override { ERC721A.transferFrom(from, to, tokenId); _updateBalancesOnTransfer(from, to, tokenId); } function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { ERC721A.safeTransferFrom(from, to, tokenId, _data); _updateBalancesOnTransfer(from, to, tokenId); } // OWNER UTILITIES function mintForAddresses( address[] calldata _receivers, uint256[] calldata _amounts ) external onlyOwner { for (uint256 i; i < _receivers.length; ) { _safeMint(_receivers[i], _amounts[i]); _updateBalancesOnStandardMint(_receivers[i], _amounts[i]); unchecked { ++i; } } } function withdraw() external onlyOwner { (bool success, ) = payable(owner()).call{value: address(this).balance}( "" ); require(success, "Withdraw failed!"); } // SETTERS function setFeedToken(address _yield) external onlyOwner { feedToken = IFeedToken(_yield); } function setCustomTraitsManager(address _traitsManager) external onlyOwner { customTraitsManager = ITraitsManager(_traitsManager); } function setTokenURIManager(address _tokenURIManager) external onlyOwner { ITokenURIManager newTokenURIManager = ITokenURIManager( _tokenURIManager ); // If there was a pre-existing TokenURIManager, record the previous base URI // and set it in the new manager if (address(tokenURIManager) != address(0)) { newTokenURIManager.setBaseUri(tokenURIManager.baseURI()); } tokenURIManager = newTokenURIManager; } function setBaseUri(string calldata _baseUri) external onlyOwner { if (address(tokenURIManager) != address(0)) { tokenURIManager.setBaseUri(_baseUri); } } function setMintState(MintState _state) external onlyOwner { mintState = _state; } function setMerkleRootForExclusiveList( bytes32 _root, ExclusiveList _exclusiveList ) external onlyOwner { merkleRoots[uint256(_exclusiveList)] = _root; } // NOTE: UNIT IS WEI! function setMintCostForMintState(uint256 _cost, MintState _mintState) external onlyOwner { mintCosts[uint256(_mintState)] = _cost; } function setMaxSupply(uint256 _supply) external onlyOwner { MAX_SUPPLY = _supply; } function setMaxGenesisSupply(uint256 _supply) external onlyOwner { MAX_GENESIS_SUPPLY = _supply; } function setMaxGenesisMintAmountPerWallet(uint256 _maxMintAmountPerWallet) external onlyOwner { MAX_GENESIS_MINT_AMOUNT_PER_WALLET = _maxMintAmountPerWallet; } function setMaxChonklistMintAmountPerWallet(uint256 _maxMintAmountPerWallet) external onlyOwner { MAX_CHONKLIST_MINT_AMOUNT_PER_WALLET = _maxMintAmountPerWallet; } // INTERNAL FUNCTIONS // Mint helpers function _calculateAndRegisterGenesisQuantity(uint256 _maxMintAmount) internal returns (uint256) { // Allocate as many of _maxMintAmount as possible to be genesis tokens, // under wallet and supply constraints. unchecked { uint256 genesisQty = Math.min( Math.min( MAX_GENESIS_MINT_AMOUNT_PER_WALLET - numGenesisMinted[_msgSender()], _maxMintAmount ), MAX_GENESIS_SUPPLY - totalGenesisSupply ); // If any genesis tokens are being minted in this transaction, perform pre-mint // registration steps for them (set isGenesis status for each tokenId, // increment numGenesisMinted for user, increment totalGenesisSupply) if (genesisQty > 0) { uint256 tokenId = _currentIndex; for (uint256 i = 0; i < genesisQty; ++i) { isGenesis[tokenId + i] = true; } numGenesisMinted[_msgSender()] += genesisQty; totalGenesisSupply += genesisQty; } return genesisQty; } } function _registerPresaleStandardQuantity(uint256 _standardTokenQuantity) internal { // If any standard tokens are being minted in this presale transaction, // verify that the total minted quantity for the user is within max per wallet constraints, // then increment numChonkListMinted for user. if (_standardTokenQuantity > 0) { require( _standardTokenQuantity + numChonklistMinted[_msgSender()] <= MAX_CHONKLIST_MINT_AMOUNT_PER_WALLET, "Exceeded max per wallet" ); numChonklistMinted[_msgSender()] += _standardTokenQuantity; } } function _mintAndUpdateBalance( uint256 _mintAmount, uint256 _genesisMintAmount ) internal { _safeMint(_msgSender(), _mintAmount); _updateBalancesOnGenesisMint(_msgSender(), _genesisMintAmount); _updateBalancesOnStandardMint( _msgSender(), _mintAmount - _genesisMintAmount ); } // Balance updates on transfers/mints function _updateBalancesOnTransfer( address from, address to, uint256 tokenId ) private { feedToken.updateFeedCountOnTransfer(from, to); // No risk of overflow or underflow: // num{Genesis,Standard}Owned[from] will always be > 0 // All num{Genesis,Standard}Owned balances are <= MAX_SUPPLY unchecked { if (isGenesis[tokenId]) { numGenesisOwned[from]--; numGenesisOwned[to]++; } else { numStandardOwned[from]--; numStandardOwned[to]++; } } } function _updateBalancesOnGenesisMint(address _to, uint256 _mintAmount) private { if (_mintAmount > 0) { feedToken.updateFeedCountOnMint(_to); // No risk of overflow unchecked { numGenesisOwned[_to] += _mintAmount; } } } function _updateBalancesOnStandardMint(address _to, uint256 _mintAmount) private { if (_mintAmount > 0) { feedToken.updateFeedCountOnMint(_to); // No risk of overflow unchecked { numStandardOwned[_to] += _mintAmount; } } } // Before mint hook function _beforeTokenTransfers( address from, address, uint256 startTokenId, uint256 quantity ) internal view override { // Check for sufficient supply available before mints if (from == address(0)) { require( startTokenId + quantity <= MAX_SUPPLY, "Max supply exceeded" ); } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0 <0.9.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/math/Math.sol"; import {ChonkyChkns} from "./ChonkyChkns.sol"; import {IFeedToken} from "./FeedToken.sol"; interface ITraitsManager { function getNumericalTrait(uint256 _tokenId, bytes32 _traitName) external view returns (uint256); function getCategoricalTrait(uint256 _tokenId, bytes32 _traitName) external view returns (bytes32); function getFreeFormTrait(uint256 _tokenId, bytes32 _traitName) external view returns (bytes32); function getNumericalTraitIncreasePrice(bytes32 _traitName) external view returns (uint128); function getNumericalTraitDecreasePrice(bytes32 _traitName) external view returns (uint128); function getCategoricalTraitAddPrice( bytes32 _traitName, bytes32 _traitValue ) external view returns (uint128); function getCategoricalTraitRemovePrice( bytes32 _traitName, bytes32 _traitValue ) external view returns (uint128); function getFreeFormTraitAddPrice(bytes32 _traitName) external view returns (uint128); function getFreeFormTraitRemovePrice(bytes32 _traitName) external view returns (uint128); function increaseNumericalTraitForToken( uint256 _tokenId, bytes32 _traitName, uint256 _countToAdd ) external; function decreaseNumericalTraitForToken( uint256 _tokenId, bytes32 _traitName, uint256 _countToSubtract ) external; function setCategoricalTraitForToken( uint256 _tokenId, bytes32 _traitName, bytes32 _traitValue ) external; function removeCategoricalTraitForToken( uint256 _tokenId, bytes32 _traitName ) external; function setFreeFormTraitForToken( uint256 _tokenId, bytes32 _traitName, bytes32 _traitValue ) external; function removeFreeFormTraitForToken(uint256 _tokenId, bytes32 _traitName) external; } contract CustomTraitsManager is Ownable { // Mapping of (token id => (trait name => trait value)) mapping(uint256 => mapping(bytes32 => uint256)) public numericalTraits; mapping(uint256 => mapping(bytes32 => bytes32)) public categoricalTraits; mapping(uint256 => mapping(bytes32 => bytes32)) public freeFormTraits; // Mappings of (numerical/categorical trait type => (price to add a unit, price to remove a unit)). struct Prices { uint128 addPrice; uint128 removePrice; } mapping(bytes32 => Prices) public traitPrices; mapping(bytes32 => mapping(bytes32 => Prices)) public categoricalTraitPrices; // =============================== // Map of contracts that have the ability to modify trait values on tokens, // to perform tasks such as: // - trait boosts/giveaways // - affiliated NFTs that get linked to ChonkyChkns through traits mapping(address => bool) public traitModifiersList; ChonkyChkns public chonkyContract; IFeedToken public feedToken; constructor(address _chonkyChkns) { chonkyContract = ChonkyChkns(_chonkyChkns); feedToken = chonkyContract.feedToken(); } function addTrustedContract(address _contract) external onlyOwner { traitModifiersList[_contract] = true; } function removeTrustedContract(address _contract) external onlyOwner { traitModifiersList[_contract] = false; } function addNewNumericalTrait( bytes32 _traitName, uint128 _traitPriceToIncrease, uint128 _traitPriceToDecrease ) external virtual onlyOwner { require(!_isValidTrait(_traitName), "Trait already exists"); traitPrices[_traitName] = Prices( _traitPriceToIncrease, _traitPriceToDecrease ); } function addNewCategoricalTrait( bytes32 _traitName, bytes32[] calldata _traitValues, uint128[] calldata _addPrices, uint128[] calldata _removePrices ) external virtual onlyOwner { require( _traitValues.length == _addPrices.length, "Trait value and Prices should be the same length." ); require( _traitValues.length == _removePrices.length, "Trait value and Prices should be the same length." ); unchecked { for (uint256 i; i < _traitValues.length; ++i) { bytes32 traitValue = _traitValues[i]; require( !_isValidCategoricalTrait(_traitName, traitValue), "Categorical trait already exists" ); categoricalTraitPrices[_traitName][traitValue] = Prices( _addPrices[i], _removePrices[i] ); } } } function addNewFreeFormTrait( bytes32 _traitName, uint128 _addPrice, uint128 _removePrice ) external virtual onlyOwner { require(!_isValidTrait(_traitName), "Trait already exists"); traitPrices[_traitName] = Prices(_addPrice, _removePrice); } function updateNumericalTraitPrice( bytes32 _traitName, uint128 _traitIncreaseUnitPrice, uint128 _traitDecreaseUnitPrice ) external virtual onlyOwner { _requireValidTrait(_traitName); traitPrices[_traitName] = Prices( _traitIncreaseUnitPrice, _traitDecreaseUnitPrice ); } function updateCategoricalTraitPrice( bytes32 _traitName, bytes32 _traitValue, uint128 _traitAddPrice, uint128 _traitRemovePrice ) external virtual onlyOwner { _requireValidCategoricalTrait(_traitName, _traitValue); categoricalTraitPrices[_traitName][_traitValue] = Prices( _traitAddPrice, _traitRemovePrice ); } function updateFreeFormTraitPrice( bytes32 _traitName, uint128 _traitIncreaseUnitPrice, uint128 _traitDecreaseUnitPrice ) external virtual onlyOwner { _requireValidTrait(_traitName); traitPrices[_traitName] = Prices( _traitIncreaseUnitPrice, _traitDecreaseUnitPrice ); } // GETTERS function getNumericalTrait(uint256 _tokenId, bytes32 _traitName) external view returns (uint256) { _requireValidTrait(_traitName); return numericalTraits[_tokenId][_traitName]; } function getCategoricalTrait(uint256 _tokenId, bytes32 _traitName) external view returns (bytes32) { bytes32 traitValue = categoricalTraits[_tokenId][_traitName]; _requireValidCategoricalTrait(_traitName, traitValue); return traitValue; } function getFreeFormTrait(uint256 _tokenId, bytes32 _traitName) external view returns (bytes32) { _requireValidTrait(_traitName); return freeFormTraits[_tokenId][_traitName]; } function getSortedTokenIdsByTrait(bytes32 _traitName, bool ascending) external view returns (uint256[2][] memory) { _requireValidTrait(_traitName); uint256 numTokens = chonkyContract.totalSupply(); uint256[2][] memory ranks = new uint256[2][](numTokens); unchecked { uint256 ranksLength = 0; for (uint256 i = 0; i < numTokens; ++i) { uint256 traitValue = numericalTraits[i][_traitName]; if (traitValue > 0) { ranks[ranksLength] = [i, traitValue]; ranksLength++; } } if (ranksLength > 0) { _quickSortArrayOfTuples(ranks, 0, ranksLength - 1); } uint256[2][] memory sortedTokens = new uint256[2][](ranksLength); if (ascending) { for (uint256 i = 0; i < ranksLength; ++i) { sortedTokens[i] = ranks[i]; } } else { for (uint256 i = 0; i < ranksLength; ++i) { sortedTokens[i] = ranks[ranksLength - i - 1]; } } return sortedTokens; } } function getNumericalTraitIncreasePrice(bytes32 _traitName) external view returns (uint128) { _requireValidTrait(_traitName); return traitPrices[_traitName].addPrice; } function getNumericalTraitDecreasePrice(bytes32 _traitName) external view returns (uint128) { _requireValidTrait(_traitName); return traitPrices[_traitName].removePrice; } function getCategoricalTraitAddPrice( bytes32 _traitName, bytes32 _traitValue ) external view returns (uint128) { _requireValidCategoricalTrait(_traitName, _traitValue); return categoricalTraitPrices[_traitName][_traitValue].addPrice; } function getCategoricalTraitRemovePrice( bytes32 _traitName, bytes32 _traitValue ) external view returns (uint128) { _requireValidCategoricalTrait(_traitName, _traitValue); return categoricalTraitPrices[_traitName][_traitValue].removePrice; } function getFreeFormTraitAddPrice(bytes32 _traitName) external view returns (uint128) { _requireValidTrait(_traitName); return traitPrices[_traitName].addPrice; } function getFreeFormTraitRemovePrice(bytes32 _traitName) external view returns (uint128) { _requireValidTrait(_traitName); return traitPrices[_traitName].removePrice; } // SETTERS function setFeedToken(address _feedToken) external onlyOwner { feedToken = IFeedToken(_feedToken); } function increaseNumericalTraitForToken( uint256 _tokenId, bytes32 _traitName, uint256 _countToAdd ) external { address tokenOwner = chonkyContract.ownerOf(_tokenId); require( tokenOwner == _msgSender() || _isTrustedCaller(), "Caller is not a trusted contract nor the owner of the given tokenId" ); Prices memory traitPrice = traitPrices[_traitName]; // addPrice and removePrice are set by contract owner, will never overflow unchecked { require( traitPrice.addPrice + traitPrice.removePrice > 0, "Invalid trait" ); } feedToken.spend(tokenOwner, _countToAdd * uint256(traitPrice.addPrice)); numericalTraits[_tokenId][_traitName] += _countToAdd; } function decreaseNumericalTraitForToken( uint256 _tokenId, bytes32 _traitName, uint256 _countToSubtract ) external { address tokenOwner = chonkyContract.ownerOf(_tokenId); require( tokenOwner == _msgSender() || _isTrustedCaller(), "Caller is not a trusted contract nor the owner of the given tokenId" ); Prices memory traitPrice = traitPrices[_traitName]; // addPrice and removePrice are set by contract owner, will never overflow unchecked { require( traitPrice.addPrice + traitPrice.removePrice > 0, "Invalid trait" ); } feedToken.spend( tokenOwner, _countToSubtract * uint256(traitPrice.removePrice) ); numericalTraits[_tokenId][_traitName] -= _countToSubtract; } function setCategoricalTraitForToken( uint256 _tokenId, bytes32 _traitName, bytes32 _traitValue ) external { address tokenOwner = chonkyContract.ownerOf(_tokenId); require( tokenOwner == _msgSender() || _isTrustedCaller(), "Caller is not a trusted contract nor the owner of the given tokenId" ); Prices memory traitPrice = categoricalTraitPrices[_traitName][ _traitValue ]; // addPrice and removePrice are set by contract owner, will never overflow unchecked { require( traitPrice.addPrice + traitPrice.removePrice > 0, "Invalid trait" ); } feedToken.spend(tokenOwner, uint256(traitPrice.addPrice)); categoricalTraits[_tokenId][_traitName] = _traitValue; } function removeCategoricalTraitForToken( uint256 _tokenId, bytes32 _traitName ) external { address tokenOwner = chonkyContract.ownerOf(_tokenId); require( tokenOwner == _msgSender() || _isTrustedCaller(), "Caller is not a trusted contract nor the owner of the given tokenId" ); Prices memory traitPrice = categoricalTraitPrices[_traitName][ categoricalTraits[_tokenId][_traitName] ]; // addPrice and removePrice are set by contract owner, will never overflow unchecked { require( traitPrice.addPrice + traitPrice.removePrice > 0, "Invalid trait" ); } feedToken.spend(tokenOwner, uint256(traitPrice.removePrice)); categoricalTraits[_tokenId][_traitName] = 0; } function setFreeFormTraitForToken( uint256 _tokenId, bytes32 _traitName, bytes32 _traitValue ) external { address tokenOwner = chonkyContract.ownerOf(_tokenId); require( tokenOwner == _msgSender() || _isTrustedCaller(), "Caller is not a trusted contract nor the owner of the given tokenId" ); Prices memory traitPrice = traitPrices[_traitName]; // addPrice and removePrice are set by contract owner, will never overflow unchecked { require( traitPrice.addPrice + traitPrice.removePrice > 0, "Invalid trait" ); } feedToken.spend(tokenOwner, uint256(traitPrice.addPrice)); freeFormTraits[_tokenId][_traitName] = _traitValue; } function removeFreeFormTraitForToken(uint256 _tokenId, bytes32 _traitName) external { address tokenOwner = chonkyContract.ownerOf(_tokenId); require( tokenOwner == _msgSender() || _isTrustedCaller(), "Caller is not a trusted contract nor the owner of the given tokenId" ); Prices memory traitPrice = traitPrices[_traitName]; // addPrice and removePrice are set by contract owner, will never overflow unchecked { require( traitPrice.addPrice + traitPrice.removePrice > 0, "Invalid trait" ); } feedToken.spend(tokenOwner, uint256(traitPrice.removePrice)); freeFormTraits[_tokenId][_traitName] = 0; } // INTERNAL FUNCTIONS function _isTrustedCaller() internal view returns (bool) { return traitModifiersList[_msgSender()]; } function _quickSortArrayOfTuples( uint256[2][] memory arr, uint256 left, uint256 right ) internal pure { unchecked { uint256 i = left; uint256 j = right; if (i == j) return; uint256 pivot = arr[uint256(left + (right - left) / 2)][1]; while (i <= j) { while (arr[uint256(i)][1] < pivot) i++; while (pivot < arr[uint256(j)][1]) j--; if (i <= j) { (arr[uint256(i)], arr[uint256(j)]) = ( arr[uint256(j)], arr[uint256(i)] ); i++; if (j == 0) break; j--; } } if (left < j) _quickSortArrayOfTuples(arr, left, j); if (i < right) _quickSortArrayOfTuples(arr, i, right); } } function _requireValidTrait(bytes32 _traitName) internal view { require(_isValidTrait(_traitName), "This trait does not exist"); } function _requireValidCategoricalTrait( bytes32 _traitName, bytes32 _traitValue ) internal view { require( _isValidCategoricalTrait(_traitName, _traitValue), "This trait does not exist" ); } function _isValidTrait(bytes32 _traitName) internal view returns (bool) { Prices memory existingPrices = traitPrices[_traitName]; // addPrice and removePrice are set by contract owner, will never overflow unchecked { return existingPrices.addPrice + existingPrices.removePrice > 0; } } function _isValidCategoricalTrait(bytes32 _traitName, bytes32 _traitValue) internal view returns (bool) { Prices memory existingPrices = categoricalTraitPrices[_traitName][ _traitValue ]; // addPrice and removePrice are set by contract owner, will never overflow unchecked { return existingPrices.addPrice + existingPrices.removePrice > 0; } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0 <0.9.0; import "@openzeppelin/contracts/utils/Strings.sol"; import {ChonkyChkns} from "./ChonkyChkns.sol"; interface ITokenURIManager { function setBaseUri(string calldata _baseUri) external; function baseURI() external view returns (string memory); function tokenURI(uint256 tokenId) external view returns (string memory); } contract ChonkyChknsTokenURIManager { using Strings for uint256; ChonkyChkns public chonkyContract; string private _baseURI; constructor(address _chonkyChkns) { chonkyContract = ChonkyChkns(_chonkyChkns); } modifier onlyContract() { require( msg.sender == address(chonkyContract), "Only callable by ChonkyChkns contract" ); _; } function setBaseUri(string calldata _newBaseURI) external onlyContract { _baseURI = _newBaseURI; } function baseURI() external view onlyContract returns (string memory) { return _baseURI; } function tokenURI(uint256 tokenId) external view onlyContract returns (string memory) { // TokenURI branches off depending on token type of tokenId string memory tokenType = chonkyContract.isGenesis(tokenId) ? "genesis" : "standard"; return bytes(_baseURI).length != 0 ? string( abi.encodePacked( _baseURI, tokenType, "/", tokenId.toString() ) ) : ""; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0 <0.9.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/math/Math.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import {ChonkyChkns} from "./ChonkyChkns.sol"; interface IFeedToken { function updateFeedCountOnMint(address _user) external; function updateFeedCountOnTransfer(address _from, address _to) external; function updateFeedCount(address _user) external; function getTotalClaimable(address _user) external view returns (uint256); function burn(address _from, uint256 _amount) external; function reward(address _user, uint256 _amount) external; function spend(address _user, uint256 _amount) external; } contract FeedToken is ERC20("Feed", "FEED"), Ownable { // CONSTANTS uint256 public constant SECONDS_IN_DAY = 86400; // settable configs uint256 public GENESIS_RATE = 5 ether; // feed / day generated by genesis tokens uint256 public STANDARD_RATE = 1 ether; // feed per day generated by normal tokens uint256 public FEED_PRODUCTION_END_DATE; // date feed production ends mapping(address => uint256) public feedCount; mapping(address => uint256) public lastUpdate; ChonkyChkns public chonkyContract; // Map of contracts that have the ability to modify feed balances on tokens, // to perform tasks such as: // - FEED giveaways // - spending FEED to buy ChonkyChkns traits (ChonkyChkns's CustomTraitManager will be on the list) mapping(address => bool) public balanceModifiersList; constructor(address _chonkyChkns) { chonkyContract = ChonkyChkns(_chonkyChkns); addTrustedContract(_chonkyChkns); FEED_PRODUCTION_END_DATE = block.timestamp + 5 * 365 * 24 * 60 * 60; } function addTrustedContract(address _contract) public onlyOwner { balanceModifiersList[_contract] = true; } function removeTrustedContract(address _contract) external onlyOwner { balanceModifiersList[_contract] = false; } // FEED COUNT UPDATE FUNCTIONS // Called specifically when minting tokens. function updateFeedCountOnMint(address _user) external { require(_msgSender() == address(chonkyContract), "Can't call this"); uint256 time = Math.min(block.timestamp, FEED_PRODUCTION_END_DATE); _updateFeedCountAtTime(_user, time); } // Called specfically when a token is transferring ownership function updateFeedCountOnTransfer(address _from, address _to) external { require(_msgSender() == address(chonkyContract), "Can't call this"); uint256 time = Math.min(block.timestamp, FEED_PRODUCTION_END_DATE); _updateFeedCountAtTime(_from, time); if (_to != address(0)) { _updateFeedCountAtTime(_to, time); } } // Can be called at any time to have getTotalClaimable() amount reflected in feedCount() balance. function updateFeedCount(address _user) external { uint256 time = Math.min(block.timestamp, FEED_PRODUCTION_END_DATE); _updateFeedCountAtTime(_user, time); } // WITHDRAW FUNCTION // Withdraw (mint) the current feed balance of a particular address to that address. // Pending claimable portion of feed balance is withdrawn as well. function withdrawFeed(address _to) external { require(_msgSender() == _to, "Can only be called by owner of withdrawing address"); uint256 feedToBeClaimed = getTotalClaimable(_to); if (feedToBeClaimed > 0) { feedCount[_to] = 0; lastUpdate[_to] = Math.min( block.timestamp, FEED_PRODUCTION_END_DATE ); _mint(_to, feedToBeClaimed); } } // FUNCTIONS CALLABLE BY TRUSTED CONTRACTS (used for FEED gamification features) function reward(address _user, uint256 _amount) external { require(_isTrustedCaller(), "Can only be called by trusted address"); feedCount[_user] = getTotalClaimable(_user) + _amount; lastUpdate[_user] = Math.min(block.timestamp, FEED_PRODUCTION_END_DATE); } function spend(address _user, uint256 _amount) external { require(_isTrustedCaller(), "Can only be called by trusted address"); uint256 currentBalance = getTotalClaimable(_user); // Amount in excess of user's feedCount balance that needs to be burned from their wallet. uint256 feedCountDiff = _amount - Math.min(_amount, currentBalance); if (feedCountDiff > 0) { _burn(_user, feedCountDiff); } // Set feed count based on remaining amount that needs to be spent from balance feedCount[_user] = currentBalance + feedCountDiff - _amount; lastUpdate[_user] = Math.min(block.timestamp, FEED_PRODUCTION_END_DATE); } function burn(address _from, uint256 _amount) external { require(_isTrustedCaller(), "Can only be called by trusted address"); _burn(_from, _amount); } // VIEW FUNCTIONS function getTotalClaimable(address _user) public view returns (uint256) { // lastUpdate[_user] is upper bounded by FEED_PRODUCTION_END_DATE - this will not underflow uint256 timeSinceLastUpdate; unchecked { timeSinceLastUpdate = Math.min(block.timestamp, FEED_PRODUCTION_END_DATE) - lastUpdate[_user]; } uint256 numGenesisOwned = chonkyContract.numGenesisOwned(_user); uint256 numStandardOwned = chonkyContract.numStandardOwned(_user); uint256 genesisPending = numGenesisOwned > 0 ? _getPendingFeed( numGenesisOwned, GENESIS_RATE, timeSinceLastUpdate ) : 0; uint256 normalPending = numStandardOwned > 0 ? _getPendingFeed( numStandardOwned, STANDARD_RATE, timeSinceLastUpdate ) : 0; return feedCount[_user] + genesisPending + normalPending; } // INTERNAL FUNCTIONS function _isTrustedCaller() internal view returns (bool) { return balanceModifiersList[_msgSender()]; } function _updateFeedCountAtTime(address _user, uint256 time) internal { uint256 lastUpdateTime = lastUpdate[_user]; if (lastUpdateTime > 0) { uint256 numGenesisOwned = chonkyContract.numGenesisOwned(_user); uint256 numStandardOwned = chonkyContract.numStandardOwned(_user); uint256 timeSinceLastUpdate = time - lastUpdateTime; uint256 totalPending; // Non-zero conditionals - Slight optimization for those only holding one token type if (numGenesisOwned > 0) { totalPending += _getPendingFeed( numGenesisOwned, GENESIS_RATE, timeSinceLastUpdate ); } if (numStandardOwned > 0) { totalPending += _getPendingFeed( numStandardOwned, STANDARD_RATE, timeSinceLastUpdate ); } feedCount[_user] += totalPending; } lastUpdate[_user] = time; } // get number of feed pending given number of chkn tokens, feed rate per day, time elapsed function _getPendingFeed( uint256 _numTokens, uint256 _rate, uint256 _timeElapsed ) internal pure returns (uint256) { return _numTokens * ((_rate * _timeElapsed) / SECONDS_IN_DAY); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.0; /** * @dev These functions deal with verification of Merkle Trees proofs. * * The proofs can be generated using the JavaScript library * https://github.com/miguelmota/merkletreejs[merkletreejs]. * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled. * * See `test/utils/cryptography/MerkleProof.test.js` for some examples. * * WARNING: You should avoid using leaf values that are 64 bytes long prior to * hashing, or use a hash function other than keccak256 for hashing leaves. * This is because the concatenation of a sorted pair of internal nodes in * the merkle tree could be reinterpreted as a leaf value. */ library MerkleProof { /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify( bytes32[] memory proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProof(proof, leaf) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leafs & pre-images are assumed to be sorted. * * _Available since v4.4._ */ function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { bytes32 proofElement = proof[i]; if (computedHash <= proofElement) { // Hash(current computed hash + current element of the proof) computedHash = _efficientHash(computedHash, proofElement); } else { // Hash(current element of the proof + current computed hash) computedHash = _efficientHash(proofElement, computedHash); } } return computedHash; } function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) { assembly { mstore(0x00, a) mstore(0x20, b) value := keccak256(0x00, 0x40) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a / b + (a % b == 0 ? 0 : 1); } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v3.3.0 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721AQueryable.sol'; import '../ERC721A.sol'; /** * @title ERC721A Queryable * @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` * * If the `tokenId` is burned: * - `addr` = `<Address of owner before token was burned>` * - `startTimestamp` = `<Timestamp when token was burned>` * - `burned = `true` * * Otherwise: * - `addr` = `<Address of owner>` * - `startTimestamp` = `<Timestamp of start of ownership>` * - `burned = `false` */ function explicitOwnershipOf(uint256 tokenId) public view override returns (TokenOwnership memory) { TokenOwnership memory ownership; if (tokenId < _startTokenId() || tokenId >= _currentIndex) { return ownership; } ownership = _ownerships[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[] memory tokenIds) external view 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 override returns (uint256[] memory) { unchecked { if (start >= stop) revert InvalidQueryRange(); uint256 tokenIdsIdx; uint256 stopLimit = _currentIndex; // Set `start = max(start, _startTokenId())`. if (start < _startTokenId()) { start = _startTokenId(); } // Set `stop = min(stop, _currentIndex)`. 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 = _ownerships[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 pfp collections should be fine). */ function tokensOfOwner(address owner) external view 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 = _ownerships[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 // ERC721A Contracts v3.3.0 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721A.sol'; import '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol'; import '@openzeppelin/contracts/utils/Address.sol'; import '@openzeppelin/contracts/utils/Context.sol'; import '@openzeppelin/contracts/utils/Strings.sol'; import '@openzeppelin/contracts/utils/introspection/ERC165.sol'; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension. Built to optimize for lower gas during batch mints. * * Assumes serials are sequentially minted starting at _startTokenId() (defaults to 0, e.g. 0, 1, 2, 3..). * * Assumes that an owner cannot have more than 2**64 - 1 (max value of uint64) of supply. * * Assumes that the maximum token id cannot exceed 2**256 - 1 (max value of uint256). */ contract ERC721A is Context, ERC165, IERC721A { using Address for address; using Strings for uint256; // The tokenId of the next token to be minted. uint256 internal _currentIndex; // The number of tokens burned. uint256 internal _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 _ownershipOf implementation for details. mapping(uint256 => TokenOwnership) internal _ownerships; // Mapping owner address to address data mapping(address => AddressData) private _addressData; // 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; constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; _currentIndex = _startTokenId(); } /** * To change the starting tokenId, please override this function. */ function _startTokenId() internal view virtual returns (uint256) { return 0; } /** * @dev Burned tokens are calculated here, use _totalMinted() if you want to count just minted tokens. */ function totalSupply() public view override returns (uint256) { // Counter underflow is impossible as _burnCounter cannot be incremented // more than _currentIndex - _startTokenId() times unchecked { return _currentIndex - _burnCounter - _startTokenId(); } } /** * Returns the total amount of tokens minted in the contract. */ function _totalMinted() internal view returns (uint256) { // Counter underflow is impossible as _currentIndex does not decrement, // and it is initialized to _startTokenId() unchecked { return _currentIndex - _startTokenId(); } } /** * @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 override returns (uint256) { if (owner == address(0)) revert BalanceQueryForZeroAddress(); return uint256(_addressData[owner].balance); } /** * Returns the number of tokens minted by `owner`. */ function _numberMinted(address owner) internal view returns (uint256) { return uint256(_addressData[owner].numberMinted); } /** * Returns the number of tokens burned by or on behalf of `owner`. */ function _numberBurned(address owner) internal view returns (uint256) { return uint256(_addressData[owner].numberBurned); } /** * Returns the auxillary data for `owner`. (e.g. number of whitelist mint slots used). */ function _getAux(address owner) internal view returns (uint64) { return _addressData[owner].aux; } /** * Sets the auxillary 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 { _addressData[owner].aux = aux; } /** * Gas spent here starts off proportional to the maximum mint batch size. * It gradually moves to O(1) as tokens get transferred around in the collection over time. */ function _ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) { uint256 curr = tokenId; unchecked { if (_startTokenId() <= curr) if (curr < _currentIndex) { TokenOwnership memory ownership = _ownerships[curr]; if (!ownership.burned) { if (ownership.addr != address(0)) { return ownership; } // Invariant: // There will always be an ownership that has an address and is not burned // before an ownership that does not have an address and is not burned. // Hence, curr will not underflow. while (true) { curr--; ownership = _ownerships[curr]; if (ownership.addr != address(0)) { return ownership; } } } } } revert OwnerQueryForNonexistentToken(); } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view override returns (address) { return _ownershipOf(tokenId).addr; } /** * @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) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ''; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ''; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public override { address owner = ERC721A.ownerOf(tokenId); if (to == owner) revert ApprovalToCurrentOwner(); if (_msgSender() != owner) if(!isApprovedForAll(owner, _msgSender())) { revert ApprovalCallerNotOwnerNorApproved(); } _approve(to, tokenId, owner); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view override returns (address) { if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken(); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { if (operator == _msgSender()) revert ApproveToCaller(); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_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 { _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 { _transfer(from, to, tokenId); if (to.isContract()) if(!_checkContractOnERC721Received(from, to, tokenId, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } /** * @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`), */ function _exists(uint256 tokenId) internal view returns (bool) { return _startTokenId() <= tokenId && tokenId < _currentIndex && !_ownerships[tokenId].burned; } /** * @dev Equivalent to `_safeMint(to, quantity, '')`. */ function _safeMint(address to, uint256 quantity) internal { _safeMint(to, 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. * * Emits a {Transfer} event. */ function _safeMint( address to, uint256 quantity, bytes memory _data ) internal { uint256 startTokenId = _currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1 // updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1 unchecked { _addressData[to].balance += uint64(quantity); _addressData[to].numberMinted += uint64(quantity); _ownerships[startTokenId].addr = to; _ownerships[startTokenId].startTimestamp = uint64(block.timestamp); uint256 updatedIndex = startTokenId; uint256 end = updatedIndex + quantity; if (to.isContract()) { do { emit Transfer(address(0), to, updatedIndex); if (!_checkContractOnERC721Received(address(0), to, updatedIndex++, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } while (updatedIndex < end); // Reentrancy protection if (_currentIndex != startTokenId) revert(); } else { do { emit Transfer(address(0), to, updatedIndex++); } while (updatedIndex < end); } _currentIndex = updatedIndex; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @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. */ function _mint(address to, uint256 quantity) internal { uint256 startTokenId = _currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1 // updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1 unchecked { _addressData[to].balance += uint64(quantity); _addressData[to].numberMinted += uint64(quantity); _ownerships[startTokenId].addr = to; _ownerships[startTokenId].startTimestamp = uint64(block.timestamp); uint256 updatedIndex = startTokenId; uint256 end = updatedIndex + quantity; do { emit Transfer(address(0), to, updatedIndex++); } while (updatedIndex < end); _currentIndex = updatedIndex; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Transfers `tokenId` from `from` to `to`. * * 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 ) private { TokenOwnership memory prevOwnership = _ownershipOf(tokenId); if (prevOwnership.addr != from) revert TransferFromIncorrectOwner(); bool isApprovedOrOwner = (_msgSender() == from || isApprovedForAll(from, _msgSender()) || getApproved(tokenId) == _msgSender()); if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved(); if (to == address(0)) revert TransferToZeroAddress(); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner _approve(address(0), tokenId, from); // 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 { _addressData[from].balance -= 1; _addressData[to].balance += 1; TokenOwnership storage currSlot = _ownerships[tokenId]; currSlot.addr = to; currSlot.startTimestamp = uint64(block.timestamp); // If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it. // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls. uint256 nextTokenId = tokenId + 1; TokenOwnership storage nextSlot = _ownerships[nextTokenId]; if (nextSlot.addr == address(0)) { // This will suffice for checking _exists(nextTokenId), // as a burned slot cannot contain the zero address. if (nextTokenId != _currentIndex) { nextSlot.addr = from; nextSlot.startTimestamp = prevOwnership.startTimestamp; } } } emit Transfer(from, to, tokenId); _afterTokenTransfers(from, to, tokenId, 1); } /** * @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 { TokenOwnership memory prevOwnership = _ownershipOf(tokenId); address from = prevOwnership.addr; if (approvalCheck) { bool isApprovedOrOwner = (_msgSender() == from || isApprovedForAll(from, _msgSender()) || getApproved(tokenId) == _msgSender()); if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved(); } _beforeTokenTransfers(from, address(0), tokenId, 1); // Clear approvals from the previous owner _approve(address(0), tokenId, from); // 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 { AddressData storage addressData = _addressData[from]; addressData.balance -= 1; addressData.numberBurned += 1; // Keep track of who burned the token, and the timestamp of burning. TokenOwnership storage currSlot = _ownerships[tokenId]; currSlot.addr = from; currSlot.startTimestamp = uint64(block.timestamp); currSlot.burned = true; // If the ownership slot of tokenId+1 is not explicitly set, that means the burn initiator owns it. // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls. uint256 nextTokenId = tokenId + 1; TokenOwnership storage nextSlot = _ownerships[nextTokenId]; if (nextSlot.addr == address(0)) { // This will suffice for checking _exists(nextTokenId), // as a burned slot cannot contain the zero address. if (nextTokenId != _currentIndex) { nextSlot.addr = from; nextSlot.startTimestamp = prevOwnership.startTimestamp; } } } emit Transfer(from, address(0), tokenId); _afterTokenTransfers(from, address(0), tokenId, 1); // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times. unchecked { _burnCounter++; } } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve( address to, uint256 tokenId, address owner ) private { _tokenApprovals[tokenId] = to; emit Approval(owner, to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target 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 _checkContractOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert TransferToNonERC721ReceiverImplementer(); } else { assembly { revert(add(32, reason), mload(reason)) } } } } /** * @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 {} }
// SPDX-License-Identifier: MIT // ERC721A Contracts v3.3.0 // Creator: Chiru Labs pragma solidity ^0.8.4; import '../IERC721A.sol'; /** * @dev Interface of an ERC721AQueryable compliant contract. */ 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` * * If the `tokenId` is burned: * - `addr` = `<Address of owner before token was burned>` * - `startTimestamp` = `<Timestamp when token was burned>` * - `burned = `true` * * Otherwise: * - `addr` = `<Address of owner>` * - `startTimestamp` = `<Timestamp of start of ownership>` * - `burned = `false` */ 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 pfp collections should be fine). */ function tokensOfOwner(address owner) external view returns (uint256[] memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.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 // ERC721A Contracts v3.3.0 // Creator: Chiru Labs pragma solidity ^0.8.4; import '@openzeppelin/contracts/token/ERC721/IERC721.sol'; import '@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol'; /** * @dev Interface of an ERC721A compliant contract. */ interface IERC721A is IERC721, IERC721Metadata { /** * The caller must own the token or be an approved operator. */ error ApprovalCallerNotOwnerNorApproved(); /** * The token does not exist. */ error ApprovalQueryForNonexistentToken(); /** * The caller cannot approve to their own address. */ error ApproveToCaller(); /** * The caller cannot approve to the current owner. */ error ApprovalToCurrentOwner(); /** * 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(); // Compiler will pack this into a single 256bit word. struct TokenOwnership { // The address of the owner. address addr; // Keeps track of the start time of ownership with minimal overhead for tokenomics. uint64 startTimestamp; // Whether the token has been burned. bool burned; } // Compiler will pack this into a single 256bit word. struct AddressData { // Realistically, 2**64-1 is more than enough. uint64 balance; // Keeps track of mint count with minimal overhead for tokenomics. uint64 numberMinted; // Keeps track of burn count with minimal overhead for tokenomics. uint64 numberBurned; // For miscellaneous variable(s) pertaining to the address // (e.g. number of whitelist mint slots used). // If there are multiple variables, please pack them into a uint64. uint64 aux; } /** * @dev Returns the total amount of tokens stored by the contract. * * Burned tokens are calculated here, use `_totalMinted()` if you want to count just minted tokens. */ function totalSupply() external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol) pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; } _balances[to] += amount; emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens 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 amount ) 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, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been 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 _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
// 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/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 be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
{ "optimizer": { "enabled": true, "runs": 200 }, "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":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"ApprovalToCurrentOwner","type":"error"},{"inputs":[],"name":"ApproveToCaller","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"InvalidQueryRange","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"MAX_CHONKLIST_MINT_AMOUNT_PER_WALLET","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_GENESIS_MINT_AMOUNT_PER_WALLET","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_GENESIS_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"customTraitsManager","outputs":[{"internalType":"contract ITraitsManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"explicitOwnershipOf","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"}],"internalType":"struct IERC721A.TokenOwnership","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"explicitOwnershipsOf","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"}],"internalType":"struct IERC721A.TokenOwnership[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feedToken","outputs":[{"internalType":"contract IFeedToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_mintAmount","type":"uint256"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"genesisPresaleMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_mintAmount","type":"uint256"}],"name":"genesisPublicMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"isGenesis","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_receivers","type":"address[]"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"}],"name":"mintForAddresses","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"mintState","outputs":[{"internalType":"enum ChonkyChkns.MintState","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"numChonklistMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"numGenesisMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"numGenesisOwned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"numStandardOwned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":[{"internalType":"uint256","name":"_mintAmount","type":"uint256"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"presaleMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_mintAmount","type":"uint256"}],"name":"publicMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","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":"_traitsManager","type":"address"}],"name":"setCustomTraitsManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_yield","type":"address"}],"name":"setFeedToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxMintAmountPerWallet","type":"uint256"}],"name":"setMaxChonklistMintAmountPerWallet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxMintAmountPerWallet","type":"uint256"}],"name":"setMaxGenesisMintAmountPerWallet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_supply","type":"uint256"}],"name":"setMaxGenesisSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_supply","type":"uint256"}],"name":"setMaxSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_root","type":"bytes32"},{"internalType":"enum ChonkyChkns.ExclusiveList","name":"_exclusiveList","type":"uint8"}],"name":"setMerkleRootForExclusiveList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_cost","type":"uint256"},{"internalType":"enum ChonkyChkns.MintState","name":"_mintState","type":"uint8"}],"name":"setMintCostForMintState","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum ChonkyChkns.MintState","name":"_state","type":"uint8"}],"name":"setMintState","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenURIManager","type":"address"}],"name":"setTokenURIManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenURIManager","outputs":[{"internalType":"contract ITokenURIManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"tokensOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"stop","type":"uint256"}],"name":"tokensOfOwnerIn","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalGenesisSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalStandardSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b506040518060400160405280600b81526020016a43686f6e6b7943686b6e7360a81b8152506040518060400160405280600b81526020016a43484f4e4b5943484b4e5360a81b81525081600290805190602001906200007292919062000144565b5080516200008890600390602084019062000144565b505060008055506200009a33620000f2565b6001600981905561138260115560fa601255600f55600360105560408051808201909152666a94d74f4300008082526020820152620000de90600b906002620001d3565b50600a805460ff1916600217905562000263565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b828054620001529062000226565b90600052602060002090601f016020900481019282620001765760008555620001c1565b82601f106200019157805160ff1916838001178555620001c1565b82800160010185558215620001c1579182015b82811115620001c1578251825591602001919060010190620001a4565b50620001cf9291506200020f565b5090565b8260028101928215620001c1579160200282015b82811115620001c1578251829066ffffffffffffff16905591602001919060010190620001e7565b5b80821115620001cf576000815560010162000210565b600181811c908216806200023b57607f821691505b602082108114156200025d57634e487b7160e01b600052602260045260246000fd5b50919050565b61307a80620002736000396000f3fe60806040526004361061031a5760003560e01c806395d89b41116101ab578063c23dc68f116100f7578063e985e9c511610095578063f1e25ea81161006f578063f1e25ea814610945578063f2fde38b14610975578063f4adf43314610995578063f5690ef9146109b557600080fd5b8063e985e9c5146108f2578063eb50411e14610912578063f11cb0af1461092557600080fd5b8063c87b56dd116100d1578063c87b56dd14610889578063dcbbe13a146108a9578063e3e1e8ef146108bf578063e43fe0da146108d257600080fd5b8063c23dc68f1461081c578063c27308a814610849578063c4277da81461086957600080fd5b8063b1826a4e11610164578063b88d4fde1161013e578063b88d4fde14610788578063bd93bc30146107a8578063bf252443146107c8578063c051e38a146107f557600080fd5b8063b1826a4e14610735578063b4ad57ec14610755578063b585f0981461077557600080fd5b806395d89b411461067d57806399a2557a146106925780639c5ee7e0146106b25780639ce8d33d146106c8578063a0bcfc7f146106f5578063a22cb4651461071557600080fd5b806345aafae51161026a57806370a0823111610223578063838dc2b6116101fd578063838dc2b6146105fd5780638462151c146106125780638da5cb5b1461063f57806393b6cf9b1461065d57600080fd5b806370a08231146105b2578063715018a6146105d2578063738e7218146105e757600080fd5b806345aafae5146104d85780635bbb2177146104f85780635eed9c6b146105255780636352211e146105455780636d6c3c97146105655780636f8b44b01461059257600080fd5b806318160ddd116102d757806332cb6b0c116102b157806332cb6b0c1461047757806333373ab51461048d5780633ccfd60b146104a357806342842e0e146104b857600080fd5b806318160ddd1461042b57806323b872dd146104445780632db115441461046457600080fd5b806301ffc9a71461031f57806302ac5b1c1461035457806304ac96db1461037657806306fdde03146103b1578063081812fc146103d3578063095ea7b31461040b575b600080fd5b34801561032b57600080fd5b5061033f61033a366004612ad6565b6109d5565b60405190151581526020015b60405180910390f35b34801561036057600080fd5b5061037461036f366004612c12565b610a27565b005b34801561038257600080fd5b506103a36103913660046127c9565b60156020526000908152604090205481565b60405190815260200161034b565b3480156103bd57600080fd5b506103c6610a5f565b60405161034b9190612dfb565b3480156103df57600080fd5b506103f36103ee366004612c12565b610af1565b6040516001600160a01b03909116815260200161034b565b34801561041757600080fd5b50610374610426366004612939565b610b35565b34801561043757600080fd5b50600154600054036103a3565b34801561045057600080fd5b5061037461045f366004612817565b610bbc565b610374610472366004612c12565b610bd2565b34801561048357600080fd5b506103a360115481565b34801561049957600080fd5b506103a360105481565b3480156104af57600080fd5b50610374610c18565b3480156104c457600080fd5b506103746104d3366004612817565b610cec565b3480156104e457600080fd5b50601b546103f3906001600160a01b031681565b34801561050457600080fd5b50610518610513366004612a01565b610d07565b60405161034b9190612d02565b34801561053157600080fd5b50610374610540366004612aad565b610dcd565b34801561055157600080fd5b506103f3610560366004612c12565b610e22565b34801561057157600080fd5b506103a36105803660046127c9565b60166020526000908152604090205481565b34801561059e57600080fd5b506103746105ad366004612c12565b610e34565b3480156105be57600080fd5b506103a36105cd3660046127c9565b610e63565b3480156105de57600080fd5b50610374610eb1565b3480156105f357600080fd5b506103a360125481565b34801561060957600080fd5b506103a3610ee7565b34801561061e57600080fd5b5061063261062d3660046127c9565b610eff565b60405161034b9190612d6c565b34801561064b57600080fd5b506008546001600160a01b03166103f3565b34801561066957600080fd5b50601a546103f3906001600160a01b031681565b34801561068957600080fd5b506103c661104c565b34801561069e57600080fd5b506106326106ad366004612963565b61105b565b3480156106be57600080fd5b506103a3600f5481565b3480156106d457600080fd5b506103a36106e33660046127c9565b60186020526000908152604090205481565b34801561070157600080fd5b50610374610710366004612b2b565b611213565b34801561072157600080fd5b506103746107303660046128fd565b6112b7565b34801561074157600080fd5b50610374610750366004612996565b61134d565b34801561076157600080fd5b50610374610770366004612c12565b611421565b610374610783366004612c2b565b611450565b34801561079457600080fd5b506103746107a3366004612853565b6114ba565b3480156107b457600080fd5b506103746107c3366004612c12565b6114d7565b3480156107d457600080fd5b506103a36107e33660046127c9565b60176020526000908152604090205481565b34801561080157600080fd5b50600a5461080f9060ff1681565b60405161034b9190612da4565b34801561082857600080fd5b5061083c610837366004612c12565b611506565b60405161034b9190612e7a565b34801561085557600080fd5b506019546103f3906001600160a01b031681565b34801561087557600080fd5b506103746108843660046127c9565b6115b4565b34801561089557600080fd5b506103c66108a4366004612c12565b611600565b3480156108b557600080fd5b506103a360135481565b6103746108cd366004612c2b565b6116a8565b3480156108de57600080fd5b506103746108ed3660046127c9565b6116fd565b3480156108fe57600080fd5b5061033f61090d3660046127e4565b611749565b610374610920366004612c12565b611777565b34801561093157600080fd5b50610374610940366004612b10565b6117ca565b34801561095157600080fd5b5061033f610960366004612c12565b60146020526000908152604090205460ff1681565b34801561098157600080fd5b506103746109903660046127c9565b61181b565b3480156109a157600080fd5b506103746109b0366004612c76565b6118b3565b3480156109c157600080fd5b506103746109d03660046127c9565b6118f2565b60006001600160e01b031982166380ac58cd60e01b1480610a0657506001600160e01b03198216635b5e139f60e01b145b80610a2157506301ffc9a760e01b6001600160e01b03198316145b92915050565b6008546001600160a01b03163314610a5a5760405162461bcd60e51b8152600401610a5190612e0e565b60405180910390fd5b601055565b606060028054610a6e90612f80565b80601f0160208091040260200160405190810160405280929190818152602001828054610a9a90612f80565b8015610ae75780601f10610abc57610100808354040283529160200191610ae7565b820191906000526020600020905b815481529060010190602001808311610aca57829003601f168201915b5050505050905090565b6000610afc82611a3a565b610b19576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b6000610b4082610e22565b9050806001600160a01b0316836001600160a01b03161415610b755760405163250fdee360e21b815260040160405180910390fd5b336001600160a01b03821614610bac57610b8f8133611749565b610bac576040516367d9dca160e11b815260040160405180910390fd5b610bb7838383611a65565b505050565b610bc7838383611ac1565b610bb7838383611acc565b60026009541415610bf55760405162461bcd60e51b8152600401610a5190612e43565b6002600955610c05816001611bb2565b610c10816000611c93565b506001600955565b6008546001600160a01b03163314610c425760405162461bcd60e51b8152600401610a5190612e0e565b6000610c566008546001600160a01b031690565b6001600160a01b03164760405160006040518083038185875af1925050503d8060008114610ca0576040519150601f19603f3d011682016040523d82523d6000602084013e610ca5565b606091505b5050905080610ce95760405162461bcd60e51b815260206004820152601060248201526f5769746864726177206661696c65642160801b6044820152606401610a51565b50565b610bb7838383604051806020016040528060008152506114ba565b80516060906000816001600160401b03811115610d2657610d26613018565b604051908082528060200260200182016040528015610d7157816020015b6040805160608101825260008082526020808301829052928201528252600019909201910181610d445790505b50905060005b828114610dc557610da0858281518110610d9357610d93613002565b6020026020010151611506565b828281518110610db257610db2613002565b6020908102919091010152600101610d77565b509392505050565b6008546001600160a01b03163314610df75760405162461bcd60e51b8152600401610a5190612e0e565b81600d826001811115610e0c57610e0c612fec565b60028110610e1c57610e1c613002565b01555050565b6000610e2d82611cba565b5192915050565b6008546001600160a01b03163314610e5e5760405162461bcd60e51b8152600401610a5190612e0e565b601155565b60006001600160a01b038216610e8c576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b6008546001600160a01b03163314610edb5760405162461bcd60e51b8152600401610a5190612e0e565b610ee56000611dd4565b565b6000601354610ef96001546000540390565b03905090565b60606000806000610f0f85610e63565b90506000816001600160401b03811115610f2b57610f2b613018565b604051908082528060200260200182016040528015610f54578160200160208202803683370190505b509050610f7a604080516060810182526000808252602082018190529181019190915290565b60005b83861461104057600081815260046020908152604091829020825160608101845290546001600160a01b0381168252600160a01b81046001600160401b031692820192909252600160e01b90910460ff16158015928201929092529250610fe357611038565b81516001600160a01b031615610ff857815194505b876001600160a01b0316856001600160a01b03161415611038578083878060010198508151811061102b5761102b613002565b6020026020010181815250505b600101610f7d565b50909695505050505050565b606060038054610a6e90612f80565b606081831061107d57604051631960ccad60e11b815260040160405180910390fd5b600080548084111561108d578093505b600061109887610e63565b9050848610156110b757858503818110156110b1578091505b506110bb565b5060005b6000816001600160401b038111156110d5576110d5613018565b6040519080825280602002602001820160405280156110fe578160200160208202803683370190505b5090508161111157935061120c92505050565b600061111c88611506565b90506000816040015161112d575080515b885b88811415801561113f5750848714155b1561120057600081815260046020908152604091829020825160608101845290546001600160a01b0381168252600160a01b81046001600160401b031692820192909252600160e01b90910460ff161580159282019290925293506111a3576111f8565b82516001600160a01b0316156111b857825191505b8a6001600160a01b0316826001600160a01b031614156111f857808488806001019950815181106111eb576111eb613002565b6020026020010181815250505b60010161112f565b50505092835250909150505b9392505050565b6008546001600160a01b0316331461123d5760405162461bcd60e51b8152600401610a5190612e0e565b601b546001600160a01b0316156112b357601b5460405163a0bcfc7f60e01b81526001600160a01b039091169063a0bcfc7f906112809085908590600401612dcc565b600060405180830381600087803b15801561129a57600080fd5b505af11580156112ae573d6000803e3d6000fd5b505050505b5050565b6001600160a01b0382163314156112e15760405163b06307db60e01b815260040160405180910390fd5b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6008546001600160a01b031633146113775760405162461bcd60e51b8152600401610a5190612e0e565b60005b8381101561141a576113ca85858381811061139757611397613002565b90506020020160208101906113ac91906127c9565b8484848181106113be576113be613002565b90506020020135611e26565b6114128585838181106113df576113df613002565b90506020020160208101906113f491906127c9565b84848481811061140657611406613002565b90506020020135611e40565b60010161137a565b5050505050565b6008546001600160a01b0316331461144b5760405162461bcd60e51b8152600401610a5190612e0e565b600f55565b600260095414156114735760405162461bcd60e51b8152600401610a5190612e43565b6002600955611486836000808585611ec7565b600061149184611fa8565b90506114a56114a08286612f3d565b612039565b6114af8482611c93565b505060016009555050565b6114c6848484846120d1565b6114d1848484611acc565b50505050565b6008546001600160a01b031633146115015760405162461bcd60e51b8152600401610a5190612e0e565b601255565b604080516060808201835260008083526020808401829052838501829052845192830185528183528201819052928101839052909150600054831061154b5792915050565b50600082815260046020908152604091829020825160608101845290546001600160a01b0381168252600160a01b81046001600160401b031692820192909252600160e01b90910460ff1615801592820192909252906115ab5792915050565b61120c83611cba565b6008546001600160a01b031633146115de5760405162461bcd60e51b8152600401610a5190612e0e565b601a80546001600160a01b0319166001600160a01b0392909216919091179055565b606061160b82611a3a565b61162857604051630a14c4b560e41b815260040160405180910390fd5b601b5460405163c87b56dd60e01b8152600481018490526001600160a01b039091169063c87b56dd9060240160006040518083038186803b15801561166c57600080fd5b505afa158015611680573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610a219190810190612b9c565b600260095414156116cb5760405162461bcd60e51b8152600401610a5190612e43565b60026009556116df83600060018585611ec7565b6116e883612039565b6116f3836000611c93565b5050600160095550565b6008546001600160a01b031633146117275760405162461bcd60e51b8152600401610a5190612e0e565b601980546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b6002600954141561179a5760405162461bcd60e51b8152600401610a5190612e43565b60026009556117aa816001611bb2565b60006117b582611fa8565b90506117c18282611c93565b50506001600955565b6008546001600160a01b031633146117f45760405162461bcd60e51b8152600401610a5190612e0e565b600a805482919060ff1916600183600281111561181357611813612fec565b021790555050565b6008546001600160a01b031633146118455760405162461bcd60e51b8152600401610a5190612e0e565b6001600160a01b0381166118aa5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a51565b610ce981611dd4565b6008546001600160a01b031633146118dd5760405162461bcd60e51b8152600401610a5190612e0e565b81600b826002811115610e0c57610e0c612fec565b6008546001600160a01b0316331461191c5760405162461bcd60e51b8152600401610a5190612e0e565b601b5481906001600160a01b031615611a1757806001600160a01b031663a0bcfc7f601b60009054906101000a90046001600160a01b03166001600160a01b0316636c0360eb6040518163ffffffff1660e01b815260040160006040518083038186803b15801561198c57600080fd5b505afa1580156119a0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526119c89190810190612b9c565b6040518263ffffffff1660e01b81526004016119e49190612dfb565b600060405180830381600087803b1580156119fe57600080fd5b505af1158015611a12573d6000803e3d6000fd5b505050505b601b80546001600160a01b0319166001600160a01b039290921691909117905550565b6000805482108015610a21575050600090815260046020526040902054600160e01b900460ff161590565b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b610bb7838383612115565b6019546040516246474760e51b81526001600160a01b0385811660048301528481166024830152909116906308c8e8e090604401600060405180830381600087803b158015611b1a57600080fd5b505af1158015611b2e573d6000803e3d6000fd5b50505060008281526014602052604090205460ff16159050611b7e576001600160a01b03808416600090815260176020526040808220805460001901905591841681522080546001019055505050565b6001600160a01b03808416600090815260186020526040808220805460001901905591841681522080546001019055505050565b806002811115611bc457611bc4612fec565b600a5460ff166002811115611bdb57611bdb612fec565b14611c1e5760405162461bcd60e51b815260206004820152601360248201527226b4b73a1039ba30b3b2903737ba1037b832b760691b6044820152606401610a51565b81600b826002811115611c3357611c33612fec565b60028110611c4357611c43613002565b0154611c4f9190612f1e565b3410156112b35760405162461bcd60e51b8152602060048201526012602482015271496e73756666696369656e742066756e647360701b6044820152606401610a51565b611c9d3383611e26565b611ca7338261230d565b6112b333611cb58385612f3d565b611e40565b604080516060810182526000808252602082018190529181019190915281600054811015611dbb57600081815260046020908152604091829020825160608101845290546001600160a01b0381168252600160a01b81046001600160401b031692820192909252600160e01b90910460ff16151591810182905290611db95780516001600160a01b031615611d50579392505050565b5060001901600081815260046020908152604091829020825160608101845290546001600160a01b038116808352600160a01b82046001600160401b031693830193909352600160e01b900460ff1615159281019290925215611db4579392505050565b611d50565b505b604051636f96cda160e11b815260040160405180910390fd5b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6112b3828260405180602001604052806000815250612394565b80156112b357601954604051631e10a3b760e31b81526001600160a01b0384811660048301529091169063f0851db890602401600060405180830381600087803b158015611e8d57600080fd5b505af1158015611ea1573d6000803e3d6000fd5b5050506001600160a01b0383166000908152601860205260409020805483019055505050565b611ed18585611bb2565b611f6b600d846001811115611ee857611ee8612fec565b60028110611ef857611ef8613002565b01546040516bffffffffffffffffffffffff193360601b166020820152603401604051602081830303815290604052805190602001208484808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509294939250506125659050565b61141a5760405162461bcd60e51b815260206004820152600e60248201526d139bdd08185d5d1a1bdc9a5e995960921b6044820152606401610a51565b33600090815260156020526040812054600f548291611fd991611fcd9190038561257b565b6013546012540361257b565b90508015610a215760008054905b82811015612014578181016000908152601460205260409020805460ff1916600190811790915501611fe7565b5050336000908152601560205260409020805482019055601380548201905592915050565b8015610ce9576010543360009081526016602052604090205461205c9083612f06565b11156120aa5760405162461bcd60e51b815260206004820152601760248201527f4578636565646564206d6178207065722077616c6c65740000000000000000006044820152606401610a51565b33600090815260166020526040812080548392906120c9908490612f06565b909155505050565b6120dc848484612115565b6001600160a01b0383163b156114d1576120f884848484612591565b6114d1576040516368d2bf6b60e11b815260040160405180910390fd5b600061212082611cba565b9050836001600160a01b031681600001516001600160a01b0316146121575760405162a1148160e81b815260040160405180910390fd5b6000336001600160a01b038616148061217557506121758533611749565b8061219057503361218584610af1565b6001600160a01b0316145b9050806121b057604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b0384166121d757604051633a954ecd60e21b815260040160405180910390fd5b6121e48585856001612688565b6121f060008487611a65565b6001600160a01b038581166000908152600560209081526040808320805467ffffffffffffffff198082166001600160401b0392831660001901831617909255898616808652838620805493841693831660019081018416949094179055898652600490945282852080546001600160e01b031916909417600160a01b429092169190910217835587018084529220805491939091166122c45760005482146122c457805460208601516001600160401b0316600160a01b026001600160e01b03199091166001600160a01b038a16171781555b50505082846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a461141a565b80156112b357601954604051631e10a3b760e31b81526001600160a01b0384811660048301529091169063f0851db890602401600060405180830381600087803b15801561235a57600080fd5b505af115801561236e573d6000803e3d6000fd5b5050506001600160a01b0383166000908152601760205260409020805483019055505050565b6000546001600160a01b0384166123bd57604051622e076360e81b815260040160405180910390fd5b826123db5760405163b562e8dd60e01b815260040160405180910390fd5b6123e86000858386612688565b6001600160a01b038416600081815260056020908152604080832080546fffffffffffffffffffffffffffffffff1981166001600160401b038083168b0181169182176801000000000000000067ffffffffffffffff1990941690921783900481168b01811690920217909155858452600490925290912080546001600160e01b0319168317600160a01b42909316929092029190911790558190818501903b15612510575b60405182906001600160a01b038816906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a46124d96000878480600101955087612591565b6124f6576040516368d2bf6b60e11b815260040160405180910390fd5b80821061248e57826000541461250b57600080fd5b612555565b5b6040516001830192906001600160a01b038816906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4808210612511575b5060009081556114d19085838684565b60008261257285846126e7565b14949350505050565b600081831061258a578161120c565b5090919050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a02906125c6903390899088908890600401612cc5565b602060405180830381600087803b1580156125e057600080fd5b505af1925050508015612610575060408051601f3d908101601f1916820190925261260d91810190612af3565b60015b61266b573d80801561263e576040519150601f19603f3d011682016040523d82523d6000602084013e612643565b606091505b508051612663576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b6001600160a01b0384166114d1576011546126a38284612f06565b11156114d15760405162461bcd60e51b815260206004820152601360248201527213585e081cdd5c1c1b1e48195e18d959591959606a1b6044820152606401610a51565b600081815b8451811015610dc557600085828151811061270957612709613002565b6020026020010151905080831161272f5760008381526020829052604090209250612740565b600081815260208490526040902092505b508061274b81612fbb565b9150506126ec565b80356001600160a01b038116811461276a57600080fd5b919050565b60008083601f84011261278157600080fd5b5081356001600160401b0381111561279857600080fd5b6020830191508360208260051b85010111156127b357600080fd5b9250929050565b80356003811061276a57600080fd5b6000602082840312156127db57600080fd5b61120c82612753565b600080604083850312156127f757600080fd5b61280083612753565b915061280e60208401612753565b90509250929050565b60008060006060848603121561282c57600080fd5b61283584612753565b925061284360208501612753565b9150604084013590509250925092565b6000806000806080858703121561286957600080fd5b61287285612753565b935061288060208601612753565b92506040850135915060608501356001600160401b038111156128a257600080fd5b8501601f810187136128b357600080fd5b80356128c66128c182612edf565b612eaf565b8181528860208385010111156128db57600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b6000806040838503121561291057600080fd5b61291983612753565b91506020830135801515811461292e57600080fd5b809150509250929050565b6000806040838503121561294c57600080fd5b61295583612753565b946020939093013593505050565b60008060006060848603121561297857600080fd5b61298184612753565b95602085013595506040909401359392505050565b600080600080604085870312156129ac57600080fd5b84356001600160401b03808211156129c357600080fd5b6129cf8883890161276f565b909650945060208701359150808211156129e857600080fd5b506129f58782880161276f565b95989497509550505050565b60006020808385031215612a1457600080fd5b82356001600160401b0380821115612a2b57600080fd5b818501915085601f830112612a3f57600080fd5b813581811115612a5157612a51613018565b8060051b9150612a62848301612eaf565b8181528481019084860184860187018a1015612a7d57600080fd5b600095505b83861015612aa0578035835260019590950194918601918601612a82565b5098975050505050505050565b60008060408385031215612ac057600080fd5b8235915060208301356002811061292e57600080fd5b600060208284031215612ae857600080fd5b813561120c8161302e565b600060208284031215612b0557600080fd5b815161120c8161302e565b600060208284031215612b2257600080fd5b61120c826127ba565b60008060208385031215612b3e57600080fd5b82356001600160401b0380821115612b5557600080fd5b818501915085601f830112612b6957600080fd5b813581811115612b7857600080fd5b866020828501011115612b8a57600080fd5b60209290920196919550909350505050565b600060208284031215612bae57600080fd5b81516001600160401b03811115612bc457600080fd5b8201601f81018413612bd557600080fd5b8051612be36128c182612edf565b818152856020838501011115612bf857600080fd5b612c09826020830160208601612f54565b95945050505050565b600060208284031215612c2457600080fd5b5035919050565b600080600060408486031215612c4057600080fd5b8335925060208401356001600160401b03811115612c5d57600080fd5b612c698682870161276f565b9497909650939450505050565b60008060408385031215612c8957600080fd5b8235915061280e602084016127ba565b60008151808452612cb1816020860160208601612f54565b601f01601f19169290920160200192915050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612cf890830184612c99565b9695505050505050565b6020808252825182820181905260009190848201906040850190845b8181101561104057612d5983855180516001600160a01b031682526020808201516001600160401b0316908301526040908101511515910152565b9284019260609290920191600101612d1e565b6020808252825182820181905260009190848201906040850190845b8181101561104057835183529284019291840191600101612d88565b6020810160038310612dc657634e487b7160e01b600052602160045260246000fd5b91905290565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b60208152600061120c6020830184612c99565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b81516001600160a01b031681526020808301516001600160401b03169082015260408083015115159082015260608101610a21565b604051601f8201601f191681016001600160401b0381118282101715612ed757612ed7613018565b604052919050565b60006001600160401b03821115612ef857612ef8613018565b50601f01601f191660200190565b60008219821115612f1957612f19612fd6565b500190565b6000816000190483118215151615612f3857612f38612fd6565b500290565b600082821015612f4f57612f4f612fd6565b500390565b60005b83811015612f6f578181015183820152602001612f57565b838111156114d15750506000910152565b600181811c90821680612f9457607f821691505b60208210811415612fb557634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415612fcf57612fcf612fd6565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b031981168114610ce957600080fdfea2646970667358221220bfe95d6de8932d9f2a1c3f1a8efcb43a704307b43b6e99ff51269636aa28fb9164736f6c63430008070033
Deployed Bytecode
0x60806040526004361061031a5760003560e01c806395d89b41116101ab578063c23dc68f116100f7578063e985e9c511610095578063f1e25ea81161006f578063f1e25ea814610945578063f2fde38b14610975578063f4adf43314610995578063f5690ef9146109b557600080fd5b8063e985e9c5146108f2578063eb50411e14610912578063f11cb0af1461092557600080fd5b8063c87b56dd116100d1578063c87b56dd14610889578063dcbbe13a146108a9578063e3e1e8ef146108bf578063e43fe0da146108d257600080fd5b8063c23dc68f1461081c578063c27308a814610849578063c4277da81461086957600080fd5b8063b1826a4e11610164578063b88d4fde1161013e578063b88d4fde14610788578063bd93bc30146107a8578063bf252443146107c8578063c051e38a146107f557600080fd5b8063b1826a4e14610735578063b4ad57ec14610755578063b585f0981461077557600080fd5b806395d89b411461067d57806399a2557a146106925780639c5ee7e0146106b25780639ce8d33d146106c8578063a0bcfc7f146106f5578063a22cb4651461071557600080fd5b806345aafae51161026a57806370a0823111610223578063838dc2b6116101fd578063838dc2b6146105fd5780638462151c146106125780638da5cb5b1461063f57806393b6cf9b1461065d57600080fd5b806370a08231146105b2578063715018a6146105d2578063738e7218146105e757600080fd5b806345aafae5146104d85780635bbb2177146104f85780635eed9c6b146105255780636352211e146105455780636d6c3c97146105655780636f8b44b01461059257600080fd5b806318160ddd116102d757806332cb6b0c116102b157806332cb6b0c1461047757806333373ab51461048d5780633ccfd60b146104a357806342842e0e146104b857600080fd5b806318160ddd1461042b57806323b872dd146104445780632db115441461046457600080fd5b806301ffc9a71461031f57806302ac5b1c1461035457806304ac96db1461037657806306fdde03146103b1578063081812fc146103d3578063095ea7b31461040b575b600080fd5b34801561032b57600080fd5b5061033f61033a366004612ad6565b6109d5565b60405190151581526020015b60405180910390f35b34801561036057600080fd5b5061037461036f366004612c12565b610a27565b005b34801561038257600080fd5b506103a36103913660046127c9565b60156020526000908152604090205481565b60405190815260200161034b565b3480156103bd57600080fd5b506103c6610a5f565b60405161034b9190612dfb565b3480156103df57600080fd5b506103f36103ee366004612c12565b610af1565b6040516001600160a01b03909116815260200161034b565b34801561041757600080fd5b50610374610426366004612939565b610b35565b34801561043757600080fd5b50600154600054036103a3565b34801561045057600080fd5b5061037461045f366004612817565b610bbc565b610374610472366004612c12565b610bd2565b34801561048357600080fd5b506103a360115481565b34801561049957600080fd5b506103a360105481565b3480156104af57600080fd5b50610374610c18565b3480156104c457600080fd5b506103746104d3366004612817565b610cec565b3480156104e457600080fd5b50601b546103f3906001600160a01b031681565b34801561050457600080fd5b50610518610513366004612a01565b610d07565b60405161034b9190612d02565b34801561053157600080fd5b50610374610540366004612aad565b610dcd565b34801561055157600080fd5b506103f3610560366004612c12565b610e22565b34801561057157600080fd5b506103a36105803660046127c9565b60166020526000908152604090205481565b34801561059e57600080fd5b506103746105ad366004612c12565b610e34565b3480156105be57600080fd5b506103a36105cd3660046127c9565b610e63565b3480156105de57600080fd5b50610374610eb1565b3480156105f357600080fd5b506103a360125481565b34801561060957600080fd5b506103a3610ee7565b34801561061e57600080fd5b5061063261062d3660046127c9565b610eff565b60405161034b9190612d6c565b34801561064b57600080fd5b506008546001600160a01b03166103f3565b34801561066957600080fd5b50601a546103f3906001600160a01b031681565b34801561068957600080fd5b506103c661104c565b34801561069e57600080fd5b506106326106ad366004612963565b61105b565b3480156106be57600080fd5b506103a3600f5481565b3480156106d457600080fd5b506103a36106e33660046127c9565b60186020526000908152604090205481565b34801561070157600080fd5b50610374610710366004612b2b565b611213565b34801561072157600080fd5b506103746107303660046128fd565b6112b7565b34801561074157600080fd5b50610374610750366004612996565b61134d565b34801561076157600080fd5b50610374610770366004612c12565b611421565b610374610783366004612c2b565b611450565b34801561079457600080fd5b506103746107a3366004612853565b6114ba565b3480156107b457600080fd5b506103746107c3366004612c12565b6114d7565b3480156107d457600080fd5b506103a36107e33660046127c9565b60176020526000908152604090205481565b34801561080157600080fd5b50600a5461080f9060ff1681565b60405161034b9190612da4565b34801561082857600080fd5b5061083c610837366004612c12565b611506565b60405161034b9190612e7a565b34801561085557600080fd5b506019546103f3906001600160a01b031681565b34801561087557600080fd5b506103746108843660046127c9565b6115b4565b34801561089557600080fd5b506103c66108a4366004612c12565b611600565b3480156108b557600080fd5b506103a360135481565b6103746108cd366004612c2b565b6116a8565b3480156108de57600080fd5b506103746108ed3660046127c9565b6116fd565b3480156108fe57600080fd5b5061033f61090d3660046127e4565b611749565b610374610920366004612c12565b611777565b34801561093157600080fd5b50610374610940366004612b10565b6117ca565b34801561095157600080fd5b5061033f610960366004612c12565b60146020526000908152604090205460ff1681565b34801561098157600080fd5b506103746109903660046127c9565b61181b565b3480156109a157600080fd5b506103746109b0366004612c76565b6118b3565b3480156109c157600080fd5b506103746109d03660046127c9565b6118f2565b60006001600160e01b031982166380ac58cd60e01b1480610a0657506001600160e01b03198216635b5e139f60e01b145b80610a2157506301ffc9a760e01b6001600160e01b03198316145b92915050565b6008546001600160a01b03163314610a5a5760405162461bcd60e51b8152600401610a5190612e0e565b60405180910390fd5b601055565b606060028054610a6e90612f80565b80601f0160208091040260200160405190810160405280929190818152602001828054610a9a90612f80565b8015610ae75780601f10610abc57610100808354040283529160200191610ae7565b820191906000526020600020905b815481529060010190602001808311610aca57829003601f168201915b5050505050905090565b6000610afc82611a3a565b610b19576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b6000610b4082610e22565b9050806001600160a01b0316836001600160a01b03161415610b755760405163250fdee360e21b815260040160405180910390fd5b336001600160a01b03821614610bac57610b8f8133611749565b610bac576040516367d9dca160e11b815260040160405180910390fd5b610bb7838383611a65565b505050565b610bc7838383611ac1565b610bb7838383611acc565b60026009541415610bf55760405162461bcd60e51b8152600401610a5190612e43565b6002600955610c05816001611bb2565b610c10816000611c93565b506001600955565b6008546001600160a01b03163314610c425760405162461bcd60e51b8152600401610a5190612e0e565b6000610c566008546001600160a01b031690565b6001600160a01b03164760405160006040518083038185875af1925050503d8060008114610ca0576040519150601f19603f3d011682016040523d82523d6000602084013e610ca5565b606091505b5050905080610ce95760405162461bcd60e51b815260206004820152601060248201526f5769746864726177206661696c65642160801b6044820152606401610a51565b50565b610bb7838383604051806020016040528060008152506114ba565b80516060906000816001600160401b03811115610d2657610d26613018565b604051908082528060200260200182016040528015610d7157816020015b6040805160608101825260008082526020808301829052928201528252600019909201910181610d445790505b50905060005b828114610dc557610da0858281518110610d9357610d93613002565b6020026020010151611506565b828281518110610db257610db2613002565b6020908102919091010152600101610d77565b509392505050565b6008546001600160a01b03163314610df75760405162461bcd60e51b8152600401610a5190612e0e565b81600d826001811115610e0c57610e0c612fec565b60028110610e1c57610e1c613002565b01555050565b6000610e2d82611cba565b5192915050565b6008546001600160a01b03163314610e5e5760405162461bcd60e51b8152600401610a5190612e0e565b601155565b60006001600160a01b038216610e8c576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b6008546001600160a01b03163314610edb5760405162461bcd60e51b8152600401610a5190612e0e565b610ee56000611dd4565b565b6000601354610ef96001546000540390565b03905090565b60606000806000610f0f85610e63565b90506000816001600160401b03811115610f2b57610f2b613018565b604051908082528060200260200182016040528015610f54578160200160208202803683370190505b509050610f7a604080516060810182526000808252602082018190529181019190915290565b60005b83861461104057600081815260046020908152604091829020825160608101845290546001600160a01b0381168252600160a01b81046001600160401b031692820192909252600160e01b90910460ff16158015928201929092529250610fe357611038565b81516001600160a01b031615610ff857815194505b876001600160a01b0316856001600160a01b03161415611038578083878060010198508151811061102b5761102b613002565b6020026020010181815250505b600101610f7d565b50909695505050505050565b606060038054610a6e90612f80565b606081831061107d57604051631960ccad60e11b815260040160405180910390fd5b600080548084111561108d578093505b600061109887610e63565b9050848610156110b757858503818110156110b1578091505b506110bb565b5060005b6000816001600160401b038111156110d5576110d5613018565b6040519080825280602002602001820160405280156110fe578160200160208202803683370190505b5090508161111157935061120c92505050565b600061111c88611506565b90506000816040015161112d575080515b885b88811415801561113f5750848714155b1561120057600081815260046020908152604091829020825160608101845290546001600160a01b0381168252600160a01b81046001600160401b031692820192909252600160e01b90910460ff161580159282019290925293506111a3576111f8565b82516001600160a01b0316156111b857825191505b8a6001600160a01b0316826001600160a01b031614156111f857808488806001019950815181106111eb576111eb613002565b6020026020010181815250505b60010161112f565b50505092835250909150505b9392505050565b6008546001600160a01b0316331461123d5760405162461bcd60e51b8152600401610a5190612e0e565b601b546001600160a01b0316156112b357601b5460405163a0bcfc7f60e01b81526001600160a01b039091169063a0bcfc7f906112809085908590600401612dcc565b600060405180830381600087803b15801561129a57600080fd5b505af11580156112ae573d6000803e3d6000fd5b505050505b5050565b6001600160a01b0382163314156112e15760405163b06307db60e01b815260040160405180910390fd5b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6008546001600160a01b031633146113775760405162461bcd60e51b8152600401610a5190612e0e565b60005b8381101561141a576113ca85858381811061139757611397613002565b90506020020160208101906113ac91906127c9565b8484848181106113be576113be613002565b90506020020135611e26565b6114128585838181106113df576113df613002565b90506020020160208101906113f491906127c9565b84848481811061140657611406613002565b90506020020135611e40565b60010161137a565b5050505050565b6008546001600160a01b0316331461144b5760405162461bcd60e51b8152600401610a5190612e0e565b600f55565b600260095414156114735760405162461bcd60e51b8152600401610a5190612e43565b6002600955611486836000808585611ec7565b600061149184611fa8565b90506114a56114a08286612f3d565b612039565b6114af8482611c93565b505060016009555050565b6114c6848484846120d1565b6114d1848484611acc565b50505050565b6008546001600160a01b031633146115015760405162461bcd60e51b8152600401610a5190612e0e565b601255565b604080516060808201835260008083526020808401829052838501829052845192830185528183528201819052928101839052909150600054831061154b5792915050565b50600082815260046020908152604091829020825160608101845290546001600160a01b0381168252600160a01b81046001600160401b031692820192909252600160e01b90910460ff1615801592820192909252906115ab5792915050565b61120c83611cba565b6008546001600160a01b031633146115de5760405162461bcd60e51b8152600401610a5190612e0e565b601a80546001600160a01b0319166001600160a01b0392909216919091179055565b606061160b82611a3a565b61162857604051630a14c4b560e41b815260040160405180910390fd5b601b5460405163c87b56dd60e01b8152600481018490526001600160a01b039091169063c87b56dd9060240160006040518083038186803b15801561166c57600080fd5b505afa158015611680573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610a219190810190612b9c565b600260095414156116cb5760405162461bcd60e51b8152600401610a5190612e43565b60026009556116df83600060018585611ec7565b6116e883612039565b6116f3836000611c93565b5050600160095550565b6008546001600160a01b031633146117275760405162461bcd60e51b8152600401610a5190612e0e565b601980546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b6002600954141561179a5760405162461bcd60e51b8152600401610a5190612e43565b60026009556117aa816001611bb2565b60006117b582611fa8565b90506117c18282611c93565b50506001600955565b6008546001600160a01b031633146117f45760405162461bcd60e51b8152600401610a5190612e0e565b600a805482919060ff1916600183600281111561181357611813612fec565b021790555050565b6008546001600160a01b031633146118455760405162461bcd60e51b8152600401610a5190612e0e565b6001600160a01b0381166118aa5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a51565b610ce981611dd4565b6008546001600160a01b031633146118dd5760405162461bcd60e51b8152600401610a5190612e0e565b81600b826002811115610e0c57610e0c612fec565b6008546001600160a01b0316331461191c5760405162461bcd60e51b8152600401610a5190612e0e565b601b5481906001600160a01b031615611a1757806001600160a01b031663a0bcfc7f601b60009054906101000a90046001600160a01b03166001600160a01b0316636c0360eb6040518163ffffffff1660e01b815260040160006040518083038186803b15801561198c57600080fd5b505afa1580156119a0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526119c89190810190612b9c565b6040518263ffffffff1660e01b81526004016119e49190612dfb565b600060405180830381600087803b1580156119fe57600080fd5b505af1158015611a12573d6000803e3d6000fd5b505050505b601b80546001600160a01b0319166001600160a01b039290921691909117905550565b6000805482108015610a21575050600090815260046020526040902054600160e01b900460ff161590565b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b610bb7838383612115565b6019546040516246474760e51b81526001600160a01b0385811660048301528481166024830152909116906308c8e8e090604401600060405180830381600087803b158015611b1a57600080fd5b505af1158015611b2e573d6000803e3d6000fd5b50505060008281526014602052604090205460ff16159050611b7e576001600160a01b03808416600090815260176020526040808220805460001901905591841681522080546001019055505050565b6001600160a01b03808416600090815260186020526040808220805460001901905591841681522080546001019055505050565b806002811115611bc457611bc4612fec565b600a5460ff166002811115611bdb57611bdb612fec565b14611c1e5760405162461bcd60e51b815260206004820152601360248201527226b4b73a1039ba30b3b2903737ba1037b832b760691b6044820152606401610a51565b81600b826002811115611c3357611c33612fec565b60028110611c4357611c43613002565b0154611c4f9190612f1e565b3410156112b35760405162461bcd60e51b8152602060048201526012602482015271496e73756666696369656e742066756e647360701b6044820152606401610a51565b611c9d3383611e26565b611ca7338261230d565b6112b333611cb58385612f3d565b611e40565b604080516060810182526000808252602082018190529181019190915281600054811015611dbb57600081815260046020908152604091829020825160608101845290546001600160a01b0381168252600160a01b81046001600160401b031692820192909252600160e01b90910460ff16151591810182905290611db95780516001600160a01b031615611d50579392505050565b5060001901600081815260046020908152604091829020825160608101845290546001600160a01b038116808352600160a01b82046001600160401b031693830193909352600160e01b900460ff1615159281019290925215611db4579392505050565b611d50565b505b604051636f96cda160e11b815260040160405180910390fd5b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6112b3828260405180602001604052806000815250612394565b80156112b357601954604051631e10a3b760e31b81526001600160a01b0384811660048301529091169063f0851db890602401600060405180830381600087803b158015611e8d57600080fd5b505af1158015611ea1573d6000803e3d6000fd5b5050506001600160a01b0383166000908152601860205260409020805483019055505050565b611ed18585611bb2565b611f6b600d846001811115611ee857611ee8612fec565b60028110611ef857611ef8613002565b01546040516bffffffffffffffffffffffff193360601b166020820152603401604051602081830303815290604052805190602001208484808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509294939250506125659050565b61141a5760405162461bcd60e51b815260206004820152600e60248201526d139bdd08185d5d1a1bdc9a5e995960921b6044820152606401610a51565b33600090815260156020526040812054600f548291611fd991611fcd9190038561257b565b6013546012540361257b565b90508015610a215760008054905b82811015612014578181016000908152601460205260409020805460ff1916600190811790915501611fe7565b5050336000908152601560205260409020805482019055601380548201905592915050565b8015610ce9576010543360009081526016602052604090205461205c9083612f06565b11156120aa5760405162461bcd60e51b815260206004820152601760248201527f4578636565646564206d6178207065722077616c6c65740000000000000000006044820152606401610a51565b33600090815260166020526040812080548392906120c9908490612f06565b909155505050565b6120dc848484612115565b6001600160a01b0383163b156114d1576120f884848484612591565b6114d1576040516368d2bf6b60e11b815260040160405180910390fd5b600061212082611cba565b9050836001600160a01b031681600001516001600160a01b0316146121575760405162a1148160e81b815260040160405180910390fd5b6000336001600160a01b038616148061217557506121758533611749565b8061219057503361218584610af1565b6001600160a01b0316145b9050806121b057604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b0384166121d757604051633a954ecd60e21b815260040160405180910390fd5b6121e48585856001612688565b6121f060008487611a65565b6001600160a01b038581166000908152600560209081526040808320805467ffffffffffffffff198082166001600160401b0392831660001901831617909255898616808652838620805493841693831660019081018416949094179055898652600490945282852080546001600160e01b031916909417600160a01b429092169190910217835587018084529220805491939091166122c45760005482146122c457805460208601516001600160401b0316600160a01b026001600160e01b03199091166001600160a01b038a16171781555b50505082846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a461141a565b80156112b357601954604051631e10a3b760e31b81526001600160a01b0384811660048301529091169063f0851db890602401600060405180830381600087803b15801561235a57600080fd5b505af115801561236e573d6000803e3d6000fd5b5050506001600160a01b0383166000908152601760205260409020805483019055505050565b6000546001600160a01b0384166123bd57604051622e076360e81b815260040160405180910390fd5b826123db5760405163b562e8dd60e01b815260040160405180910390fd5b6123e86000858386612688565b6001600160a01b038416600081815260056020908152604080832080546fffffffffffffffffffffffffffffffff1981166001600160401b038083168b0181169182176801000000000000000067ffffffffffffffff1990941690921783900481168b01811690920217909155858452600490925290912080546001600160e01b0319168317600160a01b42909316929092029190911790558190818501903b15612510575b60405182906001600160a01b038816906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a46124d96000878480600101955087612591565b6124f6576040516368d2bf6b60e11b815260040160405180910390fd5b80821061248e57826000541461250b57600080fd5b612555565b5b6040516001830192906001600160a01b038816906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4808210612511575b5060009081556114d19085838684565b60008261257285846126e7565b14949350505050565b600081831061258a578161120c565b5090919050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a02906125c6903390899088908890600401612cc5565b602060405180830381600087803b1580156125e057600080fd5b505af1925050508015612610575060408051601f3d908101601f1916820190925261260d91810190612af3565b60015b61266b573d80801561263e576040519150601f19603f3d011682016040523d82523d6000602084013e612643565b606091505b508051612663576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b6001600160a01b0384166114d1576011546126a38284612f06565b11156114d15760405162461bcd60e51b815260206004820152601360248201527213585e081cdd5c1c1b1e48195e18d959591959606a1b6044820152606401610a51565b600081815b8451811015610dc557600085828151811061270957612709613002565b6020026020010151905080831161272f5760008381526020829052604090209250612740565b600081815260208490526040902092505b508061274b81612fbb565b9150506126ec565b80356001600160a01b038116811461276a57600080fd5b919050565b60008083601f84011261278157600080fd5b5081356001600160401b0381111561279857600080fd5b6020830191508360208260051b85010111156127b357600080fd5b9250929050565b80356003811061276a57600080fd5b6000602082840312156127db57600080fd5b61120c82612753565b600080604083850312156127f757600080fd5b61280083612753565b915061280e60208401612753565b90509250929050565b60008060006060848603121561282c57600080fd5b61283584612753565b925061284360208501612753565b9150604084013590509250925092565b6000806000806080858703121561286957600080fd5b61287285612753565b935061288060208601612753565b92506040850135915060608501356001600160401b038111156128a257600080fd5b8501601f810187136128b357600080fd5b80356128c66128c182612edf565b612eaf565b8181528860208385010111156128db57600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b6000806040838503121561291057600080fd5b61291983612753565b91506020830135801515811461292e57600080fd5b809150509250929050565b6000806040838503121561294c57600080fd5b61295583612753565b946020939093013593505050565b60008060006060848603121561297857600080fd5b61298184612753565b95602085013595506040909401359392505050565b600080600080604085870312156129ac57600080fd5b84356001600160401b03808211156129c357600080fd5b6129cf8883890161276f565b909650945060208701359150808211156129e857600080fd5b506129f58782880161276f565b95989497509550505050565b60006020808385031215612a1457600080fd5b82356001600160401b0380821115612a2b57600080fd5b818501915085601f830112612a3f57600080fd5b813581811115612a5157612a51613018565b8060051b9150612a62848301612eaf565b8181528481019084860184860187018a1015612a7d57600080fd5b600095505b83861015612aa0578035835260019590950194918601918601612a82565b5098975050505050505050565b60008060408385031215612ac057600080fd5b8235915060208301356002811061292e57600080fd5b600060208284031215612ae857600080fd5b813561120c8161302e565b600060208284031215612b0557600080fd5b815161120c8161302e565b600060208284031215612b2257600080fd5b61120c826127ba565b60008060208385031215612b3e57600080fd5b82356001600160401b0380821115612b5557600080fd5b818501915085601f830112612b6957600080fd5b813581811115612b7857600080fd5b866020828501011115612b8a57600080fd5b60209290920196919550909350505050565b600060208284031215612bae57600080fd5b81516001600160401b03811115612bc457600080fd5b8201601f81018413612bd557600080fd5b8051612be36128c182612edf565b818152856020838501011115612bf857600080fd5b612c09826020830160208601612f54565b95945050505050565b600060208284031215612c2457600080fd5b5035919050565b600080600060408486031215612c4057600080fd5b8335925060208401356001600160401b03811115612c5d57600080fd5b612c698682870161276f565b9497909650939450505050565b60008060408385031215612c8957600080fd5b8235915061280e602084016127ba565b60008151808452612cb1816020860160208601612f54565b601f01601f19169290920160200192915050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612cf890830184612c99565b9695505050505050565b6020808252825182820181905260009190848201906040850190845b8181101561104057612d5983855180516001600160a01b031682526020808201516001600160401b0316908301526040908101511515910152565b9284019260609290920191600101612d1e565b6020808252825182820181905260009190848201906040850190845b8181101561104057835183529284019291840191600101612d88565b6020810160038310612dc657634e487b7160e01b600052602160045260246000fd5b91905290565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b60208152600061120c6020830184612c99565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b81516001600160a01b031681526020808301516001600160401b03169082015260408083015115159082015260608101610a21565b604051601f8201601f191681016001600160401b0381118282101715612ed757612ed7613018565b604052919050565b60006001600160401b03821115612ef857612ef8613018565b50601f01601f191660200190565b60008219821115612f1957612f19612fd6565b500190565b6000816000190483118215151615612f3857612f38612fd6565b500290565b600082821015612f4f57612f4f612fd6565b500390565b60005b83811015612f6f578181015183820152602001612f57565b838111156114d15750506000910152565b600181811c90821680612f9457607f821691505b60208210811415612fb557634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415612fcf57612fcf612fd6565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b031981168114610ce957600080fdfea2646970667358221220bfe95d6de8932d9f2a1c3f1a8efcb43a704307b43b6e99ff51269636aa28fb9164736f6c63430008070033
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.