编译器
0.8.17+commit.8df45f5f
文件 1 的 14:DefaultOperatorFilterer.sol
pragma solidity ^0.8.13;
import {OperatorFilterer} from "./OperatorFilterer.sol";
abstract contract DefaultOperatorFilterer is OperatorFilterer {
address constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6);
constructor() OperatorFilterer(DEFAULT_SUBSCRIPTION, true) {}
}
文件 2 的 14:ERC173.sol
pragma solidity 0.8.17;
import "../interfaces/IERC173.sol";
abstract contract ERC173 is IERC173 {
error IERC173_NOT_OWNER( address operator );
address private _owner;
modifier onlyOwner() {
address _sender_ = msg.sender;
if ( owner() != _sender_ ) {
revert IERC173_NOT_OWNER( _sender_ );
}
_;
}
function _setOwner( address owner_ ) internal {
_owner = owner_;
}
function owner() public view virtual returns ( address ) {
return _owner;
}
function transferOwnership( address newOwner_ ) public virtual onlyOwner {
address _oldOwner_ = _owner;
_owner = newOwner_;
emit OwnershipTransferred( _oldOwner_, newOwner_ );
}
}
文件 3 的 14:IERC165.sol
pragma solidity 0.8.17;
interface IERC165 {
function supportsInterface(bytes4 interfaceID) external view returns (bool);
}
文件 4 的 14:IERC173.sol
pragma solidity 0.8.17;
interface IERC173 {
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function owner() view external returns(address);
function transferOwnership(address _newOwner) external;
}
文件 5 的 14:IERC721.sol
pragma solidity 0.8.17;
interface IERC721 {
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 );
function ownerOf( uint256 tokenId_ ) external view returns ( address );
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 approved_, uint256 tokenId_ ) external;
function setApprovalForAll( address operator_, bool approved_ ) external;
function getApproved( uint256 tokenId_ ) external view returns ( address );
function isApprovedForAll( address owner_, address operator_ ) external view returns ( bool );
}
文件 6 的 14:IERC721Enumerable.sol
pragma solidity 0.8.17;
interface IERC721Enumerable {
function totalSupply() external view returns ( uint256 );
function tokenByIndex( uint256 index_ ) external view returns ( uint256 );
function tokenOfOwnerByIndex( address owner_, uint256 index_ ) external view returns ( uint256 );
}
文件 7 的 14:IERC721Errors.sol
pragma solidity 0.8.17;
interface IERC721Errors {
error IERC721_CALLER_NOT_APPROVED( address tokenOwner, address operator, uint256 tokenId );
error IERC721_INVALID_APPROVAL( address operator );
error IERC721_INVALID_TRANSFER();
error IERC721_INVALID_TRANSFER_FROM( address tokenOwner, address from, uint256 tokenId );
error IERC721_NONEXISTANT_TOKEN( uint256 tokenId );
error IERC721_NON_ERC721_RECEIVER( address receiver );
error IERC721Enumerable_INDEX_OUT_OF_BOUNDS( uint256 index );
error IERC721Enumerable_OWNER_INDEX_OUT_OF_BOUNDS( address tokenOwner, uint256 index );
}
文件 8 的 14:IERC721Metadata.sol
pragma solidity 0.8.17;
interface IERC721Metadata {
function name() external view returns ( string memory _name );
function symbol() external view returns ( string memory _symbol );
function tokenURI( uint256 _tokenId ) external view returns ( string memory );
}
文件 9 的 14:IERC721Receiver.sol
pragma solidity 0.8.17;
interface IERC721Receiver {
function onERC721Received( address operator_, address from_, uint256 tokenId_, bytes calldata data_ ) external returns( bytes4 );
}
文件 10 的 14:IOperatorFilterRegistry.sol
pragma solidity ^0.8.13;
interface IOperatorFilterRegistry {
function isOperatorAllowed(address registrant, address operator)
external
view
returns (bool);
function register(address registrant) external;
function registerAndSubscribe(address registrant, address subscription)
external;
function registerAndCopyEntries(
address registrant,
address registrantToCopy
) external;
function updateOperator(
address registrant,
address operator,
bool filtered
) external;
function updateOperators(
address registrant,
address[] calldata operators,
bool filtered
) external;
function updateCodeHash(
address registrant,
bytes32 codehash,
bool filtered
) external;
function updateCodeHashes(
address registrant,
bytes32[] calldata codeHashes,
bool filtered
) external;
function subscribe(address registrant, address registrantToSubscribe)
external;
function unsubscribe(address registrant, bool copyExistingEntries) external;
function subscriptionOf(address addr) external returns (address registrant);
function subscribers(address registrant)
external
returns (address[] memory);
function subscriberAt(address registrant, uint256 index)
external
returns (address);
function copyEntriesOf(address registrant, address registrantToCopy)
external;
function isOperatorFiltered(address registrant, address operator)
external
returns (bool);
function isCodeHashOfFiltered(address registrant, address operatorWithCode)
external
returns (bool);
function isCodeHashFiltered(address registrant, bytes32 codeHash)
external
returns (bool);
function filteredOperators(address addr)
external
returns (address[] memory);
function filteredCodeHashes(address addr)
external
returns (bytes32[] memory);
function filteredOperatorAt(address registrant, uint256 index)
external
returns (address);
function filteredCodeHashAt(address registrant, uint256 index)
external
returns (bytes32);
function isRegistered(address addr) external returns (bool);
function codeHashOf(address addr) external returns (bytes32);
}
文件 11 的 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 verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
return processProofCalldata(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++) {
computedHash = _hashPair(computedHash, proof[i]);
}
return computedHash;
}
function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = _hashPair(computedHash, proof[i]);
}
return computedHash;
}
function multiProofVerify(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProof(proof, proofFlags, leaves) == root;
}
function multiProofVerifyCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProofCalldata(proof, proofFlags, leaves) == root;
}
function processMultiProof(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32[] memory leaves
) internal pure returns (bytes32 merkleRoot) {
uint256 leavesLen = leaves.length;
uint256 proofLen = proof.length;
uint256 totalHashes = proofFlags.length;
require(leavesLen + proofLen - 1 == totalHashes, "MerkleProof: invalid multiproof");
bytes32[] memory hashes = new bytes32[](totalHashes);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
for (uint256 i = 0; i < totalHashes; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i]
? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
: proof[proofPos++];
hashes[i] = _hashPair(a, b);
}
if (totalHashes > 0) {
require(proofPos == proofLen, "MerkleProof: invalid multiproof");
unchecked {
return hashes[totalHashes - 1];
}
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
function processMultiProofCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32[] memory leaves
) internal pure returns (bytes32 merkleRoot) {
uint256 leavesLen = leaves.length;
uint256 proofLen = proof.length;
uint256 totalHashes = proofFlags.length;
require(leavesLen + proofLen - 1 == totalHashes, "MerkleProof: invalid multiproof");
bytes32[] memory hashes = new bytes32[](totalHashes);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
for (uint256 i = 0; i < totalHashes; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i]
? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
: proof[proofPos++];
hashes[i] = _hashPair(a, b);
}
if (totalHashes > 0) {
require(proofPos == proofLen, "MerkleProof: invalid multiproof");
unchecked {
return hashes[totalHashes - 1];
}
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {
return a < b ? _efficientHash(a, b) : _efficientHash(b, a);
}
function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
assembly {
mstore(0x00, a)
mstore(0x20, b)
value := keccak256(0x00, 0x40)
}
}
}
文件 12 的 14:OperatorFilterer.sol
pragma solidity ^0.8.13;
import {IOperatorFilterRegistry} from "./IOperatorFilterRegistry.sol";
abstract contract OperatorFilterer {
error OperatorNotAllowed(address operator);
IOperatorFilterRegistry constant operatorFilterRegistry =
IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E);
constructor(address subscriptionOrRegistrantToCopy, bool subscribe) {
if (address(operatorFilterRegistry).code.length > 0) {
if (subscribe) {
operatorFilterRegistry.registerAndSubscribe(
address(this),
subscriptionOrRegistrantToCopy
);
} else {
if (subscriptionOrRegistrantToCopy != address(0)) {
operatorFilterRegistry.registerAndCopyEntries(
address(this),
subscriptionOrRegistrantToCopy
);
} else {
operatorFilterRegistry.register(address(this));
}
}
}
}
modifier onlyAllowedOperator(address from) virtual {
if (address(operatorFilterRegistry).code.length > 0) {
if (from == msg.sender) {
_;
return;
}
if (
!(operatorFilterRegistry.isOperatorAllowed(
address(this),
msg.sender
) &&
operatorFilterRegistry.isOperatorAllowed(
address(this),
from
))
) {
revert OperatorNotAllowed(msg.sender);
}
}
_;
}
}
文件 13 的 14:Reg_ERC721Batch.sol
pragma solidity 0.8.17;
import "./interfaces/IERC721Errors.sol";
import "./interfaces/IERC165.sol";
import "./interfaces/IERC721.sol";
import "./interfaces/IERC721Enumerable.sol";
import "./interfaces/IERC721Metadata.sol";
import "./interfaces/IERC721Receiver.sol";
abstract contract Reg_ERC721Batch is
IERC721Errors,
IERC165,
IERC721,
IERC721Metadata,
IERC721Enumerable
{
uint256 private _nextId = 1;
string public name;
string public symbol;
mapping(uint256 => address) public getApproved;
mapping(address => mapping(address => bool)) private _operatorApprovals;
mapping(uint256 => address) private _owners;
string private _baseURI;
function __init_ERC721Metadata(
string memory name_,
string memory symbol_,
string memory baseURI_
) internal {
name = name_;
symbol = symbol_;
_baseURI = baseURI_;
}
modifier exists(uint256 tokenId_) {
if (!_exists(tokenId_)) {
revert IERC721_NONEXISTANT_TOKEN(tokenId_);
}
_;
}
function _balanceOf(address tokenOwner_)
internal
view
virtual
returns (uint256)
{
if (tokenOwner_ == address(0)) {
return 0;
}
uint256 _count_ = 0;
address _currentTokenOwner_;
for (uint256 i = 1; i < _nextId; ++i) {
if (_exists(i)) {
if (_owners[i] != address(0)) {
_currentTokenOwner_ = _owners[i];
}
if (tokenOwner_ == _currentTokenOwner_) {
_count_++;
}
}
}
return _count_;
}
function _checkOnERC721Received(
address from_,
address to_,
uint256 tokenId_,
bytes memory data_
) internal virtual returns (bool) {
uint256 _size_;
assembly {
_size_ := extcodesize(to_)
}
if (_size_ > 0) {
try
IERC721Receiver(to_).onERC721Received(
msg.sender,
from_,
tokenId_,
data_
)
returns (bytes4 retval) {
return retval == IERC721Receiver.onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert IERC721_NON_ERC721_RECEIVER(to_);
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
function _exists(uint256 tokenId_) internal view virtual returns (bool) {
if (tokenId_ == 0) {
return false;
}
return tokenId_ < _nextId;
}
function _isApprovedForAll(address tokenOwner_, address operator_)
internal
view
virtual
returns (bool)
{
return _operatorApprovals[tokenOwner_][operator_];
}
function _isApprovedOrOwner(
address tokenOwner_,
address operator_,
uint256 tokenId_
) internal view virtual returns (bool) {
bool _isApproved_ = operator_ == tokenOwner_ ||
operator_ == getApproved[tokenId_] ||
_isApprovedForAll(tokenOwner_, operator_);
return _isApproved_;
}
function _mint(address to_, uint256 qty_) internal virtual {
uint256 _firstToken_ = _nextId;
uint256 _nextStart_ = _firstToken_ + qty_;
uint256 _lastToken_ = _nextStart_ - 1;
_owners[_firstToken_] = to_;
if (_lastToken_ > _firstToken_) {
_owners[_lastToken_] = to_;
}
_nextId = _nextStart_;
if (!_checkOnERC721Received(address(0), to_, _firstToken_, "")) {
revert IERC721_NON_ERC721_RECEIVER(to_);
}
for (uint256 i = _firstToken_; i < _nextStart_; ++i) {
emit Transfer(address(0), to_, i);
}
}
function _ownerOf(uint256 tokenId_)
internal
view
virtual
returns (address)
{
uint256 _tokenId_ = tokenId_;
address _tokenOwner_ = _owners[_tokenId_];
while (_tokenOwner_ == address(0)) {
_tokenId_--;
_tokenOwner_ = _owners[_tokenId_];
}
return _tokenOwner_;
}
function _setBaseURI(string memory baseURI_) internal virtual {
_baseURI = baseURI_;
}
function _totalSupply() internal view virtual returns (uint256) {
return supplyMinted();
}
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 _transfer(
address from_,
address to_,
uint256 tokenId_
) internal virtual {
getApproved[tokenId_] = address(0);
uint256 _previousId_ = tokenId_ > 1 ? tokenId_ - 1 : 1;
uint256 _nextId_ = tokenId_ + 1;
bool _previousShouldUpdate_ = _previousId_ < tokenId_ &&
_exists(_previousId_) &&
_owners[_previousId_] == address(0);
bool _nextShouldUpdate_ = _exists(_nextId_) &&
_owners[_nextId_] == address(0);
if (_previousShouldUpdate_) {
_owners[_previousId_] = from_;
}
if (_nextShouldUpdate_) {
_owners[_nextId_] = from_;
}
_owners[tokenId_] = to_;
emit Transfer(from_, to_, tokenId_);
}
function approve(address to_, uint256 tokenId_)
public
virtual
exists(tokenId_)
{
address _operator_ = msg.sender;
address _tokenOwner_ = _ownerOf(tokenId_);
if (to_ == _tokenOwner_) {
revert IERC721_INVALID_APPROVAL(to_);
}
bool _isApproved_ = _isApprovedOrOwner(
_tokenOwner_,
_operator_,
tokenId_
);
if (!_isApproved_) {
revert IERC721_CALLER_NOT_APPROVED(
_tokenOwner_,
_operator_,
tokenId_
);
}
getApproved[tokenId_] = to_;
emit Approval(_tokenOwner_, 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 {
transferFrom(from_, to_, tokenId_);
if (!_checkOnERC721Received(from_, to_, tokenId_, data_)) {
revert IERC721_NON_ERC721_RECEIVER(to_);
}
}
function setApprovalForAll(address operator_, bool approved_)
public
virtual
override
{
address _account_ = msg.sender;
if (operator_ == _account_) {
revert IERC721_INVALID_APPROVAL(operator_);
}
_operatorApprovals[_account_][operator_] = approved_;
emit ApprovalForAll(_account_, operator_, approved_);
}
function transferFrom(
address from_,
address to_,
uint256 tokenId_
) public virtual exists(tokenId_) {
if (to_ == address(0)) {
revert IERC721_INVALID_TRANSFER();
}
address _operator_ = msg.sender;
address _tokenOwner_ = _ownerOf(tokenId_);
if (from_ != _tokenOwner_) {
revert IERC721_INVALID_TRANSFER_FROM(_tokenOwner_, from_, tokenId_);
}
bool _isApproved_ = _isApprovedOrOwner(
_tokenOwner_,
_operator_,
tokenId_
);
if (!_isApproved_) {
revert IERC721_CALLER_NOT_APPROVED(
_tokenOwner_,
_operator_,
tokenId_
);
}
_transfer(_tokenOwner_, to_, tokenId_);
}
function balanceOf(address tokenOwner_)
public
view
virtual
returns (uint256)
{
return _balanceOf(tokenOwner_);
}
function isApprovedForAll(address tokenOwner_, address operator_)
public
view
virtual
returns (bool)
{
return _isApprovedForAll(tokenOwner_, operator_);
}
function ownerOf(uint256 tokenId_)
public
view
virtual
exists(tokenId_)
returns (address)
{
return _ownerOf(tokenId_);
}
function supplyMinted() public view virtual returns (uint256) {
return _nextId - 1;
}
function supportsInterface(bytes4 interfaceId_)
public
view
virtual
override
returns (bool)
{
return
interfaceId_ == type(IERC721Enumerable).interfaceId ||
interfaceId_ == type(IERC721Metadata).interfaceId ||
interfaceId_ == type(IERC721).interfaceId ||
interfaceId_ == type(IERC165).interfaceId;
}
function tokenByIndex(uint256 index_)
public
view
virtual
override
returns (uint256)
{
if (index_ >= supplyMinted()) {
revert IERC721Enumerable_INDEX_OUT_OF_BOUNDS(index_);
}
return index_ + 1;
}
function tokenOfOwnerByIndex(address tokenOwner_, uint256 index_)
public
view
virtual
override
returns (uint256 tokenId)
{
if (index_ >= _balanceOf(tokenOwner_)) {
revert IERC721Enumerable_OWNER_INDEX_OUT_OF_BOUNDS(
tokenOwner_,
index_
);
}
uint256 _count_ = 0;
for (uint256 i = 1; i < _nextId; i++) {
if (_exists(i) && tokenOwner_ == _ownerOf(i)) {
if (index_ == _count_) {
return i;
}
_count_++;
}
}
}
function tokenURI(uint256 tokenId_)
public
view
virtual
override
exists(tokenId_)
returns (string memory)
{
return
bytes(_baseURI).length > 0
? string(abi.encodePacked(_baseURI, _toString(tokenId_)))
: _toString(tokenId_);
}
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply();
}
}
文件 14 的 14:UndeadChef.sol
pragma solidity ^0.8.9;
import "./Reg_ERC721Batch.sol";
import "./utils/ERC173.sol";
import "./interfaces/DefaultOperatorFilterer.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
contract UndeadChef is
Reg_ERC721Batch,
ERC173,
DefaultOperatorFilterer
{
using MerkleProof for bytes32[];
uint256 public whitelistPrice = 0.005 ether;
uint256 public publicPrice = 0.005 ether;
uint256 public maxPerWhitelist = 3;
uint256 public maxPerPublic = 3;
uint256 public maxSupply = 4000;
error Whitelist_NOT_SET();
error Whitelist_CONSUMED(address account);
error Whitelist_FORBIDDEN(address account);
bytes32 private _root;
mapping(address => bool) private _private_consumed;
mapping(address => bool) private _private_next;
enum Sale {
PAUSED,
PRIVATE,
PRIVATE_NEXT,
PUBLIC
}
Sale public saleState = Sale.PAUSED;
mapping(address => uint256) public mintedPerWallet;
modifier isSaleState(Sale sale_) {
require(saleState == sale_, "Sale not active");
_;
}
modifier blockContracts() {
require(tx.origin == msg.sender, "No smart contracts are allowed");
_;
}
constructor(
string memory name_,
string memory symbol_,
string memory baseURI_
) {
__init_ERC721Metadata(name_, symbol_, baseURI_);
_setOwner(msg.sender);
}
function withdraw(address to_, uint amount_) public onlyOwner {
uint256 _balance_ = address(this).balance;
require(_balance_ > 0, "No balance to withdraw");
require(amount_ <= _balance_, "Amount is not valid");
address _recipient_ = payable(to_);
(bool _success_, ) = _recipient_.call{value: amount_}("");
require(_success_, "Transaction failed");
}
function setWhitelistPrice(uint256 price_) external onlyOwner {
whitelistPrice = price_;
}
function setPublicPrice(uint256 price_) external onlyOwner {
publicPrice = price_;
}
function setMintsPerWhitelist(uint256 mints_) external onlyOwner {
maxPerWhitelist = mints_;
}
function setMintsPerPublic(uint256 mints_) external onlyOwner {
maxPerPublic = mints_;
}
function setMaxSupply(uint256 supply_) external onlyOwner {
uint _currentSupply_ = totalSupply();
require(
supply_ > _currentSupply_,
"Max supply should be greater than current supply"
);
require(
supply_ < maxSupply,
"Max supply should be greater than previous max supply"
);
maxSupply = supply_;
}
function setWhitelistRoot(bytes32 root_) external onlyOwner {
_root = root_;
}
function setBaseURI(string memory baseURI_) external onlyOwner {
_setBaseURI(baseURI_);
}
function setSaleState(Sale sale_) external onlyOwner {
saleState = sale_;
}
function mintWhitelist(bytes32[] memory proof_)
external
payable
blockContracts
isSaleState(Sale.PRIVATE)
{
if (_root == 0) {
revert Whitelist_NOT_SET();
}
address account_ = msg.sender;
if (_private_consumed[account_]) {
revert Whitelist_CONSUMED(account_);
}
bytes32 leaf = keccak256(abi.encodePacked(account_));
bool isAllowed = MerkleProof.processProof(proof_, leaf) == _root;
if (!isAllowed) {
revert Whitelist_FORBIDDEN(account_);
}
uint _supply_ = totalSupply();
require(_supply_ + maxPerWhitelist <= maxSupply, "Exceeds supply");
require(
msg.value == whitelistPrice,
"Ether sent is not correct"
);
_mint(msg.sender, maxPerWhitelist);
_private_consumed[account_] = true;
}
function mintNextWhitelist(bytes32[] memory proof_)
external
payable
blockContracts
isSaleState(Sale.PRIVATE_NEXT)
{
if (_root == 0) {
revert Whitelist_NOT_SET();
}
address account_ = msg.sender;
if (_private_next[account_]) {
revert Whitelist_CONSUMED(account_);
}
bytes32 leaf = keccak256(abi.encodePacked(account_));
bool isAllowed = MerkleProof.processProof(proof_, leaf) == _root;
if (!isAllowed) {
revert Whitelist_FORBIDDEN(account_);
}
uint _supply_ = totalSupply();
require(_supply_ + maxPerWhitelist <= maxSupply, "Exceeds supply");
require(
msg.value == whitelistPrice,
"Ether sent is not correct"
);
_mint(msg.sender, maxPerWhitelist);
_private_next[account_] = true;
}
function airdrop( uint256 qty_ , address to_) onlyOwner
external
payable
blockContracts
{
uint _supply_ = totalSupply();
require(_supply_ + qty_ <= maxSupply, "Exceeds supply");
_mint(to_, qty_);
}
function mintPublic(uint256 qty_)
external
payable
blockContracts
isSaleState(Sale.PUBLIC)
{
uint _supply_ = totalSupply();
require(
mintedPerWallet[msg.sender] + qty_ <= maxPerPublic,
"Exceeds mint per wallet"
);
require(_supply_ + qty_ <= maxSupply, "Exceeds supply");
require(msg.value == qty_ * publicPrice, "Ether sent is not correct");
_mint(msg.sender, qty_);
mintedPerWallet[msg.sender] += qty_;
}
function transferFrom(
address from,
address to,
uint256 tokenId
) public override onlyAllowedOperator(from) {
super.transferFrom(from, to, tokenId);
}
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public override onlyAllowedOperator(from) {
super.safeTransferFrom(from, to, tokenId);
}
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory data
) public override onlyAllowedOperator(from) {
super.safeTransferFrom(from, to, tokenId, data);
}
}
{
"compilationTarget": {
"contracts/UndeadChef.sol": "UndeadChef"
},
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
}
[{"inputs":[{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"string","name":"baseURI_","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"IERC173_NOT_OWNER","type":"error"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"IERC721Enumerable_INDEX_OUT_OF_BOUNDS","type":"error"},{"inputs":[{"internalType":"address","name":"tokenOwner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"IERC721Enumerable_OWNER_INDEX_OUT_OF_BOUNDS","type":"error"},{"inputs":[{"internalType":"address","name":"tokenOwner","type":"address"},{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"IERC721_CALLER_NOT_APPROVED","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"IERC721_INVALID_APPROVAL","type":"error"},{"inputs":[],"name":"IERC721_INVALID_TRANSFER","type":"error"},{"inputs":[{"internalType":"address","name":"tokenOwner","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"IERC721_INVALID_TRANSFER_FROM","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"IERC721_NONEXISTANT_TOKEN","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"IERC721_NON_ERC721_RECEIVER","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"OperatorNotAllowed","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"Whitelist_CONSUMED","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"Whitelist_FORBIDDEN","type":"error"},{"inputs":[],"name":"Whitelist_NOT_SET","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner_","type":"address"},{"indexed":true,"internalType":"address","name":"approved_","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId_","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner_","type":"address"},{"indexed":true,"internalType":"address","name":"operator_","type":"address"},{"indexed":false,"internalType":"bool","name":"approved_","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"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":"uint256","name":"qty_","type":"uint256"},{"internalType":"address","name":"to_","type":"address"}],"name":"airdrop","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":"tokenOwner_","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenOwner_","type":"address"},{"internalType":"address","name":"operator_","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxPerPublic","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxPerWhitelist","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"proof_","type":"bytes32[]"}],"name":"mintNextWhitelist","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"qty_","type":"uint256"}],"name":"mintPublic","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"proof_","type":"bytes32[]"}],"name":"mintWhitelist","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"mintedPerWallet","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":"publicPrice","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":"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":[],"name":"saleState","outputs":[{"internalType":"enum UndeadChef.Sale","name":"","type":"uint8"}],"stateMutability":"view","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":"uint256","name":"supply_","type":"uint256"}],"name":"setMaxSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"mints_","type":"uint256"}],"name":"setMintsPerPublic","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"mints_","type":"uint256"}],"name":"setMintsPerWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"price_","type":"uint256"}],"name":"setPublicPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum UndeadChef.Sale","name":"sale_","type":"uint8"}],"name":"setSaleState","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"price_","type":"uint256"}],"name":"setWhitelistPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"root_","type":"bytes32"}],"name":"setWhitelistRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"supplyMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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":"index_","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenOwner_","type":"address"},{"internalType":"uint256","name":"index_","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId_","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner_","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"whitelistPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to_","type":"address"},{"internalType":"uint256","name":"amount_","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]