文件 1 的 17:Address.sol
pragma solidity ^0.8.0;
library Address {
function isContract(address account) internal view returns (bool) {
uint256 size;
assembly { size := extcodesize(account) }
return size > 0;
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
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");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
文件 2 的 17:Context.sol
pragma solidity ^0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this;
return msg.data;
}
}
文件 3 的 17:Counters.sol
pragma solidity ^0.8.0;
library Counters {
struct Counter {
uint256 _value;
}
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;
}
}
}
文件 4 的 17:ERC165.sol
pragma solidity ^0.8.0;
import "./IERC165.sol";
abstract contract ERC165 is IERC165 {
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
文件 5 的 17:ERC721.sol
pragma solidity ^0.8.0;
import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
string private _name;
string private _symbol;
mapping (uint256 => address) private _owners;
mapping (address => uint256) private _balances;
mapping (uint256 => address) private _tokenApprovals;
mapping (address => mapping (address => bool)) private _operatorApprovals;
constructor (string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return interfaceId == type(IERC721).interfaceId
|| interfaceId == type(IERC721Metadata).interfaceId
|| super.supportsInterface(interfaceId);
}
function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _balances[owner];
}
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;
}
function name() public view virtual override returns (string memory) {
return _name;
}
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
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()))
: '';
}
function _baseURI() internal view virtual returns (string memory) {
return "";
}
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);
}
function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
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);
}
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
function transferFrom(address from, address to, uint256 tokenId) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transfer(from, to, tokenId);
}
function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
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);
}
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");
}
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
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));
}
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
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");
}
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);
}
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
}
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);
_approve(address(0), tokenId);
_balances[from] -= 1;
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
}
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
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 {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual { }
}
文件 6 的 17:ERC721Pausable.sol
pragma solidity ^0.8.0;
import "../ERC721.sol";
import "../../../security/Pausable.sol";
abstract contract ERC721Pausable is ERC721, Pausable {
function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual override {
super._beforeTokenTransfer(from, to, tokenId);
require(!paused(), "ERC721Pausable: token transfer while paused");
}
}
文件 7 的 17:ERC721URIStorage.sol
pragma solidity ^0.8.0;
import "../ERC721.sol";
abstract contract ERC721URIStorage is ERC721 {
using Strings for uint256;
mapping (uint256 => string) private _tokenURIs;
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 (bytes(base).length == 0) {
return _tokenURI;
}
if (bytes(_tokenURI).length > 0) {
return string(abi.encodePacked(base, _tokenURI));
}
return super.tokenURI(tokenId);
}
function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
require(_exists(tokenId), "ERC721URIStorage: URI set of nonexistent token");
_tokenURIs[tokenId] = _tokenURI;
}
function _burn(uint256 tokenId) internal virtual override {
super._burn(tokenId);
if (bytes(_tokenURIs[tokenId]).length != 0) {
delete _tokenURIs[tokenId];
}
}
}
文件 8 的 17:IERC165.sol
pragma solidity ^0.8.0;
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
文件 9 的 17:IERC20.sol
pragma solidity ^0.8.0;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
文件 10 的 17:IERC721.sol
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
interface IERC721 is IERC165 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
function balanceOf(address owner) external view returns (uint256 balance);
function ownerOf(uint256 tokenId) external view returns (address owner);
function safeTransferFrom(address from, address to, uint256 tokenId) external;
function transferFrom(address from, address to, uint256 tokenId) external;
function approve(address to, uint256 tokenId) external;
function getApproved(uint256 tokenId) external view returns (address operator);
function setApprovalForAll(address operator, bool _approved) external;
function isApprovedForAll(address owner, address operator) external view returns (bool);
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
}
文件 11 的 17:IERC721Metadata.sol
pragma solidity ^0.8.0;
import "../IERC721.sol";
interface IERC721Metadata is IERC721 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function tokenURI(uint256 tokenId) external view returns (string memory);
}
文件 12 的 17:IERC721Receiver.sol
pragma solidity ^0.8.0;
interface IERC721Receiver {
function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4);
}
文件 13 的 17:Ownable.sol
pragma solidity ^0.8.0;
import "../utils/Context.sol";
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
文件 14 的 17:Pausable.sol
pragma solidity ^0.8.0;
import "../utils/Context.sol";
abstract contract Pausable is Context {
event Paused(address account);
event Unpaused(address account);
bool private _paused;
constructor () {
_paused = false;
}
function paused() public view virtual returns (bool) {
return _paused;
}
modifier whenNotPaused() {
require(!paused(), "Pausable: paused");
_;
}
modifier whenPaused() {
require(paused(), "Pausable: not paused");
_;
}
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}
文件 15 的 17:SafeMath.sol
pragma solidity ^0.8.0;
library SafeMath {
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);
}
}
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
文件 16 的 17:SnapUniverse.sol
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);
}
function toString(uint256 value) internal pure returns (string memory) {
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];
}
}
文件 17 的 17:Strings.sol
pragma solidity ^0.8.0;
library Strings {
bytes16 private constant alphabet = "0123456789abcdef";
function toString(uint256 value) internal pure returns (string memory) {
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 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);
}
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);
}
}
{
"compilationTarget": {
"contracts/SnapUniverse.sol": "SnapUniverse"
},
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": []
}
[{"inputs":[{"internalType":"address","name":"_snapAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"wallet","type":"address"},{"indexed":false,"internalType":"uint256","name":"count","type":"uint256"}],"name":"MintPassClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cashOut","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"getMintPass","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"wallet","type":"address"}],"name":"mintPass_EWa9pesKnnMe","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"wallet","type":"address"},{"internalType":"uint256","name":"numberOfMints","type":"uint256"}],"name":"mintPublic_NbrluxKI1WhB","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"wallet","type":"address"}],"name":"mintSpecial","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"wallet","type":"address"},{"internalType":"uint256","name":"numberOfMints","type":"uint256"}],"name":"mintWhitelist_kJipc46qGX3K","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"baseURIPrefix","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_buyLimitMintPass","type":"uint256"}],"name":"setBuyLimitMintPass","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_buyLimitPublicSale","type":"uint256"}],"name":"setBuyLimitPublicSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_buyLimitWhitelist","type":"uint256"}],"name":"setBuyLimitWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"a","type":"address"},{"internalType":"uint256","name":"tokens","type":"uint256"}],"name":"setMintPass","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_modeWhitelist","type":"bool"}],"name":"setModeWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_snapAddress","type":"address"}],"name":"setSnapAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_snapSupplyToMintPass","type":"uint256"}],"name":"setSnapSupplyToMintPass","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_totalSupply","type":"uint256"}],"name":"setTotalSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]