ERC-721
Overview
Max Total Supply
247 MvM
Holders
112
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Balance
1 MvMLoading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Source Code Verified (Exact Match)
Contract Name:
MvM
Compiler Version
v0.8.11+commit.d7f03943
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: Apache-2.0 /****************************************** * Amendeded by OBYC Labs Development * * Author: devAlex.eth * ******************************************/ // Trademark S/N: 97720989 // Mutants v. Machines™ // OBYC Labs LLC // www.givnerlawpc.com pragma solidity ^0.8.0; import "@thirdweb-dev/contracts/base/ERC721LazyMint.sol"; import "@thirdweb-dev/contracts/base/ERC1155Drop.sol"; import "@thirdweb-dev/contracts/eip/ERC721A.sol"; import "@thirdweb-dev/contracts/eip/ERC1155.sol"; import "@thirdweb-dev/contracts/extension/Ownable.sol"; import "@thirdweb-dev/contracts/lib/TWStrings.sol"; contract MvM is ERC721A, Ownable { using TWStrings for uint256; ERC721A public immutable obyc; ERC1155Drop public immutable obyclabs; bytes localBytes = new bytes(0); string public notRevealedUri; uint256[] public mvmL1Tokens; uint256[] public mvmL2Tokens; uint256[] public mvmL3Tokens; uint256 public mvmL1TokensCount = 0; uint256 public mvmL2TokensCount = 0; uint256 public mvmL3TokensCount = 0; string public baseURIL1 = ""; string public baseURIL2 = ""; string public baseURIL3 = ""; bool public pauseMintL1 = false; bool public pauseMintL2 = true; bool public pauseMintL3 = true; struct TransformInfoLevelOne { address user; uint256 obycTokenId; uint256 obycLabsTokenId; } struct TransformInfoLevelTwo { address user; uint256 mvmLevelOneTokenId; uint256 obycTokenId; uint256 obycLabsTokenId; } struct TransformInfoLevelThree { address user; uint256 mvmLevelOneTokenId; uint256 mvmLevelTwoTokenId; uint256 obycTokenId; uint256 obycLabsTokenId; } mapping(uint256 => TransformInfoLevelOne) public transformInfoLevelOneByTokenId; mapping(uint256 => TransformInfoLevelTwo) public transformInfoLevelTwoByTokenId; mapping(uint256 => TransformInfoLevelThree) public transformInfoLevelThreeByTokenId; mapping(uint256 => uint256) public tokenIdStatus; constructor( string memory _name, string memory _symbol, address _obycAddress, address _obyclabsAddress ) ERC721A(_name, _symbol) { _setupOwner(msg.sender); obyc = ERC721A(_obycAddress); obyclabs = ERC1155Drop(_obyclabsAddress); } function isL1(uint256 _tokenId) public view returns (bool) { for (uint256 index = 0; index < mvmL1Tokens.length; index++) { if (mvmL1Tokens[index] == _tokenId) { return true; } } return false; } function isL2(uint256 _tokenId) public view returns (bool) { for (uint256 index = 0; index < mvmL2Tokens.length; index++) { if (mvmL2Tokens[index] == _tokenId) { return true; } } return false; } function isL3(uint256 _tokenId) public view returns (bool) { for (uint256 index = 0; index < mvmL3Tokens.length; index++) { if (mvmL3Tokens[index] == _tokenId) { return true; } } return false; } function isAlreadyMintedMvML1(uint256 _obycTokenId) public view returns (bool) { for (uint256 index = 0; index < mvmL1Tokens.length; index++) { if ( transformInfoLevelOneByTokenId[mvmL1Tokens[index]] .obycTokenId == _obycTokenId ) { return true; } } return false; } function isAlreadyMintedMvML2(uint256 _mvmTokenId) internal view returns (bool) { for (uint256 index = 0; index < mvmL2Tokens.length; index++) { if ( transformInfoLevelTwoByTokenId[mvmL2Tokens[index]] .mvmLevelOneTokenId == _mvmTokenId ) { return true; } } return false; } function isAlreadyMintedMvML3(uint256 _mvmTokenId) internal view returns (bool) { for (uint256 index = 0; index < mvmL3Tokens.length; index++) { if ( transformInfoLevelThreeByTokenId[mvmL3Tokens[index]] .mvmLevelTwoTokenId == _mvmTokenId ) { return true; } } return false; } function getStatusOfObycToken(uint256 _obycTokenId) public view returns (uint256[2] memory) { uint256 level = tokenIdStatus[_obycTokenId]; uint256 tokenId=100001; if (level == 1) { for (uint256 index = 0; index < mvmL1Tokens.length; index++) { if ( transformInfoLevelOneByTokenId[mvmL1Tokens[index]] .obycTokenId == _obycTokenId ) { tokenId = mvmL1Tokens[index]; } } } else if (level == 2) { for (uint256 index = 0; index < mvmL2Tokens.length; index++) { if ( transformInfoLevelTwoByTokenId[mvmL2Tokens[index]] .obycTokenId == _obycTokenId ) { tokenId = mvmL2Tokens[index]; } } } else if (level == 3) { for (uint256 index = 0; index < mvmL3Tokens.length; index++) { if ( transformInfoLevelThreeByTokenId[mvmL3Tokens[index]] .obycTokenId == _obycTokenId ) { tokenId = mvmL3Tokens[index]; } } } require( _exists(tokenId), "ERC721Metadata: URI query for nonexistent token" ); return [level, tokenId]; } function isCorrectLabTokenForL2Mint( uint256 _obycLabTokenId, uint256 _mvmTokenId ) internal view returns (bool) { if ( transformInfoLevelOneByTokenId[_mvmTokenId].obycLabsTokenId == 0 && _obycLabTokenId == 2 ) { return true; } else if ( transformInfoLevelOneByTokenId[_mvmTokenId].obycLabsTokenId == 1 && _obycLabTokenId == 3 ) { return true; } return false; } function verifyClaim( uint256 _obycTokenId, uint256 _obycLabTokenId, uint256 _mvmL1TokenId, uint256 _mvmL2TokenId, uint256 _level ) public payable { if (_level == 1) { require(!pauseMintL1, "Minting for L1 is Paused"); address tokenIdAdd = obyc.ownerOf(_obycTokenId); address sender = address(msg.sender); require(sender == tokenIdAdd, "You Dont Own the OBYC NFT"); require( !isAlreadyMintedMvML1(_obycTokenId), "You Have Already Transformed this OBYC Token" ); require( _obycLabTokenId == 0 || _obycLabTokenId == 1, "Wrong Lab Token Id for Level One Transformation" ); require( obyc.balanceOf(msg.sender) >= 1, "You don't own enough OBYC NFTs" ); // - They own an NFT from the OBYC Labs contract require( obyclabs.balanceOf(msg.sender, _obycLabTokenId) >= 1, "You don't own enough Level One Lab Items" ); TransformInfoLevelOne memory transformInfoLevelOne = TransformInfoLevelOne( msg.sender, _obycTokenId, _obycLabTokenId ); transformInfoLevelOneByTokenId[ _currentIndex ] = transformInfoLevelOne; mvmL1Tokens.push(_currentIndex); mvmL1TokensCount++; tokenIdStatus[_obycTokenId] = 1; } else if (_level == 2) { require(!pauseMintL2, "Minting for L2 is Paused"); address tokenIdAdd = ownerOf(_mvmL1TokenId); address sender = address(msg.sender); require(sender == tokenIdAdd, "You Dont Own the MvM NFT"); require( !isAlreadyMintedMvML2(_mvmL1TokenId), "You Have Already Transformed this MvM" ); require( _obycLabTokenId == 2 || _obycLabTokenId == 3, "Wrong Lab Token Id for Level 2 Transformation" ); require( balanceOf(msg.sender) >= 1, "You don't own enough OBYC Level Two NFTs" ); // - They own an NFT from the OBYC Labs contract require( obyclabs.balanceOf(msg.sender, _obycLabTokenId) >= 1, "You don't own enough Level Two Lab Items" ); require( isCorrectLabTokenForL2Mint(_obycLabTokenId, _mvmL1TokenId), "You Selected the Wrong Lab Token ID" ); TransformInfoLevelTwo memory transformInfoLevelTwo = TransformInfoLevelTwo( msg.sender, _mvmL1TokenId, transformInfoLevelOneByTokenId[_mvmL1TokenId].obycTokenId, _obycLabTokenId ); transformInfoLevelTwoByTokenId[ _currentIndex ] = transformInfoLevelTwo; mvmL2Tokens.push(_currentIndex); mvmL2TokensCount++; tokenIdStatus[ transformInfoLevelOneByTokenId[_mvmL1TokenId].obycTokenId ] = 2; } else if (_level == 3) { require(!pauseMintL3, "Minting for L3 is Paused"); address tokenIdAdd = ownerOf(_mvmL2TokenId); address sender = address(msg.sender); require(sender == tokenIdAdd, "You Dont Own the MvM L2 NFT"); require( !isAlreadyMintedMvML3(_mvmL2TokenId), "You Have Already Transformed this MvM" ); require( _obycLabTokenId == 4, "Wrong Lab Token Id for Level 3 Transformation" ); require( balanceOf(msg.sender) >= 1, "You don't own enough OBYC Level Two NFTs" ); // - They own an NFT from the OBYC Labs contract require( obyclabs.balanceOf(msg.sender, _obycLabTokenId) >= 1, "You don't own enough Level Two Lab Items" ); TransformInfoLevelThree memory transformInfoLevelThree = TransformInfoLevelThree( msg.sender, transformInfoLevelTwoByTokenId[_mvmL2TokenId].mvmLevelOneTokenId, _mvmL2TokenId, transformInfoLevelTwoByTokenId[_mvmL2TokenId].obycTokenId, _obycLabTokenId ); transformInfoLevelThreeByTokenId[ _currentIndex ] = transformInfoLevelThree; mvmL3Tokens.push(_currentIndex); mvmL3TokensCount++; tokenIdStatus[ transformInfoLevelTwoByTokenId[_mvmL2TokenId].obycTokenId ] = 3; } } //main mint function function mint( uint256 _obycTokenId, uint256 _obycLabTokenId, uint256 _mvmTokenId, uint256 _mvmL2TokenId, uint256 _level ) public payable { verifyClaim(_obycTokenId, _obycLabTokenId, _mvmTokenId,_mvmL2TokenId,_level); _safeMint(msg.sender, 1); //burning obyc lab token obyclabs.safeTransferFrom( address(msg.sender), address(0xdEaD00647e5Af4d45760F9442025e41a357E6990), _obycLabTokenId, 1, localBytes ); } function tokenURI(uint256 _tokenId) public view virtual override returns (string memory) { // string memory batchUri = getBaseURI(_tokenId); // return string(abi.encodePacked(batchUri, _tokenId.toString())); require( _exists(_tokenId), "ERC721Metadata: URI query for nonexistent token" ); if (isL1(_tokenId)) { string memory currentBaseURI = _baseURI(); return bytes(currentBaseURI).length > 0 ? string( abi.encodePacked( currentBaseURI, _tokenId.toString(), ".json" ) ) : ""; } else if (isL2(_tokenId)) { string memory currentBaseURI = _baseURILevelTwo(); return bytes(currentBaseURI).length > 0 ? string( abi.encodePacked( currentBaseURI, _tokenId.toString(), ".json" ) ) : ""; } else if (isL2(_tokenId)) { string memory currentBaseURI = _baseURILevelThree(); return bytes(currentBaseURI).length > 0 ? string( abi.encodePacked( currentBaseURI, _tokenId.toString(), ".json" ) ) : ""; } else { return ""; } } function _baseURI() internal view virtual override returns (string memory) { return baseURIL1; } // Set base URI of metadata (an IPFS URL) ======================= function setBaseURI(string memory _newBaseURI) public onlyOwner { baseURIL1 = _newBaseURI; } function _baseURILevelTwo() internal view virtual returns (string memory) { return baseURIL2; } // Set base URI of metadata (an IPFS URL) ======================= function setBaseURILevelTwo(string memory _newBaseURILevelTwo) public onlyOwner { baseURIL2 = _newBaseURILevelTwo; } function _baseURILevelThree() internal view virtual returns (string memory) { return baseURIL3; } // Set base URI of metadata (an IPFS URL) ======================= function setBaseURILevelThree(string memory _newBaseURILevelThree) public onlyOwner { baseURIL3 = _newBaseURILevelThree; } //setter function to pause/start level one mint function setPauseMintL1(bool _pauseMintL1) public onlyOwner { pauseMintL1 = _pauseMintL1; } //setter function to pause/start level two mint function setPauseMintL2(bool _pauseMintL2) public onlyOwner { pauseMintL2 = _pauseMintL2; } //setter function to pause/start level three mint function setPauseMintL3(bool _pauseMintL3) public onlyOwner { pauseMintL3 = _pauseMintL3; } /// @dev Returns whether owner can be set in the given execution context. function _canSetOwner() internal view virtual override returns (bool) { return msg.sender == owner(); } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import { ERC1155 } from "../eip/ERC1155.sol"; import "../extension/ContractMetadata.sol"; import "../extension/Multicall.sol"; import "../extension/Ownable.sol"; import "../extension/Royalty.sol"; import "../extension/BatchMintMetadata.sol"; import "../extension/PrimarySale.sol"; import "../extension/DropSinglePhase1155.sol"; import "../extension/LazyMint.sol"; import "../extension/DelayedReveal.sol"; import "../lib/CurrencyTransferLib.sol"; import "../lib/TWStrings.sol"; /** * BASE: ERC1155Base * EXTENSION: DropSinglePhase1155 * * The `ERC1155Base` smart contract implements the ERC1155 NFT standard. * It includes the following additions to standard ERC1155 logic: * * - Contract metadata for royalty support on platforms such as OpenSea that use * off-chain information to distribute roaylties. * * - Ownership of the contract, with the ability to restrict certain functions to * only be called by the contract's owner. * * - Multicall capability to perform multiple actions atomically * * - EIP 2981 compliance for royalty support on NFT marketplaces. * * The `drop` mechanism in the `DropSinglePhase1155` extension is a distribution mechanism for lazy minted tokens. It lets * you set restrictions such as a price to charge, an allowlist etc. when an address atttempts to mint lazy minted tokens. * * The `ERC721Drop` contract lets you lazy mint tokens, and distribute those lazy minted tokens via the drop mechanism. */ contract ERC1155Drop is ERC1155, ContractMetadata, Ownable, Royalty, Multicall, BatchMintMetadata, PrimarySale, LazyMint, DelayedReveal, DropSinglePhase1155 { using TWStrings for uint256; /*////////////////////////////////////////////////////////////// Mappings //////////////////////////////////////////////////////////////*/ /** * @notice Returns the total supply of NFTs of a given tokenId * @dev Mapping from tokenId => total circulating supply of NFTs of that tokenId. */ mapping(uint256 => uint256) public totalSupply; /*/////////////////////////////////////////////////////////////// Constructor //////////////////////////////////////////////////////////////*/ constructor( string memory _name, string memory _symbol, address _royaltyRecipient, uint128 _royaltyBps, address _primarySaleRecipient ) ERC1155(_name, _symbol) { _setupOwner(msg.sender); _setupDefaultRoyaltyInfo(_royaltyRecipient, _royaltyBps); _setupPrimarySaleRecipient(_primarySaleRecipient); } /*////////////////////////////////////////////////////////////// ERC165 Logic //////////////////////////////////////////////////////////////*/ /// @notice Returns whether this contract supports the given interface. function supportsInterface(bytes4 interfaceId) public view virtual override(ERC1155, IERC165) returns (bool) { return interfaceId == 0x01ffc9a7 || // ERC165 Interface ID for ERC165 interfaceId == 0xd9b67a26 || // ERC165 Interface ID for ERC1155 interfaceId == 0x0e89341c || // ERC165 Interface ID for ERC1155MetadataURI interfaceId == type(IERC2981).interfaceId; // ERC165 ID for ERC2981 } /*////////////////////////////////////////////////////////////// Minting/burning logic //////////////////////////////////////////////////////////////*/ /** * @notice Lets an owner or approved operator burn NFTs of the given tokenId. * * @param _owner The owner of the NFT to burn. * @param _tokenId The tokenId of the NFT to burn. * @param _amount The amount of the NFT to burn. */ function burn( address _owner, uint256 _tokenId, uint256 _amount ) external virtual { address caller = msg.sender; require(caller == _owner || isApprovedForAll[_owner][caller], "Unapproved caller"); require(balanceOf[_owner][_tokenId] >= _amount, "Not enough tokens owned"); _burn(_owner, _tokenId, _amount); } /** * @notice Lets an owner or approved operator burn NFTs of the given tokenIds. * * @param _owner The owner of the NFTs to burn. * @param _tokenIds The tokenIds of the NFTs to burn. * @param _amounts The amounts of the NFTs to burn. */ function burnBatch( address _owner, uint256[] memory _tokenIds, uint256[] memory _amounts ) external virtual { address caller = msg.sender; require(caller == _owner || isApprovedForAll[_owner][caller], "Unapproved caller"); require(_tokenIds.length == _amounts.length, "Length mismatch"); for (uint256 i = 0; i < _tokenIds.length; i += 1) { require(balanceOf[_owner][_tokenIds[i]] >= _amounts[i], "Not enough tokens owned"); } _burnBatch(_owner, _tokenIds, _amounts); } /*/////////////////////////////////////////////////////////////// Overriden metadata logic //////////////////////////////////////////////////////////////*/ /** * @notice Returns the metadata URI for an NFT. * @dev See `BatchMintMetadata` for handling of metadata in this contract. * * @param _tokenId The tokenId of an NFT. */ function uri(uint256 _tokenId) public view virtual override returns (string memory) { (uint256 batchId, ) = _getBatchId(_tokenId); string memory batchUri = _getBaseURI(_tokenId); if (isEncryptedBatch(batchId)) { return string(abi.encodePacked(batchUri, "0")); } else { return string(abi.encodePacked(batchUri, _tokenId.toString())); } } /*/////////////////////////////////////////////////////////////// Delayed reveal logic //////////////////////////////////////////////////////////////*/ /** * @notice Lets an authorized address reveal a batch of delayed reveal NFTs. * * @param _index The ID for the batch of delayed-reveal NFTs to reveal. * @param _key The key with which the base URI for the relevant batch of NFTs was encrypted. */ function reveal(uint256 _index, bytes calldata _key) public virtual override returns (string memory revealedURI) { require(_canReveal(), "Not authorized"); uint256 batchId = getBatchIdAtIndex(_index); revealedURI = getRevealURI(batchId, _key); _setEncryptedData(batchId, ""); _setBaseURI(batchId, revealedURI); emit TokenURIRevealed(_index, revealedURI); } /*/////////////////////////////////////////////////////////////// Overriden lazy minting logic //////////////////////////////////////////////////////////////*/ /** * @notice Lets an authorized address lazy mint a given amount of NFTs. * * @param _amount The number of NFTs to lazy mint. * @param _baseURIForTokens The placeholder base URI for the 'n' number of NFTs being lazy minted, where the * metadata for each of those NFTs is `${baseURIForTokens}/${tokenId}`. * @param _data The encrypted base URI + provenance hash for the batch of NFTs being lazy minted. * @return batchId A unique integer identifier for the batch of NFTs lazy minted together. */ function lazyMint( uint256 _amount, string calldata _baseURIForTokens, bytes calldata _data ) public virtual override returns (uint256 batchId) { if (_data.length > 0) { (bytes memory encryptedURI, bytes32 provenanceHash) = abi.decode(_data, (bytes, bytes32)); if (encryptedURI.length != 0 && provenanceHash != "") { _setEncryptedData(nextTokenIdToLazyMint + _amount, _data); } } return LazyMint.lazyMint(_amount, _baseURIForTokens, _data); } /// @notice The tokenId assigned to the next new NFT to be lazy minted. function nextTokenIdToMint() public view virtual returns (uint256) { return nextTokenIdToLazyMint; } /*/////////////////////////////////////////////////////////////// Internal functions //////////////////////////////////////////////////////////////*/ /// @dev Runs before every `claim` function call. function _beforeClaim( uint256 _tokenId, address, uint256, address, uint256, AllowlistProof calldata, bytes memory ) internal view virtual override { if (_tokenId >= nextTokenIdToLazyMint) { revert("Not enough minted tokens"); } } /// @dev Collects and distributes the primary sale value of NFTs being claimed. function _collectPriceOnClaim( address _primarySaleRecipient, uint256 _quantityToClaim, address _currency, uint256 _pricePerToken ) internal virtual override { if (_pricePerToken == 0) { return; } uint256 totalPrice = _quantityToClaim * _pricePerToken; if (_currency == CurrencyTransferLib.NATIVE_TOKEN) { if (msg.value != totalPrice) { revert("Must send total price."); } } address saleRecipient = _primarySaleRecipient == address(0) ? primarySaleRecipient() : _primarySaleRecipient; CurrencyTransferLib.transferCurrency(_currency, msg.sender, saleRecipient, totalPrice); } /// @dev Transfers the NFTs being claimed. function _transferTokensOnClaim( address _to, uint256 _tokenId, uint256 _quantityBeingClaimed ) internal virtual override { _mint(_to, _tokenId, _quantityBeingClaimed, ""); } /// @dev Runs before every token transfer / mint / burn. function _beforeTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual override { super._beforeTokenTransfer(operator, from, to, ids, amounts, data); if (from == address(0)) { for (uint256 i = 0; i < ids.length; ++i) { totalSupply[ids[i]] += amounts[i]; } } if (to == address(0)) { for (uint256 i = 0; i < ids.length; ++i) { totalSupply[ids[i]] -= amounts[i]; } } } /// @dev Checks whether primary sale recipient can be set in the given execution context. function _canSetPrimarySaleRecipient() internal view virtual override returns (bool) { return msg.sender == owner(); } /// @dev Checks whether owner can be set in the given execution context. function _canSetOwner() internal view virtual override returns (bool) { return msg.sender == owner(); } /// @dev Checks whether royalty info can be set in the given execution context. function _canSetRoyaltyInfo() internal view virtual override returns (bool) { return msg.sender == owner(); } /// @dev Checks whether contract metadata can be set in the given execution context. function _canSetContractURI() internal view virtual override returns (bool) { return msg.sender == owner(); } /// @dev Checks whether platform fee info can be set in the given execution context. function _canSetClaimConditions() internal view virtual override returns (bool) { return msg.sender == owner(); } /// @dev Returns whether lazy minting can be done in the given execution context. function _canLazyMint() internal view virtual override returns (bool) { return msg.sender == owner(); } /// @dev Checks whether NFTs can be revealed in the given execution context. function _canReveal() internal view virtual returns (bool) { return msg.sender == owner(); } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import { ERC721A } from "../eip/ERC721A.sol"; import "../extension/ContractMetadata.sol"; import "../extension/Multicall.sol"; import "../extension/Ownable.sol"; import "../extension/Royalty.sol"; import "../extension/BatchMintMetadata.sol"; import "../extension/LazyMint.sol"; import "../extension/interface/IClaimableERC721.sol"; import "../lib/TWStrings.sol"; import "../openzeppelin-presets/security/ReentrancyGuard.sol"; /** * BASE: ERC721A * EXTENSION: LazyMint * * The `ERC721LazyMint` smart contract implements the ERC721 NFT standard, along with the ERC721A optimization to the standard. * It includes the following additions to standard ERC721 logic: * * - Lazy minting * * - Contract metadata for royalty support on platforms such as OpenSea that use * off-chain information to distribute roaylties. * * - Ownership of the contract, with the ability to restrict certain functions to * only be called by the contract's owner. * * - Multicall capability to perform multiple actions atomically * * - EIP 2981 compliance for royalty support on NFT marketplaces. * * 'Lazy minting' means defining the metadata of NFTs without minting it to an address. Regular 'minting' * of NFTs means actually assigning an owner to an NFT. * * As a contract admin, this lets you prepare the metadata for NFTs that will be minted by an external party, * without paying the gas cost for actually minting the NFTs. */ contract ERC721LazyMint is ERC721A, ContractMetadata, Multicall, Ownable, Royalty, BatchMintMetadata, LazyMint, IClaimableERC721, ReentrancyGuard { using TWStrings for uint256; /*////////////////////////////////////////////////////////////// Constructor //////////////////////////////////////////////////////////////*/ constructor( string memory _name, string memory _symbol, address _royaltyRecipient, uint128 _royaltyBps ) ERC721A(_name, _symbol) { _setupOwner(msg.sender); _setupDefaultRoyaltyInfo(_royaltyRecipient, _royaltyBps); } /*////////////////////////////////////////////////////////////// ERC165 Logic //////////////////////////////////////////////////////////////*/ /// @dev See ERC165: https://eips.ethereum.org/EIPS/eip-165 function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721A, IERC165) returns (bool) { return interfaceId == 0x01ffc9a7 || // ERC165 Interface ID for ERC165 interfaceId == 0x80ac58cd || // ERC165 Interface ID for ERC721 interfaceId == 0x5b5e139f || // ERC165 Interface ID for ERC721Metadata interfaceId == type(IERC2981).interfaceId; // ERC165 ID for ERC2981 } /*////////////////////////////////////////////////////////////// Overriden ERC721 logic //////////////////////////////////////////////////////////////*/ /** * @notice Returns the metadata URI for an NFT. * @dev See `BatchMintMetadata` for handling of metadata in this contract. * * @param _tokenId The tokenId of an NFT. */ function tokenURI(uint256 _tokenId) public view virtual override returns (string memory) { string memory batchUri = _getBaseURI(_tokenId); return string(abi.encodePacked(batchUri, _tokenId.toString())); } /*////////////////////////////////////////////////////////////// Claiming logic //////////////////////////////////////////////////////////////*/ /** * @notice Lets an address claim multiple lazy minted NFTs at once to a recipient. * This function prevents any reentrant calls, and is not allowed to be overridden. * * Contract creators should override `verifyClaim` and `transferTokensOnClaim` * functions to create custom logic for verification and claiming, * for e.g. price collection, allowlist, max quantity, etc. * * @dev The logic in `verifyClaim` determines whether the caller is authorized to mint NFTs. * The logic in `transferTokensOnClaim` does actual minting of tokens, * can also be used to apply other state changes. * * @param _receiver The recipient of the NFT to mint. * @param _quantity The number of NFTs to mint. */ function claim(address _receiver, uint256 _quantity) public payable nonReentrant { require(_currentIndex + _quantity <= nextTokenIdToLazyMint, "Not enough lazy minted tokens."); verifyClaim(msg.sender, _quantity); // Add your claim verification logic by overriding this function. uint256 startTokenId = _transferTokensOnClaim(_receiver, _quantity); // Mints tokens. Apply any state updates by overriding this function. emit TokensClaimed(msg.sender, _receiver, startTokenId, _quantity); } /** * @notice Override this function to add logic for claim verification, based on conditions * such as allowlist, price, max quantity etc. * * @dev Checks a request to claim NFTs against a custom condition. * * @param _claimer Caller of the claim function. * @param _quantity The number of NFTs being claimed. */ function verifyClaim(address _claimer, uint256 _quantity) public view virtual {} /** * @notice Lets an owner or approved operator burn the NFT of the given tokenId. * @dev ERC721A's `_burn(uint256,bool)` internally checks for token approvals. * * @param _tokenId The tokenId of the NFT to burn. */ function burn(uint256 _tokenId) external virtual { _burn(_tokenId, true); } /// @notice The tokenId assigned to the next new NFT to be lazy minted. function nextTokenIdToMint() public view virtual returns (uint256) { return nextTokenIdToLazyMint; } /// @notice The tokenId assigned to the next new NFT to be claimed. function nextTokenIdToClaim() public view virtual returns (uint256) { return _currentIndex; } /*////////////////////////////////////////////////////////////// Internal functions //////////////////////////////////////////////////////////////*/ /** * @notice Mints tokens to receiver on claim. * Any state changes related to `claim` must be applied * here by overriding this function. * * @dev Override this function to add logic for state updation. * When overriding, apply any state changes before `_safeMint`. */ function _transferTokensOnClaim(address _receiver, uint256 _quantity) internal virtual returns (uint256 startTokenId) { startTokenId = _currentIndex; _safeMint(_receiver, _quantity); } /// @dev Returns whether lazy minting can be done in the given execution context. function _canLazyMint() internal view virtual override returns (bool) { return msg.sender == owner(); } /// @dev Returns whether contract metadata can be set in the given execution context. function _canSetContractURI() internal view virtual override returns (bool) { return msg.sender == owner(); } /// @dev Returns whether owner can be set in the given execution context. function _canSetOwner() internal view virtual override returns (bool) { return msg.sender == owner(); } /// @dev Returns whether royalty info can be set in the given execution context. function _canSetRoyaltyInfo() internal view virtual override returns (bool) { return msg.sender == owner(); } }
// SPDX-License-Identifier: Apache 2.0 pragma solidity ^0.8.0; import "./interface/IERC1155.sol"; import "./interface/IERC1155Metadata.sol"; import "./interface/IERC1155Receiver.sol"; contract ERC1155 is IERC1155, IERC1155Metadata { /*////////////////////////////////////////////////////////////// State variables //////////////////////////////////////////////////////////////*/ string public name; string public symbol; /*////////////////////////////////////////////////////////////// Mappings //////////////////////////////////////////////////////////////*/ mapping(address => mapping(uint256 => uint256)) public balanceOf; mapping(address => mapping(address => bool)) public isApprovedForAll; mapping(uint256 => string) internal _uri; /*////////////////////////////////////////////////////////////// Constructor //////////////////////////////////////////////////////////////*/ constructor(string memory _name, string memory _symbol) { name = _name; symbol = _symbol; } /*////////////////////////////////////////////////////////////// View functions //////////////////////////////////////////////////////////////*/ function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) { return interfaceId == 0x01ffc9a7 || // ERC165 Interface ID for ERC165 interfaceId == 0xd9b67a26 || // ERC165 Interface ID for ERC1155 interfaceId == 0x0e89341c; // ERC165 Interface ID for ERC1155MetadataURI } function uri(uint256 tokenId) public view virtual override returns (string memory) { return _uri[tokenId]; } function balanceOfBatch(address[] memory accounts, uint256[] memory ids) public view virtual override returns (uint256[] memory) { require(accounts.length == ids.length, "LENGTH_MISMATCH"); uint256[] memory batchBalances = new uint256[](accounts.length); for (uint256 i = 0; i < accounts.length; ++i) { batchBalances[i] = balanceOf[accounts[i]][ids[i]]; } return batchBalances; } /*////////////////////////////////////////////////////////////// ERC1155 logic //////////////////////////////////////////////////////////////*/ function setApprovalForAll(address operator, bool approved) public virtual override { address owner = msg.sender; require(owner != operator, "APPROVING_SELF"); isApprovedForAll[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) public virtual override { require(from == msg.sender || isApprovedForAll[from][msg.sender], "!OWNER_OR_APPROVED"); _safeTransferFrom(from, to, id, amount, data); } function safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) public virtual override { require(from == msg.sender || isApprovedForAll[from][msg.sender], "!OWNER_OR_APPROVED"); _safeBatchTransferFrom(from, to, ids, amounts, data); } /*////////////////////////////////////////////////////////////// Internal logic //////////////////////////////////////////////////////////////*/ function _safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(to != address(0), "TO_ZERO_ADDR"); address operator = msg.sender; _beforeTokenTransfer(operator, from, to, _asSingletonArray(id), _asSingletonArray(amount), data); uint256 fromBalance = balanceOf[from][id]; require(fromBalance >= amount, "INSUFFICIENT_BAL"); unchecked { balanceOf[from][id] = fromBalance - amount; } balanceOf[to][id] += amount; emit TransferSingle(operator, from, to, id, amount); _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data); } function _safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { require(ids.length == amounts.length, "LENGTH_MISMATCH"); require(to != address(0), "TO_ZERO_ADDR"); address operator = msg.sender; _beforeTokenTransfer(operator, from, to, ids, amounts, data); for (uint256 i = 0; i < ids.length; ++i) { uint256 id = ids[i]; uint256 amount = amounts[i]; uint256 fromBalance = balanceOf[from][id]; require(fromBalance >= amount, "INSUFFICIENT_BAL"); unchecked { balanceOf[from][id] = fromBalance - amount; } balanceOf[to][id] += amount; } emit TransferBatch(operator, from, to, ids, amounts); _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data); } function _setTokenURI(uint256 tokenId, string memory newuri) internal virtual { _uri[tokenId] = newuri; } function _mint( address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(to != address(0), "TO_ZERO_ADDR"); address operator = msg.sender; _beforeTokenTransfer(operator, address(0), to, _asSingletonArray(id), _asSingletonArray(amount), data); balanceOf[to][id] += amount; emit TransferSingle(operator, address(0), to, id, amount); _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data); } function _mintBatch( address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { require(to != address(0), "TO_ZERO_ADDR"); require(ids.length == amounts.length, "LENGTH_MISMATCH"); address operator = msg.sender; _beforeTokenTransfer(operator, address(0), to, ids, amounts, data); for (uint256 i = 0; i < ids.length; i++) { balanceOf[to][ids[i]] += amounts[i]; } emit TransferBatch(operator, address(0), to, ids, amounts); _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data); } function _burn( address from, uint256 id, uint256 amount ) internal virtual { require(from != address(0), "FROM_ZERO_ADDR"); address operator = msg.sender; _beforeTokenTransfer(operator, from, address(0), _asSingletonArray(id), _asSingletonArray(amount), ""); uint256 fromBalance = balanceOf[from][id]; require(fromBalance >= amount, "INSUFFICIENT_BAL"); unchecked { balanceOf[from][id] = fromBalance - amount; } emit TransferSingle(operator, from, address(0), id, amount); } function _burnBatch( address from, uint256[] memory ids, uint256[] memory amounts ) internal virtual { require(from != address(0), "FROM_ZERO_ADDR"); require(ids.length == amounts.length, "LENGTH_MISMATCH"); address operator = msg.sender; _beforeTokenTransfer(operator, from, address(0), ids, amounts, ""); for (uint256 i = 0; i < ids.length; i++) { uint256 id = ids[i]; uint256 amount = amounts[i]; uint256 fromBalance = balanceOf[from][id]; require(fromBalance >= amount, "INSUFFICIENT_BAL"); unchecked { balanceOf[from][id] = fromBalance - amount; } } emit TransferBatch(operator, from, address(0), ids, amounts); } function _beforeTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual {} function _doSafeTransferAcceptanceCheck( address operator, address from, address to, uint256 id, uint256 amount, bytes memory data ) private { if (to.code.length > 0) { try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) { if (response != IERC1155Receiver.onERC1155Received.selector) { revert("TOKENS_REJECTED"); } } catch Error(string memory reason) { revert(reason); } catch { revert("!ERC1155RECEIVER"); } } } function _doSafeBatchTransferAcceptanceCheck( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) private { if (to.code.length > 0) { try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns ( bytes4 response ) { if (response != IERC1155Receiver.onERC1155BatchReceived.selector) { revert("TOKENS_REJECTED"); } } catch Error(string memory reason) { revert(reason); } catch { revert("!ERC1155RECEIVER"); } } } function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) { uint256[] memory array = new uint256[](1); array[0] = element; return array; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./interface/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 // ERC721A Contracts v3.3.0 // Creator: Chiru Labs pragma solidity ^0.8.4; import "./interface/IERC721A.sol"; import "../openzeppelin-presets/token/ERC721/IERC721Receiver.sol"; import "../lib/TWAddress.sol"; import "../openzeppelin-presets/utils/Context.sol"; import "../lib/TWStrings.sol"; import "./ERC165.sol"; /** * @dev Implementation of [ERC721](https://eips.ethereum.org/EIPS/eip-721) 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 TWAddress for address; using TWStrings 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) 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: Apache-2.0 pragma solidity ^0.8.0; /** @title ERC-1155 Multi Token Standard @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1155.md Note: The ERC-165 identifier for this interface is 0xd9b67a26. */ interface IERC1155 { /** @dev Either `TransferSingle` or `TransferBatch` MUST emit when tokens are transferred, including zero value transfers as well as minting or burning (see "Safe Transfer Rules" section of the standard). The `_operator` argument MUST be msg.sender. The `_from` argument MUST be the address of the holder whose balance is decreased. The `_to` argument MUST be the address of the recipient whose balance is increased. The `_id` argument MUST be the token type being transferred. The `_value` argument MUST be the number of tokens the holder balance is decreased by and match what the recipient balance is increased by. When minting/creating tokens, the `_from` argument MUST be set to `0x0` (i.e. zero address). When burning/destroying tokens, the `_to` argument MUST be set to `0x0` (i.e. zero address). */ event TransferSingle( address indexed _operator, address indexed _from, address indexed _to, uint256 _id, uint256 _value ); /** @dev Either `TransferSingle` or `TransferBatch` MUST emit when tokens are transferred, including zero value transfers as well as minting or burning (see "Safe Transfer Rules" section of the standard). The `_operator` argument MUST be msg.sender. The `_from` argument MUST be the address of the holder whose balance is decreased. The `_to` argument MUST be the address of the recipient whose balance is increased. The `_ids` argument MUST be the list of tokens being transferred. The `_values` argument MUST be the list of number of tokens (matching the list and order of tokens specified in _ids) the holder balance is decreased by and match what the recipient balance is increased by. When minting/creating tokens, the `_from` argument MUST be set to `0x0` (i.e. zero address). When burning/destroying tokens, the `_to` argument MUST be set to `0x0` (i.e. zero address). */ event TransferBatch( address indexed _operator, address indexed _from, address indexed _to, uint256[] _ids, uint256[] _values ); /** @dev MUST emit when approval for a second party/operator address to manage all tokens for an owner address is enabled or disabled (absense of an event assumes disabled). */ event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved); /** @dev MUST emit when the URI is updated for a token ID. URIs are defined in RFC 3986. The URI MUST point a JSON file that conforms to the "ERC-1155 Metadata URI JSON Schema". */ event URI(string _value, uint256 indexed _id); /** @notice Transfers `_value` amount of an `_id` from the `_from` address to the `_to` address specified (with safety call). @dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard). MUST revert if `_to` is the zero address. MUST revert if balance of holder for token `_id` is lower than the `_value` sent. MUST revert on any other error. MUST emit the `TransferSingle` event to reflect the balance change (see "Safe Transfer Rules" section of the standard). After the above conditions are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call `onERC1155Received` on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard). @param _from Source address @param _to Target address @param _id ID of the token type @param _value Transfer amount @param _data Additional data with no specified format, MUST be sent unaltered in call to `onERC1155Received` on `_to` */ function safeTransferFrom( address _from, address _to, uint256 _id, uint256 _value, bytes calldata _data ) external; /** @notice Transfers `_values` amount(s) of `_ids` from the `_from` address to the `_to` address specified (with safety call). @dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard). MUST revert if `_to` is the zero address. MUST revert if length of `_ids` is not the same as length of `_values`. MUST revert if any of the balance(s) of the holder(s) for token(s) in `_ids` is lower than the respective amount(s) in `_values` sent to the recipient. MUST revert on any other error. MUST emit `TransferSingle` or `TransferBatch` event(s) such that all the balance changes are reflected (see "Safe Transfer Rules" section of the standard). Balance changes and events MUST follow the ordering of the arrays (_ids[0]/_values[0] before _ids[1]/_values[1], etc). After the above conditions for the transfer(s) in the batch are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call the relevant `ERC1155TokenReceiver` hook(s) on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard). @param _from Source address @param _to Target address @param _ids IDs of each token type (order and length must match _values array) @param _values Transfer amounts per token type (order and length must match _ids array) @param _data Additional data with no specified format, MUST be sent unaltered in call to the `ERC1155TokenReceiver` hook(s) on `_to` */ function safeBatchTransferFrom( address _from, address _to, uint256[] calldata _ids, uint256[] calldata _values, bytes calldata _data ) external; /** @notice Get the balance of an account's Tokens. @param _owner The address of the token holder @param _id ID of the Token @return The _owner's balance of the Token type requested */ function balanceOf(address _owner, uint256 _id) external view returns (uint256); /** @notice Get the balance of multiple account/token pairs @param _owners The addresses of the token holders @param _ids ID of the Tokens @return The _owner's balance of the Token types requested (i.e. balance for each (owner, id) pair) */ function balanceOfBatch(address[] calldata _owners, uint256[] calldata _ids) external view returns (uint256[] memory); /** @notice Enable or disable approval for a third party ("operator") to manage all of the caller's tokens. @dev MUST emit the ApprovalForAll event on success. @param _operator Address to add to the set of authorized operators @param _approved True if the operator is approved, false to revoke approval */ function setApprovalForAll(address _operator, bool _approved) external; /** @notice Queries the approval status of an operator for a given owner. @param _owner The owner of the Tokens @param _operator Address of authorized operator @return True if the operator is approved, false if not */ function isApprovedForAll(address _owner, address _operator) external view returns (bool); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; /** Note: The ERC-165 identifier for this interface is 0x0e89341c. */ interface IERC1155Metadata { /** @notice A distinct Uniform Resource Identifier (URI) for a given token. @dev URIs are defined in RFC 3986. The URI may point to a JSON file that conforms to the "ERC-1155 Metadata URI JSON Schema". @return URI string */ function uri(uint256 _id) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev _Available since v3.1._ */ interface IERC1155Receiver is IERC165 { /** * @dev Handles the receipt of a single ERC1155 token type. This function is * called at the end of a `safeTransferFrom` after the balance has been updated. * * NOTE: To accept the transfer, this must return * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` * (i.e. 0xf23a6e61, or its own function selector). * * @param operator The address which initiated the transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param id The ID of the token being transferred * @param value The amount of tokens being transferred * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed */ function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns (bytes4); /** * @dev Handles the receipt of a multiple ERC1155 token types. This function * is called at the end of a `safeBatchTransferFrom` after the balances have * been updated. * * NOTE: To accept the transfer(s), this must return * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` * (i.e. 0xbc197c81, or its own function selector). * * @param operator The address which initiated the batch transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param ids An array containing ids of each token being transferred (order and length must match values array) * @param values An array containing amounts of each token being transferred (order and length must match ids array) * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed */ function onERC1155BatchReceived( address operator, address from, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external returns (bytes4); }
// 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 * [EIP](https://eips.ethereum.org/EIPS/eip-165). * * 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 * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address who) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); function transfer(address to, uint256 value) external returns (bool); function approve(address spender, uint256 value) external returns (bool); function transferFrom( address from, address to, uint256 value ) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: Apache 2.0 pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Interface for the NFT Royalty Standard. * * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal * support for royalty payments across all NFT marketplaces and ecosystem participants. * * _Available since v4.5._ */ interface IERC2981 is IERC165 { /** * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of * exchange. The royalty amount is denominated and should be payed in that same unit of exchange. */ function royaltyInfo(uint256 tokenId, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT // ERC721A Contracts v3.3.0 // Creator: Chiru Labs pragma solidity ^0.8.4; import "./IERC721.sol"; import "./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: Apache-2.0 pragma solidity ^0.8.0; /// @title ERC-721 Non-Fungible Token Standard, optional metadata extension /// @dev See https://eips.ethereum.org/EIPS/eip-721 /// Note: the ERC-165 identifier for this interface is 0x5b5e139f. /* is ERC721 */ interface IERC721Metadata { /// @notice A descriptive name for a collection of NFTs in this contract function name() external view returns (string memory); /// @notice An abbreviated name for NFTs in this contract function symbol() external view returns (string memory); /// @notice A distinct Uniform Resource Identifier (URI) for a given asset. /// @dev Throws if `_tokenId` is not a valid NFT. URIs are defined in RFC /// 3986. The URI may point to a JSON file that conforms to the "ERC721 /// Metadata JSON Schema". function tokenURI(uint256 _tokenId) external view returns (string memory); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; /** * @title Batch-mint Metadata * @notice The `BatchMintMetadata` is a contract extension for any base NFT contract. It lets the smart contract * using this extension set metadata for `n` number of NFTs all at once. This is enabled by storing a single * base URI for a batch of `n` NFTs, where the metadata for each NFT in a relevant batch is `baseURI/tokenId`. */ contract BatchMintMetadata { /// @dev Largest tokenId of each batch of tokens with the same baseURI. uint256[] private batchIds; /// @dev Mapping from id of a batch of tokens => to base URI for the respective batch of tokens. mapping(uint256 => string) private baseURI; /** * @notice Returns the count of batches of NFTs. * @dev Each batch of tokens has an in ID and an associated `baseURI`. * See {batchIds}. */ function getBaseURICount() public view returns (uint256) { return batchIds.length; } /** * @notice Returns the ID for the batch of tokens the given tokenId belongs to. * @dev See {getBaseURICount}. * @param _index ID of a token. */ function getBatchIdAtIndex(uint256 _index) public view returns (uint256) { if (_index >= getBaseURICount()) { revert("Invalid index"); } return batchIds[_index]; } /// @dev Returns the id for the batch of tokens the given tokenId belongs to. function _getBatchId(uint256 _tokenId) internal view returns (uint256 batchId, uint256 index) { uint256 numOfTokenBatches = getBaseURICount(); uint256[] memory indices = batchIds; for (uint256 i = 0; i < numOfTokenBatches; i += 1) { if (_tokenId < indices[i]) { index = i; batchId = indices[i]; return (batchId, index); } } revert("Invalid tokenId"); } /// @dev Returns the baseURI for a token. The intended metadata URI for the token is baseURI + tokenId. function _getBaseURI(uint256 _tokenId) internal view returns (string memory) { uint256 numOfTokenBatches = getBaseURICount(); uint256[] memory indices = batchIds; for (uint256 i = 0; i < numOfTokenBatches; i += 1) { if (_tokenId < indices[i]) { return baseURI[indices[i]]; } } revert("Invalid tokenId"); } /// @dev Sets the base URI for the batch of tokens with the given batchId. function _setBaseURI(uint256 _batchId, string memory _baseURI) internal { baseURI[_batchId] = _baseURI; } /// @dev Mints a batch of tokenIds and associates a common baseURI to all those Ids. function _batchMintMetadata( uint256 _startId, uint256 _amountToMint, string memory _baseURIForTokens ) internal returns (uint256 nextTokenIdToMint, uint256 batchId) { batchId = _startId + _amountToMint; nextTokenIdToMint = batchId; batchIds.push(batchId); baseURI[batchId] = _baseURIForTokens; } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import "./interface/IContractMetadata.sol"; /** * @title Contract Metadata * @notice Thirdweb's `ContractMetadata` is a contract extension for any base contracts. It lets you set a metadata URI * for you contract. * Additionally, `ContractMetadata` is necessary for NFT contracts that want royalties to get distributed on OpenSea. */ abstract contract ContractMetadata is IContractMetadata { /// @notice Returns the contract metadata URI. string public override contractURI; /** * @notice Lets a contract admin set the URI for contract-level metadata. * @dev Caller should be authorized to setup contractURI, e.g. contract admin. * See {_canSetContractURI}. * Emits {ContractURIUpdated Event}. * * @param _uri keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE") */ function setContractURI(string memory _uri) external override { if (!_canSetContractURI()) { revert("Not authorized"); } _setupContractURI(_uri); } /// @dev Lets a contract admin set the URI for contract-level metadata. function _setupContractURI(string memory _uri) internal { string memory prevURI = contractURI; contractURI = _uri; emit ContractURIUpdated(prevURI, _uri); } /// @dev Returns whether contract metadata can be set in the given execution context. function _canSetContractURI() internal view virtual returns (bool); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import "./interface/IDelayedReveal.sol"; /** * @title Delayed Reveal * @notice Thirdweb's `DelayedReveal` is a contract extension for base NFT contracts. It lets you create batches of * 'delayed-reveal' NFTs. You can learn more about the usage of delayed reveal NFTs here - https://blog.thirdweb.com/delayed-reveal-nfts */ abstract contract DelayedReveal is IDelayedReveal { /// @dev Mapping from tokenId of a batch of tokens => to delayed reveal data. mapping(uint256 => bytes) public encryptedData; /// @dev Sets the delayed reveal data for a batchId. function _setEncryptedData(uint256 _batchId, bytes memory _encryptedData) internal { encryptedData[_batchId] = _encryptedData; } /** * @notice Returns revealed URI for a batch of NFTs. * @dev Reveal encrypted base URI for `_batchId` with caller/admin's `_key` used for encryption. * Reverts if there's no encrypted URI for `_batchId`. * See {encryptDecrypt}. * * @param _batchId ID of the batch for which URI is being revealed. * @param _key Secure key used by caller/admin for encryption of baseURI. * * @return revealedURI Decrypted base URI. */ function getRevealURI(uint256 _batchId, bytes calldata _key) public view returns (string memory revealedURI) { bytes memory data = encryptedData[_batchId]; if (data.length == 0) { revert("Nothing to reveal"); } (bytes memory encryptedURI, bytes32 provenanceHash) = abi.decode(data, (bytes, bytes32)); revealedURI = string(encryptDecrypt(encryptedURI, _key)); require(keccak256(abi.encodePacked(revealedURI, _key, block.chainid)) == provenanceHash, "Incorrect key"); } /** * @notice Encrypt/decrypt data on chain. * @dev Encrypt/decrypt given `data` with `key`. Uses inline assembly. * See: https://ethereum.stackexchange.com/questions/69825/decrypt-message-on-chain * * @param data Bytes of data to encrypt/decrypt. * @param key Secure key used by caller for encryption/decryption. * * @return result Output after encryption/decryption of given data. */ function encryptDecrypt(bytes memory data, bytes calldata key) public pure override returns (bytes memory result) { // Store data length on stack for later use uint256 length = data.length; // solhint-disable-next-line no-inline-assembly assembly { // Set result to free memory pointer result := mload(0x40) // Increase free memory pointer by lenght + 32 mstore(0x40, add(add(result, length), 32)) // Set result length mstore(result, length) } // Iterate over the data stepping by 32 bytes for (uint256 i = 0; i < length; i += 32) { // Generate hash of the key and offset bytes32 hash = keccak256(abi.encodePacked(key, i)); bytes32 chunk; // solhint-disable-next-line no-inline-assembly assembly { // Read 32-bytes data chunk chunk := mload(add(data, add(i, 32))) } // XOR the chunk with hash chunk ^= hash; // solhint-disable-next-line no-inline-assembly assembly { // Write 32-byte encrypted chunk mstore(add(result, add(i, 32)), chunk) } } } /** * @notice Returns whether the relvant batch of NFTs is subject to a delayed reveal. * @dev Returns `true` if `_batchId`'s base URI is encrypted. * @param _batchId ID of a batch of NFTs. */ function isEncryptedBatch(uint256 _batchId) public view returns (bool) { return encryptedData[_batchId].length > 0; } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import "./interface/IDropSinglePhase1155.sol"; import "../lib/MerkleProof.sol"; abstract contract DropSinglePhase1155 is IDropSinglePhase1155 { /*/////////////////////////////////////////////////////////////// Mappings //////////////////////////////////////////////////////////////*/ /// @dev Mapping from tokenId => active claim condition for the tokenId. mapping(uint256 => ClaimCondition) public claimCondition; /// @dev Mapping from tokenId => active claim condition's UID. mapping(uint256 => bytes32) private conditionId; /** * @dev Map from a claim condition uid and account to supply claimed by account. */ mapping(bytes32 => mapping(address => uint256)) private supplyClaimedByWallet; /*/////////////////////////////////////////////////////////////// Drop logic //////////////////////////////////////////////////////////////*/ /// @dev Lets an account claim tokens. function claim( address _receiver, uint256 _tokenId, uint256 _quantity, address _currency, uint256 _pricePerToken, AllowlistProof calldata _allowlistProof, bytes memory _data ) public payable virtual override { _beforeClaim(_tokenId, _receiver, _quantity, _currency, _pricePerToken, _allowlistProof, _data); ClaimCondition memory condition = claimCondition[_tokenId]; bytes32 activeConditionId = conditionId[_tokenId]; verifyClaim(_tokenId, _dropMsgSender(), _quantity, _currency, _pricePerToken, _allowlistProof); // Update contract state. condition.supplyClaimed += _quantity; supplyClaimedByWallet[activeConditionId][_dropMsgSender()] += _quantity; claimCondition[_tokenId] = condition; // If there's a price, collect price. _collectPriceOnClaim(address(0), _quantity, _currency, _pricePerToken); // Mint the relevant NFTs to claimer. _transferTokensOnClaim(_receiver, _tokenId, _quantity); emit TokensClaimed(_dropMsgSender(), _receiver, _tokenId, _quantity); _afterClaim(_tokenId, _receiver, _quantity, _currency, _pricePerToken, _allowlistProof, _data); } /// @dev Lets a contract admin set claim conditions. function setClaimConditions( uint256 _tokenId, ClaimCondition calldata _condition, bool _resetClaimEligibility ) external override { if (!_canSetClaimConditions()) { revert("Not authorized"); } ClaimCondition memory condition = claimCondition[_tokenId]; bytes32 targetConditionId = conditionId[_tokenId]; uint256 supplyClaimedAlready = condition.supplyClaimed; if (_resetClaimEligibility) { supplyClaimedAlready = 0; targetConditionId = keccak256(abi.encodePacked(_dropMsgSender(), block.number)); } if (supplyClaimedAlready > _condition.maxClaimableSupply) { revert("max supply claimed"); } ClaimCondition memory updatedCondition = ClaimCondition({ startTimestamp: _condition.startTimestamp, maxClaimableSupply: _condition.maxClaimableSupply, supplyClaimed: supplyClaimedAlready, quantityLimitPerWallet: _condition.quantityLimitPerWallet, merkleRoot: _condition.merkleRoot, pricePerToken: _condition.pricePerToken, currency: _condition.currency, metadata: _condition.metadata }); claimCondition[_tokenId] = updatedCondition; conditionId[_tokenId] = targetConditionId; emit ClaimConditionUpdated(_tokenId, _condition, _resetClaimEligibility); } /// @dev Checks a request to claim NFTs against the active claim condition's criteria. function verifyClaim( uint256 _tokenId, address _claimer, uint256 _quantity, address _currency, uint256 _pricePerToken, AllowlistProof calldata _allowlistProof ) public view returns (bool isOverride) { ClaimCondition memory currentClaimPhase = claimCondition[_tokenId]; uint256 claimLimit = currentClaimPhase.quantityLimitPerWallet; uint256 claimPrice = currentClaimPhase.pricePerToken; address claimCurrency = currentClaimPhase.currency; if (currentClaimPhase.merkleRoot != bytes32(0)) { (isOverride, ) = MerkleProof.verify( _allowlistProof.proof, currentClaimPhase.merkleRoot, keccak256( abi.encodePacked( _claimer, _allowlistProof.quantityLimitPerWallet, _allowlistProof.pricePerToken, _allowlistProof.currency ) ) ); } if (isOverride) { claimLimit = _allowlistProof.quantityLimitPerWallet != 0 ? _allowlistProof.quantityLimitPerWallet : claimLimit; claimPrice = _allowlistProof.pricePerToken != type(uint256).max ? _allowlistProof.pricePerToken : claimPrice; claimCurrency = _allowlistProof.pricePerToken != type(uint256).max && _allowlistProof.currency != address(0) ? _allowlistProof.currency : claimCurrency; } uint256 _supplyClaimedByWallet = supplyClaimedByWallet[conditionId[_tokenId]][_claimer]; if (_currency != claimCurrency || _pricePerToken != claimPrice) { revert("!PriceOrCurrency"); } if (_quantity == 0 || (_quantity + _supplyClaimedByWallet > claimLimit)) { revert("!Qty"); } if (currentClaimPhase.supplyClaimed + _quantity > currentClaimPhase.maxClaimableSupply) { revert("!MaxSupply"); } if (currentClaimPhase.startTimestamp > block.timestamp) { revert("cant claim yet"); } } /// @dev Returns the supply claimed by claimer for active conditionId. function getSupplyClaimedByWallet(uint256 _tokenId, address _claimer) public view returns (uint256) { return supplyClaimedByWallet[conditionId[_tokenId]][_claimer]; } /*//////////////////////////////////////////////////////////////////// Optional hooks that can be implemented in the derived contract ///////////////////////////////////////////////////////////////////*/ /// @dev Exposes the ability to override the msg sender. function _dropMsgSender() internal virtual returns (address) { return msg.sender; } /// @dev Runs before every `claim` function call. function _beforeClaim( uint256 _tokenId, address _receiver, uint256 _quantity, address _currency, uint256 _pricePerToken, AllowlistProof calldata _allowlistProof, bytes memory _data ) internal virtual {} /// @dev Runs after every `claim` function call. function _afterClaim( uint256 _tokenId, address _receiver, uint256 _quantity, address _currency, uint256 _pricePerToken, AllowlistProof calldata _allowlistProof, bytes memory _data ) internal virtual {} /// @dev Collects and distributes the primary sale value of NFTs being claimed. function _collectPriceOnClaim( address _primarySaleRecipient, uint256 _quantityToClaim, address _currency, uint256 _pricePerToken ) internal virtual; /// @dev Transfers the NFTs being claimed. function _transferTokensOnClaim( address _to, uint256 _tokenId, uint256 _quantityBeingClaimed ) internal virtual; function _canSetClaimConditions() internal view virtual returns (bool); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import "./interface/ILazyMint.sol"; import "./BatchMintMetadata.sol"; /** * The `LazyMint` is a contract extension for any base NFT contract. It lets you 'lazy mint' any number of NFTs * at once. Here, 'lazy mint' means defining the metadata for particular tokenIds of your NFT contract, without actually * minting a non-zero balance of NFTs of those tokenIds. */ abstract contract LazyMint is ILazyMint, BatchMintMetadata { /// @notice The tokenId assigned to the next new NFT to be lazy minted. uint256 internal nextTokenIdToLazyMint; /** * @notice Lets an authorized address lazy mint a given amount of NFTs. * * @param _amount The number of NFTs to lazy mint. * @param _baseURIForTokens The base URI for the 'n' number of NFTs being lazy minted, where the metadata for each * of those NFTs is `${baseURIForTokens}/${tokenId}`. * @param _data Additional bytes data to be used at the discretion of the consumer of the contract. * @return batchId A unique integer identifier for the batch of NFTs lazy minted together. */ function lazyMint( uint256 _amount, string calldata _baseURIForTokens, bytes calldata _data ) public virtual override returns (uint256 batchId) { if (!_canLazyMint()) { revert("Not authorized"); } if (_amount == 0) { revert("0 amt"); } uint256 startId = nextTokenIdToLazyMint; (nextTokenIdToLazyMint, batchId) = _batchMintMetadata(startId, _amount, _baseURIForTokens); emit TokensLazyMinted(startId, startId + _amount - 1, _baseURIForTokens, _data); return batchId; } /// @dev Returns whether lazy minting can be performed in the given execution context. function _canLazyMint() internal view virtual returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Multicall.sol) pragma solidity ^0.8.0; import "../lib/TWAddress.sol"; import "./interface/IMulticall.sol"; /** * @dev Provides a function to batch together multiple calls in a single external call. * * _Available since v4.1._ */ contract Multicall is IMulticall { /** * @notice Receives and executes a batch of function calls on this contract. * @dev Receives and executes a batch of function calls on this contract. * * @param data The bytes data that makes up the batch of function calls to execute. * @return results The bytes data that makes up the result of the batch of function calls executed. */ function multicall(bytes[] calldata data) external virtual override returns (bytes[] memory results) { results = new bytes[](data.length); for (uint256 i = 0; i < data.length; i++) { results[i] = TWAddress.functionDelegateCall(address(this), data[i]); } return results; } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import "./interface/IOwnable.sol"; /** * @title Ownable * @notice Thirdweb's `Ownable` is a contract extension to be used with any base contract. It exposes functions for setting and reading * who the 'owner' of the inheriting smart contract is, and lets the inheriting contract perform conditional logic that uses * information about who the contract's owner is. */ abstract contract Ownable is IOwnable { /// @dev Owner of the contract (purpose: OpenSea compatibility) address private _owner; /// @dev Reverts if caller is not the owner. modifier onlyOwner() { if (msg.sender != _owner) { revert("Not authorized"); } _; } /** * @notice Returns the owner of the contract. */ function owner() public view override returns (address) { return _owner; } /** * @notice Lets an authorized wallet set a new owner for the contract. * @param _newOwner The address to set as the new owner of the contract. */ function setOwner(address _newOwner) external override { if (!_canSetOwner()) { revert("Not authorized"); } _setupOwner(_newOwner); } /// @dev Lets a contract admin set a new owner for the contract. The new owner must be a contract admin. function _setupOwner(address _newOwner) internal { address _prevOwner = _owner; _owner = _newOwner; emit OwnerUpdated(_prevOwner, _newOwner); } /// @dev Returns whether owner can be set in the given execution context. function _canSetOwner() internal view virtual returns (bool); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import "./interface/IPrimarySale.sol"; /** * @title Primary Sale * @notice Thirdweb's `PrimarySale` is a contract extension to be used with any base contract. It exposes functions for setting and reading * the recipient of primary sales, and lets the inheriting contract perform conditional logic that uses information about * primary sales, if desired. */ abstract contract PrimarySale is IPrimarySale { /// @dev The address that receives all primary sales value. address private recipient; /// @dev Returns primary sale recipient address. function primarySaleRecipient() public view override returns (address) { return recipient; } /** * @notice Updates primary sale recipient. * @dev Caller should be authorized to set primary sales info. * See {_canSetPrimarySaleRecipient}. * Emits {PrimarySaleRecipientUpdated Event}; See {_setupPrimarySaleRecipient}. * * @param _saleRecipient Address to be set as new recipient of primary sales. */ function setPrimarySaleRecipient(address _saleRecipient) external override { if (!_canSetPrimarySaleRecipient()) { revert("Not authorized"); } _setupPrimarySaleRecipient(_saleRecipient); } /// @dev Lets a contract admin set the recipient for all primary sales. function _setupPrimarySaleRecipient(address _saleRecipient) internal { recipient = _saleRecipient; emit PrimarySaleRecipientUpdated(_saleRecipient); } /// @dev Returns whether primary sale recipient can be set in the given execution context. function _canSetPrimarySaleRecipient() internal view virtual returns (bool); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import "./interface/IRoyalty.sol"; /** * @title Royalty * @notice Thirdweb's `Royalty` is a contract extension to be used with any base contract. It exposes functions for setting and reading * the recipient of royalty fee and the royalty fee basis points, and lets the inheriting contract perform conditional logic * that uses information about royalty fees, if desired. * * @dev The `Royalty` contract is ERC2981 compliant. */ abstract contract Royalty is IRoyalty { /// @dev The (default) address that receives all royalty value. address private royaltyRecipient; /// @dev The (default) % of a sale to take as royalty (in basis points). uint16 private royaltyBps; /// @dev Token ID => royalty recipient and bps for token mapping(uint256 => RoyaltyInfo) private royaltyInfoForToken; /** * @notice View royalty info for a given token and sale price. * @dev Returns royalty amount and recipient for `tokenId` and `salePrice`. * @param tokenId The tokenID of the NFT for which to query royalty info. * @param salePrice Sale price of the token. * * @return receiver Address of royalty recipient account. * @return royaltyAmount Royalty amount calculated at current royaltyBps value. */ function royaltyInfo(uint256 tokenId, uint256 salePrice) external view virtual override returns (address receiver, uint256 royaltyAmount) { (address recipient, uint256 bps) = getRoyaltyInfoForToken(tokenId); receiver = recipient; royaltyAmount = (salePrice * bps) / 10_000; } /** * @notice View royalty info for a given token. * @dev Returns royalty recipient and bps for `_tokenId`. * @param _tokenId The tokenID of the NFT for which to query royalty info. */ function getRoyaltyInfoForToken(uint256 _tokenId) public view override returns (address, uint16) { RoyaltyInfo memory royaltyForToken = royaltyInfoForToken[_tokenId]; return royaltyForToken.recipient == address(0) ? (royaltyRecipient, uint16(royaltyBps)) : (royaltyForToken.recipient, uint16(royaltyForToken.bps)); } /** * @notice Returns the defualt royalty recipient and BPS for this contract's NFTs. */ function getDefaultRoyaltyInfo() external view override returns (address, uint16) { return (royaltyRecipient, uint16(royaltyBps)); } /** * @notice Updates default royalty recipient and bps. * @dev Caller should be authorized to set royalty info. * See {_canSetRoyaltyInfo}. * Emits {DefaultRoyalty Event}; See {_setupDefaultRoyaltyInfo}. * * @param _royaltyRecipient Address to be set as default royalty recipient. * @param _royaltyBps Updated royalty bps. */ function setDefaultRoyaltyInfo(address _royaltyRecipient, uint256 _royaltyBps) external override { if (!_canSetRoyaltyInfo()) { revert("Not authorized"); } _setupDefaultRoyaltyInfo(_royaltyRecipient, _royaltyBps); } /// @dev Lets a contract admin update the default royalty recipient and bps. function _setupDefaultRoyaltyInfo(address _royaltyRecipient, uint256 _royaltyBps) internal { if (_royaltyBps > 10_000) { revert("Exceeds max bps"); } royaltyRecipient = _royaltyRecipient; royaltyBps = uint16(_royaltyBps); emit DefaultRoyalty(_royaltyRecipient, _royaltyBps); } /** * @notice Updates default royalty recipient and bps for a particular token. * @dev Sets royalty info for `_tokenId`. Caller should be authorized to set royalty info. * See {_canSetRoyaltyInfo}. * Emits {RoyaltyForToken Event}; See {_setupRoyaltyInfoForToken}. * * @param _recipient Address to be set as royalty recipient for given token Id. * @param _bps Updated royalty bps for the token Id. */ function setRoyaltyInfoForToken( uint256 _tokenId, address _recipient, uint256 _bps ) external override { if (!_canSetRoyaltyInfo()) { revert("Not authorized"); } _setupRoyaltyInfoForToken(_tokenId, _recipient, _bps); } /// @dev Lets a contract admin set the royalty recipient and bps for a particular token Id. function _setupRoyaltyInfoForToken( uint256 _tokenId, address _recipient, uint256 _bps ) internal { if (_bps > 10_000) { revert("Exceeds max bps"); } royaltyInfoForToken[_tokenId] = RoyaltyInfo({ recipient: _recipient, bps: _bps }); emit RoyaltyForToken(_tokenId, _recipient, _bps); } /// @dev Returns whether royalty info can be set in the given execution context. function _canSetRoyaltyInfo() internal view virtual returns (bool); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; /** * The interface `IClaimCondition` is written for thirdweb's 'Drop' contracts, which are distribution mechanisms for tokens. * * A claim condition defines criteria under which accounts can mint tokens. Claim conditions can be overwritten * or added to by the contract admin. At any moment, there is only one active claim condition. */ interface IClaimCondition { /** * @notice The criteria that make up a claim condition. * * @param startTimestamp The unix timestamp after which the claim condition applies. * The same claim condition applies until the `startTimestamp` * of the next claim condition. * * @param maxClaimableSupply The maximum total number of tokens that can be claimed under * the claim condition. * * @param supplyClaimed At any given point, the number of tokens that have been claimed * under the claim condition. * * @param quantityLimitPerWallet The maximum number of tokens that can be claimed by a wallet. * * @param merkleRoot The allowlist of addresses that can claim tokens under the claim * condition. * * @param pricePerToken The price required to pay per token claimed. * * @param currency The currency in which the `pricePerToken` must be paid. * * @param metadata Claim condition metadata. */ struct ClaimCondition { uint256 startTimestamp; uint256 maxClaimableSupply; uint256 supplyClaimed; uint256 quantityLimitPerWallet; bytes32 merkleRoot; uint256 pricePerToken; address currency; string metadata; } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; interface IClaimableERC721 { /// @dev Emitted when tokens are claimed event TokensClaimed( address indexed claimer, address indexed receiver, uint256 indexed startTokenId, uint256 quantityClaimed ); /** * @notice Lets an address claim multiple lazy minted NFTs at once to a recipient. * Contract creators should override this function to create custom logic for claiming, * for e.g. price collection, allowlist, max quantity, etc. * * @dev The logic in the `verifyClaim` function determines whether the caller is authorized to mint NFTs. * * @param _receiver The recipient of the NFT to mint. * @param _quantity The number of NFTs to mint. */ function claim(address _receiver, uint256 _quantity) external payable; /** * @notice Override this function to add logic for claim verification, based on conditions * such as allowlist, price, max quantity etc. * * @dev Checks a request to claim NFTs against a custom condition. * * @param _claimer Caller of the claim function. * @param _quantity The number of NFTs being claimed. */ function verifyClaim(address _claimer, uint256 _quantity) external view; }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; /** * Thirdweb's `ContractMetadata` is a contract extension for any base contracts. It lets you set a metadata URI * for you contract. * * Additionally, `ContractMetadata` is necessary for NFT contracts that want royalties to get distributed on OpenSea. */ interface IContractMetadata { /// @dev Returns the metadata URI of the contract. function contractURI() external view returns (string memory); /** * @dev Sets contract URI for the storefront-level metadata of the contract. * Only module admin can call this function. */ function setContractURI(string calldata _uri) external; /// @dev Emitted when the contract URI is updated. event ContractURIUpdated(string prevURI, string newURI); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; /** * Thirdweb's `DelayedReveal` is a contract extension for base NFT contracts. It lets you create batches of * 'delayed-reveal' NFTs. You can learn more about the usage of delayed reveal NFTs here - https://blog.thirdweb.com/delayed-reveal-nfts */ interface IDelayedReveal { /// @dev Emitted when tokens are revealed. event TokenURIRevealed(uint256 indexed index, string revealedURI); /** * @notice Reveals a batch of delayed reveal NFTs. * * @param identifier The ID for the batch of delayed-reveal NFTs to reveal. * * @param key The key with which the base URI for the relevant batch of NFTs was encrypted. */ function reveal(uint256 identifier, bytes calldata key) external returns (string memory revealedURI); /** * @notice Performs XOR encryption/decryption. * * @param data The data to encrypt. In the case of delayed-reveal NFTs, this is the "revealed" state * base URI of the relevant batch of NFTs. * * @param key The key with which to encrypt data */ function encryptDecrypt(bytes memory data, bytes calldata key) external pure returns (bytes memory result); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import "./IClaimCondition.sol"; /** * The interface `IDropSinglePhase1155` is written for thirdweb's 'DropSinglePhase' contracts, which are distribution mechanisms for tokens. * * An authorized wallet can set a claim condition for the distribution of the contract's tokens. * A claim condition defines criteria under which accounts can mint tokens. Claim conditions can be overwritten * or added to by the contract admin. At any moment, there is only one active claim condition. */ interface IDropSinglePhase1155 is IClaimCondition { /** * @param proof Prood of concerned wallet's inclusion in an allowlist. * @param quantityLimitPerWallet The total quantity of tokens the allowlisted wallet is eligible to claim over time. * @param pricePerToken The price per token the allowlisted wallet must pay to claim tokens. * @param currency The currency in which the allowlisted wallet must pay the price for claiming tokens. */ struct AllowlistProof { bytes32[] proof; uint256 quantityLimitPerWallet; uint256 pricePerToken; address currency; } /// @notice Emitted when tokens are claimed via `claim`. event TokensClaimed( address indexed claimer, address indexed receiver, uint256 indexed tokenId, uint256 quantityClaimed ); /// @notice Emitted when the contract's claim conditions are updated. event ClaimConditionUpdated(uint256 indexed tokenId, ClaimCondition condition, bool resetEligibility); /** * @notice Lets an account claim a given quantity of NFTs. * * @param receiver The receiver of the NFT to claim. * @param tokenId The tokenId of the NFT to claim. * @param quantity The quantity of the NFT to claim. * @param currency The currency in which to pay for the claim. * @param pricePerToken The price per token to pay for the claim. * @param allowlistProof The proof of the claimer's inclusion in the merkle root allowlist * of the claim conditions that apply. * @param data Arbitrary bytes data that can be leveraged in the implementation of this interface. */ function claim( address receiver, uint256 tokenId, uint256 quantity, address currency, uint256 pricePerToken, AllowlistProof calldata allowlistProof, bytes memory data ) external payable; /** * @notice Lets a contract admin (account with `DEFAULT_ADMIN_ROLE`) set claim conditions. * * @param phase Claim condition to set. * * @param resetClaimEligibility Whether to honor the restrictions applied to wallets who have claimed tokens in the current conditions, * in the new claim conditions being set. * * @param tokenId The tokenId for which to set the relevant claim condition. */ function setClaimConditions( uint256 tokenId, ClaimCondition calldata phase, bool resetClaimEligibility ) external; }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; /** * Thirdweb's `LazyMint` is a contract extension for any base NFT contract. It lets you 'lazy mint' any number of NFTs * at once. Here, 'lazy mint' means defining the metadata for particular tokenIds of your NFT contract, without actually * minting a non-zero balance of NFTs of those tokenIds. */ interface ILazyMint { /// @dev Emitted when tokens are lazy minted. event TokensLazyMinted(uint256 indexed startTokenId, uint256 endTokenId, string baseURI, bytes encryptedBaseURI); /** * @notice Lazy mints a given amount of NFTs. * * @param amount The number of NFTs to lazy mint. * * @param baseURIForTokens The base URI for the 'n' number of NFTs being lazy minted, where the metadata for each * of those NFTs is `${baseURIForTokens}/${tokenId}`. * * @param extraData Additional bytes data to be used at the discretion of the consumer of the contract. * * @return batchId A unique integer identifier for the batch of NFTs lazy minted together. */ function lazyMint( uint256 amount, string calldata baseURIForTokens, bytes calldata extraData ) external returns (uint256 batchId); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Multicall.sol) pragma solidity ^0.8.0; /** * @dev Provides a function to batch together multiple calls in a single external call. * * _Available since v4.1._ */ interface IMulticall { /** * @dev Receives and executes a batch of function calls on this contract. */ function multicall(bytes[] calldata data) external returns (bytes[] memory results); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; /** * Thirdweb's `Ownable` is a contract extension to be used with any base contract. It exposes functions for setting and reading * who the 'owner' of the inheriting smart contract is, and lets the inheriting contract perform conditional logic that uses * information about who the contract's owner is. */ interface IOwnable { /// @dev Returns the owner of the contract. function owner() external view returns (address); /// @dev Lets a module admin set a new owner for the contract. The new owner must be a module admin. function setOwner(address _newOwner) external; /// @dev Emitted when a new Owner is set. event OwnerUpdated(address indexed prevOwner, address indexed newOwner); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; /** * Thirdweb's `Primary` is a contract extension to be used with any base contract. It exposes functions for setting and reading * the recipient of primary sales, and lets the inheriting contract perform conditional logic that uses information about * primary sales, if desired. */ interface IPrimarySale { /// @dev The adress that receives all primary sales value. function primarySaleRecipient() external view returns (address); /// @dev Lets a module admin set the default recipient of all primary sales. function setPrimarySaleRecipient(address _saleRecipient) external; /// @dev Emitted when a new sale recipient is set. event PrimarySaleRecipientUpdated(address indexed recipient); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import "../../eip/interface/IERC2981.sol"; /** * Thirdweb's `Royalty` is a contract extension to be used with any base contract. It exposes functions for setting and reading * the recipient of royalty fee and the royalty fee basis points, and lets the inheriting contract perform conditional logic * that uses information about royalty fees, if desired. * * The `Royalty` contract is ERC2981 compliant. */ interface IRoyalty is IERC2981 { struct RoyaltyInfo { address recipient; uint256 bps; } /// @dev Returns the royalty recipient and fee bps. function getDefaultRoyaltyInfo() external view returns (address, uint16); /// @dev Lets a module admin update the royalty bps and recipient. function setDefaultRoyaltyInfo(address _royaltyRecipient, uint256 _royaltyBps) external; /// @dev Lets a module admin set the royalty recipient for a particular token Id. function setRoyaltyInfoForToken( uint256 tokenId, address recipient, uint256 bps ) external; /// @dev Returns the royalty recipient for a particular token Id. function getRoyaltyInfoForToken(uint256 tokenId) external view returns (address, uint16); /// @dev Emitted when royalty info is updated. event DefaultRoyalty(address indexed newRoyaltyRecipient, uint256 newRoyaltyBps); /// @dev Emitted when royalty recipient for tokenId is set event RoyaltyForToken(uint256 indexed tokenId, address indexed royaltyRecipient, uint256 royaltyBps); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; interface IWETH { function deposit() external payable; function withdraw(uint256 amount) external; function transfer(address to, uint256 value) external returns (bool); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; // Helper interfaces import { IWETH } from "../interfaces/IWETH.sol"; import "../openzeppelin-presets/token/ERC20/utils/SafeERC20.sol"; library CurrencyTransferLib { using SafeERC20 for IERC20; /// @dev The address interpreted as native token of the chain. address public constant NATIVE_TOKEN = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; /// @dev Transfers a given amount of currency. function transferCurrency( address _currency, address _from, address _to, uint256 _amount ) internal { if (_amount == 0) { return; } if (_currency == NATIVE_TOKEN) { safeTransferNativeToken(_to, _amount); } else { safeTransferERC20(_currency, _from, _to, _amount); } } /// @dev Transfers a given amount of currency. (With native token wrapping) function transferCurrencyWithWrapper( address _currency, address _from, address _to, uint256 _amount, address _nativeTokenWrapper ) internal { if (_amount == 0) { return; } if (_currency == NATIVE_TOKEN) { if (_from == address(this)) { // withdraw from weth then transfer withdrawn native token to recipient IWETH(_nativeTokenWrapper).withdraw(_amount); safeTransferNativeTokenWithWrapper(_to, _amount, _nativeTokenWrapper); } else if (_to == address(this)) { // store native currency in weth require(_amount == msg.value, "msg.value != amount"); IWETH(_nativeTokenWrapper).deposit{ value: _amount }(); } else { safeTransferNativeTokenWithWrapper(_to, _amount, _nativeTokenWrapper); } } else { safeTransferERC20(_currency, _from, _to, _amount); } } /// @dev Transfer `amount` of ERC20 token from `from` to `to`. function safeTransferERC20( address _currency, address _from, address _to, uint256 _amount ) internal { if (_from == _to) { return; } if (_from == address(this)) { IERC20(_currency).safeTransfer(_to, _amount); } else { IERC20(_currency).safeTransferFrom(_from, _to, _amount); } } /// @dev Transfers `amount` of native token to `to`. function safeTransferNativeToken(address to, uint256 value) internal { // solhint-disable avoid-low-level-calls // slither-disable-next-line low-level-calls (bool success, ) = to.call{ value: value }(""); require(success, "native token transfer failed"); } /// @dev Transfers `amount` of native token to `to`. (With native token wrapping) function safeTransferNativeTokenWithWrapper( address to, uint256 value, address _nativeTokenWrapper ) internal { // solhint-disable avoid-low-level-calls // slither-disable-next-line low-level-calls (bool success, ) = to.call{ value: value }(""); if (!success) { IWETH(_nativeTokenWrapper).deposit{ value: value }(); IERC20(_nativeTokenWrapper).safeTransfer(to, value); } } }
// SPDX-License-Identifier: MIT // Modified from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.3.0/contracts/utils/cryptography/MerkleProof.sol // Copied from https://github.com/ensdomains/governance/blob/master/contracts/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. * * Source: https://github.com/ensdomains/governance/blob/master/contracts/MerkleProof.sol */ 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, uint256) { bytes32 computedHash = leaf; uint256 index = 0; for (uint256 i = 0; i < proof.length; i++) { index *= 2; bytes32 proofElement = proof[i]; if (computedHash <= proofElement) { // Hash(current computed hash + current element of the proof) computedHash = keccak256(abi.encodePacked(computedHash, proofElement)); } else { // Hash(current element of the proof + current computed hash) computedHash = keccak256(abi.encodePacked(proofElement, computedHash)); index += 1; } } // Check if the computed hash (root) is equal to the provided root return (computedHash == root, index); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library TWAddress { /** * @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. * * [EIP1884](https://eips.ethereum.org/EIPS/eip-1884) 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 v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library TWStrings { 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 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; abstract contract ReentrancyGuard { 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. */ 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 (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../../../../eip/interface/IERC20.sol"; import "../../../../lib/TWAddress.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using TWAddress for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (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; } }
{ "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "london", "remappings": [], "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"address","name":"_obycAddress","type":"address"},{"internalType":"address","name":"_obyclabsAddress","type":"address"}],"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":"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":"prevOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerUpdated","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":[{"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":"baseURIL1","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURIL2","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURIL3","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_obycTokenId","type":"uint256"}],"name":"getStatusOfObycToken","outputs":[{"internalType":"uint256[2]","name":"","type":"uint256[2]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_obycTokenId","type":"uint256"}],"name":"isAlreadyMintedMvML1","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"isL1","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"isL2","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"isL3","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_obycTokenId","type":"uint256"},{"internalType":"uint256","name":"_obycLabTokenId","type":"uint256"},{"internalType":"uint256","name":"_mvmTokenId","type":"uint256"},{"internalType":"uint256","name":"_mvmL2TokenId","type":"uint256"},{"internalType":"uint256","name":"_level","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"mvmL1Tokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mvmL1TokensCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"mvmL2Tokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mvmL2TokensCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"mvmL3Tokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mvmL3TokensCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"notRevealedUri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"obyc","outputs":[{"internalType":"contract ERC721A","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"obyclabs","outputs":[{"internalType":"contract ERC1155Drop","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pauseMintL1","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pauseMintL2","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pauseMintL3","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_newBaseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_newBaseURILevelThree","type":"string"}],"name":"setBaseURILevelThree","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_newBaseURILevelTwo","type":"string"}],"name":"setBaseURILevelTwo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"setOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_pauseMintL1","type":"bool"}],"name":"setPauseMintL1","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_pauseMintL2","type":"bool"}],"name":"setPauseMintL2","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_pauseMintL3","type":"bool"}],"name":"setPauseMintL3","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":"","type":"uint256"}],"name":"tokenIdStatus","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"transformInfoLevelOneByTokenId","outputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"obycTokenId","type":"uint256"},{"internalType":"uint256","name":"obycLabsTokenId","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"transformInfoLevelThreeByTokenId","outputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"mvmLevelOneTokenId","type":"uint256"},{"internalType":"uint256","name":"mvmLevelTwoTokenId","type":"uint256"},{"internalType":"uint256","name":"obycTokenId","type":"uint256"},{"internalType":"uint256","name":"obycLabsTokenId","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"transformInfoLevelTwoByTokenId","outputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"mvmLevelOneTokenId","type":"uint256"},{"internalType":"uint256","name":"obycTokenId","type":"uint256"},{"internalType":"uint256","name":"obycLabsTokenId","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_obycTokenId","type":"uint256"},{"internalType":"uint256","name":"_obycLabTokenId","type":"uint256"},{"internalType":"uint256","name":"_mvmL1TokenId","type":"uint256"},{"internalType":"uint256","name":"_mvmL2TokenId","type":"uint256"},{"internalType":"uint256","name":"_level","type":"uint256"}],"name":"verifyClaim","outputs":[],"stateMutability":"payable","type":"function"}]
Contract Creation Code
600060c081905260e060408190526200001c91600991906200017e565b506000600e819055600f81905560108190556040805160208101918290528290526200004c91601191906200017e565b506040805160208101918290526000908190526200006d916012916200017e565b506040805160208101918290526000908190526200008e916013916200017e565b506014805462ffffff191662010100179055348015620000ad57600080fd5b506040516200358a3803806200358a833981016040819052620000d0916200030e565b835184908490620000e99060029060208501906200017e565b508051620000ff9060039060208401906200017e565b5050600080555062000111336200012c565b6001600160a01b039182166080521660a05250620003da9050565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d7690600090a35050565b8280546200018c906200039d565b90600052602060002090601f016020900481019282620001b05760008555620001fb565b82601f10620001cb57805160ff1916838001178555620001fb565b82800160010185558215620001fb579182015b82811115620001fb578251825591602001919060010190620001de565b50620002099291506200020d565b5090565b5b808211156200020957600081556001016200020e565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200024c57600080fd5b81516001600160401b038082111562000269576200026962000224565b604051601f8301601f19908116603f0116810190828211818310171562000294576200029462000224565b81604052838152602092508683858801011115620002b157600080fd5b600091505b83821015620002d55785820183015181830184015290820190620002b6565b83821115620002e75760008385830101525b9695505050505050565b80516001600160a01b03811681146200030957600080fd5b919050565b600080600080608085870312156200032557600080fd5b84516001600160401b03808211156200033d57600080fd5b6200034b888389016200023a565b955060208701519150808211156200036257600080fd5b5062000371878288016200023a565b9350506200038260408601620002f1565b91506200039260608601620002f1565b905092959194509250565b600181811c90821680620003b257607f821691505b60208210811415620003d457634e487b7160e01b600052602260045260246000fd5b50919050565b60805160a0516131606200042a600039600081816104e50152818161122c0152818161155e015281816118d00152611c8201526000818161065601528181610f8b015261114d01526131606000f3fe6080604052600436106102935760003560e01c80636352211e1161015a578063b88d4fde116100c1578063d43f85451161007a578063d43f8545146108db578063e45d65a0146108fb578063e8fb7f7b1461091b578063e985e9c514610948578063f60e2e2d14610968578063f7f4bdd81461097d57600080fd5b8063b88d4fde14610830578063c36b1d5b14610850578063c4ee8be114610870578063c87b56dd14610885578063cb6c72c8146108a5578063d0010778146108bb57600080fd5b806395d89b411161011357806395d89b411461073c578063a1281bbd14610751578063a22cb46514610767578063ae3dfa2814610787578063b2ba6dad1461079a578063b6cee12e1461081057600080fd5b80636352211e1461060457806370a08231146106245780637386bb2d146106445780637dc468d8146106785780638da5cb5b146106985780639181a8f7146106b657600080fd5b8063219af85e116101fe57806338f17147116101b757806338f171471461055a5780633b6070c41461056f57806342842e0e146105855780634427b3bd146105a557806355f804b3146105c457806358e74a92146105e457600080fd5b8063219af85e1461049357806323b872dd146104b357806326f94723146104d35780632e4f0a95146105075780633616ac601461052757806337f141c81461054757600080fd5b80630ba4db65116102505780630ba4db651461037857806313af40351461039857806315fd8538146103b857806318160ddd1461042357806319ec21d4146104465780631aba0dc21461046657600080fd5b806301ffc9a71461029857806306fdde03146102cd578063081812fc146102ef578063081c8c441461032757806308c24f221461033c578063095ea7b314610356575b600080fd5b3480156102a457600080fd5b506102b86102b33660046129b1565b61099d565b60405190151581526020015b60405180910390f35b3480156102d957600080fd5b506102e26109ef565b6040516102c49190612a26565b3480156102fb57600080fd5b5061030f61030a366004612a39565b610a81565b6040516001600160a01b0390911681526020016102c4565b34801561033357600080fd5b506102e2610ac5565b34801561034857600080fd5b506014546102b89060ff1681565b34801561036257600080fd5b50610376610371366004612a67565b610b53565b005b34801561038457600080fd5b506102b8610393366004612a39565b610bda565b3480156103a457600080fd5b506103766103b3366004612a93565b610c47565b3480156103c457600080fd5b506103fe6103d3366004612a39565b6015602052600090815260409020805460018201546002909201546001600160a01b03909116919083565b604080516001600160a01b0390941684526020840192909252908201526060016102c4565b34801561042f57600080fd5b50600154600054035b6040519081526020016102c4565b34801561045257600080fd5b50610376610461366004612b3c565b610c80565b34801561047257600080fd5b50610486610481366004612a39565b610cc1565b6040516102c49190612b85565b34801561049f57600080fd5b506104386104ae366004612a39565b610ead565b3480156104bf57600080fd5b506103766104ce366004612bb6565b610ece565b3480156104df57600080fd5b5061030f7f000000000000000000000000000000000000000000000000000000000000000081565b34801561051357600080fd5b50610376610522366004612c07565b610ed9565b34801561053357600080fd5b506014546102b89062010000900460ff1681565b610376610555366004612c22565b610f16565b34801561056657600080fd5b506102e2611a5d565b34801561057b57600080fd5b50610438600f5481565b34801561059157600080fd5b506103766105a0366004612bb6565b611a6a565b3480156105b157600080fd5b506014546102b890610100900460ff1681565b3480156105d057600080fd5b506103766105df366004612b3c565b611a85565b3480156105f057600080fd5b506103766105ff366004612b3c565b611ac2565b34801561061057600080fd5b5061030f61061f366004612a39565b611aff565b34801561063057600080fd5b5061043861063f366004612a93565b611b11565b34801561065057600080fd5b5061030f7f000000000000000000000000000000000000000000000000000000000000000081565b34801561068457600080fd5b506102b8610693366004612a39565b611b60565b3480156106a457600080fd5b506008546001600160a01b031661030f565b3480156106c257600080fd5b5061070a6106d1366004612a39565b601760205260009081526040902080546001820154600283015460038401546004909401546001600160a01b0390931693919290919085565b604080516001600160a01b0390961686526020860194909452928401919091526060830152608082015260a0016102c4565b34801561074857600080fd5b506102e2611bae565b34801561075d57600080fd5b5061043860105481565b34801561077357600080fd5b50610376610782366004612c5d565b611bbd565b610376610795366004612c22565b611c53565b3480156107a657600080fd5b506107e66107b5366004612a39565b60166020526000908152604090208054600182015460028301546003909301546001600160a01b0390921692909184565b604080516001600160a01b03909516855260208501939093529183015260608201526080016102c4565b34801561081c57600080fd5b5061043861082b366004612a39565b611d0e565b34801561083c57600080fd5b5061037661084b366004612c92565b611d1e565b34801561085c57600080fd5b506102b861086b366004612a39565b611d68565b34801561087c57600080fd5b506102e2611db6565b34801561089157600080fd5b506102e26108a0366004612a39565b611dc3565b3480156108b157600080fd5b50610438600e5481565b3480156108c757600080fd5b506104386108d6366004612a39565b611e9d565b3480156108e757600080fd5b506103766108f6366004612c07565b611ead565b34801561090757600080fd5b506102b8610916366004612a39565b611ef1565b34801561092757600080fd5b50610438610936366004612a39565b60186020526000908152604090205481565b34801561095457600080fd5b506102b8610963366004612d12565b611f3f565b34801561097457600080fd5b506102e2611f6d565b34801561098957600080fd5b50610376610998366004612c07565b611f7a565b60006001600160e01b031982166380ac58cd60e01b14806109ce57506001600160e01b03198216635b5e139f60e01b145b806109e957506301ffc9a760e01b6001600160e01b03198316145b92915050565b6060600280546109fe90612d4b565b80601f0160208091040260200160405190810160405280929190818152602001828054610a2a90612d4b565b8015610a775780601f10610a4c57610100808354040283529160200191610a77565b820191906000526020600020905b815481529060010190602001808311610a5a57829003601f168201915b5050505050905090565b6000610a8c82611fc0565b610aa9576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b600a8054610ad290612d4b565b80601f0160208091040260200160405190810160405280929190818152602001828054610afe90612d4b565b8015610b4b5780601f10610b2057610100808354040283529160200191610b4b565b820191906000526020600020905b815481529060010190602001808311610b2e57829003601f168201915b505050505081565b6000610b5e82611aff565b9050806001600160a01b0316836001600160a01b03161415610b935760405163250fdee360e21b815260040160405180910390fd5b336001600160a01b03821614610bca57610bad8133611f3f565b610bca576040516367d9dca160e11b815260040160405180910390fd5b610bd5838383611feb565b505050565b6000805b600b54811015610c3e578260156000600b8481548110610c0057610c00612d86565b90600052602060002001548152602001908152602001600020600101541415610c2c5750600192915050565b80610c3681612db2565b915050610bde565b50600092915050565b610c4f612047565b610c745760405162461bcd60e51b8152600401610c6b90612dcd565b60405180910390fd5b610c7d81612074565b50565b6008546001600160a01b03163314610caa5760405162461bcd60e51b8152600401610c6b90612dcd565b8051610cbd9060139060208401906128e4565b5050565b610cc9612968565b600082815260186020526040902054620186a16001821415610d665760005b600b54811015610d60578460156000600b8481548110610d0a57610d0a612d86565b90600052602060002001548152602001908152602001600020600101541415610d4e57600b8181548110610d4057610d40612d86565b906000526020600020015491505b80610d5881612db2565b915050610ce8565b50610e70565b8160021415610dea5760005b600c54811015610d60578460166000600c8481548110610d9457610d94612d86565b90600052602060002001548152602001908152602001600020600201541415610dd857600c8181548110610dca57610dca612d86565b906000526020600020015491505b80610de281612db2565b915050610d72565b8160031415610e705760005b600d54811015610e6e578460176000600d8481548110610e1857610e18612d86565b90600052602060002001548152602001908152602001600020600301541415610e5c57600d8181548110610e4e57610e4e612d86565b906000526020600020015491505b80610e6681612db2565b915050610df6565b505b610e7981611fc0565b610e955760405162461bcd60e51b8152600401610c6b90612df5565b60408051808201909152918252602082015292915050565b600d8181548110610ebd57600080fd5b600091825260209091200154905081565b610bd58383836120c6565b6008546001600160a01b03163314610f035760405162461bcd60e51b8152600401610c6b90612dcd565b6014805460ff1916911515919091179055565b80600114156113b95760145460ff1615610f725760405162461bcd60e51b815260206004820152601860248201527f4d696e74696e6720666f72204c312069732050617573656400000000000000006044820152606401610c6b565b6040516331a9108f60e11b8152600481018690526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa158015610fda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ffe9190612e44565b9050336001600160a01b03821681146110595760405162461bcd60e51b815260206004820152601960248201527f596f7520446f6e74204f776e20746865204f425943204e4654000000000000006044820152606401610c6b565b61106287610bda565b156110c45760405162461bcd60e51b815260206004820152602c60248201527f596f75204861766520416c7265616479205472616e73666f726d65642074686960448201526b399027a12ca1902a37b5b2b760a11b6064820152608401610c6b565b8515806110d15750856001145b6111355760405162461bcd60e51b815260206004820152602f60248201527f57726f6e67204c616220546f6b656e20496420666f72204c6576656c204f6e6560448201526e102a3930b739b337b936b0ba34b7b760891b6064820152608401610c6b565b6040516370a0823160e01b81523360048201526001907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa15801561119c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111c09190612e61565b101561120e5760405162461bcd60e51b815260206004820152601e60248201527f596f7520646f6e2774206f776e20656e6f756768204f425943204e46547300006044820152606401610c6b565b604051627eeac760e11b8152336004820152602481018790526001907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169062fdd58e90604401602060405180830381865afa15801561127a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061129e9190612e61565b10156112fd5760405162461bcd60e51b815260206004820152602860248201527f596f7520646f6e2774206f776e20656e6f756768204c6576656c204f6e65204c6044820152676162204974656d7360c01b6064820152608401610c6b565b6040805160608101825233815260208082018a81528284018a81526000805481526015909352938220835181546001600160a01b0319166001600160a01b03909116178155905160018083019190915593516002909101558054600b8054948501815582527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db990930192909255600e8054919261139983612db2565b90915550505060008781526018602052604090206001905550611a569050565b806002141561173557601454610100900460ff161561141a5760405162461bcd60e51b815260206004820152601860248201527f4d696e74696e6720666f72204c322069732050617573656400000000000000006044820152606401610c6b565b600061142584611aff565b9050336001600160a01b03821681146114805760405162461bcd60e51b815260206004820152601860248201527f596f7520446f6e74204f776e20746865204d764d204e465400000000000000006044820152606401610c6b565b611489856122b3565b156114a65760405162461bcd60e51b8152600401610c6b90612e7a565b85600214806114b55750856003145b6115175760405162461bcd60e51b815260206004820152602d60248201527f57726f6e67204c616220546f6b656e20496420666f72204c6576656c2032205460448201526c3930b739b337b936b0ba34b7b760991b6064820152608401610c6b565b600161152233611b11565b10156115405760405162461bcd60e51b8152600401610c6b90612ebf565b604051627eeac760e11b8152336004820152602481018790526001907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169062fdd58e90604401602060405180830381865afa1580156115ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115d09190612e61565b10156115ee5760405162461bcd60e51b8152600401610c6b90612f07565b6115f88686612317565b6116505760405162461bcd60e51b815260206004820152602360248201527f596f752053656c6563746564207468652057726f6e67204c616220546f6b656e60448201526208125160ea1b6064820152608401610c6b565b604080516080810182523381526020808201888152600089815260158352848120600190810154858701908152606086018d8152835484526016909552958220855181546001600160a01b0319166001600160a01b039091161781559251838201559451600283015591516003909101558054600c8054948501815582527fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c790930192909255600f8054919261170583612db2565b9091555050506000858152601560209081526040808320600101548352601890915290206002905550611a569050565b8060031415611a565760145462010000900460ff16156117975760405162461bcd60e51b815260206004820152601860248201527f4d696e74696e6720666f72204c332069732050617573656400000000000000006044820152606401610c6b565b60006117a283611aff565b9050336001600160a01b03821681146117fd5760405162461bcd60e51b815260206004820152601b60248201527f596f7520446f6e74204f776e20746865204d764d204c32204e465400000000006044820152606401610c6b565b61180684612371565b156118235760405162461bcd60e51b8152600401610c6b90612e7a565b856004146118895760405162461bcd60e51b815260206004820152602d60248201527f57726f6e67204c616220546f6b656e20496420666f72204c6576656c2033205460448201526c3930b739b337b936b0ba34b7b760991b6064820152608401610c6b565b600161189433611b11565b10156118b25760405162461bcd60e51b8152600401610c6b90612ebf565b604051627eeac760e11b8152336004820152602481018790526001907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169062fdd58e90604401602060405180830381865afa15801561191e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119429190612e61565b10156119605760405162461bcd60e51b8152600401610c6b90612f07565b6040805160a0810182523381526000868152601660209081528382206001808201548386019081528587018b815260029384015460608801908152608088018f8152875488526017909652978620875181546001600160a01b0319166001600160a01b0390911617815591518284015551928101929092559451600382015590516004909101558054600d8054948501815582527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb590930192909255601080549192611a2b83612db2565b9091555050506000848152601660209081526040808320600201548352601890915290206003905550505b5050505050565b60138054610ad290612d4b565b610bd583838360405180602001604052806000815250611d1e565b6008546001600160a01b03163314611aaf5760405162461bcd60e51b8152600401610c6b90612dcd565b8051610cbd9060119060208401906128e4565b6008546001600160a01b03163314611aec5760405162461bcd60e51b8152600401610c6b90612dcd565b8051610cbd9060129060208401906128e4565b6000611b0a826123d5565b5192915050565b60006001600160a01b038216611b3a576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b031660009081526005602052604090205467ffffffffffffffff1690565b6000805b600c54811015610c3e5782600c8281548110611b8257611b82612d86565b90600052602060002001541415611b9c5750600192915050565b80611ba681612db2565b915050611b64565b6060600380546109fe90612d4b565b6001600160a01b038216331415611be75760405163b06307db60e01b815260040160405180910390fd5b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b611c608585858585610f16565b611c6b3360016124f1565b604051637921219560e11b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063f242432a90611cd590339073dead00647e5af4d45760f9442025e41a357e6990908990600190600990600401612f4f565b600060405180830381600087803b158015611cef57600080fd5b505af1158015611d03573d6000803e3d6000fd5b505050505050505050565b600b8181548110610ebd57600080fd5b611d298484846120c6565b6001600160a01b0383163b15611d6257611d458484848461250b565b611d62576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b6000805b600d54811015610c3e5782600d8281548110611d8a57611d8a612d86565b90600052602060002001541415611da45750600192915050565b80611dae81612db2565b915050611d6c565b60128054610ad290612d4b565b6060611dce82611fc0565b611dea5760405162461bcd60e51b8152600401610c6b90612df5565b611df382611ef1565b15611e54576000611e026125f4565b90506000815111611e225760405180602001604052806000815250611e4d565b80611e2c84612603565b604051602001611e3d929190613024565b6040516020818303038152906040525b9392505050565b611e5d82611b60565b15611e6c576000611e02612701565b611e7582611b60565b15611e84576000611e02612710565b505060408051602081019091526000815290565b919050565b600c8181548110610ebd57600080fd5b6008546001600160a01b03163314611ed75760405162461bcd60e51b8152600401610c6b90612dcd565b601480549115156101000261ff0019909216919091179055565b6000805b600b54811015610c3e5782600b8281548110611f1357611f13612d86565b90600052602060002001541415611f2d5750600192915050565b80611f3781612db2565b915050611ef5565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b60118054610ad290612d4b565b6008546001600160a01b03163314611fa45760405162461bcd60e51b8152600401610c6b90612dcd565b60148054911515620100000262ff000019909216919091179055565b60008054821080156109e9575050600090815260046020526040902054600160e01b900460ff161590565b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b600061205b6008546001600160a01b031690565b6001600160a01b0316336001600160a01b031614905090565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d7690600090a35050565b60006120d1826123d5565b9050836001600160a01b031681600001516001600160a01b0316146121085760405162a1148160e81b815260040160405180910390fd5b6000336001600160a01b038616148061212657506121268533611f3f565b8061214157503361213684610a81565b6001600160a01b0316145b90508061216157604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b03841661218857604051633a954ecd60e21b815260040160405180910390fd5b61219460008487611feb565b6001600160a01b038581166000908152600560209081526040808320805467ffffffffffffffff1980821667ffffffffffffffff92831660001901831617909255898616808652838620805493841693831660019081018416949094179055898652600490945282852080546001600160e01b031916909417600160a01b4290921691909102178355870180845292208054919390911661226a57600054821461226a578054602086015167ffffffffffffffff16600160a01b026001600160e01b03199091166001600160a01b038a16171781555b50505082846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4611a56565b6000805b600c54811015610c3e578260166000600c84815481106122d9576122d9612d86565b906000526020600020015481526020019081526020016000206001015414156123055750600192915050565b8061230f81612db2565b9150506122b7565b6000818152601560205260408120600201541580156123365750826002145b15612343575060016109e9565b60008281526015602052604090206002015460011480156123645750826003145b15610c3e575060016109e9565b6000805b600d54811015610c3e578260176000600d848154811061239757612397612d86565b906000526020600020015481526020019081526020016000206002015414156123c35750600192915050565b806123cd81612db2565b915050612375565b6040805160608101825260008082526020820181905291810191909152816000548110156124d857600081815260046020908152604091829020825160608101845290546001600160a01b0381168252600160a01b810467ffffffffffffffff1692820192909252600160e01b90910460ff161515918101829052906124d65780516001600160a01b03161561246c579392505050565b5060001901600081815260046020908152604091829020825160608101845290546001600160a01b038116808352600160a01b820467ffffffffffffffff1693830193909352600160e01b900460ff16151592810192909252156124d1579392505050565b61246c565b505b604051636f96cda160e11b815260040160405180910390fd5b610cbd82826040518060200160405280600081525061271f565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290612540903390899088908890600401613063565b6020604051808303816000875af192505050801561257b575060408051601f3d908101601f19168201909252612578918101906130a0565b60015b6125d6573d8080156125a9576040519150601f19603f3d011682016040523d82523d6000602084013e6125ae565b606091505b5080516125ce576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b6060601180546109fe90612d4b565b6060816126275750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612651578061263b81612db2565b915061264a9050600a836130d3565b915061262b565b60008167ffffffffffffffff81111561266c5761266c612ab0565b6040519080825280601f01601f191660200182016040528015612696576020820181803683370190505b5090505b84156125ec576126ab6001836130e7565b91506126b8600a866130fe565b6126c3906030613112565b60f81b8183815181106126d8576126d8612d86565b60200101906001600160f81b031916908160001a9053506126fa600a866130d3565b945061269a565b6060601280546109fe90612d4b565b6060601380546109fe90612d4b565b6000546001600160a01b03841661274857604051622e076360e81b815260040160405180910390fd5b826127665760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b038416600081815260056020908152604080832080546fffffffffffffffffffffffffffffffff19811667ffffffffffffffff8083168b0181169182176801000000000000000067ffffffffffffffff1990941690921783900481168b01811690920217909155858452600490925290912080546001600160e01b0319168317600160a01b42909316929092029190911790558190818501903b1561288f575b60405182906001600160a01b038816906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4612858600087848060010195508761250b565b612875576040516368d2bf6b60e11b815260040160405180910390fd5b80821061280d57826000541461288a57600080fd5b6128d4565b5b6040516001830192906001600160a01b038816906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4808210612890575b506000908155611d629085838684565b8280546128f090612d4b565b90600052602060002090601f0160209004810192826129125760008555612958565b82601f1061292b57805160ff1916838001178555612958565b82800160010185558215612958579182015b8281111561295857825182559160200191906001019061293d565b50612964929150612986565b5090565b60405180604001604052806002906020820280368337509192915050565b5b808211156129645760008155600101612987565b6001600160e01b031981168114610c7d57600080fd5b6000602082840312156129c357600080fd5b8135611e4d8161299b565b60005b838110156129e95781810151838201526020016129d1565b83811115611d625750506000910152565b60008151808452612a128160208601602086016129ce565b601f01601f19169290920160200192915050565b602081526000611e4d60208301846129fa565b600060208284031215612a4b57600080fd5b5035919050565b6001600160a01b0381168114610c7d57600080fd5b60008060408385031215612a7a57600080fd5b8235612a8581612a52565b946020939093013593505050565b600060208284031215612aa557600080fd5b8135611e4d81612a52565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff80841115612ae157612ae1612ab0565b604051601f8501601f19908116603f01168101908282118183101715612b0957612b09612ab0565b81604052809350858152868686011115612b2257600080fd5b858560208301376000602087830101525050509392505050565b600060208284031215612b4e57600080fd5b813567ffffffffffffffff811115612b6557600080fd5b8201601f81018413612b7657600080fd5b6125ec84823560208401612ac6565b60408101818360005b6002811015612bad578151835260209283019290910190600101612b8e565b50505092915050565b600080600060608486031215612bcb57600080fd5b8335612bd681612a52565b92506020840135612be681612a52565b929592945050506040919091013590565b80358015158114611e9857600080fd5b600060208284031215612c1957600080fd5b611e4d82612bf7565b600080600080600060a08688031215612c3a57600080fd5b505083359560208501359550604085013594606081013594506080013592509050565b60008060408385031215612c7057600080fd5b8235612c7b81612a52565b9150612c8960208401612bf7565b90509250929050565b60008060008060808587031215612ca857600080fd5b8435612cb381612a52565b93506020850135612cc381612a52565b925060408501359150606085013567ffffffffffffffff811115612ce657600080fd5b8501601f81018713612cf757600080fd5b612d0687823560208401612ac6565b91505092959194509250565b60008060408385031215612d2557600080fd5b8235612d3081612a52565b91506020830135612d4081612a52565b809150509250929050565b600181811c90821680612d5f57607f821691505b60208210811415612d8057634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415612dc657612dc6612d9c565b5060010190565b6020808252600e908201526d139bdd08185d5d1a1bdc9a5e995960921b604082015260600190565b6020808252602f908201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60408201526e3732bc34b9ba32b73a103a37b5b2b760891b606082015260800190565b600060208284031215612e5657600080fd5b8151611e4d81612a52565b600060208284031215612e7357600080fd5b5051919050565b60208082526025908201527f596f75204861766520416c7265616479205472616e73666f726d65642074686960408201526473204d764d60d81b606082015260800190565b60208082526028908201527f596f7520646f6e2774206f776e20656e6f756768204f425943204c6576656c2060408201526754776f204e46547360c01b606082015260800190565b60208082526028908201527f596f7520646f6e2774206f776e20656e6f756768204c6576656c2054776f204c6040820152676162204974656d7360c01b606082015260800190565b6001600160a01b0386811682528516602080830191909152604082018590526060820184905260a0608083015282546000918291600181811c9082811680612f9857607f831692505b848310811415612fb657634e487b7160e01b86526022600452602486fd5b60a0880183905260c08801818015612fd55760018114612fe657613011565b60ff19861682528682019750613011565b60008b81526020902060005b8681101561300b57815484820152908501908801612ff2565b83019850505b50959d9c50505050505050505050505050565b600083516130368184602088016129ce565b83519083019061304a8183602088016129ce565b64173539b7b760d91b9101908152600501949350505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090613096908301846129fa565b9695505050505050565b6000602082840312156130b257600080fd5b8151611e4d8161299b565b634e487b7160e01b600052601260045260246000fd5b6000826130e2576130e26130bd565b500490565b6000828210156130f9576130f9612d9c565b500390565b60008261310d5761310d6130bd565b500690565b6000821982111561312557613125612d9c565b50019056fea2646970667358221220cf50c8616207f148d1d5f706566805b51115fc6fbc467338d298b3b123fac86064736f6c634300080b0033000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000004becbdf97747413a18c5a2a53321d09198d3a100000000000000000000000000f2aecee06841f0cc984ab8d7de5b1e9106890fdc00000000000000000000000000000000000000000000000000000000000000114d7574616e747356734d616368696e657300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034d764d0000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x6080604052600436106102935760003560e01c80636352211e1161015a578063b88d4fde116100c1578063d43f85451161007a578063d43f8545146108db578063e45d65a0146108fb578063e8fb7f7b1461091b578063e985e9c514610948578063f60e2e2d14610968578063f7f4bdd81461097d57600080fd5b8063b88d4fde14610830578063c36b1d5b14610850578063c4ee8be114610870578063c87b56dd14610885578063cb6c72c8146108a5578063d0010778146108bb57600080fd5b806395d89b411161011357806395d89b411461073c578063a1281bbd14610751578063a22cb46514610767578063ae3dfa2814610787578063b2ba6dad1461079a578063b6cee12e1461081057600080fd5b80636352211e1461060457806370a08231146106245780637386bb2d146106445780637dc468d8146106785780638da5cb5b146106985780639181a8f7146106b657600080fd5b8063219af85e116101fe57806338f17147116101b757806338f171471461055a5780633b6070c41461056f57806342842e0e146105855780634427b3bd146105a557806355f804b3146105c457806358e74a92146105e457600080fd5b8063219af85e1461049357806323b872dd146104b357806326f94723146104d35780632e4f0a95146105075780633616ac601461052757806337f141c81461054757600080fd5b80630ba4db65116102505780630ba4db651461037857806313af40351461039857806315fd8538146103b857806318160ddd1461042357806319ec21d4146104465780631aba0dc21461046657600080fd5b806301ffc9a71461029857806306fdde03146102cd578063081812fc146102ef578063081c8c441461032757806308c24f221461033c578063095ea7b314610356575b600080fd5b3480156102a457600080fd5b506102b86102b33660046129b1565b61099d565b60405190151581526020015b60405180910390f35b3480156102d957600080fd5b506102e26109ef565b6040516102c49190612a26565b3480156102fb57600080fd5b5061030f61030a366004612a39565b610a81565b6040516001600160a01b0390911681526020016102c4565b34801561033357600080fd5b506102e2610ac5565b34801561034857600080fd5b506014546102b89060ff1681565b34801561036257600080fd5b50610376610371366004612a67565b610b53565b005b34801561038457600080fd5b506102b8610393366004612a39565b610bda565b3480156103a457600080fd5b506103766103b3366004612a93565b610c47565b3480156103c457600080fd5b506103fe6103d3366004612a39565b6015602052600090815260409020805460018201546002909201546001600160a01b03909116919083565b604080516001600160a01b0390941684526020840192909252908201526060016102c4565b34801561042f57600080fd5b50600154600054035b6040519081526020016102c4565b34801561045257600080fd5b50610376610461366004612b3c565b610c80565b34801561047257600080fd5b50610486610481366004612a39565b610cc1565b6040516102c49190612b85565b34801561049f57600080fd5b506104386104ae366004612a39565b610ead565b3480156104bf57600080fd5b506103766104ce366004612bb6565b610ece565b3480156104df57600080fd5b5061030f7f000000000000000000000000f2aecee06841f0cc984ab8d7de5b1e9106890fdc81565b34801561051357600080fd5b50610376610522366004612c07565b610ed9565b34801561053357600080fd5b506014546102b89062010000900460ff1681565b610376610555366004612c22565b610f16565b34801561056657600080fd5b506102e2611a5d565b34801561057b57600080fd5b50610438600f5481565b34801561059157600080fd5b506103766105a0366004612bb6565b611a6a565b3480156105b157600080fd5b506014546102b890610100900460ff1681565b3480156105d057600080fd5b506103766105df366004612b3c565b611a85565b3480156105f057600080fd5b506103766105ff366004612b3c565b611ac2565b34801561061057600080fd5b5061030f61061f366004612a39565b611aff565b34801561063057600080fd5b5061043861063f366004612a93565b611b11565b34801561065057600080fd5b5061030f7f0000000000000000000000004becbdf97747413a18c5a2a53321d09198d3a10081565b34801561068457600080fd5b506102b8610693366004612a39565b611b60565b3480156106a457600080fd5b506008546001600160a01b031661030f565b3480156106c257600080fd5b5061070a6106d1366004612a39565b601760205260009081526040902080546001820154600283015460038401546004909401546001600160a01b0390931693919290919085565b604080516001600160a01b0390961686526020860194909452928401919091526060830152608082015260a0016102c4565b34801561074857600080fd5b506102e2611bae565b34801561075d57600080fd5b5061043860105481565b34801561077357600080fd5b50610376610782366004612c5d565b611bbd565b610376610795366004612c22565b611c53565b3480156107a657600080fd5b506107e66107b5366004612a39565b60166020526000908152604090208054600182015460028301546003909301546001600160a01b0390921692909184565b604080516001600160a01b03909516855260208501939093529183015260608201526080016102c4565b34801561081c57600080fd5b5061043861082b366004612a39565b611d0e565b34801561083c57600080fd5b5061037661084b366004612c92565b611d1e565b34801561085c57600080fd5b506102b861086b366004612a39565b611d68565b34801561087c57600080fd5b506102e2611db6565b34801561089157600080fd5b506102e26108a0366004612a39565b611dc3565b3480156108b157600080fd5b50610438600e5481565b3480156108c757600080fd5b506104386108d6366004612a39565b611e9d565b3480156108e757600080fd5b506103766108f6366004612c07565b611ead565b34801561090757600080fd5b506102b8610916366004612a39565b611ef1565b34801561092757600080fd5b50610438610936366004612a39565b60186020526000908152604090205481565b34801561095457600080fd5b506102b8610963366004612d12565b611f3f565b34801561097457600080fd5b506102e2611f6d565b34801561098957600080fd5b50610376610998366004612c07565b611f7a565b60006001600160e01b031982166380ac58cd60e01b14806109ce57506001600160e01b03198216635b5e139f60e01b145b806109e957506301ffc9a760e01b6001600160e01b03198316145b92915050565b6060600280546109fe90612d4b565b80601f0160208091040260200160405190810160405280929190818152602001828054610a2a90612d4b565b8015610a775780601f10610a4c57610100808354040283529160200191610a77565b820191906000526020600020905b815481529060010190602001808311610a5a57829003601f168201915b5050505050905090565b6000610a8c82611fc0565b610aa9576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b600a8054610ad290612d4b565b80601f0160208091040260200160405190810160405280929190818152602001828054610afe90612d4b565b8015610b4b5780601f10610b2057610100808354040283529160200191610b4b565b820191906000526020600020905b815481529060010190602001808311610b2e57829003601f168201915b505050505081565b6000610b5e82611aff565b9050806001600160a01b0316836001600160a01b03161415610b935760405163250fdee360e21b815260040160405180910390fd5b336001600160a01b03821614610bca57610bad8133611f3f565b610bca576040516367d9dca160e11b815260040160405180910390fd5b610bd5838383611feb565b505050565b6000805b600b54811015610c3e578260156000600b8481548110610c0057610c00612d86565b90600052602060002001548152602001908152602001600020600101541415610c2c5750600192915050565b80610c3681612db2565b915050610bde565b50600092915050565b610c4f612047565b610c745760405162461bcd60e51b8152600401610c6b90612dcd565b60405180910390fd5b610c7d81612074565b50565b6008546001600160a01b03163314610caa5760405162461bcd60e51b8152600401610c6b90612dcd565b8051610cbd9060139060208401906128e4565b5050565b610cc9612968565b600082815260186020526040902054620186a16001821415610d665760005b600b54811015610d60578460156000600b8481548110610d0a57610d0a612d86565b90600052602060002001548152602001908152602001600020600101541415610d4e57600b8181548110610d4057610d40612d86565b906000526020600020015491505b80610d5881612db2565b915050610ce8565b50610e70565b8160021415610dea5760005b600c54811015610d60578460166000600c8481548110610d9457610d94612d86565b90600052602060002001548152602001908152602001600020600201541415610dd857600c8181548110610dca57610dca612d86565b906000526020600020015491505b80610de281612db2565b915050610d72565b8160031415610e705760005b600d54811015610e6e578460176000600d8481548110610e1857610e18612d86565b90600052602060002001548152602001908152602001600020600301541415610e5c57600d8181548110610e4e57610e4e612d86565b906000526020600020015491505b80610e6681612db2565b915050610df6565b505b610e7981611fc0565b610e955760405162461bcd60e51b8152600401610c6b90612df5565b60408051808201909152918252602082015292915050565b600d8181548110610ebd57600080fd5b600091825260209091200154905081565b610bd58383836120c6565b6008546001600160a01b03163314610f035760405162461bcd60e51b8152600401610c6b90612dcd565b6014805460ff1916911515919091179055565b80600114156113b95760145460ff1615610f725760405162461bcd60e51b815260206004820152601860248201527f4d696e74696e6720666f72204c312069732050617573656400000000000000006044820152606401610c6b565b6040516331a9108f60e11b8152600481018690526000907f0000000000000000000000004becbdf97747413a18c5a2a53321d09198d3a1006001600160a01b031690636352211e90602401602060405180830381865afa158015610fda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ffe9190612e44565b9050336001600160a01b03821681146110595760405162461bcd60e51b815260206004820152601960248201527f596f7520446f6e74204f776e20746865204f425943204e4654000000000000006044820152606401610c6b565b61106287610bda565b156110c45760405162461bcd60e51b815260206004820152602c60248201527f596f75204861766520416c7265616479205472616e73666f726d65642074686960448201526b399027a12ca1902a37b5b2b760a11b6064820152608401610c6b565b8515806110d15750856001145b6111355760405162461bcd60e51b815260206004820152602f60248201527f57726f6e67204c616220546f6b656e20496420666f72204c6576656c204f6e6560448201526e102a3930b739b337b936b0ba34b7b760891b6064820152608401610c6b565b6040516370a0823160e01b81523360048201526001907f0000000000000000000000004becbdf97747413a18c5a2a53321d09198d3a1006001600160a01b0316906370a0823190602401602060405180830381865afa15801561119c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111c09190612e61565b101561120e5760405162461bcd60e51b815260206004820152601e60248201527f596f7520646f6e2774206f776e20656e6f756768204f425943204e46547300006044820152606401610c6b565b604051627eeac760e11b8152336004820152602481018790526001907f000000000000000000000000f2aecee06841f0cc984ab8d7de5b1e9106890fdc6001600160a01b03169062fdd58e90604401602060405180830381865afa15801561127a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061129e9190612e61565b10156112fd5760405162461bcd60e51b815260206004820152602860248201527f596f7520646f6e2774206f776e20656e6f756768204c6576656c204f6e65204c6044820152676162204974656d7360c01b6064820152608401610c6b565b6040805160608101825233815260208082018a81528284018a81526000805481526015909352938220835181546001600160a01b0319166001600160a01b03909116178155905160018083019190915593516002909101558054600b8054948501815582527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db990930192909255600e8054919261139983612db2565b90915550505060008781526018602052604090206001905550611a569050565b806002141561173557601454610100900460ff161561141a5760405162461bcd60e51b815260206004820152601860248201527f4d696e74696e6720666f72204c322069732050617573656400000000000000006044820152606401610c6b565b600061142584611aff565b9050336001600160a01b03821681146114805760405162461bcd60e51b815260206004820152601860248201527f596f7520446f6e74204f776e20746865204d764d204e465400000000000000006044820152606401610c6b565b611489856122b3565b156114a65760405162461bcd60e51b8152600401610c6b90612e7a565b85600214806114b55750856003145b6115175760405162461bcd60e51b815260206004820152602d60248201527f57726f6e67204c616220546f6b656e20496420666f72204c6576656c2032205460448201526c3930b739b337b936b0ba34b7b760991b6064820152608401610c6b565b600161152233611b11565b10156115405760405162461bcd60e51b8152600401610c6b90612ebf565b604051627eeac760e11b8152336004820152602481018790526001907f000000000000000000000000f2aecee06841f0cc984ab8d7de5b1e9106890fdc6001600160a01b03169062fdd58e90604401602060405180830381865afa1580156115ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115d09190612e61565b10156115ee5760405162461bcd60e51b8152600401610c6b90612f07565b6115f88686612317565b6116505760405162461bcd60e51b815260206004820152602360248201527f596f752053656c6563746564207468652057726f6e67204c616220546f6b656e60448201526208125160ea1b6064820152608401610c6b565b604080516080810182523381526020808201888152600089815260158352848120600190810154858701908152606086018d8152835484526016909552958220855181546001600160a01b0319166001600160a01b039091161781559251838201559451600283015591516003909101558054600c8054948501815582527fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c790930192909255600f8054919261170583612db2565b9091555050506000858152601560209081526040808320600101548352601890915290206002905550611a569050565b8060031415611a565760145462010000900460ff16156117975760405162461bcd60e51b815260206004820152601860248201527f4d696e74696e6720666f72204c332069732050617573656400000000000000006044820152606401610c6b565b60006117a283611aff565b9050336001600160a01b03821681146117fd5760405162461bcd60e51b815260206004820152601b60248201527f596f7520446f6e74204f776e20746865204d764d204c32204e465400000000006044820152606401610c6b565b61180684612371565b156118235760405162461bcd60e51b8152600401610c6b90612e7a565b856004146118895760405162461bcd60e51b815260206004820152602d60248201527f57726f6e67204c616220546f6b656e20496420666f72204c6576656c2033205460448201526c3930b739b337b936b0ba34b7b760991b6064820152608401610c6b565b600161189433611b11565b10156118b25760405162461bcd60e51b8152600401610c6b90612ebf565b604051627eeac760e11b8152336004820152602481018790526001907f000000000000000000000000f2aecee06841f0cc984ab8d7de5b1e9106890fdc6001600160a01b03169062fdd58e90604401602060405180830381865afa15801561191e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119429190612e61565b10156119605760405162461bcd60e51b8152600401610c6b90612f07565b6040805160a0810182523381526000868152601660209081528382206001808201548386019081528587018b815260029384015460608801908152608088018f8152875488526017909652978620875181546001600160a01b0319166001600160a01b0390911617815591518284015551928101929092559451600382015590516004909101558054600d8054948501815582527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb590930192909255601080549192611a2b83612db2565b9091555050506000848152601660209081526040808320600201548352601890915290206003905550505b5050505050565b60138054610ad290612d4b565b610bd583838360405180602001604052806000815250611d1e565b6008546001600160a01b03163314611aaf5760405162461bcd60e51b8152600401610c6b90612dcd565b8051610cbd9060119060208401906128e4565b6008546001600160a01b03163314611aec5760405162461bcd60e51b8152600401610c6b90612dcd565b8051610cbd9060129060208401906128e4565b6000611b0a826123d5565b5192915050565b60006001600160a01b038216611b3a576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b031660009081526005602052604090205467ffffffffffffffff1690565b6000805b600c54811015610c3e5782600c8281548110611b8257611b82612d86565b90600052602060002001541415611b9c5750600192915050565b80611ba681612db2565b915050611b64565b6060600380546109fe90612d4b565b6001600160a01b038216331415611be75760405163b06307db60e01b815260040160405180910390fd5b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b611c608585858585610f16565b611c6b3360016124f1565b604051637921219560e11b81526001600160a01b037f000000000000000000000000f2aecee06841f0cc984ab8d7de5b1e9106890fdc169063f242432a90611cd590339073dead00647e5af4d45760f9442025e41a357e6990908990600190600990600401612f4f565b600060405180830381600087803b158015611cef57600080fd5b505af1158015611d03573d6000803e3d6000fd5b505050505050505050565b600b8181548110610ebd57600080fd5b611d298484846120c6565b6001600160a01b0383163b15611d6257611d458484848461250b565b611d62576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b6000805b600d54811015610c3e5782600d8281548110611d8a57611d8a612d86565b90600052602060002001541415611da45750600192915050565b80611dae81612db2565b915050611d6c565b60128054610ad290612d4b565b6060611dce82611fc0565b611dea5760405162461bcd60e51b8152600401610c6b90612df5565b611df382611ef1565b15611e54576000611e026125f4565b90506000815111611e225760405180602001604052806000815250611e4d565b80611e2c84612603565b604051602001611e3d929190613024565b6040516020818303038152906040525b9392505050565b611e5d82611b60565b15611e6c576000611e02612701565b611e7582611b60565b15611e84576000611e02612710565b505060408051602081019091526000815290565b919050565b600c8181548110610ebd57600080fd5b6008546001600160a01b03163314611ed75760405162461bcd60e51b8152600401610c6b90612dcd565b601480549115156101000261ff0019909216919091179055565b6000805b600b54811015610c3e5782600b8281548110611f1357611f13612d86565b90600052602060002001541415611f2d5750600192915050565b80611f3781612db2565b915050611ef5565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b60118054610ad290612d4b565b6008546001600160a01b03163314611fa45760405162461bcd60e51b8152600401610c6b90612dcd565b60148054911515620100000262ff000019909216919091179055565b60008054821080156109e9575050600090815260046020526040902054600160e01b900460ff161590565b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b600061205b6008546001600160a01b031690565b6001600160a01b0316336001600160a01b031614905090565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d7690600090a35050565b60006120d1826123d5565b9050836001600160a01b031681600001516001600160a01b0316146121085760405162a1148160e81b815260040160405180910390fd5b6000336001600160a01b038616148061212657506121268533611f3f565b8061214157503361213684610a81565b6001600160a01b0316145b90508061216157604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b03841661218857604051633a954ecd60e21b815260040160405180910390fd5b61219460008487611feb565b6001600160a01b038581166000908152600560209081526040808320805467ffffffffffffffff1980821667ffffffffffffffff92831660001901831617909255898616808652838620805493841693831660019081018416949094179055898652600490945282852080546001600160e01b031916909417600160a01b4290921691909102178355870180845292208054919390911661226a57600054821461226a578054602086015167ffffffffffffffff16600160a01b026001600160e01b03199091166001600160a01b038a16171781555b50505082846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4611a56565b6000805b600c54811015610c3e578260166000600c84815481106122d9576122d9612d86565b906000526020600020015481526020019081526020016000206001015414156123055750600192915050565b8061230f81612db2565b9150506122b7565b6000818152601560205260408120600201541580156123365750826002145b15612343575060016109e9565b60008281526015602052604090206002015460011480156123645750826003145b15610c3e575060016109e9565b6000805b600d54811015610c3e578260176000600d848154811061239757612397612d86565b906000526020600020015481526020019081526020016000206002015414156123c35750600192915050565b806123cd81612db2565b915050612375565b6040805160608101825260008082526020820181905291810191909152816000548110156124d857600081815260046020908152604091829020825160608101845290546001600160a01b0381168252600160a01b810467ffffffffffffffff1692820192909252600160e01b90910460ff161515918101829052906124d65780516001600160a01b03161561246c579392505050565b5060001901600081815260046020908152604091829020825160608101845290546001600160a01b038116808352600160a01b820467ffffffffffffffff1693830193909352600160e01b900460ff16151592810192909252156124d1579392505050565b61246c565b505b604051636f96cda160e11b815260040160405180910390fd5b610cbd82826040518060200160405280600081525061271f565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290612540903390899088908890600401613063565b6020604051808303816000875af192505050801561257b575060408051601f3d908101601f19168201909252612578918101906130a0565b60015b6125d6573d8080156125a9576040519150601f19603f3d011682016040523d82523d6000602084013e6125ae565b606091505b5080516125ce576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b6060601180546109fe90612d4b565b6060816126275750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612651578061263b81612db2565b915061264a9050600a836130d3565b915061262b565b60008167ffffffffffffffff81111561266c5761266c612ab0565b6040519080825280601f01601f191660200182016040528015612696576020820181803683370190505b5090505b84156125ec576126ab6001836130e7565b91506126b8600a866130fe565b6126c3906030613112565b60f81b8183815181106126d8576126d8612d86565b60200101906001600160f81b031916908160001a9053506126fa600a866130d3565b945061269a565b6060601280546109fe90612d4b565b6060601380546109fe90612d4b565b6000546001600160a01b03841661274857604051622e076360e81b815260040160405180910390fd5b826127665760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b038416600081815260056020908152604080832080546fffffffffffffffffffffffffffffffff19811667ffffffffffffffff8083168b0181169182176801000000000000000067ffffffffffffffff1990941690921783900481168b01811690920217909155858452600490925290912080546001600160e01b0319168317600160a01b42909316929092029190911790558190818501903b1561288f575b60405182906001600160a01b038816906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4612858600087848060010195508761250b565b612875576040516368d2bf6b60e11b815260040160405180910390fd5b80821061280d57826000541461288a57600080fd5b6128d4565b5b6040516001830192906001600160a01b038816906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4808210612890575b506000908155611d629085838684565b8280546128f090612d4b565b90600052602060002090601f0160209004810192826129125760008555612958565b82601f1061292b57805160ff1916838001178555612958565b82800160010185558215612958579182015b8281111561295857825182559160200191906001019061293d565b50612964929150612986565b5090565b60405180604001604052806002906020820280368337509192915050565b5b808211156129645760008155600101612987565b6001600160e01b031981168114610c7d57600080fd5b6000602082840312156129c357600080fd5b8135611e4d8161299b565b60005b838110156129e95781810151838201526020016129d1565b83811115611d625750506000910152565b60008151808452612a128160208601602086016129ce565b601f01601f19169290920160200192915050565b602081526000611e4d60208301846129fa565b600060208284031215612a4b57600080fd5b5035919050565b6001600160a01b0381168114610c7d57600080fd5b60008060408385031215612a7a57600080fd5b8235612a8581612a52565b946020939093013593505050565b600060208284031215612aa557600080fd5b8135611e4d81612a52565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff80841115612ae157612ae1612ab0565b604051601f8501601f19908116603f01168101908282118183101715612b0957612b09612ab0565b81604052809350858152868686011115612b2257600080fd5b858560208301376000602087830101525050509392505050565b600060208284031215612b4e57600080fd5b813567ffffffffffffffff811115612b6557600080fd5b8201601f81018413612b7657600080fd5b6125ec84823560208401612ac6565b60408101818360005b6002811015612bad578151835260209283019290910190600101612b8e565b50505092915050565b600080600060608486031215612bcb57600080fd5b8335612bd681612a52565b92506020840135612be681612a52565b929592945050506040919091013590565b80358015158114611e9857600080fd5b600060208284031215612c1957600080fd5b611e4d82612bf7565b600080600080600060a08688031215612c3a57600080fd5b505083359560208501359550604085013594606081013594506080013592509050565b60008060408385031215612c7057600080fd5b8235612c7b81612a52565b9150612c8960208401612bf7565b90509250929050565b60008060008060808587031215612ca857600080fd5b8435612cb381612a52565b93506020850135612cc381612a52565b925060408501359150606085013567ffffffffffffffff811115612ce657600080fd5b8501601f81018713612cf757600080fd5b612d0687823560208401612ac6565b91505092959194509250565b60008060408385031215612d2557600080fd5b8235612d3081612a52565b91506020830135612d4081612a52565b809150509250929050565b600181811c90821680612d5f57607f821691505b60208210811415612d8057634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415612dc657612dc6612d9c565b5060010190565b6020808252600e908201526d139bdd08185d5d1a1bdc9a5e995960921b604082015260600190565b6020808252602f908201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60408201526e3732bc34b9ba32b73a103a37b5b2b760891b606082015260800190565b600060208284031215612e5657600080fd5b8151611e4d81612a52565b600060208284031215612e7357600080fd5b5051919050565b60208082526025908201527f596f75204861766520416c7265616479205472616e73666f726d65642074686960408201526473204d764d60d81b606082015260800190565b60208082526028908201527f596f7520646f6e2774206f776e20656e6f756768204f425943204c6576656c2060408201526754776f204e46547360c01b606082015260800190565b60208082526028908201527f596f7520646f6e2774206f776e20656e6f756768204c6576656c2054776f204c6040820152676162204974656d7360c01b606082015260800190565b6001600160a01b0386811682528516602080830191909152604082018590526060820184905260a0608083015282546000918291600181811c9082811680612f9857607f831692505b848310811415612fb657634e487b7160e01b86526022600452602486fd5b60a0880183905260c08801818015612fd55760018114612fe657613011565b60ff19861682528682019750613011565b60008b81526020902060005b8681101561300b57815484820152908501908801612ff2565b83019850505b50959d9c50505050505050505050505050565b600083516130368184602088016129ce565b83519083019061304a8183602088016129ce565b64173539b7b760d91b9101908152600501949350505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090613096908301846129fa565b9695505050505050565b6000602082840312156130b257600080fd5b8151611e4d8161299b565b634e487b7160e01b600052601260045260246000fd5b6000826130e2576130e26130bd565b500490565b6000828210156130f9576130f9612d9c565b500390565b60008261310d5761310d6130bd565b500690565b6000821982111561312557613125612d9c565b50019056fea2646970667358221220cf50c8616207f148d1d5f706566805b51115fc6fbc467338d298b3b123fac86064736f6c634300080b0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000004becbdf97747413a18c5a2a53321d09198d3a100000000000000000000000000f2aecee06841f0cc984ab8d7de5b1e9106890fdc00000000000000000000000000000000000000000000000000000000000000114d7574616e747356734d616368696e657300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034d764d0000000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _name (string): MutantsVsMachines
Arg [1] : _symbol (string): MvM
Arg [2] : _obycAddress (address): 0x4BEcbdf97747413A18C5a2a53321D09198d3a100
Arg [3] : _obyclabsAddress (address): 0xF2aECeE06841F0Cc984aB8d7dE5B1e9106890FDC
-----Encoded View---------------
8 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [2] : 0000000000000000000000004becbdf97747413a18c5a2a53321d09198d3a100
Arg [3] : 000000000000000000000000f2aecee06841f0cc984ab8d7de5b1e9106890fdc
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000011
Arg [5] : 4d7574616e747356734d616368696e6573000000000000000000000000000000
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [7] : 4d764d0000000000000000000000000000000000000000000000000000000000
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.