编译器
0.8.18+commit.87f61d96
文件 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 functionCallWithValue(target, data, 0, "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");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, 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) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, 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) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
文件 2 的 14:AntERC721.sol
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/common/ERC2981.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
interface RefCode {
function getCodeIdx(string memory group, string memory code) external view returns (int16[2] memory) ;
function validateCodeIdx(string memory group, string memory code, uint16 groupIdx, uint16 codeIdx) external view returns (bool);
}
contract AntERC721 is ERC721, ERC2981, Ownable {
event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId);
bool mint_allowed = false;
uint8 special_minted;
uint8 reveal_state = REVEAL_LOCKED;
uint16 last_nft_id;
uint8 public MAX_CNT_PER_MINT = 3;
uint32 public LOCK_PERIOD = 86400 * 7;
uint16[3] nftPool;
uint256 public mintPrice = (1 ether / 100);
uint256[3] first_nft_price = [0, (1 ether / 1000 * 5), (1 ether / 100)];
address[2] refCodesContract;
bool[8500] private single_codes_used;
bool[6100] is_guardian;
bool[6100] is_collector;
uint16[6100] nft_family_idx;
mapping(address => uint8) public cnt_minted;
mapping(uint16 => uint32) public locked_until;
mapping(uint16 => uint32) public last_transfered;
mapping(uint16 => address) public owners;
mapping(address => uint16[]) public owned;
string initialMetadata;
string preRevealMetadata;
string revealMetadata;
string contractUri;
mapping(bytes18 => int16) public coupons;
uint8 public constant CNT_SPECIAL = 12;
uint8 public constant fam_guardians = 0;
uint8 public constant fam_collectors = 1;
uint8 public constant fam_miners = 2;
uint8 public constant REVEAL_LOCKED = 0;
uint8 public constant REVEAL_EARLY = 1;
uint8 public constant REVEAL_OPEN = 2;
struct NFT {
bool isRevealed;
bool isGuardian;
bool isMiner;
bool isCollector;
uint16 id;
}
constructor(
address[2] memory refCodes,
uint16[3] memory nftCounts,
string memory name_,
string memory symbol_)
ERC721(name_, symbol_)
{
refCodesContract = refCodes;
nftPool = nftCounts;
_setDefaultRoyalty(msg.sender, 100);
}
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721, ERC2981) returns (bool) {
return super.supportsInterface(interfaceId);
}
function mintCustom() onlyOwner external {
require(!mint_allowed, "Mint already started");
require(last_nft_id == 0, "Something already minted");
for (uint256 j = 1; j <= CNT_SPECIAL; j = j + 1) {
last_nft_id++;
_mint(msg.sender, last_nft_id);
owners[last_nft_id] = msg.sender;
}
special_minted = CNT_SPECIAL;
}
function setMaxCountPerMint(uint8 cnt) onlyOwner external {
MAX_CNT_PER_MINT = cnt;
}
function setLockPeriod(uint32 sec) onlyOwner external {
LOCK_PERIOD = sec;
}
function setContractUri(string memory uri) onlyOwner external {
contractUri = uri;
emit BatchMetadataUpdate(0, last_nft_id);
}
function setInitialMetadataUri(string memory uri) onlyOwner external {
initialMetadata = uri;
emit BatchMetadataUpdate(0, last_nft_id);
}
function setPreRevealMetadataUri(string memory uri) onlyOwner external {
preRevealMetadata = uri;
emit BatchMetadataUpdate(0, last_nft_id);
}
function setRevealMetadataUri(string memory uri) onlyOwner external {
revealMetadata = uri;
emit BatchMetadataUpdate(0, last_nft_id);
}
function setCodesContract(address[2] memory addr) onlyOwner external {
refCodesContract = addr;
}
function handleMint(address to, uint8 cnt) private {
uint256 familyIdx = rand() % 3;
uint32 ts = uint32(block.timestamp % 2**32);
for (uint256 j = 1; j <= cnt; j = j + 1) {
last_nft_id++;
uint256 b;
for (b = 0; b < 4; b = b + 1) {
if (b == 3) {
revert("No NFTs left");
}
familyIdx = (familyIdx + 1) % 3;
if (nftPool[familyIdx] > 0) {
_mint(to, last_nft_id);
is_guardian[last_nft_id] = familyIdx == fam_guardians;
is_collector[last_nft_id] = familyIdx == fam_collectors;
nft_family_idx[last_nft_id] = nftPool[familyIdx];
nftPool[familyIdx]--;
if (b == 0 && (owned[to].length == 0)) {
locked_until[last_nft_id] = ts + LOCK_PERIOD;
bytes18 code = _calcCouponCode(to);
coupons[code] = -1;
}
owners[last_nft_id] = to;
owned[to].push(last_nft_id);
break;
}
}
}
cnt_minted[to] += cnt;
}
function mint(uint8 cnt, bytes18 coupon) external payable {
address to = msg.sender;
require(mint_allowed, "Mint not started");
require(cnt >= 1 && (cnt + cnt_minted[to]) <= MAX_CNT_PER_MINT, "Wrong quantity");
require(isCouponValid(coupon, cnt), "Invalid coupon");
uint8 priceLevel = 1;
for (uint8 j = 17; j > 0; j--) {
bytes1 currentByte = coupon[j];
if (currentByte != 0) {
priceLevel = getCodePriceLevel(currentByte);
break;
}
}
require(msg.value == getNFTEthPrice(to, cnt, priceLevel), "Not enough ETH");
handleMint(to, cnt);
coupons[coupon] = coupons[coupon] - int16(int8(cnt));
}
function mintWithSingleUseCode(uint8 cnt, string memory group, string memory code, uint16 groupIdx, uint16 codeIdx, uint8 setIdx) external payable {
address to = msg.sender;
require(mint_allowed, "Mint not started");
require(cnt >= 1 && (cnt + cnt_minted[to]) <= MAX_CNT_PER_MINT, "Wrong quantity");
uint8 priceLevel = getStringCodePriceLevel(group);
bool isValid = RefCode(refCodesContract[setIdx]).validateCodeIdx(group, code, groupIdx, codeIdx);
require(isValid, "Validation failed");
require(!single_codes_used[codeIdx], "Code used");
require(msg.value == getNFTEthPrice(to, cnt, priceLevel), "Not enough ETH");
single_codes_used[codeIdx] = true;
handleMint(to, cnt);
}
function ownerMint(address to, uint8 cnt) onlyOwner external {
handleMint(to, cnt);
}
function bulkMint(address[] memory to, uint8[] memory cnt) onlyOwner external {
for (uint16 j = 0; j < to.length; j++) {
handleMint(to[j], cnt[j]);
}
}
function rand() private view returns(uint256) {
uint256 seed = uint256(keccak256(abi.encodePacked(
block.timestamp + block.prevrandao +
((uint256(keccak256(abi.encodePacked(block.coinbase)))) / (block.timestamp)) +
block.gaslimit +
((uint256(keccak256(abi.encodePacked(msg.sender)))) / (block.timestamp)) +
block.number
)));
return (seed - ((seed / 1000) * 1000));
}
function burn(uint16 tokenId) external {
require(owners[tokenId] == msg.sender, "Not an owner");
require(tokenId <= special_minted, "Can't burn this NFT");
_burn(tokenId);
}
function earlyReveal() onlyOwner external {
reveal_state = REVEAL_EARLY;
}
function fullReveal() onlyOwner external {
reveal_state = REVEAL_OPEN;
}
function tokenURI(uint256 _tokenId) public view virtual override returns (string memory) {
if (owners[uint16(_tokenId)] == address(0)) {
return string.concat(initialMetadata, "default.json") ;
}
if (_tokenId <= special_minted) {
return string.concat(reveal_state == REVEAL_LOCKED ? initialMetadata : (reveal_state == REVEAL_EARLY ? preRevealMetadata : revealMetadata), Strings.toString(_tokenId), ".json") ;
}
NFT memory nft = getNFT(uint16(_tokenId));
if (reveal_state == REVEAL_LOCKED || !nft.isRevealed) {
return string.concat(initialMetadata, "default.json") ;
}
string memory fileName = string.concat(is_collector[_tokenId] ? "1-" : (is_guardian[_tokenId] ? "2-" : "3-"), Strings.toString(nft_family_idx[_tokenId]));
return string.concat(reveal_state == REVEAL_EARLY ? preRevealMetadata : revealMetadata, fileName, ".json");
}
function contractURI() public view returns (string memory) {
return contractUri;
}
function setFirstNFTPrice(uint256 idx, uint256 price) onlyOwner external {
first_nft_price[idx] = price;
}
function setMintStatus(bool isAllowed) onlyOwner external {
mint_allowed = isAllowed;
}
function setMintPrice(uint256 price) onlyOwner external {
mintPrice = price;
}
function registerCoupon(bytes18 coupon, int16 limit) onlyOwner external {
coupons[coupon] = limit;
}
function registerBulkCoupons(bytes18[] memory cpns, int16[] memory limit) onlyOwner external {
for (uint i = 0; i < cpns.length; i++) {
coupons[cpns[i]] = limit[i];
}
}
function isCouponValid(bytes18 coupon, uint8 cnt) view public returns (bool) {
require(mint_allowed, "Mint not started");
require(cnt >= 1 && cnt <= MAX_CNT_PER_MINT, "Wrong quantity");
int16 remaining = coupons[coupon];
return ((remaining > 0) && (remaining - int16(int8((cnt))) >= 0)) || (remaining < 0);
}
function getCodeIdx(string calldata group, string calldata code) public view returns (int16[3] memory) {
for (int16 i = 0; i < 2; i++) {
int16[2] memory idx = RefCode(refCodesContract[uint256(uint16(i))]).getCodeIdx(group, code);
if (idx[0] > -1 && idx[1] > -1) {
return [idx[0], idx[1], i];
}
}
return [int16(-1), int16(-1), int16(-1)];
}
function transferFrom(address from, address to, uint256 tokenId) public override {
safeTransferFrom(from, to, tokenId);
}
function safeTransferFrom(address from, address to, uint256 tokenId) public override {
uint32 ts = uint32(block.timestamp % 2**32);
uint16 safeId = uint16(tokenId);
require (locked_until[safeId] < ts, "Locked");
super.safeTransferFrom(from, to, safeId);
owned[to].push(safeId);
owners[safeId] = to;
for (uint i = 0; i < owned[from].length; i++) {
if (owned[from][i] == safeId) {
owned[from][i] = 0;
}
}
while (owned[from].length > 0 && (owned[from][owned[from].length - 1] == 0)) {
owned[from].pop();
}
last_transfered[safeId] = ts;
}
function availableSupply() view public returns (uint256) {
return nftPool[0] + nftPool[1] + nftPool[2];
}
function totalSupply() view public returns (uint256) {
return last_nft_id + availableSupply();
}
function getStringCodePriceLevel(string memory coupon) pure public returns (uint8) {
uint256 end = bytes(coupon).length - 1;
return getCodePriceLevel(bytes(coupon)[end]);
}
function getCodePriceLevel(bytes1 coupon) pure public returns (uint8) {
bytes32 last = keccak256(abi.encodePacked(coupon));
if (keccak256(abi.encodePacked("a")) == last) {
return 0;
}
else if (keccak256(abi.encodePacked("b")) == last) {
return 1;
}
else if (keccak256(abi.encodePacked("c")) == last) {
return 2;
}
else {
return 1;
}
}
function getNFTEthPrice(address to, uint256 count, uint256 priceLevel) view public returns (uint256) {
bool firstMinted = owned[to].length > 0;
uint256 price = ((mintPrice * count) - ((firstMinted ? 0 : 1) * mintPrice)) + (firstMinted ? 0 : first_nft_price[priceLevel]);
if (count == 4) {
price = (price * 9) / 10;
}
return price;
}
function isEligibleForEarlyReveal(address to) view public returns (bool) {
return coupons[getCouponCode(to)] < -1;
}
function getMintPrice() view public returns (uint256) {
return mintPrice;
}
function getFirstNftPrice(uint256 idx) view public returns (uint256) {
return first_nft_price[idx];
}
function getAllPriceLevels() view public returns (uint256[3] memory) {
return first_nft_price;
}
function getNFTs(address to) view public returns (NFT[] memory) {
NFT[] memory userNfts = new NFT[](owned[to].length);
uint16 idx = 0;
for (uint16 i = 0; i < owned[to].length; i++) {
if (owned[to][i] != 0) {
userNfts[idx] = getNFT(owned[to][i]);
idx++;
}
}
return userNfts;
}
function getNFT(uint16 id) view public returns (NFT memory) {
NFT memory nft = NFT({
id: id,
isRevealed: isRevealed(id),
isGuardian: isGuardian(id),
isMiner: isMiner(id),
isCollector: isCollector(id)
});
return nft;
}
function isRevealed(uint16 id) view internal returns (bool) {
return (reveal_state == REVEAL_OPEN) ||
((reveal_state == REVEAL_EARLY) && (last_transfered[id] == 0) && isEligibleForEarlyReveal(owners[id]));
}
function isGuardian(uint16 id) view internal returns (bool) {
return isRevealed(id) && is_guardian[id];
}
function isCollector(uint16 id) view internal returns (bool) {
return isRevealed(id) && is_collector[id];
}
function isMiner(uint16 id) view internal returns (bool) {
return isRevealed(id) && !is_collector[id] && !is_guardian[id];
}
function getSliceBytes(bytes32 text, uint256 begin, uint256 end) internal pure returns (bytes memory) {
if (end > text.length) {
end = text.length;
}
bytes memory a = new bytes(end - begin + 1);
for(uint i = 0; i <= end - begin; i++) {
unchecked { a[i] = text[i + begin - 1]; }
}
return a;
}
function _calcCouponCode(address to) internal pure returns (bytes18) {
bytes32 addressHashBytes = sha256(abi.encodePacked(to, 'antrep'));
return iToHex(getSliceBytes(addressHashBytes, 1, 4));
}
function iToHex(bytes memory buffer) public pure returns (bytes18) {
bytes memory converted = new bytes(buffer.length * 2);
bytes memory _base = "0123456789defghijklmnopqrstuvwxyz";
for (uint256 i = 0; i < buffer.length; i++) {
converted[i * 2] = _base[uint8(buffer[i]) / _base.length];
converted[i * 2 + 1] = _base[uint8(buffer[i]) % _base.length];
}
return bytes10(abi.encodePacked(converted));
}
function getCouponCode(address to) internal view returns (bytes18) {
bytes18 code = _calcCouponCode(to);
if (coupons[code] < 0) {
return code;
} else {
return "";
}
}
function getMyCouponCode() public view returns (bytes18) {
return getCouponCode(msg.sender);
}
function setDefaultRoyalty(address receiver, uint96 feeNumerator) onlyOwner external {
_setDefaultRoyalty(receiver, feeNumerator);
}
function deleteDefaultRoyalty() onlyOwner external {
_deleteDefaultRoyalty();
}
function setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) onlyOwner external {
_setTokenRoyalty(tokenId, receiver, feeNumerator);
}
function resetTokenRoyalty(uint256 tokenId) onlyOwner external {
_resetTokenRoyalty(tokenId);
}
function withdraw(address to) public onlyOwner {
uint256 amount = address(this).balance;
require(amount > 0, "Nothing to withdraw; contract balance empty");
(bool sent, ) = to.call{value: amount}("");
require(sent, "Failed to send Ether");
}
receive() external payable {}
fallback() external payable {}
}
文件 3 的 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;
}
}
文件 4 的 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;
}
}
文件 5 的 14:ERC2981.sol
pragma solidity ^0.8.0;
import "../../interfaces/IERC2981.sol";
import "../../utils/introspection/ERC165.sol";
abstract contract ERC2981 is IERC2981, ERC165 {
struct RoyaltyInfo {
address receiver;
uint96 royaltyFraction;
}
RoyaltyInfo private _defaultRoyaltyInfo;
mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo;
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) {
return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId);
}
function royaltyInfo(uint256 _tokenId, uint256 _salePrice) public view virtual override returns (address, uint256) {
RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId];
if (royalty.receiver == address(0)) {
royalty = _defaultRoyaltyInfo;
}
uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator();
return (royalty.receiver, royaltyAmount);
}
function _feeDenominator() internal pure virtual returns (uint96) {
return 10000;
}
function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {
require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
require(receiver != address(0), "ERC2981: invalid receiver");
_defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
}
function _deleteDefaultRoyalty() internal virtual {
delete _defaultRoyaltyInfo;
}
function _setTokenRoyalty(
uint256 tokenId,
address receiver,
uint96 feeNumerator
) internal virtual {
require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
require(receiver != address(0), "ERC2981: Invalid parameters");
_tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);
}
function _resetTokenRoyalty(uint256 tokenId) internal virtual {
delete _tokenRoyaltyInfo[tokenId];
}
}
文件 6 的 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: address zero is not a valid owner");
return _balances[owner];
}
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _ownerOf(tokenId);
require(owner != address(0), "ERC721: invalid token ID");
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) {
_requireMinted(tokenId);
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 token owner or approved for all"
);
_approve(to, tokenId);
}
function getApproved(uint256 tokenId) public view virtual override returns (address) {
_requireMinted(tokenId);
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: caller is not token owner or 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: caller is not token owner or 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 _ownerOf(uint256 tokenId) internal view virtual returns (address) {
return _owners[tokenId];
}
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _ownerOf(tokenId) != address(0);
}
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
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, 1);
require(!_exists(tokenId), "ERC721: token already minted");
unchecked {
_balances[to] += 1;
}
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
_afterTokenTransfer(address(0), to, tokenId, 1);
}
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId, 1);
owner = ERC721.ownerOf(tokenId);
delete _tokenApprovals[tokenId];
unchecked {
_balances[owner] -= 1;
}
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
_afterTokenTransfer(owner, address(0), tokenId, 1);
}
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, 1);
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
delete _tokenApprovals[tokenId];
unchecked {
_balances[from] -= 1;
_balances[to] += 1;
}
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
_afterTokenTransfer(from, to, tokenId, 1);
}
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 _requireMinted(uint256 tokenId) internal view virtual {
require(_exists(tokenId), "ERC721: invalid token ID");
}
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 firstTokenId,
uint256 batchSize
) internal virtual {}
function _afterTokenTransfer(
address from,
address to,
uint256 firstTokenId,
uint256 batchSize
) internal virtual {}
function __unsafe_increaseBalance(address account, uint256 amount) internal {
_balances[account] += amount;
}
}
文件 7 的 14:IERC165.sol
pragma solidity ^0.8.0;
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
文件 8 的 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);
}
文件 9 的 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);
}
文件 10 的 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);
}
文件 11 的 14:IERC721Receiver.sol
pragma solidity ^0.8.0;
interface IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
文件 12 的 14:Math.sol
pragma solidity ^0.8.0;
library Math {
enum Rounding {
Down,
Up,
Zero
}
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
function average(uint256 a, uint256 b) internal pure returns (uint256) {
return (a & b) + (a ^ b) / 2;
}
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
return a == 0 ? 0 : (a - 1) / b + 1;
}
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator
) internal pure returns (uint256 result) {
unchecked {
uint256 prod0;
uint256 prod1;
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
if (prod1 == 0) {
return prod0 / denominator;
}
require(denominator > prod1);
uint256 remainder;
assembly {
remainder := mulmod(x, y, denominator)
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
uint256 twos = denominator & (~denominator + 1);
assembly {
denominator := div(denominator, twos)
prod0 := div(prod0, twos)
twos := add(div(sub(0, twos), twos), 1)
}
prod0 |= prod1 * twos;
uint256 inverse = (3 * denominator) ^ 2;
inverse *= 2 - denominator * inverse;
inverse *= 2 - denominator * inverse;
inverse *= 2 - denominator * inverse;
inverse *= 2 - denominator * inverse;
inverse *= 2 - denominator * inverse;
inverse *= 2 - denominator * inverse;
result = prod0 * inverse;
return result;
}
}
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator,
Rounding rounding
) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 result = 1 << (log2(a) >> 1);
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10**64) {
value /= 10**64;
result += 64;
}
if (value >= 10**32) {
value /= 10**32;
result += 32;
}
if (value >= 10**16) {
value /= 10**16;
result += 16;
}
if (value >= 10**8) {
value /= 10**8;
result += 8;
}
if (value >= 10**4) {
value /= 10**4;
result += 4;
}
if (value >= 10**2) {
value /= 10**2;
result += 2;
}
if (value >= 10**1) {
result += 1;
}
}
return result;
}
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
}
}
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
}
}
}
文件 13 的 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());
}
modifier onlyOwner() {
_checkOwner();
_;
}
function owner() public view virtual returns (address) {
return _owner;
}
function _checkOwner() internal view virtual {
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);
}
}
文件 14 的 14:Strings.sol
pragma solidity ^0.8.0;
import "./math/Math.sol";
library Strings {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
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] = _SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
}
{
"compilationTarget": {
"contracts/AntERC721.sol": "AntERC721"
},
"evmVersion": "paris",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": []
}
[{"inputs":[{"internalType":"address[2]","name":"refCodes","type":"address[2]"},{"internalType":"uint16[3]","name":"nftCounts","type":"uint16[3]"},{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"}],"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":"uint256","name":"_fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_toTokenId","type":"uint256"}],"name":"BatchMetadataUpdate","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"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"CNT_SPECIAL","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LOCK_PERIOD","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_CNT_PER_MINT","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REVEAL_EARLY","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REVEAL_LOCKED","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REVEAL_OPEN","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"availableSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"to","type":"address[]"},{"internalType":"uint8[]","name":"cnt","type":"uint8[]"}],"name":"bulkMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"tokenId","type":"uint16"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"cnt_minted","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes18","name":"","type":"bytes18"}],"name":"coupons","outputs":[{"internalType":"int16","name":"","type":"int16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"deleteDefaultRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"earlyReveal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"fam_collectors","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fam_guardians","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fam_miners","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fullReveal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getAllPriceLevels","outputs":[{"internalType":"uint256[3]","name":"","type":"uint256[3]"}],"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":"string","name":"group","type":"string"},{"internalType":"string","name":"code","type":"string"}],"name":"getCodeIdx","outputs":[{"internalType":"int16[3]","name":"","type":"int16[3]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes1","name":"coupon","type":"bytes1"}],"name":"getCodePriceLevel","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"idx","type":"uint256"}],"name":"getFirstNftPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMintPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMyCouponCode","outputs":[{"internalType":"bytes18","name":"","type":"bytes18"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"id","type":"uint16"}],"name":"getNFT","outputs":[{"components":[{"internalType":"bool","name":"isRevealed","type":"bool"},{"internalType":"bool","name":"isGuardian","type":"bool"},{"internalType":"bool","name":"isMiner","type":"bool"},{"internalType":"bool","name":"isCollector","type":"bool"},{"internalType":"uint16","name":"id","type":"uint16"}],"internalType":"struct AntERC721.NFT","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"count","type":"uint256"},{"internalType":"uint256","name":"priceLevel","type":"uint256"}],"name":"getNFTEthPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"getNFTs","outputs":[{"components":[{"internalType":"bool","name":"isRevealed","type":"bool"},{"internalType":"bool","name":"isGuardian","type":"bool"},{"internalType":"bool","name":"isMiner","type":"bool"},{"internalType":"bool","name":"isCollector","type":"bool"},{"internalType":"uint16","name":"id","type":"uint16"}],"internalType":"struct AntERC721.NFT[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"coupon","type":"string"}],"name":"getStringCodePriceLevel","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes","name":"buffer","type":"bytes"}],"name":"iToHex","outputs":[{"internalType":"bytes18","name":"","type":"bytes18"}],"stateMutability":"pure","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":"bytes18","name":"coupon","type":"bytes18"},{"internalType":"uint8","name":"cnt","type":"uint8"}],"name":"isCouponValid","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"isEligibleForEarlyReveal","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"}],"name":"last_transfered","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"}],"name":"locked_until","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"cnt","type":"uint8"},{"internalType":"bytes18","name":"coupon","type":"bytes18"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"mintCustom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"mintPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"cnt","type":"uint8"},{"internalType":"string","name":"group","type":"string"},{"internalType":"string","name":"code","type":"string"},{"internalType":"uint16","name":"groupIdx","type":"uint16"},{"internalType":"uint16","name":"codeIdx","type":"uint16"},{"internalType":"uint8","name":"setIdx","type":"uint8"}],"name":"mintWithSingleUseCode","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"owned","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint8","name":"cnt","type":"uint8"}],"name":"ownerMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"}],"name":"owners","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes18[]","name":"cpns","type":"bytes18[]"},{"internalType":"int16[]","name":"limit","type":"int16[]"}],"name":"registerBulkCoupons","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes18","name":"coupon","type":"bytes18"},{"internalType":"int16","name":"limit","type":"int16"}],"name":"registerCoupon","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"resetTokenRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"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":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[2]","name":"addr","type":"address[2]"}],"name":"setCodesContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"uri","type":"string"}],"name":"setContractUri","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint96","name":"feeNumerator","type":"uint96"}],"name":"setDefaultRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"idx","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"}],"name":"setFirstNFTPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"uri","type":"string"}],"name":"setInitialMetadataUri","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"sec","type":"uint32"}],"name":"setLockPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"cnt","type":"uint8"}],"name":"setMaxCountPerMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"price","type":"uint256"}],"name":"setMintPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"isAllowed","type":"bool"}],"name":"setMintStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"uri","type":"string"}],"name":"setPreRevealMetadataUri","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"uri","type":"string"}],"name":"setRevealMetadataUri","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint96","name":"feeNumerator","type":"uint96"}],"name":"setTokenRoyalty","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":"to","type":"address"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]