Verified contractExactMIT
SnapUniverse
Address0x97af01052ba78fbc3af047cc34ee349a55fa7a97
- Balance
0 ETH
- Transactions
459
- Compiler
solc 0.8.7
- Same code
Only this contract
Details
- Compiler
- solc 0.8.7+commit.e28d00a7
- Language
- solidity
- Optimization
- Yes, 200 runs
- EVM version
- london
- License
- MIT
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 13,672,097
- Creation transaction
- 0x585d2df782…87f01a3826
17 files
- contracts/SnapUniverse.solmain18.38 KB
- @openzeppelin/contracts/access/Ownable.sol2.24 KB
- @openzeppelin/contracts/security/Pausable.sol2.17 KB
- @openzeppelin/contracts/token/ERC20/IERC20.sol2.7 KB
- @openzeppelin/contracts/token/ERC721/ERC721.sol12.98 KB
- @openzeppelin/contracts/token/ERC721/IERC721.sol4.59 KB
- @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol858 B
- @openzeppelin/contracts/token/ERC721/extensions/ERC721Pausable.sol834 B
- @openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol1.83 KB
- @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol683 B
- @openzeppelin/contracts/utils/Address.sol7.81 KB
- @openzeppelin/contracts/utils/Context.sol923 B
- @openzeppelin/contracts/utils/Counters.sol1.25 KB
- @openzeppelin/contracts/utils/Strings.sol1.97 KB
- @openzeppelin/contracts/utils/introspection/ERC165.sol921 B
- @openzeppelin/contracts/utils/introspection/IERC165.sol786 B
- @openzeppelin/contracts/utils/math/SafeMath.sol6.83 KB
contracts/SnapUniverse.sol
// SPDX-License-Identifier: MIT License
// www.snap-universe.com
//MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWWWWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//MMMMMMMMMMMMMMMMMMMMMMMMMMMWX0kdooolllllooooodxOXWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//MMMMMMMMMMMMMMMMMMMMMMMWXkdlc:;:::cccccccc::;;;;cokXWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//MMMMMMMMMMMMMMMMMMMMMW0dc;:cccccccccccccccccccccc:;cdKWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//MMMMMMMMMMMMMMMMMMMMWk::ccccccccccccccccccccccccccc:;;o0WMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//MMMMMMMMMMMMMMMMMMMWk;:ccccccccccccccccccccccccccccccc;;oXMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//MMMMMMMMMMMMMMMMMMMK:,ccccccccccccccccccccccccccccccccc:;:OWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//MMMMMMMMMMMMMMMMMMWd,:ccccccccccccccccccccccccccccccccccc:;xWMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//MMMMMMMMMMMMMMMMMMO:;ccccccccccccccccccccccccccccccccccccc;:0MMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//MMMMMMMMMMMMMMMMMXc,:cccccc::ccc::cccc:ccccccccccccccccccc::0MMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//MMMMMMMMMMMMMMMKdc,,::cccc:;::::::::c:;;:ccccccccccccccccc;cKMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//MMMMMMMMMMMMMMWo,::;,;ccc:;;::::::::cc:;;:cccccccccccccccc;dWMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//MMMMMMMMMMMMMMNo,;,;;';cc::;;,,;,,;;;::::;:cccccccccccccc:;kMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//MMMMMMMMMMMMMMO::;'.,;:ccc:;,;;;;;:;,,,::::c::::ccccc:::c;cKMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//MMMMMMMMMMMMMMO;::;,;c:::cccc::;,,,,,'.';::c:,,::::c:::::;oWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//MMMMMMMMMMMMMMNo,c;,:::::::cc:::,..''...,;;;;;;;;::::::::,dWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//MMMMMMMMMMMMMMWo'::,:c::;::::::cc:;,,..,;;,,;;,,;;:::;;;;;xMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//MMMMMMMMMMMMMMO,':::ccc:;;;:cccccc::::c:::;;;''',,,;;;;;':0MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//MMMMMMMMMMMMWO;';,,:ccccc:;::::cccccccccc;;c:,,,''...;::oKWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//MMMMMMMMMMMXx,,:c;,:c:cccc;,;:ccccc:::cc::cc;';::;;,';d0WMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//MMMMMWNK0kd;,,;c:,;c::::c:;;:cccc::,,;:ccc:;,,:cccc:;xWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//0Oxdooc::;,;:::c:',c;;:c:;;:cccccc:;;;;;ccc:,,;cccc;oXMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//;,;;:cccc:::;;ccc,.';;:c;;:c::::::cccc;;;;;;;;:c:;;oKMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//ccc:::ccccc:;:ccc:. .';c;,::;,,;;;;::::::::cccc;':ONMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//cccccccccccc:::ccc' .,c:;:c:::::::;,,;;:;;::;;,lXMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//ccccccccccccc:;:cc,. .:c:ccccc:;;;;,,::;,;;;,,oXMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//ccccc;;:ccccc;;:cc;. 'cccccccc::;;,;::;:::;;oXMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//cc:,,',:::cc:,;ccc:. .;ccccccccccccccc:,,ckKNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//:,.',;:::::;,;cccc:.... .:cccccccc:::cc:'..l0XNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//..,:,:c:c:;,;ccccc:'';. ...',,,;;;;:cc,. .':lONMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//..,,;:cc:,,;cc;;:c:',c,. ..'''.. ...,:d0NMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//::;,,,,,',:cc:,,:c:,;c:;,,'.... .'''..''';;.,cdkKNNWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//..',:::;,,;;::;;:c:;::::;,,;,.. .. ..;:cccc:::c:;;;,,;;coxONWMMMMMMMMMMMMMMMMMMMMMMMMMMM
//,,'',;::c:;;;,,',::;:c:,',:;... ...',..;cccccccccc;,''''''';cdONMMMMMMMMMMMMMMMMMMMMMMMMM
//ccc::::cccccc:::;;,',c,.,::'.,;. ';',;'.,,;;;;::cc:::cccc:::c:;lkXMMMMMMMMMMMMMMMMMMMMMMM
//ccccccccccccccccc:;'';',:;,'',;,..',,,,;,;;;:cc:::::ccccccccccccc:lOWMMMMMMMMMMMMMMMMMMMMM
//cccccccccccccccccccc;,,;,,::::::::::cc::;;;;,,,'...';:ccccc:ccccc:,,xWMMMMMMMMMMMMMMMMMMMM
//:::cccccccccccccccccc::::cccccccccccc:::::::::::;;;;;:::cccccccccc:',OMMMMMMMMMMMMMMMMMMMM
//:::cccccccccccccccccc::cccccccccccccccccccccccccccccc:;,;c:ccccccccc;c0WMMMMMMMMMMMMMMMMMM
//:::cccccccccccccccccc;,:c:cccccccccccccccccccccccccccc:,':cccccccccc:;:0WMMMMMMMMMMMMMMMMM
//::ccccccccccccccccccc;,:c:ccccccccccccccccccccccccccccc:',cccccccccc::;:OWMMMMMMMMMMMMMMMM
//::ccccccccccccccccccc;,::::ccccccccccccccccccccccccccccc,':c:ccccccc::c;cKMMMMMMMMMMMMMMMM
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Pausable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract SnapUniverse is ERC721URIStorage, ERC721Pausable, Ownable {
using SafeMath for uint256;
using Address for address;
using Counters for Counters.Counter;
Counters.Counter private _tokenIds;
uint256 public totalSupply;
uint256 private fee;
uint256 private buyLimitMintPass;
uint256 private buyLimitWhitelist;
uint256 private buyLimitPublicSale;
uint256 private snapSupplyToMintPass;
bool private modeWhitelist;
string private _baseURIPrefix;
address private snapAddress;
address payable private cashOutWallet;
address[] private cashOutCallers;
address private constant _deadWalletAddress = 0x000000000000000000000000000000000000dEaD;
mapping (address => bool) private mintPassClaimed;
mapping (address => uint256) private mp;
mapping (address => uint256) private mintedWhiteList;
receive() external payable {}
event MintPassClaimed(address wallet, uint256 count);
constructor(address _snapAddress) ERC721("Snap! Universe", "SNAP! UNIVERSE") {
totalSupply = 10_000;
fee = 0.09 ether;
buyLimitMintPass = 25;
buyLimitWhitelist = totalSupply;
buyLimitPublicSale = totalSupply;
modeWhitelist = true;
snapAddress =_snapAddress;
snapSupplyToMintPass = 200000000000000000000;
_baseURIPrefix = "ipfs://QmNTH97qJsBkzTy3U7vNsjMErSNeaTMmbdvxzCUFB2Cmrn/";
cashOutWallet = payable(0x751ee118d4C37896479de3C1C238e84a6Fde7cC7);
cashOutCallers = [msg.sender, 0x071B6eb0199F81Bd23044B0B3456a8aABEc42AB5, 0xcbA1d08dEc5eECa6573Fd692037F483C97939716, 0x24736E4a794bc48844dBCE629bE83E859403bA4c, 0x98D9cE6C5AF6c3d28F59F76839BAd4bd673F3BE8, 0x345E4c008a5aaC91bc2b384cC636b0217210Fb49];
mp[0xcbA1d08dEc5eECa6573Fd692037F483C97939716] = 2;
mp[0x8456f1C4f8e6B1b356E5DcdA43D3b51309ef6c8F] = 4;
mp[0xb2843F7aC8d82322BC3438643fb5A1CE42DA20A4] = 2;
mp[0xe982E27715265B6FE8fd10FcBb4F13C37526CBeE] = 1;
mp[0x4579Ac723c85855F0cD945a41D4D8a70ABA589a3] = 1;
mp[0xD5Ed3eab8733ac8Ded7BfCe5fdB8D6265ee5Acc9] = 1;
mp[0x68326658D43995f9dCdaa34B4927DE48798A9cDa] = 2;
mp[0x07587c046d4d4BD97C2d64EDBfAB1c1fE28A10E5] = 4;
mp[0x3F049E5850229d18f01460DFda38c3ea6422b5a4] = 4;
mp[0x0DB0f4506F5De744052D90f04E3fcA3D1dD3600d] = 1;
mp[0x988ceCe1a783e62627cf2E95b7dcd46cD6217f15] = 3;
mp[0x3EeA9Bfa4e1E348FBCA79bEC1BFD900775701C12] = 3;
mp[0xc5BD4cbb6edF957AB6E4e27D2F14921ddc0f0dE0] = 3;
mp[0xf3F9D042781dB15c19b02B77d55A2a15a45ae305] = 11;
mp[0x22CAb0b36CC4EC24Bfd5732D07828b45E7547F9e] = 1;
mp[0xD39a841f45D230d22413D80895e3Fd95c0daEd4A] = 2;
mp[0x78E37187998bf8886e13c50252815f2571E4fC6E] = 1;
mp[0xf92EF75557F11bd68ced35edE822A6622fB0F6fc] = 4;
mp[0x483a3b616885ce3b2225B2AFaFE0CbE47b4BE1B9] = 1;
mp[0xB78fD9E442EEf5f34c939AC9209319146654A361] = 3;
mp[0x1D309f17AE5645e189268ff739DAf8FF68EBd312] = 3;
mp[0x04C1F863Aad0604119c78faC46E74f5a1d65368D] = 2;
mp[0xe24f1714203518c0972f9E81286E273b445980B5] = 4;
mp[0x4Ca6c98A67c65Dc90d3106d0d090d74C6D53fbBb] = 1;
mp[0x125377dBDB4Ed6B49F57a569A3D9282F8E3F5366] = 2;
mp[0x14df5677aa90eC0D64c631621DaD80b44f9DeAFF] = 1;
mp[0x04bfcB7b6bc81361F14c1E2C7592d712e3b9f456] = 4;
mp[0x07B167B84021419F8385fA5fA1733F6230Ec0b27] = 1;
mp[0xdCAff5C361fc6f36143394ADE1Ce84e5CDe439Ab] = 1;
mp[0x83613775bEF3111Fe58479ABb94dB247245A051f] = 1;
mp[0xCAee9112E87A90510dc280Ad6DfF500b092E383F] = 1;
mp[0xb045985c32390d3cE12300f73cEB8Dd805673027] = 4;
mp[0xd1177558b645e063f38AF09ae9454Cb3786BB9E0] = 3;
mp[0x0B01fE5189d95c0fa890fd6b431928B5dF58D027] = 1;
mp[0xC12c0577b0E1F47Ce2e2148996f6845DC24631b2] = 2;
mp[0x1F2C87b25830C710a56B2aA7035342d99BC1cBbA] = 2;
mp[0xDb925a4c46e8Ac000b80ccd82b1fdb472C70cb31] = 2;
mp[0x5fd9C4368ee7E8fc79e48fBa390c148fd16453Ee] = 2;
mp[0x88092758B19f330234CFc851Ab4Ef2B974665476] = 2;
mp[0xad9F7000c2278c1D58554e6348866104e82c2E39] = 4;
mp[0x236797eb343408668D6F5D34c0FF04387545AA3A] = 1;
mp[0xf8e8dEda67cFB656cC067A42E170B5eA852111D5] = 3;
mp[0x2bEae0f40aEE2D68fb9844B2CC70AD545B0e1150] = 1;
mp[0xfC30085ad17D7340dd73bACeFb8D9f8C6b0F307F] = 1;
mp[0x1821Ce945bbCD7253cA349c54EF0a302e88b2346] = 1;
mp[0xC9a30725312B2d137CAFfdF2c707826cb641C206] = 1;
mp[0x07211045B99A9f924c439988bbCbcDb3712f226D] = 1;
mp[0x71cfe23928616DEd724ca9DC90a64409a071D29C] = 1;
mp[0x74fac75DFd8f2B75AAebeD2614455E670be807af] = 1;
mp[0x202c07Cbc8ae17Da8Fd9eE2563067250A0f546De] = 1;
mp[0xF8D9624c05C668fee9FeB91505D273068901872d] = 1;
mp[0x023B141c2cE8f79B19fcda0DaAEE4a4542f9a2B7] = 1;
mp[0xD8bfDA9368e0DdA6d81ca79e78DDe703471dB283] = 1;
mp[0x3141F76EF4c7709d978A27B38f2971751f88cF0F] = 1;
mp[0x3Ee4c0ba4D05c3B1f7C3B3754E5ddf65e1CaC361] = 1;
mp[0xAC7CF6bA79896d90f02FB61d76502918845c1947] = 1;
mp[0x35066f85686C1f1aF829385c88CaD2DAb8a5A9b3] = 1;
mp[0x48483532FdEaAE4c3EfD9fc0fe198FD9b205f83a] = 1;
mp[0x4F3EdF987c6e434C9a57eCc2182f4e9B38B9D8dC] = 1;
mp[0xeBdBFa365Efa6d1DA06d2b7CBf7E54D2B5Dd7185] = 2;
mp[0x3D031Cd569400fD3b3f7FA9ADf6a3b131a43c197] = 1;
mp[0x1f171834FeF16233ae93BB3acA99d83021EA00c4] = 1;
mp[0x7d07B59090f481BA8FF7a67422C04595CB2C93B2] = 1;
mp[0x1cd75A8387c0e36061b270af917AFb206634918c] = 1;
mp[0x2C7F7Db1710B02F19cCB2Ab3f88Fc74A467fF5c9] = 1;
mp[0xc2DfCFa2Bf1C871cB5af60b7eFBd95864984129D] = 1;
mp[0xDe25b8bf8149913097AfA99EF52f9b6bF86De1eC] = 1;
mp[0xCaC624276Df3bA84Bbb68270769a49a1e5c270d3] = 1;
mp[0xc266672ab58f57C945fC5fe5cD89B2Ae591c6124] = 1;
mp[0xf7C4e374e116b68c5324463949Ba3c5275B27236] = 1;
mp[0x8b885f80feC49F397f0B53dB86aE8af4235C4763] = 1;
mp[0x47923342988F3fD29EE6292Ad9A440728440ce4C] = 1;
mp[0xd224c1061F9eD4bfbCddb1b45bB41eEa24b770e3] = 1;
mp[0x205c726fE98b962530acd54C57EfD600f6AAfD50] = 1;
mp[0xB45fCf6e1DAB1f15a21449d75F00Eef34fa7CB5e] = 1;
mp[0xC43327b13ec860d8303e02CDC891b064BB5B7c4e] = 1;
mp[0x45F8aef4DfaBfbF943416Db1e43f088e543bFDB6] = 1;
mp[0x83D77D2199e8FB4aE195d464701de13D68C6671f] = 1;
mp[0x18e4351436C02574b37c3526CF3D8C2057fa3Ca4] = 1;
mp[0x57fbfe9726F7c0F8BD507d23113d892D6d541F45] = 1;
mp[0x1183BDB0a24DC6ED62127F59eEe9De2fB410251A] = 1;
mp[0xA32922d422F726AD0d10Dbf65d22B86e074aF68B] = 1;
mp[0xd21f21Ed6B663028D6B9fC31f240e6D42A2E401b] = 1;
mp[0x47B3A74eDa0042BbbD4C1a08c748171004233972] = 1;
mp[0x4565F34C301f0b211854e025c67064A6a302837e] = 1;
mp[0x5DCa0725DA4ABa4c253a17Dd3Bdae912CC9cCe97] = 1;
mp[0x056161C77b4c4e51592bDff3dED1f4f14C600ECC] = 1;
mp[0x64dc4cD18A82218BEaC92310Fbde8a46BD03a5fC] = 1;
mintOwner();
_pause();
}
function setBaseURI(string memory baseURIPrefix) external onlyOwner {
_baseURIPrefix = baseURIPrefix;
}
function _baseURI() internal view override returns (string memory) {
return _baseURIPrefix;
}
function tokenURI(uint256 tokenId) public view override(ERC721, ERC721URIStorage) returns (string memory) {
return super.tokenURI(tokenId);
}
function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal whenNotPaused override(ERC721, ERC721Pausable) {
super._beforeTokenTransfer(from, to, tokenId);
}
function _burn(uint256 tokenId) internal override(ERC721, ERC721URIStorage) {
super._burn(tokenId);
}
/**
* @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);
}
function beforeMint(uint256 numberOfMints) internal view {
address sender = _msgSender();
require(!sender.isContract() && tx.origin == sender, "Bots have no power here!");
require(_tokenIds.current() + numberOfMints <= totalSupply, "Maximum amount of tokens already minted");
}
function mintPass_EWa9pesKnnMe(address wallet) whenNotPaused external returns (uint256) {
uint256 numberOfMints = getMintPass(wallet).mul(2);
uint mpFromSnap = IERC20(snapAddress).balanceOf(wallet).div(snapSupplyToMintPass);
numberOfMints = numberOfMints.add(mpFromSnap.mul(2));
if (numberOfMints > buyLimitMintPass) {
numberOfMints = buyLimitMintPass;
}
require(numberOfMints > 0, "Cannot claim");
beforeMint(numberOfMints);
require(numberOfMints <= buyLimitMintPass, "You reached buy limit from single tx");
require(!mintPassClaimed[wallet], "You reached wallet limit");
mintPassClaimed[wallet] = true;
doMint(wallet, numberOfMints);
emit MintPassClaimed(wallet, numberOfMints);
return _tokenIds.current();
}
function mintWhitelist_kJipc46qGX3K(address wallet, uint256 numberOfMints) whenNotPaused external payable returns (uint256) {
beforeMint(numberOfMints);
require(modeWhitelist, "Invoke same method but for public sale");
require(numberOfMints <= buyLimitWhitelist, "You reached buy limit from single tx");
require(mintedWhiteList[wallet].add(numberOfMints) <= buyLimitWhitelist, "You reached wallet limit");
require(msg.value >= fee * numberOfMints, "Fee is not correct.");
mintedWhiteList[wallet] = mintedWhiteList[wallet].add(numberOfMints);
doMint(wallet, numberOfMints);
return _tokenIds.current();
}
function mintPublic_NbrluxKI1WhB(address wallet, uint256 numberOfMints) whenNotPaused external payable returns (uint256) {
beforeMint(numberOfMints);
require(numberOfMints <= buyLimitPublicSale, "You reached buy limit from single tx");
require(msg.value >= fee * numberOfMints, "Fee is not correct.");
doMint(wallet, numberOfMints);
return _tokenIds.current();
}
function doMint(address wallet, uint numberOfMints) private {
for(uint i = 0; i < numberOfMints; i++) {
_tokenIds.increment();
uint256 tokenId = _tokenIds.current();
_safeMint(wallet, tokenId);
string memory tokenURISuffix = string(abi.encodePacked(toString(tokenId), ".json"));
_setTokenURI(tokenId, tokenURISuffix);
}
}
function mintOwner() private onlyOwner returns (uint256) {
require(_tokenIds.current() == 0);
doMint(msg.sender, 200);
return _tokenIds.current();
}
function mintSpecial(address wallet) external onlyOwner returns (uint256) {
doMint(wallet, 1);
totalSupply = totalSupply.add(1);
return _tokenIds.current();
}
function setTotalSupply(uint256 _totalSupply) external onlyOwner {
totalSupply = _totalSupply;
}
function setFee(uint256 _fee) external onlyOwner {
fee = _fee;
}
function setBuyLimitMintPass(uint256 _buyLimitMintPass) external onlyOwner {
buyLimitMintPass = _buyLimitMintPass;
}
function setBuyLimitWhitelist(uint256 _buyLimitWhitelist) external onlyOwner {
buyLimitWhitelist = _buyLimitWhitelist;
}
function setBuyLimitPublicSale(uint256 _buyLimitPublicSale) external onlyOwner {
buyLimitPublicSale = _buyLimitPublicSale;
}
function getFee() external view returns (uint) {
return fee;
}
function cashOut() external {
require(msg.sender == cashOutCallers[0] || msg.sender == cashOutCallers[1] || msg.sender == cashOutCallers[2] || msg.sender == cashOutCallers[3] || msg.sender == cashOutCallers[4] || msg.sender == cashOutCallers[5], "Should be called with whitelisted wallet");
cashOutWallet.call{value: address(this).balance}("");
}
function currentTokenId() external view returns (uint256) {
return _tokenIds.current();
}
function pause() external onlyOwner {
_pause();
}
function unpause() external onlyOwner {
_unpause();
}
function setModeWhitelist(bool _modeWhitelist) external onlyOwner {
modeWhitelist = _modeWhitelist;
}
function setSnapAddress(address _snapAddress) external onlyOwner {
snapAddress = _snapAddress;
}
function setSnapSupplyToMintPass(uint256 _snapSupplyToMintPass) external onlyOwner {
snapSupplyToMintPass = _snapSupplyToMintPass;
}
function setMintPass(address a, uint256 tokens) external onlyOwner {
if (tokens == 0) {
delete mp[a];
} else {
mp[a] = tokens;
}
}
function getMintPass(address _address) public view returns (uint256) {
return mp[_address];
}
}
@openzeppelin/contracts/access/Ownable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
@openzeppelin/contracts/security/Pausable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract Pausable is Context {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
constructor () {
_paused = false;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
require(!paused(), "Pausable: paused");
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
require(paused(), "Pausable: not paused");
_;
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}
@openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
@openzeppelin/contracts/token/ERC721/ERC721.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}.
*/
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping (uint256 => address) private _owners;
// Mapping owner address to token count
mapping (address => uint256) private _balances;
// Mapping from token ID to approved address
mapping (uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping (address => mapping (address => bool)) private _operatorApprovals;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
constructor (string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return interfaceId == type(IERC721).interfaceId
|| interfaceId == type(IERC721Metadata).interfaceId
|| super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _owners[tokenId];
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0
? string(abi.encodePacked(baseURI, tokenId.toString()))
: '';
}
/**
* @dev Base URI for computing {tokenURI}. Empty by default, can be overriden
* in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
require(operator != _msgSender(), "ERC721: approve to caller");
_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 {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_safeTransfer(from, to, tokenId, _data);
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `_data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(address to, uint256 tokenId, bytes memory _data) internal virtual {
_mint(to, tokenId);
require(_checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(address from, address to, uint256 tokenId) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_balances[from] -= 1;
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data)
private returns (bool)
{
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver(to).onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: transfer to non ERC721Receiver implementer");
} else {
// solhint-disable-next-line no-inline-assembly
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` will be burned.
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual { }
}
@openzeppelin/contracts/token/ERC721/IERC721.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
}
@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol
// SPDX-License-Identifier: MIT
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);
}
@openzeppelin/contracts/token/ERC721/extensions/ERC721Pausable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../ERC721.sol";
import "../../../security/Pausable.sol";
/**
* @dev ERC721 token with pausable token transfers, minting and burning.
*
* Useful for scenarios such as preventing trades until the end of an evaluation
* period, or having an emergency switch for freezing all token transfers in the
* event of a large bug.
*/
abstract contract ERC721Pausable is ERC721, Pausable {
/**
* @dev See {ERC721-_beforeTokenTransfer}.
*
* Requirements:
*
* - the contract must not be paused.
*/
function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual override {
super._beforeTokenTransfer(from, to, tokenId);
require(!paused(), "ERC721Pausable: token transfer while paused");
}
}
@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../ERC721.sol";
/**
* @dev ERC721 token with storage based token URI management.
*/
abstract contract ERC721URIStorage is ERC721 {
using Strings for uint256;
// Optional mapping for token URIs
mapping (uint256 => string) private _tokenURIs;
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721URIStorage: URI query for nonexistent token");
string memory _tokenURI = _tokenURIs[tokenId];
string memory base = _baseURI();
// If there is no base URI, return the token URI.
if (bytes(base).length == 0) {
return _tokenURI;
}
// If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).
if (bytes(_tokenURI).length > 0) {
return string(abi.encodePacked(base, _tokenURI));
}
return super.tokenURI(tokenId);
}
/**
* @dev Sets `_tokenURI` as the tokenURI of `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
require(_exists(tokenId), "ERC721URIStorage: URI set of nonexistent token");
_tokenURIs[tokenId] = _tokenURI;
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual override {
super._burn(tokenId);
if (bytes(_tokenURIs[tokenId]).length != 0) {
delete _tokenURIs[tokenId];
}
}
}
@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
@openzeppelin/contracts/utils/Address.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(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");
// solhint-disable-next-line avoid-low-level-calls
(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");
// solhint-disable-next-line avoid-low-level-calls
(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");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private 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
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
@openzeppelin/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT
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) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
@openzeppelin/contracts/utils/Counters.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides counters that can only be incremented or decremented by one. This can be used e.g. to track the number
* of elements in a mapping, issuing ERC721 ids, or counting request ids.
*
* Include with `using Counters for Counters.Counter;`
*/
library Counters {
struct Counter {
// This variable should never be directly accessed by users of the library: interactions must be restricted to
// the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
// this feature: see https://github.com/ethereum/solidity/issues/4637
uint256 _value; // default: 0
}
function current(Counter storage counter) internal view returns (uint256) {
return counter._value;
}
function increment(Counter storage counter) internal {
unchecked {
counter._value += 1;
}
}
function decrement(Counter storage counter) internal {
uint256 value = counter._value;
require(value > 0, "Counter: decrement overflow");
unchecked {
counter._value = value - 1;
}
}
}
@openzeppelin/contracts/utils/Strings.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant alphabet = "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] = alphabet[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
@openzeppelin/contracts/utils/introspection/ERC165.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
@openzeppelin/contracts/utils/introspection/IERC165.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
@openzeppelin/contracts/utils/math/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
Compiler settingsShow
{
"metadata": {
"bytecodeHash": "ipfs"
},
"libraries": {},
"optimizer": {
"runs": 200,
"enabled": true
},
"evmVersion": "london",
"remappings": []
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.