编译器
0.8.13+commit.abaa5c0e
文件 1 的 14:Address.sol
pragma solidity ^0.8.1;
library Address {
function isContract(address account) internal view returns (bool) {
return account.code.length > 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
) internal 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 的 14: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) {
return msg.data;
}
}
文件 3 的 14: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;
}
}
文件 4 的 14: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 {
_setApprovalForAll(_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 || isApprovedForAll(owner, spender) || getApproved(tokenId) == 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);
_afterTokenTransfer(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);
_afterTokenTransfer(owner, address(0), tokenId);
}
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
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);
_afterTokenTransfer(from, to, tokenId);
}
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
function _setApprovalForAll(
address owner,
address operator,
bool approved
) internal virtual {
require(owner != operator, "ERC721: approve to caller");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
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.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 {}
function _afterTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
}
文件 5 的 14:IERC165.sol
pragma solidity ^0.8.0;
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
文件 6 的 14:IERC2981.sol
pragma solidity ^0.8.0;
import "../utils/introspection/IERC165.sol";
interface IERC2981 is IERC165 {
function royaltyInfo(uint256 tokenId, uint256 salePrice)
external
view
returns (address receiver, uint256 royaltyAmount);
}
文件 7 的 14: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,
bytes calldata data
) external;
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 setApprovalForAll(address operator, bool _approved) external;
function getApproved(uint256 tokenId) external view returns (address operator);
function isApprovedForAll(address owner, address operator) external view returns (bool);
}
文件 8 的 14: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);
}
文件 9 的 14:IERC721Receiver.sol
pragma solidity ^0.8.0;
interface IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
文件 10 的 14:MerkleProof.sol
pragma solidity ^0.8.0;
library MerkleProof {
function verify(
bytes32[] memory proof,
bytes32 root,
bytes32 leaf
) internal pure returns (bool) {
return processProof(proof, leaf) == root;
}
function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
bytes32 proofElement = proof[i];
if (computedHash <= proofElement) {
computedHash = _efficientHash(computedHash, proofElement);
} else {
computedHash = _efficientHash(proofElement, computedHash);
}
}
return computedHash;
}
function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
assembly {
mstore(0x00, a)
mstore(0x20, b)
value := keccak256(0x00, 0x40)
}
}
}
文件 11 的 14: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() {
_transferOwnership(_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 {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
文件 12 的 14:ReentrancyGuard.sol
pragma solidity ^0.8.0;
abstract contract ReentrancyGuard {
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
modifier nonReentrant() {
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
_status = _ENTERED;
_;
_status = _NOT_ENTERED;
}
}
文件 13 的 14:Strings.sol
pragma solidity ^0.8.0;
library Strings {
bytes16 private constant _HEX_SYMBOLS = "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] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
文件 14 的 14:TheCryptomasksProject.sol
pragma solidity ^0.8.12;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/interfaces/IERC2981.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
contract TheCryptomasksProject is ERC721, IERC2981, ReentrancyGuard, Ownable {
using Strings for uint256;
bool private phase1 = false;
bool private phase2 = false;
bool private phase3 = false;
bool public paused = true;
uint256 public priceCommon = 0.02 ether;
uint256 public priceRare = 0.04 ether;
uint256 public priceEpic = 0.06 ether;
uint256 public priceLegendary = 0.12 ether;
uint256 public priceMythic = 0.25 ether;
uint256 public pricePublicSale = 0.03 ether;
uint256 public maxSupply = 555;
uint256 private mythicCounter = 1;
uint256 private legendaryCounter = 5;
uint256 private epicCounter = 30;
uint256 private rareCounter = 115;
uint256 private commonCounter = 270;
string public baseURI = "ipfs://Qmbpnw4zHg3XvhPz2QyUuHPMWgxfT3SstQUv9Z1bEgmTS8/";
string private collectionURI = "ipfs://QmQwYkbVj7TcamQa3NsuGvFVpEGTKWks8RPkSm19sEktVS/";
address private proxyAddr = 0xa5409ec958C83C3f309868babACA7c86DCB077c1;
address private projectWallet;
address private royaltyReceiver;
uint256 private royaltyPercentBps;
bytes32 private whitelist;
uint256 private limit = 5;
mapping(address => bool) public claimed;
mapping(address => bool) public minted;
mapping(address => uint256) public mints;
mapping(address => bool) private partners;
constructor() ERC721("TheCryptomasksProject", "MASK") {}
function claim(uint256 rank, bytes32[] calldata proof) public payable canMint() {
require(phase1, "phase 1 not started");
require(!claimed[msg.sender], "already claimed");
require(_verify(_leaf(msg.sender, rank), proof), "invalid proof");
uint256 tokenId = _getTokenId(rank);
_mint(msg.sender, tokenId);
_updateCounter(tokenId);
claimed[msg.sender] = true;
}
function presaleMint(uint256 rank, bytes32[] calldata proof) public payable canMint() {
require(phase2, "phase 2 not started");
require(!minted[msg.sender], "already minted");
require(_verify(_leaf(msg.sender, rank), proof), "invalid proof");
uint256 tokenId = _getTokenId(rank);
require(msg.value >= getPrice(tokenId), "funds n/a");
_mint(msg.sender, tokenId);
_updateCounter(tokenId);
minted[msg.sender] = true;
}
function publicMint() public payable canMint() {
require(phase3, "phase 3 not started");
require(mints[msg.sender] < limit, "minted max");
uint256 tokenId = _getTokenIdRandom();
require(msg.value >= pricePublicSale, "funds n/a");
_mint(msg.sender, tokenId);
_updateCounter(tokenId);
mints[msg.sender] += 1;
}
function getPrice(uint256 rank) public view returns (uint256 priceIs) {
if (rank == 1) { return priceMythic; }
if (rank == 2) { return priceLegendary; }
if (rank == 3) { return priceEpic; }
if (rank == 4) { return priceRare; }
if (rank == 5) { return priceCommon; }
}
function getSaleStatus() public view returns (uint256 phaseIs) {
if (phase1) { return 1; }
if (phase2) { return 2; }
if (phase3) { return 3; }
else { return 0; }
}
modifier canMint() {
require(tx.origin == msg.sender, "humans only");
require(!paused, "contract paused");
require(totalSupply() < maxSupply, "sold out");
_;
}
function _getTokenId(uint256 rank) internal virtual returns (uint256 newToken) {
require(0 < rank && rank < 6, "ranks are 1-5");
if (rank == 1) {
require(mythicCounter < 5, "supply n/a");
return mythicCounter;
}
if (rank == 2) {
require(legendaryCounter < 30, "supply n/a");
return legendaryCounter;
}
if (rank == 3) {
require(epicCounter < 115, "supply n/a");
return epicCounter;
}
if (rank == 4) {
require(rareCounter < 270, "supply n/a");
return rareCounter;
}
if (rank == 5) {
require(commonCounter < 555, "supply n/a");
return commonCounter;
}
}
function _random() internal view returns (uint256) {
uint256 randomnumber = uint256(keccak256(abi.encodePacked(
block.timestamp,
msg.sender,
totalSupply()
))) % 5;
randomnumber = randomnumber + 1;
return randomnumber;
}
function _getTokenIdRandom() internal view returns (uint256 newToken) {
uint256 luck = _random();
if (luck == 5) {
if (mythicCounter < 5) { return mythicCounter; }
if (legendaryCounter < 30) { return legendaryCounter; }
if (epicCounter < 115) { return epicCounter; }
if (rareCounter < 270) { return rareCounter; }
if (commonCounter < 555) { return commonCounter; }
}
else if (luck == 4) {
if (legendaryCounter < 30) { return legendaryCounter; }
if (epicCounter < 115) { return epicCounter; }
if (rareCounter < 270) { return rareCounter; }
if (commonCounter < 555) { return commonCounter; }
if (mythicCounter < 5) { return mythicCounter; }
}
else if (luck == 3) {
if (epicCounter < 115) { return epicCounter; }
if (rareCounter < 270) { return rareCounter; }
if (commonCounter < 555) { return commonCounter; }
if (mythicCounter < 5) { return mythicCounter; }
if (legendaryCounter < 30) { return legendaryCounter; }
}
else if (luck == 2) {
if (rareCounter < 270) { return rareCounter; }
if (epicCounter < 115) { return epicCounter; }
if (legendaryCounter < 30) { return legendaryCounter; }
if (mythicCounter < 5) { return mythicCounter; }
if (commonCounter < 555) { return commonCounter; }
}
else if (luck == 1) {
if (commonCounter < 555) { return commonCounter; }
if (rareCounter < 270) { return rareCounter; }
if (epicCounter < 115) { return epicCounter; }
if (legendaryCounter < 30) { return legendaryCounter; }
if (mythicCounter < 5) { return mythicCounter; }
}
}
function _updateCounter(uint256 tokenId) internal virtual {
if (0 < tokenId && tokenId < 5) { mythicCounter++; }
if (4 < tokenId && tokenId < 30) { legendaryCounter++; }
if (29 < tokenId && tokenId < 115) { epicCounter++; }
if (114 < tokenId && tokenId < 270) { rareCounter++; }
if (269 < tokenId && tokenId < 556) { commonCounter++; }
}
function _leaf(address account, uint256 rank) internal pure returns (bytes32) {
return keccak256(abi.encodePacked(account, rank));
}
function _verify(bytes32 _leafNode, bytes32[] memory proof) internal view returns (bool) {
return MerkleProof.verify(proof, whitelist, _leafNode);
}
function airdropRandom(address[] memory _addresses) public payable onlyOwner canMint() {
require(_addresses.length + totalSupply() < maxSupply, "supply n/a");
for (uint256 i; i < _addresses.length; i++) {
uint256 tokenId = _getTokenIdRandom();
_mint(_addresses[i], tokenId);
_updateCounter(tokenId);
}
}
function airdrop(address[] memory _addresses, uint256 rank) public payable onlyOwner canMint() {
require(0 < rank && rank < 6, "ranks are 1-5");
if (rank == 1) {
require(_addresses.length + mythicCounter < 5, "supply n/a");
for (uint256 i; i < _addresses.length; i++) {
_mint(_addresses[i], mythicCounter);
mythicCounter++;
}
}
if (rank == 2) {
require(_addresses.length + legendaryCounter < 30, "supply n/a");
for (uint256 i; i < _addresses.length; i++) {
_mint(_addresses[i], legendaryCounter);
legendaryCounter++;
}
}
if (rank == 3) {
require(_addresses.length + epicCounter < 115, "supply n/a");
for (uint256 i; i < _addresses.length; i++) {
_mint(_addresses[i], epicCounter);
epicCounter++;
}
}
if (rank == 4) {
require(_addresses.length + rareCounter < 270, "supply n/a");
for (uint256 i; i < _addresses.length; i++) {
_mint(_addresses[i], rareCounter);
rareCounter++;
}
}
if (rank == 5) {
require(_addresses.length + commonCounter < 555, "supply n/a");
for (uint256 i; i < _addresses.length; i++) {
_mint(_addresses[i], commonCounter);
commonCounter++;
}
}
}
function giveaway(address wallet, uint256 rank) public payable onlyOwner canMint() {
require(wallet != address(0), "invalid address");
require(0 < rank && rank < 6, "ranks are 1-5");
if (rank == 1) {
require(mythicCounter < 5, "supply n/a");
_mint(wallet, mythicCounter);
mythicCounter++;
}
if (rank == 2) {
require(legendaryCounter < 30, "supply n/a");
_mint(wallet, legendaryCounter);
legendaryCounter++;
}
if (rank == 3) {
require(epicCounter < 115, "supply n/a");
_mint(wallet, epicCounter);
epicCounter++;
}
if (rank == 4) {
require(rareCounter < 270, "supply n/a");
_mint(wallet, rareCounter);
rareCounter++;
}
if (rank == 5) {
require(commonCounter < 555, "supply n/a");
_mint(wallet, commonCounter);
commonCounter++;
}
}
function setWhitelist(bytes32 whitelistRoot) public onlyOwner {
whitelist = whitelistRoot;
}
function setPresaleConfig(uint256 _common, uint256 _rare, uint256 _epic, uint256 _legend, uint256 _mythic) public onlyOwner {
priceCommon = _common;
priceRare = _rare;
priceEpic = _epic;
priceLegendary = _legend;
priceMythic = _mythic;
}
function setPublicSaleConfig(uint256 _publicPrice, uint256 _limitPerWallet) public onlyOwner {
pricePublicSale = _publicPrice;
limit = _limitPerWallet;
}
function setCollectionURI(string memory _collectionURI) public onlyOwner {
collectionURI = _collectionURI;
}
function setOpenseaProxy(address _proxyAddr) public onlyOwner {
proxyAddr = _proxyAddr;
}
function setPartner(address _partnerAddr) public onlyOwner {
partners[_partnerAddr] = !partners[_partnerAddr];
}
function setPaused() public onlyOwner {
paused = !paused;
}
function startPhase1() public onlyOwner {
phase1 = true;
phase2 = false;
phase3 = false;
}
function startPhase2() public onlyOwner {
phase1 = false;
phase2 = true;
phase3 = false;
}
function startPhase3() public onlyOwner {
phase1 = false;
phase2 = false;
phase3 = true;
}
function setBaseURI(string memory _baseURI) public onlyOwner {
baseURI = _baseURI;
}
function setRoyalty(address _royaltyReceiver, uint256 _percentBPs) public onlyOwner {
royaltyReceiver = _royaltyReceiver;
royaltyPercentBps = _percentBPs;
}
function setProjectWallet(address _projectWallet) public onlyOwner {
projectWallet = _projectWallet;
}
function withdrawETH() public onlyOwner nonReentrant {
require(projectWallet != address(0), "no wallet found");
(bool success, ) = payable(projectWallet).call{value: address(this).balance}("");
require(success, "withdraw failed");
}
function isApprovedForAll(address owner, address operator) public override view returns (bool) {
OpenSeaProxyRegistry proxyRegistry = OpenSeaProxyRegistry(proxyAddr);
if (address(proxyRegistry.proxies(owner)) == operator || partners[operator]) return true;
return super.isApprovedForAll(owner, operator);
}
function royaltyInfo(uint256 _tokenId, uint256 _salePrice) external view returns (address receiver, uint256 royaltyAmount) {
require(_exists(_tokenId), "Cannot query non-existent token");
return (royaltyReceiver, (_salePrice * royaltyPercentBps) / 10000);
}
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721, IERC165) returns (bool) {
return (interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId));
}
function contractURI() public view returns (string memory) {
return collectionURI;
}
function tokenURI(uint256 _tokenId) public view override returns (string memory) {
require(_exists(_tokenId), "Token does not exist.");
return string(abi.encodePacked(baseURI, Strings.toString(_tokenId)));
}
function totalSupply() public view returns (uint256) {
uint256 m = mythicCounter - 1;
uint256 l = legendaryCounter - 5;
uint256 e = epicCounter - 30;
uint256 r = rareCounter - 115;
uint256 c = commonCounter - 270;
uint256 totalMinted = m + l + e + r + c;
return totalMinted;
}
function walletOfOwner(address _address) public virtual view returns (uint256[] memory) {
uint256 _balance = balanceOf(_address);
uint256[] memory _tokens = new uint256[] (_balance);
uint256 _index;
uint256 _loop = totalSupply();
for (uint256 i = 0; i < _loop; i++) {
bool _exists = _exists(i);
if (_exists) {
if (ownerOf(i) == _address) { _tokens[_index] = i; _index++; }
}
else if (!_exists && _tokens[_balance -1] == 0) { _loop++; }
}
return _tokens;
}
}
contract OwnableDelegateProxy { }
contract OpenSeaProxyRegistry {
mapping(address => OwnableDelegateProxy) public proxies;
}
{
"compilationTarget": {
"contracts/TheCryptomasksProject.sol": "TheCryptomasksProject"
},
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 555
},
"remappings": []
}
[{"inputs":[],"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":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address[]","name":"_addresses","type":"address[]"},{"internalType":"uint256","name":"rank","type":"uint256"}],"name":"airdrop","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_addresses","type":"address[]"}],"name":"airdropRandom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"rank","type":"uint256"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"claim","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"claimed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"rank","type":"uint256"}],"name":"getPrice","outputs":[{"internalType":"uint256","name":"priceIs","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSaleStatus","outputs":[{"internalType":"uint256","name":"phaseIs","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"wallet","type":"address"},{"internalType":"uint256","name":"rank","type":"uint256"}],"name":"giveaway","outputs":[],"stateMutability":"payable","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":[],"name":"maxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"minted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"mints","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"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":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"rank","type":"uint256"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"presaleMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"priceCommon","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceEpic","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceLegendary","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceMythic","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pricePublicSale","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceRare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"publicMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"royaltyAmount","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":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_baseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_collectionURI","type":"string"}],"name":"setCollectionURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_proxyAddr","type":"address"}],"name":"setOpenseaProxy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_partnerAddr","type":"address"}],"name":"setPartner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"setPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_common","type":"uint256"},{"internalType":"uint256","name":"_rare","type":"uint256"},{"internalType":"uint256","name":"_epic","type":"uint256"},{"internalType":"uint256","name":"_legend","type":"uint256"},{"internalType":"uint256","name":"_mythic","type":"uint256"}],"name":"setPresaleConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_projectWallet","type":"address"}],"name":"setProjectWallet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_publicPrice","type":"uint256"},{"internalType":"uint256","name":"_limitPerWallet","type":"uint256"}],"name":"setPublicSaleConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_royaltyReceiver","type":"address"},{"internalType":"uint256","name":"_percentBPs","type":"uint256"}],"name":"setRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"whitelistRoot","type":"bytes32"}],"name":"setWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startPhase1","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startPhase2","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startPhase3","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":[{"internalType":"address","name":"_address","type":"address"}],"name":"walletOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawETH","outputs":[],"stateMutability":"nonpayable","type":"function"}]