zellic-audit
Initial commit
f998fcd
raw
history blame
No virus
83.4 kB
{
"language": "Solidity",
"sources": {
"contracts/MarmottoshisIsERC1155.sol": {
"content": "// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.17;\r\n\r\nimport \"./IMarmottoshisIsERC1155.sol\";\r\nimport \"./ERC1155/ERC1155.sol\";\r\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\r\nimport \"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\";\r\nimport \"@openzeppelin/contracts/utils/Strings.sol\";\r\nimport \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\r\nimport \"@openzeppelin/contracts/utils/Base64.sol\";\r\nimport \"@openzeppelin/contracts/token/common/ERC2981.sol\";\r\n\r\ncontract MarmottoshisIsERC1155 is IMarmottoshisIsERC1155, ERC1155, ERC2981, Ownable, ReentrancyGuard {\r\n\r\n string public name = \"Marmottoshis\";\r\n string public symbol = \"WASAT\";\r\n\r\n using Strings for uint;\r\n\r\n Step public currentStep;\r\n\r\n uint public constant maxToken = 21; // 21 different NFTs\r\n uint public constant maxSupply = 37; // 37 copies of each NFT\r\n\r\n uint public reservationPrice = 0.01727 ether; // Price of the reservation (21 USD ATM)\r\n uint public reservationNFTPrice = 0.04663 ether; // Price of the NFT for reservation list (56.7 USD ATM)\r\n uint public whitelistPrice = 0.0639 ether; // Price of whitelist mint (77.7 USD ATM)\r\n uint public publicPrice = 0.0639 ether; // Price of public mint (77.7 USD ATM)\r\n\r\n uint public balanceOfSatoshis = 0; // Balance of Satoshis (100000000 Satoshis = 1 Bitcoin)\r\n\r\n uint public currentReservationNumber = 0; // Current number of reservations purchased\r\n\r\n bytes32 public freeMintMerkleRoot; // Merkle root of the free mint\r\n bytes32 public firstMerkleRoot; // Merkle root of the first whitelist\r\n bytes32 public secondMerkleRoot; // Merkle root of the second whitelist\r\n\r\n mapping(uint => Metadata) public metadataById; // Artist by ID\r\n mapping(uint => uint) public supplyByID; // Number of NFTs minted by ID\r\n mapping(address => bool) public reservationList; // List of addresses that reserved (true = reserved)\r\n\r\n mapping(address => uint) public freeMintByWallet; // Number of NFTs minted by wallet for free mint\r\n mapping(address => uint) public reservationMintByWallet; // Number of reserved NFT mint by wallet\r\n mapping(address => uint) public firstWhitelistMintByWallet; // Number of first whitelist NFT mint by wallet\r\n mapping(address => uint) public secondWhitelistMintByWallet; // Number of second whitelist NFT mint by wallet\r\n\r\n mapping(uint => uint) public balanceOfSatoshiByID; // Balance of Satoshi by token ID\r\n\r\n address public marmott; // Marmott's address\r\n\r\n bool public isMetadataLocked = false; // Locks the metadata URI\r\n bool public isRevealed = false; // Reveal the NFTs\r\n\r\n constructor(address _marmott, string memory _uri) ERC1155(_uri) {\r\n marmott = _marmott;\r\n }\r\n\r\n // @dev see {IMarmottoshisIsERC1155-mint}\r\n function mint(uint idToMint, bytes32[] calldata _proof) public payable nonReentrant {\r\n require(\r\n currentStep == Step.FreeMint ||\r\n currentStep == Step.ReservationMint ||\r\n currentStep == Step.FirstWhitelistMint ||\r\n currentStep == Step.SecondWhitelistMint ||\r\n currentStep == Step.PublicMint\r\n , \"Sale is not open\");\r\n require(idToMint >= 1, \"Nonexistent id\");\r\n require(idToMint <= maxToken, \"Nonexistent id\");\r\n require(supplyByID[idToMint] + 1 <= maxSupply, \"Max supply exceeded for this id\");\r\n\r\n if (currentStep == Step.FreeMint) {\r\n require(isOnList(msg.sender, _proof, 0), \"Not on free mint list\");\r\n require(totalSupply() + 1 <= 77, \"Max free mint supply exceeded\");\r\n require(freeMintByWallet[msg.sender] + 1 <= 1, \"You already minted your free NFT\");\r\n freeMintByWallet[msg.sender] += 1;\r\n _mint(msg.sender, idToMint, 1, \"\");\r\n } else if (currentStep == Step.ReservationMint) {\r\n require(reservationList[msg.sender], \"Not on reservation list\");\r\n require(msg.value >= reservationNFTPrice, \"Not enough ether\");\r\n require(totalSupply() + 1 <= 477, \"Max reservation mint supply exceeded\");\r\n require(reservationMintByWallet[msg.sender] + 1 <= 1, \"You already minted your reserved NFT\");\r\n reservationMintByWallet[msg.sender] += 1;\r\n _mint(msg.sender, idToMint, 1, \"\");\r\n } else if (currentStep == Step.FirstWhitelistMint) {\r\n require(isOnList(msg.sender, _proof, 1), \"Not on first whitelist\");\r\n require(msg.value >= whitelistPrice, \"Not enough ether\");\r\n require(totalSupply() + 1 <= 577, \"Max first whitelist mint supply exceeded\");\r\n require(firstWhitelistMintByWallet[msg.sender] + 1 <= 1, \"You already minted your first whitelist NFT\");\r\n firstWhitelistMintByWallet[msg.sender] += 1;\r\n _mint(msg.sender, idToMint, 1, \"\");\r\n } else if (currentStep == Step.SecondWhitelistMint) {\r\n require(isOnList(msg.sender, _proof, 2), \"Not on second whitelist\");\r\n require(msg.value >= whitelistPrice, \"Not enough ether\");\r\n require(totalSupply() + 1 <= 777, \"Max second whitelist mint supply exceeded\");\r\n require(secondWhitelistMintByWallet[msg.sender] + 1 <= 1, \"You already minted your second whitelist NFT\");\r\n secondWhitelistMintByWallet[msg.sender] += 1;\r\n _mint(msg.sender, idToMint, 1, \"\");\r\n } else {\r\n require(msg.value >= publicPrice, \"Not enough ether\");\r\n require(totalSupply() + 1 <= 777, \"Sold out\");\r\n _mint(msg.sender, idToMint, 1, \"\");\r\n }\r\n supplyByID[idToMint]++;\r\n emit newMint(msg.sender, idToMint);\r\n }\r\n\r\n // @dev see {IMarmottoshisIsERC1155-updateStep}\r\n function updateStep(Step _step) external onlyOwner {\r\n currentStep = _step;\r\n emit stepUpdated(currentStep);\r\n }\r\n\r\n // @dev see {IMarmottoshisIsERC1155-updateMarmott}\r\n function updateMarmott(address _marmott) external {\r\n require(msg.sender == marmott || msg.sender == owner(), \"Only Marmott or owner can update Marmott\");\r\n marmott = _marmott;\r\n }\r\n\r\n // @dev see {IMarmottoshisIsERC1155-lockMetadata}\r\n function lockMetadata() external onlyOwner {\r\n isMetadataLocked = true;\r\n }\r\n\r\n // @dev see {IMarmottoshisIsERC1155-reveal}\r\n function reveal() external onlyOwner {\r\n isRevealed = true;\r\n }\r\n\r\n // @dev see {IMarmottoshisIsERC1155-updateURI}\r\n function updateURI(string memory _newUri) external onlyOwner {\r\n require(!isMetadataLocked, \"Metadata locked\");\r\n _uri = _newUri;\r\n }\r\n\r\n // @dev see {IMarmottoshisIsERC1155-addSats}\r\n function addSats(uint satoshis) external {\r\n require(msg.sender == marmott, \"Only Marmott can add BTC\");\r\n balanceOfSatoshis = balanceOfSatoshis + satoshis;\r\n uint divedBy = getNumberOfIdLeft();\r\n require(divedBy > 0, \"No NFT left\");\r\n uint satoshisPerId = satoshis / divedBy;\r\n for (uint i = 1; i <= maxToken; i++) {\r\n if (supplyByID[i] > 0) {\r\n balanceOfSatoshiByID[i] = balanceOfSatoshiByID[i] + satoshisPerId;\r\n }\r\n }\r\n }\r\n\r\n // @dev see {IMarmottoshisIsERC1155-subSats}\r\n function subSats(uint satoshis) external {\r\n require(msg.sender == marmott, \"Only Marmott can sub BTC\");\r\n require(balanceOfSatoshis >= satoshis, \"Not enough satoshis in balance to sub\");\r\n balanceOfSatoshis = balanceOfSatoshis - satoshis;\r\n uint divedBy = getNumberOfIdLeft();\r\n require(divedBy > 0, \"No NFT left\");\r\n uint satoshisPerId = satoshis / divedBy;\r\n for (uint i = 1; i <= maxToken; i++) {\r\n if (supplyByID[i] > 0) {\r\n require(balanceOfSatoshiByID[i] >= satoshisPerId, \"Not enough satoshis in balance to sub (by id)\");\r\n balanceOfSatoshiByID[i] = balanceOfSatoshiByID[i] - satoshisPerId;\r\n }\r\n }\r\n }\r\n\r\n // @dev see {IMarmottoshisIsERC1155-burnAndRedeem}\r\n function burnAndRedeem(uint _idToRedeem, string memory _btcAddress) public nonReentrant {\r\n require(_idToRedeem >= 1, \"Nonexistent id\");\r\n require(_idToRedeem <= maxToken, \"Nonexistent id\");\r\n require(currentStep == Step.SoldOut, \"You can't redeem satoshis yet\");\r\n require(balanceOf(msg.sender, _idToRedeem) >= 1, \"Not enough Marmottoshis to burn\");\r\n _burn(msg.sender, _idToRedeem, 1);\r\n uint satoshisToRedeem = redeemableById(_idToRedeem);\r\n require(satoshisToRedeem > 0, \"No satoshi to redeem\");\r\n balanceOfSatoshis = balanceOfSatoshis - satoshisToRedeem;\r\n balanceOfSatoshiByID[_idToRedeem] = balanceOfSatoshiByID[_idToRedeem] - satoshisToRedeem;\r\n supplyByID[_idToRedeem] = supplyByID[_idToRedeem] - 1;\r\n emit newRedeemRequest(msg.sender, _idToRedeem, 1, _btcAddress, satoshisToRedeem);\r\n }\r\n\r\n // @dev see {IMarmottoshisIsERC1155-reservationForWhitelist}\r\n function reservationForWhitelist() external payable nonReentrant {\r\n require(currentStep == Step.WLReservation, \"Reservation for whitelist is not open\");\r\n require(msg.value >= reservationPrice, \"Not enough ether\");\r\n require(reservationList[msg.sender] == false, \"You are already in the pre-whitelist\");\r\n require(currentReservationNumber + 1 <= 400, \"Max pre-whitelist reached\");\r\n currentReservationNumber = currentReservationNumber + 1;\r\n reservationList[msg.sender] = true;\r\n emit newReservation(msg.sender);\r\n }\r\n\r\n // @dev see {IMarmottoshisIsERC1155-redeemableById}\r\n function redeemableById(uint _id) public view returns (uint) {\r\n if (supplyByID[_id] == 0) {\r\n return 0;\r\n } else {\r\n return balanceOfSatoshiByID[_id] / supplyByID[_id];\r\n }\r\n }\r\n\r\n // @dev see {IMarmottoshisIsERC1155-getNumberOfIdLeft}\r\n function getNumberOfIdLeft() public view returns (uint) {\r\n uint numberOfIdLeft = 0;\r\n for (uint i = 1; i <= maxToken; i++) {\r\n if (supplyByID[i] > 0) {\r\n numberOfIdLeft = numberOfIdLeft + 1;\r\n }\r\n }\r\n return numberOfIdLeft;\r\n }\r\n\r\n // @dev see {IMarmottoshisIsERC1155-addMetadata}\r\n function addMetadata(uint[] memory _id, string[] memory _artists_names, string[] memory _marmot_name, string[] memory _links, string[] memory _uri) external onlyOwner {\r\n require(!isMetadataLocked, \"Metadata locked\");\r\n for (uint i = 0; i < _id.length; i++) {\r\n metadataById[_id[i]] = Metadata({\r\n id: _id[i],\r\n artist_name: _artists_names[i],\r\n marmot_name: _marmot_name[i],\r\n link: _links[i],\r\n uri: _uri[i]\r\n });\r\n }\r\n }\r\n\r\n // @dev see {IMarmottoshisIsERC1155-updateFreeMintMerkleRoot}\r\n function updateFreeMintMerkleRoot(bytes32 _merkleRoot) external onlyOwner {\r\n freeMintMerkleRoot = _merkleRoot;\r\n }\r\n\r\n // @dev see {IMarmottoshisIsERC1155-updateFirstWhitelistMerkleRoot}\r\n function updateFirstWhitelistMerkleRoot(bytes32 _merkleRoot) external onlyOwner {\r\n firstMerkleRoot = _merkleRoot;\r\n }\r\n\r\n // @dev see {IMarmottoshisIsERC1155-updateSecondWhitelistMerkleRoot}\r\n function updateSecondWhitelistMerkleRoot(bytes32 _merkleRoot) external onlyOwner {\r\n secondMerkleRoot = _merkleRoot;\r\n }\r\n\r\n // @dev see {IMarmottoshisIsERC1155-updateReservationPrice}\r\n function updateReservationPrice(uint _reservationPrice) external onlyOwner {\r\n reservationPrice = _reservationPrice;\r\n }\r\n\r\n // @dev see {IMarmottoshisIsERC1155-updateReservationNFTPrice}\r\n function updateReservationNFTPrice(uint _reservationNFTPrice) external onlyOwner {\r\n reservationNFTPrice = _reservationNFTPrice;\r\n }\r\n\r\n // @dev see {IMarmottoshisIsERC1155-updateWLPrice}\r\n function updateWLPrice(uint _whitelistPrice) external onlyOwner {\r\n whitelistPrice = _whitelistPrice;\r\n }\r\n\r\n // @dev see {IMarmottoshisIsERC1155-updatePublicPrice}\r\n function updatePublicPrice(uint _publicPrice) external onlyOwner {\r\n publicPrice = _publicPrice;\r\n }\r\n\r\n // @dev see {IERC1155MetadataURI-uri}\r\n function uri(uint256 _tokenId) override public view returns (string memory) {\r\n require(_tokenId >= 1, \"Nonexistent id\");\r\n require(_tokenId <= maxToken, \"Nonexistent id\");\r\n if (!isRevealed) {\r\n return _uri;\r\n }\r\n string memory image = metadataById[_tokenId].uri;\r\n string memory marmot_name = metadataById[_tokenId].marmot_name;\r\n string memory json = Base64.encode(\r\n bytes(\r\n string(\r\n abi.encodePacked(\r\n '{\"name\": \"', marmot_name, '\", \"image\": \"', image, '\", \"description\": \"Realised by ', metadataById[_tokenId].artist_name, '. You can see more here : ', metadataById[_tokenId].link, ' .\", \"attributes\": [{\"trait_type\": \"Satoshis\", \"value\": \"', redeemableById(_tokenId).toString(), '\"}, {\"trait_type\": \"Remaining Copy\", \"value\": \"', supplyByID[_tokenId].toString(), '\"}]}'\r\n )\r\n )\r\n )\r\n );\r\n\r\n return string(abi.encodePacked('data:application/json;base64,', json));\r\n }\r\n\r\n // @dev see {IMarmottoshisIsERC1155-totalSupply}\r\n function totalSupply() public view returns (uint) {\r\n uint supply = 0;\r\n for (uint i = 1; i <= maxToken; i++) {\r\n supply = supply + supplyByID[i];\r\n }\r\n return supply;\r\n }\r\n\r\n // @dev see {IMarmottoshisIsERC1155-withdraw}\r\n function withdraw() external onlyOwner {\r\n payable(msg.sender).transfer(address(this).balance);\r\n }\r\n\r\n // @dev see {IMarmottoshisIsERC1155-isOnList}\r\n function isOnList(address _account, bytes32[] calldata _proof, uint _step) public view returns (bool) {\r\n if (_step == 0) {\r\n return _verify(_leaf(_account), _proof, freeMintMerkleRoot);\r\n } else if (_step == 1) {\r\n return _verify(_leaf(_account), _proof, firstMerkleRoot);\r\n } else if (_step == 2) {\r\n return _verify(_leaf(_account), _proof, secondMerkleRoot);\r\n } else {\r\n return false;\r\n }\r\n }\r\n\r\n function _leaf(address _account) internal pure returns (bytes32) {\r\n return keccak256(abi.encodePacked(_account));\r\n }\r\n\r\n function _verify(bytes32 leaf, bytes32[] memory proof, bytes32 root) internal pure returns (bool) {\r\n return MerkleProof.verify(proof, root, leaf);\r\n }\r\n\r\n\r\n // @dev see {IERC165-supportsInterface}.\r\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC1155, ERC2981) returns (bool) {\r\n return super.supportsInterface(interfaceId);\r\n }\r\n\r\n // @dev see {IMarmottoshisIsERC1155-setDefaultRoyalty}\r\n function setDefaultRoyalty(address receiver, uint96 feeNumerator) external onlyOwner {\r\n _setDefaultRoyalty(receiver, feeNumerator);\r\n }\r\n}\r\n"
},
"contracts/IMarmottoshisIsERC1155.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\ninterface IMarmottoshisIsERC1155 {\n\n // @notice Structure to store artist's infos (by token ID)\n struct Metadata {\n uint id;\n string artist_name;\n string marmot_name;\n string link;\n string uri;\n }\n\n // @notice Enum of different steps of the contract process\n enum Step {\n SaleNotStarted,\n WLReservation,\n FreeMint,\n ReservationMint,\n FirstWhitelistMint,\n SecondWhitelistMint,\n PublicMint,\n SoldOut\n }\n\n event newReservation(address indexed sender); // New reservation\n event newRedeemRequest(address indexed sender, uint256 nftIdRedeemed, uint256 burnAmount, string btcAddress, uint256 satoshisAmount); // Redeem event (user want to claim sats)\n event newMint(address indexed sender, uint256 nftIdMinted); // New mint\n event stepUpdated(Step currentStep); // Step updated\n\n // @notice Returns the sum of all supplies for each NFT ID\n function totalSupply() external view returns (uint256);\n\n // @notice return max supply of NFTs\n function maxSupply() external view returns (uint256);\n\n // @notice return max token by NFT Id\n function maxToken() external view returns (uint256);\n\n /*\n * @notice return supply by ID of NFT\n * @param _tokenId : id of NFT\n */\n function supplyByID(uint256) external view returns (uint256);\n\n /*\n * @notice get number of Satoshis redeemable by NFT ID\n * @param uint : id of NFT\n */\n function redeemableById(uint256 _id) external view returns (uint256);\n\n /*\n * @notice get number of NFT's ID with supply left\n */\n function getNumberOfIdLeft() external view returns (uint256);\n\n // @notice return free mint merkle root\n function freeMintMerkleRoot() external view returns (bytes32);\n\n // @notice return first whitelist merkle root\n function firstMerkleRoot() external view returns (bytes32);\n\n // @notice return second whitelist merkle root\n function secondMerkleRoot() external view returns (bytes32);\n\n /*\n * @notice return if a user is in reservation list (true/false)\n * @param _account : address of user\n */\n function reservationList(address) external view returns (bool);\n\n /*\n * @notice return number of NFTs minted by user for reservation step\n * @param _account : address of user\n */\n function reservationMintByWallet(address) external view returns (uint256);\n\n /*\n * @notice return number of NFTs minted by user for free mint step\n * @param _account : address of user\n */\n function freeMintByWallet(address) external view returns (uint256);\n\n /*\n * @notice return number of NFTs minted by user for first whitelist step\n * @param _account : address of user\n */\n function firstWhitelistMintByWallet(address) external view returns (uint256);\n\n /*\n * @notice return number of NFTs minted by user for second whitelist step\n * @param _account : address of user\n */\n function secondWhitelistMintByWallet(address) external view returns (uint256);\n\n /*\n * @notice know if user is on a list\n * @param _account : address of user\n * @param _proof : Merkle proof\n * @param _step : step of the list (0 = free mint, 1 = first whitelist, 2 = second whitelist)\n */\n function isOnList(address _account, bytes32[] calldata _proof, uint256 _step) external view returns (bool);\n\n // @notice return reservation price\n function reservationPrice() external view returns (uint256);\n\n // @notice return reservation mint price\n function reservationNFTPrice() external view returns (uint256);\n\n // @notice return whitelist mint price (first and second)\n function whitelistPrice() external view returns (uint256);\n\n // @notice return public mint price\n function publicPrice() external view returns (uint256);\n\n // @notice return current reservation number\n function currentReservationNumber() external view returns (uint256);\n\n // @notice return balance of Satoshis of this contract\n function balanceOfSatoshis() external view returns (uint256);\n\n /*\n * @notice return balance infos by NFT Id\n * @param _tokenId : id of NFT\n */\n function balanceOfSatoshiByID(uint256) external view returns (uint256);\n\n /*\n * @notice return metadata infos by NFT Id\n * @param _tokenId : id of NFT\n */\n function metadataById(uint256) external view returns (uint id, string memory artist_name, string memory marmot_name, string memory link, string memory uri);\n\n // @notice return current step\n function currentStep() external view returns (Step);\n\n // @notice return if metadata are locked (true/false)\n function isMetadataLocked() external view returns (bool);\n\n // @notice return if NFT are revealed (true/false)\n function isRevealed() external view returns (bool);\n\n // @notice return marmott address\n function marmott() external view returns (address);\n\n ////////// Functions //////////\n /// Setter functions ///\n\n /*\n * @notice Mints a new token to msg.sender\n * @param uint : Id of NFT to mint.\n * @param bytes32[] : Proof of whitelist (could be empty []).\n */\n function mint(uint256 idToMint, bytes32[] calldata _proof) external payable;\n\n /*\n * @notice update step\n * @param _step step to update\n */\n function updateStep(Step _step) external;\n\n /*\n * @notice update Marmott's address\n * @param address : new Marmott's address\n */\n function updateMarmott(address _marmott) external;\n\n /*\n * @notice lock metadata\n */\n function lockMetadata() external;\n\n /*\n * @notice reveal NFTs\n */\n function reveal() external;\n\n /*\n * @notice update URI\n * @param string : new URI\n */\n function updateURI(string memory _newUri) external;\n\n /*\n * @notice create Metadata struct of an NFT and add it in metadataById mapping\n * @param uint[] : array of NFT Ids\n * @param string[] : array of artist names\n * @param string[] : array of marmot names\n * @param string[] : array of links\n * @param string[] : array of URIs\n */\n function addMetadata(uint[] calldata _id, string[] calldata _artists_names, string[] calldata _marmot_name, string[] calldata _links, string[] calldata _uri) external;\n\n /*\n * @notice add satoshis to balanceOfSatoshis\n * @param uint : amount of satoshis to add\n */\n function addSats(uint256 satoshis) external;\n\n /*\n * @notice remove satoshis from balanceOfSatoshis\n * @param uint : amount of satoshis to remove\n */\n function subSats(uint256 satoshis) external;\n\n /*\n * @notice redeem satoshis and burn NFT\n * @param uint : id of NFT to burn/redeem\n * @param string : bitcoin address to send satoshis to\n */\n function burnAndRedeem(uint256 _idToRedeem, string memory _btcAddress) external;\n\n /*\n * @notice function for user to be preWhitelist\n */\n function reservationForWhitelist() external payable;\n\n /*\n * @notice update first whitelist merkle root\n * @param _merkleRoot : new merkle root\n */\n function updateFirstWhitelistMerkleRoot(bytes32 _merkleRoot) external;\n\n /*\n * @notice update free mint merkle root\n * @param _merkleRoot : new merkle root\n */\n function updateFreeMintMerkleRoot(bytes32 _merkleRoot) external;\n\n /*\n * @notice update public price\n * @param _publicPrice : new public price\n */\n function updatePublicPrice(uint256 _publicPrice) external;\n\n /*\n * @notice update reservation NFT price\n * @param _reservationNFTPrice : new reservation NFT price\n */\n function updateReservationNFTPrice(uint256 _reservationNFTPrice) external;\n\n /*\n * @notice update reservation price\n * @param _reservationPrice : new reservation price\n */\n function updateReservationPrice(uint256 _reservationPrice) external;\n\n /*\n * @notice update second whitelist merkle root\n * @param _merkleRoot : new merkle root\n */\n function updateSecondWhitelistMerkleRoot(bytes32 _merkleRoot) external;\n\n /*\n * @notice update whitelist price\n * @param _whitelistPrice : new whitelist price\n */\n function updateWLPrice(uint256 _whitelistPrice) external;\n\n /*\n * @notice withdraw ether from contract\n */\n function withdraw() external;\n\n // @notice EIP2981 royalties\n function setDefaultRoyalty(address receiver, uint96 feeNumerator) external;\n}\n"
},
"contracts/ERC1155/ERC1155.sol": {
"content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/ERC1155.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./IERC1155.sol\";\r\nimport \"./extensions/IERC1155MetadataURI.sol\";\r\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\r\nimport \"@openzeppelin/contracts/utils/Address.sol\";\r\nimport \"@openzeppelin/contracts/utils/Context.sol\";\r\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\r\n\r\n/**\r\n * @dev Implementation of the basic standard multi-token.\r\n * See https://eips.ethereum.org/EIPS/eip-1155\r\n * Originally based on code by Enjin: https://github.com/enjin/erc-1155\r\n *\r\n * _Available since v3.1._\r\n */\r\ncontract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {\r\n using Address for address;\r\n\r\n // Mapping from token ID to account balances\r\n mapping(uint256 => mapping(address => uint256)) private _balances;\r\n\r\n // Mapping from account to operator approvals\r\n mapping(address => mapping(address => bool)) private _operatorApprovals;\r\n\r\n // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json\r\n string internal _uri;\r\n\r\n /**\r\n * @dev See {_setURI}.\r\n */\r\n constructor(string memory uri_) {\r\n _setURI(uri_);\r\n }\r\n\r\n /**\r\n * @dev See {IERC165-supportsInterface}.\r\n */\r\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\r\n return\r\n interfaceId == type(IERC1155).interfaceId ||\r\n interfaceId == type(IERC1155MetadataURI).interfaceId ||\r\n super.supportsInterface(interfaceId);\r\n }\r\n\r\n /**\r\n * @dev See {IERC1155MetadataURI-uri}.\r\n *\r\n * This implementation returns the same URI for *all* token types. It relies\r\n * on the token type ID substitution mechanism\r\n * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].\r\n *\r\n * Clients calling this function must replace the `\\{id\\}` substring with the\r\n * actual token type ID.\r\n */\r\n function uri(uint256) public view virtual override returns (string memory) {\r\n return _uri;\r\n }\r\n\r\n /**\r\n * @dev See {IERC1155-balanceOf}.\r\n *\r\n * Requirements:\r\n *\r\n * - `account` cannot be the zero address.\r\n */\r\n function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {\r\n require(account != address(0), \"ERC1155: address zero is not a valid owner\");\r\n return _balances[id][account];\r\n }\r\n\r\n /**\r\n * @dev See {IERC1155-balanceOfBatch}.\r\n *\r\n * Requirements:\r\n *\r\n * - `accounts` and `ids` must have the same length.\r\n */\r\n function balanceOfBatch(address[] memory accounts, uint256[] memory ids)\r\n public\r\n view\r\n virtual\r\n override\r\n returns (uint256[] memory)\r\n {\r\n require(accounts.length == ids.length, \"ERC1155: accounts and ids length mismatch\");\r\n\r\n uint256[] memory batchBalances = new uint256[](accounts.length);\r\n\r\n for (uint256 i = 0; i < accounts.length; ++i) {\r\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\r\n }\r\n\r\n return batchBalances;\r\n }\r\n\r\n /**\r\n * @dev See {IERC1155-setApprovalForAll}.\r\n */\r\n function setApprovalForAll(address operator, bool approved) public virtual override {\r\n _setApprovalForAll(_msgSender(), operator, approved);\r\n }\r\n\r\n /**\r\n * @dev See {IERC1155-isApprovedForAll}.\r\n */\r\n function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {\r\n return _operatorApprovals[account][operator];\r\n }\r\n\r\n /**\r\n * @dev See {IERC1155-safeTransferFrom}.\r\n */\r\n function safeTransferFrom(\r\n address from,\r\n address to,\r\n uint256 id,\r\n uint256 amount,\r\n bytes memory data\r\n ) public virtual override {\r\n require(\r\n from == _msgSender() || isApprovedForAll(from, _msgSender()),\r\n \"ERC1155: caller is not token owner or approved\"\r\n );\r\n _safeTransferFrom(from, to, id, amount, data);\r\n }\r\n\r\n /**\r\n * @dev See {IERC1155-safeBatchTransferFrom}.\r\n */\r\n function safeBatchTransferFrom(\r\n address from,\r\n address to,\r\n uint256[] memory ids,\r\n uint256[] memory amounts,\r\n bytes memory data\r\n ) public virtual override {\r\n require(\r\n from == _msgSender() || isApprovedForAll(from, _msgSender()),\r\n \"ERC1155: caller is not token owner or approved\"\r\n );\r\n _safeBatchTransferFrom(from, to, ids, amounts, data);\r\n }\r\n\r\n /**\r\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\r\n *\r\n * Emits a {TransferSingle} event.\r\n *\r\n * Requirements:\r\n *\r\n * - `to` cannot be the zero address.\r\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\r\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\r\n * acceptance magic value.\r\n */\r\n function _safeTransferFrom(\r\n address from,\r\n address to,\r\n uint256 id,\r\n uint256 amount,\r\n bytes memory data\r\n ) internal virtual {\r\n require(to != address(0), \"ERC1155: transfer to the zero address\");\r\n require(to != address(0x000000000000000000000000000000000000dEaD), \"You should use burnAndRedeem function\");\r\n\r\n address operator = _msgSender();\r\n uint256[] memory ids = _asSingletonArray(id);\r\n uint256[] memory amounts = _asSingletonArray(amount);\r\n\r\n _beforeTokenTransfer(operator, from, to, ids, amounts, data);\r\n\r\n uint256 fromBalance = _balances[id][from];\r\n require(fromBalance >= amount, \"ERC1155: insufficient balance for transfer\");\r\n unchecked {\r\n _balances[id][from] = fromBalance - amount;\r\n }\r\n _balances[id][to] += amount;\r\n\r\n emit TransferSingle(operator, from, to, id, amount);\r\n\r\n _afterTokenTransfer(operator, from, to, ids, amounts, data);\r\n\r\n _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);\r\n }\r\n\r\n /**\r\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.\r\n *\r\n * Emits a {TransferBatch} event.\r\n *\r\n * Requirements:\r\n *\r\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\r\n * acceptance magic value.\r\n */\r\n function _safeBatchTransferFrom(\r\n address from,\r\n address to,\r\n uint256[] memory ids,\r\n uint256[] memory amounts,\r\n bytes memory data\r\n ) internal virtual {\r\n require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\r\n require(to != address(0), \"ERC1155: transfer to the zero address\");\r\n require(to != address(0x000000000000000000000000000000000000dEaD), \"You should use burnAndRedeem function\");\r\n\r\n address operator = _msgSender();\r\n\r\n _beforeTokenTransfer(operator, from, to, ids, amounts, data);\r\n\r\n for (uint256 i = 0; i < ids.length; ++i) {\r\n uint256 id = ids[i];\r\n uint256 amount = amounts[i];\r\n\r\n uint256 fromBalance = _balances[id][from];\r\n require(fromBalance >= amount, \"ERC1155: insufficient balance for transfer\");\r\n unchecked {\r\n _balances[id][from] = fromBalance - amount;\r\n }\r\n _balances[id][to] += amount;\r\n }\r\n\r\n emit TransferBatch(operator, from, to, ids, amounts);\r\n\r\n _afterTokenTransfer(operator, from, to, ids, amounts, data);\r\n\r\n _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);\r\n }\r\n\r\n /**\r\n * @dev Sets a new URI for all token types, by relying on the token type ID\r\n * substitution mechanism\r\n * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].\r\n *\r\n * By this mechanism, any occurrence of the `\\{id\\}` substring in either the\r\n * URI or any of the amounts in the JSON file at said URI will be replaced by\r\n * clients with the token type ID.\r\n *\r\n * For example, the `https://token-cdn-domain/\\{id\\}.json` URI would be\r\n * interpreted by clients as\r\n * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`\r\n * for token type ID 0x4cce0.\r\n *\r\n * See {uri}.\r\n *\r\n * Because these URIs cannot be meaningfully represented by the {URI} event,\r\n * this function emits no events.\r\n */\r\n function _setURI(string memory newuri) internal virtual {\r\n _uri = newuri;\r\n }\r\n\r\n /**\r\n * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.\r\n *\r\n * Emits a {TransferSingle} event.\r\n *\r\n * Requirements:\r\n *\r\n * - `to` cannot be the zero address.\r\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\r\n * acceptance magic value.\r\n */\r\n function _mint(\r\n address to,\r\n uint256 id,\r\n uint256 amount,\r\n bytes memory data\r\n ) internal virtual {\r\n require(to != address(0), \"ERC1155: mint to the zero address\");\r\n\r\n address operator = _msgSender();\r\n uint256[] memory ids = _asSingletonArray(id);\r\n uint256[] memory amounts = _asSingletonArray(amount);\r\n\r\n _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);\r\n\r\n _balances[id][to] += amount;\r\n emit TransferSingle(operator, address(0), to, id, amount);\r\n\r\n _afterTokenTransfer(operator, address(0), to, ids, amounts, data);\r\n\r\n _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);\r\n }\r\n\r\n /**\r\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.\r\n *\r\n * Emits a {TransferBatch} event.\r\n *\r\n * Requirements:\r\n *\r\n * - `ids` and `amounts` must have the same length.\r\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\r\n * acceptance magic value.\r\n */\r\n function _mintBatch(\r\n address to,\r\n uint256[] memory ids,\r\n uint256[] memory amounts,\r\n bytes memory data\r\n ) internal virtual {\r\n require(to != address(0), \"ERC1155: mint to the zero address\");\r\n require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\r\n\r\n address operator = _msgSender();\r\n\r\n _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);\r\n\r\n for (uint256 i = 0; i < ids.length; i++) {\r\n _balances[ids[i]][to] += amounts[i];\r\n }\r\n\r\n emit TransferBatch(operator, address(0), to, ids, amounts);\r\n\r\n _afterTokenTransfer(operator, address(0), to, ids, amounts, data);\r\n\r\n _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);\r\n }\r\n\r\n /**\r\n * @dev Destroys `amount` tokens of token type `id` from `from`\r\n *\r\n * Emits a {TransferSingle} event.\r\n *\r\n * Requirements:\r\n *\r\n * - `from` cannot be the zero address.\r\n * - `from` must have at least `amount` tokens of token type `id`.\r\n */\r\n function _burn(\r\n address from,\r\n uint256 id,\r\n uint256 amount\r\n ) internal virtual {\r\n require(from != address(0), \"ERC1155: burn from the zero address\");\r\n\r\n address operator = _msgSender();\r\n uint256[] memory ids = _asSingletonArray(id);\r\n uint256[] memory amounts = _asSingletonArray(amount);\r\n\r\n _beforeTokenTransfer(operator, from, address(0), ids, amounts, \"\");\r\n\r\n uint256 fromBalance = _balances[id][from];\r\n require(fromBalance >= amount, \"ERC1155: burn amount exceeds balance\");\r\n unchecked {\r\n _balances[id][from] = fromBalance - amount;\r\n }\r\n\r\n emit TransferSingle(operator, from, address(0), id, amount);\r\n\r\n _afterTokenTransfer(operator, from, address(0), ids, amounts, \"\");\r\n }\r\n\r\n /**\r\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.\r\n *\r\n * Emits a {TransferBatch} event.\r\n *\r\n * Requirements:\r\n *\r\n * - `ids` and `amounts` must have the same length.\r\n */\r\n function _burnBatch(\r\n address from,\r\n uint256[] memory ids,\r\n uint256[] memory amounts\r\n ) internal virtual {\r\n require(from != address(0), \"ERC1155: burn from the zero address\");\r\n require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\r\n\r\n address operator = _msgSender();\r\n\r\n _beforeTokenTransfer(operator, from, address(0), ids, amounts, \"\");\r\n\r\n for (uint256 i = 0; i < ids.length; i++) {\r\n uint256 id = ids[i];\r\n uint256 amount = amounts[i];\r\n\r\n uint256 fromBalance = _balances[id][from];\r\n require(fromBalance >= amount, \"ERC1155: burn amount exceeds balance\");\r\n unchecked {\r\n _balances[id][from] = fromBalance - amount;\r\n }\r\n }\r\n\r\n emit TransferBatch(operator, from, address(0), ids, amounts);\r\n\r\n _afterTokenTransfer(operator, from, address(0), ids, amounts, \"\");\r\n }\r\n\r\n /**\r\n * @dev Approve `operator` to operate on all of `owner` tokens\r\n *\r\n * Emits an {ApprovalForAll} event.\r\n */\r\n function _setApprovalForAll(\r\n address owner,\r\n address operator,\r\n bool approved\r\n ) internal virtual {\r\n require(owner != operator, \"ERC1155: setting approval status for self\");\r\n _operatorApprovals[owner][operator] = approved;\r\n emit ApprovalForAll(owner, operator, approved);\r\n }\r\n\r\n /**\r\n * @dev Hook that is called before any token transfer. This includes minting\r\n * and burning, as well as batched variants.\r\n *\r\n * The same hook is called on both single and batched variants. For single\r\n * transfers, the length of the `ids` and `amounts` arrays will be 1.\r\n *\r\n * Calling conditions (for each `id` and `amount` pair):\r\n *\r\n * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens\r\n * of token type `id` will be transferred to `to`.\r\n * - When `from` is zero, `amount` tokens of token type `id` will be minted\r\n * for `to`.\r\n * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`\r\n * will be burned.\r\n * - `from` and `to` are never both zero.\r\n * - `ids` and `amounts` have the same, non-zero length.\r\n *\r\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\r\n */\r\n function _beforeTokenTransfer(\r\n address operator,\r\n address from,\r\n address to,\r\n uint256[] memory ids,\r\n uint256[] memory amounts,\r\n bytes memory data\r\n ) internal virtual {}\r\n\r\n /**\r\n * @dev Hook that is called after any token transfer. This includes minting\r\n * and burning, as well as batched variants.\r\n *\r\n * The same hook is called on both single and batched variants. For single\r\n * transfers, the length of the `id` and `amount` arrays will be 1.\r\n *\r\n * Calling conditions (for each `id` and `amount` pair):\r\n *\r\n * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens\r\n * of token type `id` will be transferred to `to`.\r\n * - When `from` is zero, `amount` tokens of token type `id` will be minted\r\n * for `to`.\r\n * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`\r\n * will be burned.\r\n * - `from` and `to` are never both zero.\r\n * - `ids` and `amounts` have the same, non-zero length.\r\n *\r\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\r\n */\r\n function _afterTokenTransfer(\r\n address operator,\r\n address from,\r\n address to,\r\n uint256[] memory ids,\r\n uint256[] memory amounts,\r\n bytes memory data\r\n ) internal virtual {}\r\n\r\n function _doSafeTransferAcceptanceCheck(\r\n address operator,\r\n address from,\r\n address to,\r\n uint256 id,\r\n uint256 amount,\r\n bytes memory data\r\n ) private {\r\n if (to.isContract()) {\r\n try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {\r\n if (response != IERC1155Receiver.onERC1155Received.selector) {\r\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\r\n }\r\n } catch Error(string memory reason) {\r\n revert(reason);\r\n } catch {\r\n revert(\"ERC1155: transfer to non-ERC1155Receiver implementer\");\r\n }\r\n }\r\n }\r\n\r\n function _doSafeBatchTransferAcceptanceCheck(\r\n address operator,\r\n address from,\r\n address to,\r\n uint256[] memory ids,\r\n uint256[] memory amounts,\r\n bytes memory data\r\n ) private {\r\n if (to.isContract()) {\r\n try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (\r\n bytes4 response\r\n ) {\r\n if (response != IERC1155Receiver.onERC1155BatchReceived.selector) {\r\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\r\n }\r\n } catch Error(string memory reason) {\r\n revert(reason);\r\n } catch {\r\n revert(\"ERC1155: transfer to non-ERC1155Receiver implementer\");\r\n }\r\n }\r\n }\r\n\r\n function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {\r\n uint256[] memory array = new uint256[](1);\r\n array[0] = element;\r\n\r\n return array;\r\n }\r\n}\r\n"
},
"@openzeppelin/contracts/access/Ownable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n"
},
"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (utils/cryptography/MerkleProof.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev These functions deal with verification of Merkle Trees proofs.\n *\n * The proofs can be generated using the JavaScript library\n * https://github.com/miguelmota/merkletreejs[merkletreejs].\n * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.\n *\n * See `test/utils/cryptography/MerkleProof.test.js` for some examples.\n *\n * WARNING: You should avoid using leaf values that are 64 bytes long prior to\n * hashing, or use a hash function other than keccak256 for hashing leaves.\n * This is because the concatenation of a sorted pair of internal nodes in\n * the merkle tree could be reinterpreted as a leaf value.\n */\nlibrary MerkleProof {\n /**\n * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree\n * defined by `root`. For this, a `proof` must be provided, containing\n * sibling hashes on the branch from the leaf to the root of the tree. Each\n * pair of leaves and each pair of pre-images are assumed to be sorted.\n */\n function verify(\n bytes32[] memory proof,\n bytes32 root,\n bytes32 leaf\n ) internal pure returns (bool) {\n return processProof(proof, leaf) == root;\n }\n\n /**\n * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up\n * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\n * hash matches the root of the tree. When processing the proof, the pairs\n * of leafs & pre-images are assumed to be sorted.\n *\n * _Available since v4.4._\n */\n function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {\n bytes32 computedHash = leaf;\n for (uint256 i = 0; i < proof.length; i++) {\n bytes32 proofElement = proof[i];\n if (computedHash <= proofElement) {\n // Hash(current computed hash + current element of the proof)\n computedHash = _efficientHash(computedHash, proofElement);\n } else {\n // Hash(current element of the proof + current computed hash)\n computedHash = _efficientHash(proofElement, computedHash);\n }\n }\n return computedHash;\n }\n\n function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {\n assembly {\n mstore(0x00, a)\n mstore(0x20, b)\n value := keccak256(0x00, 0x40)\n }\n }\n}\n"
},
"@openzeppelin/contracts/utils/Strings.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n}\n"
},
"@openzeppelin/contracts/security/ReentrancyGuard.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n}\n"
},
"@openzeppelin/contracts/utils/Base64.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/Base64.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides a set of functions to operate with Base64 strings.\n *\n * _Available since v4.5._\n */\nlibrary Base64 {\n /**\n * @dev Base64 Encoding/Decoding Table\n */\n string internal constant _TABLE = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n\n /**\n * @dev Converts a `bytes` to its Bytes64 `string` representation.\n */\n function encode(bytes memory data) internal pure returns (string memory) {\n /**\n * Inspired by Brecht Devos (Brechtpd) implementation - MIT licence\n * https://github.com/Brechtpd/base64/blob/e78d9fd951e7b0977ddca77d92dc85183770daf4/base64.sol\n */\n if (data.length == 0) return \"\";\n\n // Loads the table into memory\n string memory table = _TABLE;\n\n // Encoding takes 3 bytes chunks of binary data from `bytes` data parameter\n // and split into 4 numbers of 6 bits.\n // The final Base64 length should be `bytes` data length multiplied by 4/3 rounded up\n // - `data.length + 2` -> Round up\n // - `/ 3` -> Number of 3-bytes chunks\n // - `4 *` -> 4 characters for each chunk\n string memory result = new string(4 * ((data.length + 2) / 3));\n\n assembly {\n // Prepare the lookup table (skip the first \"length\" byte)\n let tablePtr := add(table, 1)\n\n // Prepare result pointer, jump over length\n let resultPtr := add(result, 32)\n\n // Run over the input, 3 bytes at a time\n for {\n let dataPtr := data\n let endPtr := add(data, mload(data))\n } lt(dataPtr, endPtr) {\n\n } {\n // Advance 3 bytes\n dataPtr := add(dataPtr, 3)\n let input := mload(dataPtr)\n\n // To write each character, shift the 3 bytes (18 bits) chunk\n // 4 times in blocks of 6 bits for each character (18, 12, 6, 0)\n // and apply logical AND with 0x3F which is the number of\n // the previous character in the ASCII table prior to the Base64 Table\n // The result is then added to the table to get the character to write,\n // and finally write it in the result pointer but with a left shift\n // of 256 (1 byte) - 8 (1 ASCII char) = 248 bits\n\n mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F))))\n resultPtr := add(resultPtr, 1) // Advance\n\n mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F))))\n resultPtr := add(resultPtr, 1) // Advance\n\n mstore8(resultPtr, mload(add(tablePtr, and(shr(6, input), 0x3F))))\n resultPtr := add(resultPtr, 1) // Advance\n\n mstore8(resultPtr, mload(add(tablePtr, and(input, 0x3F))))\n resultPtr := add(resultPtr, 1) // Advance\n }\n\n // When data `bytes` is not exactly 3 bytes long\n // it is padded with `=` characters at the end\n switch mod(mload(data), 3)\n case 1 {\n mstore8(sub(resultPtr, 1), 0x3d)\n mstore8(sub(resultPtr, 2), 0x3d)\n }\n case 2 {\n mstore8(sub(resultPtr, 1), 0x3d)\n }\n }\n\n return result;\n }\n}\n"
},
"@openzeppelin/contracts/token/common/ERC2981.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/common/ERC2981.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/IERC2981.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information.\n *\n * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for\n * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.\n *\n * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the\n * fee is specified in basis points by default.\n *\n * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See\n * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to\n * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.\n *\n * _Available since v4.5._\n */\nabstract contract ERC2981 is IERC2981, ERC165 {\n struct RoyaltyInfo {\n address receiver;\n uint96 royaltyFraction;\n }\n\n RoyaltyInfo private _defaultRoyaltyInfo;\n mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) {\n return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @inheritdoc IERC2981\n */\n function royaltyInfo(uint256 _tokenId, uint256 _salePrice) public view virtual override returns (address, uint256) {\n RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId];\n\n if (royalty.receiver == address(0)) {\n royalty = _defaultRoyaltyInfo;\n }\n\n uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator();\n\n return (royalty.receiver, royaltyAmount);\n }\n\n /**\n * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a\n * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an\n * override.\n */\n function _feeDenominator() internal pure virtual returns (uint96) {\n return 10000;\n }\n\n /**\n * @dev Sets the royalty information that all ids in this contract will default to.\n *\n * Requirements:\n *\n * - `receiver` cannot be the zero address.\n * - `feeNumerator` cannot be greater than the fee denominator.\n */\n function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {\n require(feeNumerator <= _feeDenominator(), \"ERC2981: royalty fee will exceed salePrice\");\n require(receiver != address(0), \"ERC2981: invalid receiver\");\n\n _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);\n }\n\n /**\n * @dev Removes default royalty information.\n */\n function _deleteDefaultRoyalty() internal virtual {\n delete _defaultRoyaltyInfo;\n }\n\n /**\n * @dev Sets the royalty information for a specific token id, overriding the global default.\n *\n * Requirements:\n *\n * - `tokenId` must be already minted.\n * - `receiver` cannot be the zero address.\n * - `feeNumerator` cannot be greater than the fee denominator.\n */\n function _setTokenRoyalty(\n uint256 tokenId,\n address receiver,\n uint96 feeNumerator\n ) internal virtual {\n require(feeNumerator <= _feeDenominator(), \"ERC2981: royalty fee will exceed salePrice\");\n require(receiver != address(0), \"ERC2981: Invalid parameters\");\n\n _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);\n }\n\n /**\n * @dev Resets royalty information for the token id back to the global default.\n */\n function _resetTokenRoyalty(uint256 tokenId) internal virtual {\n delete _tokenRoyaltyInfo[tokenId];\n }\n}\n"
},
"contracts/ERC1155/IERC1155.sol": {
"content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\r\n\r\n/**\r\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\r\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\r\n *\r\n * _Available since v3.1._\r\n */\r\ninterface IERC1155 is IERC165 {\r\n /**\r\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\r\n */\r\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\r\n\r\n /**\r\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\r\n * transfers.\r\n */\r\n event TransferBatch(\r\n address indexed operator,\r\n address indexed from,\r\n address indexed to,\r\n uint256[] ids,\r\n uint256[] values\r\n );\r\n\r\n /**\r\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\r\n * `approved`.\r\n */\r\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\r\n\r\n /**\r\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\r\n *\r\n * If an {URI} event was emitted for `id`, the standard\r\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\r\n * returned by {IERC1155MetadataURI-uri}.\r\n */\r\n event URI(string value, uint256 indexed id);\r\n\r\n /**\r\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\r\n *\r\n * Requirements:\r\n *\r\n * - `account` cannot be the zero address.\r\n */\r\n function balanceOf(address account, uint256 id) external view returns (uint256);\r\n\r\n /**\r\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\r\n *\r\n * Requirements:\r\n *\r\n * - `accounts` and `ids` must have the same length.\r\n */\r\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\r\n external\r\n view\r\n returns (uint256[] memory);\r\n\r\n /**\r\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\r\n *\r\n * Emits an {ApprovalForAll} event.\r\n *\r\n * Requirements:\r\n *\r\n * - `operator` cannot be the caller.\r\n */\r\n function setApprovalForAll(address operator, bool approved) external;\r\n\r\n /**\r\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\r\n *\r\n * See {setApprovalForAll}.\r\n */\r\n function isApprovedForAll(address account, address operator) external view returns (bool);\r\n\r\n /**\r\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\r\n *\r\n * Emits a {TransferSingle} event.\r\n *\r\n * Requirements:\r\n *\r\n * - `to` cannot be the zero address.\r\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\r\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\r\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\r\n * acceptance magic value.\r\n */\r\n function safeTransferFrom(\r\n address from,\r\n address to,\r\n uint256 id,\r\n uint256 amount,\r\n bytes calldata data\r\n ) external;\r\n\r\n /**\r\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\r\n *\r\n * Emits a {TransferBatch} event.\r\n *\r\n * Requirements:\r\n *\r\n * - `ids` and `amounts` must have the same length.\r\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\r\n * acceptance magic value.\r\n */\r\n function safeBatchTransferFrom(\r\n address from,\r\n address to,\r\n uint256[] calldata ids,\r\n uint256[] calldata amounts,\r\n bytes calldata data\r\n ) external;\r\n}\r\n"
},
"contracts/ERC1155/extensions/IERC1155MetadataURI.sol": {
"content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"../IERC1155.sol\";\r\n\r\n/**\r\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\r\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\r\n *\r\n * _Available since v3.1._\r\n */\r\ninterface IERC1155MetadataURI is IERC1155 {\r\n /**\r\n * @dev Returns the URI for token type `id`.\r\n *\r\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\r\n * clients with the actual token type ID.\r\n */\r\n function uri(uint256 id) external view returns (string memory);\r\n}\r\n"
},
"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n"
},
"@openzeppelin/contracts/utils/Address.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n"
},
"@openzeppelin/contracts/utils/Context.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n"
},
"@openzeppelin/contracts/utils/introspection/ERC165.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n"
},
"@openzeppelin/contracts/utils/introspection/IERC165.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"
},
"@openzeppelin/contracts/interfaces/IERC2981.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Interface for the NFT Royalty Standard.\n *\n * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal\n * support for royalty payments across all NFT marketplaces and ecosystem participants.\n *\n * _Available since v4.5._\n */\ninterface IERC2981 is IERC165 {\n /**\n * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of\n * exchange. The royalty amount is denominated and should be paid in that same unit of exchange.\n */\n function royaltyInfo(uint256 tokenId, uint256 salePrice)\n external\n view\n returns (address receiver, uint256 royaltyAmount);\n}\n"
}
},
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}
}