编译器
0.8.12+commit.f00d7308
文件 1 的 13: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 的 13: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 的 13:ECDSA.sol
pragma solidity ^0.8.0;
import "../Strings.sol";
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV
}
function _throwError(RecoverError error) private pure {
if (error == RecoverError.NoError) {
return;
} else if (error == RecoverError.InvalidSignature) {
revert("ECDSA: invalid signature");
} else if (error == RecoverError.InvalidSignatureLength) {
revert("ECDSA: invalid signature length");
} else if (error == RecoverError.InvalidSignatureS) {
revert("ECDSA: invalid signature 's' value");
} else if (error == RecoverError.InvalidSignatureV) {
revert("ECDSA: invalid signature 'v' value");
}
}
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else if (signature.length == 64) {
bytes32 r;
bytes32 vs;
assembly {
r := mload(add(signature, 0x20))
vs := mload(add(signature, 0x40))
}
return tryRecover(hash, r, vs);
} else {
return (address(0), RecoverError.InvalidSignatureLength);
}
}
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
return recovered;
}
function tryRecover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address, RecoverError) {
bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
uint8 v = uint8((uint256(vs) >> 255) + 27);
return tryRecover(hash, v, r, s);
}
function recover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, r, vs);
_throwError(error);
return recovered;
}
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address, RecoverError) {
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS);
}
if (v != 27 && v != 28) {
return (address(0), RecoverError.InvalidSignatureV);
}
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature);
}
return (signer, RecoverError.NoError);
}
function recover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, v, r, s);
_throwError(error);
return recovered;
}
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
}
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
}
}
文件 4 的 13: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 的 13:ERC721SZNS.sol
pragma solidity ^0.8.12;
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
error ApprovalCallerNotOwnerNorApproved();
error ApprovalQueryForNonexistentToken();
error ApproveToCaller();
error ApprovalToCurrentOwner();
error BalanceQueryForZeroAddress();
error MintZeroQuantity();
error TokenNotClaimable();
error TokenAlreadyExists();
error OwnerIsZeroAddress();
error CallOnlyValidAfterTokenOffset();
error OwnerQueryForNonexistentToken();
error TransferCallerNotOwnerNorApproved();
error TransferFromIncorrectOwner();
error TransferToNonERC721ReceiverImplementer();
error TransferToZeroAddress();
error URIQueryForNonexistentToken();
contract ERC721SZNS 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;
uint256 internal immutable _tokenSplitOffset;
uint256 private _nextTokenId;
uint256 private _tokensClaimed;
uint256 private _tokensMinted;
constructor(string memory name_, string memory symbol_, uint256 offset) {
_name = name_;
_symbol = symbol_;
_tokenSplitOffset = offset;
_nextTokenId = offset + 1;
}
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 totalSupply() public view returns (uint256) {
unchecked {
return _tokensClaimed + _tokensMinted;
}
}
function tokensClaimed() public view returns (uint256) {
return _tokensClaimed;
}
function tokensMinted() public view returns (uint256) {
return _tokensMinted;
}
function balanceOf(address owner) public view virtual override returns (uint256) {
if (owner == address(0)) revert BalanceQueryForZeroAddress();
return _balances[owner];
}
function ownerOf(uint256 tokenId) public view returns (address) {
address owner;
if (tokenId > _tokenSplitOffset) {
unchecked {
if (tokenId + 1 > _nextTokenId) revert OwnerQueryForNonexistentToken();
for (uint256 curr = tokenId;; curr--) {
owner = _owners[curr];
if (owner != address(0)) {
return owner;
}
}
}
revert OwnerQueryForNonexistentToken();
}
owner = _owners[tokenId];
if (owner == address(0)) revert OwnerIsZeroAddress();
return owner;
}
function name() public view virtual returns (string memory) {
return _name;
}
function symbol() public view virtual returns (string memory) {
return _symbol;
}
function tokenURI(uint256 tokenId) public view virtual returns (string memory) {
if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
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 {
address owner = ERC721SZNS.ownerOf(tokenId);
if (to == owner) revert ApprovalToCurrentOwner();
if (_msgSender() != owner && !isApprovedForAll(owner, _msgSender())) {
revert ApprovalCallerNotOwnerNorApproved();
}
_approve(to, tokenId, owner);
}
function getApproved(uint256 tokenId) public view virtual returns (address) {
if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();
return _tokenApprovals[tokenId];
}
function setApprovalForAll(address operator, bool approved) public virtual {
if (operator == _msgSender()) revert ApproveToCaller();
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
function isApprovedForAll(address owner, address operator) public view virtual returns (bool) {
return _operatorApprovals[owner][operator];
}
function transferFrom(address from, address to, uint256 tokenId) public {
_transfer(from, to, tokenId);
}
function safeTransferFrom(address from, address to, uint256 tokenId) public {
safeTransferFrom(from, to, tokenId, "");
}
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public {
_transfer(from, to, tokenId);
if (!_checkOnERC721Received(from, to, tokenId, _data)) revert TransferToNonERC721ReceiverImplementer();
}
function _mint(address to, uint256 quantity) internal {
if (quantity == 0) revert MintZeroQuantity();
unchecked {
_balances[to] += quantity;
_owners[_nextTokenId] = to;
uint256 updatedIndex = _nextTokenId;
for (uint256 i; i < quantity; i++) {
emit Transfer(address(0), to, updatedIndex);
updatedIndex++;
}
_tokensMinted += quantity;
_nextTokenId = updatedIndex;
}
}
function _claim(address to, uint256 tokenId) internal {
if (tokenId > _tokenSplitOffset) revert TokenNotClaimable();
if (_exists(tokenId)) revert TokenAlreadyExists();
unchecked {
_balances[to]++;
_owners[tokenId] = to;
_tokensClaimed++;
emit Transfer(address(0), to, tokenId);
}
}
function _transfer(address from, address to, uint256 tokenId) private {
address prevOwner = ERC721SZNS.ownerOf(tokenId);
bool isApprovedOrOwner = (_msgSender() == prevOwner ||
isApprovedForAll(prevOwner, _msgSender()) ||
getApproved(tokenId) == _msgSender());
if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
if (prevOwner != from) revert TransferFromIncorrectOwner();
if (to == address(0)) revert TransferToZeroAddress();
_approve(address(0), tokenId, prevOwner);
unchecked {
_balances[from]--;
_balances[to]++;
_owners[tokenId] = to;
if (tokenId > _tokenSplitOffset) {
uint256 nextTokenId = tokenId + 1;
if (_owners[nextTokenId] == address(0)) {
if (_exists(nextTokenId)) {
_owners[nextTokenId] = prevOwner;
}
}
}
}
emit Transfer(from, to, tokenId);
}
function _exists(uint256 tokenId) internal view returns (bool) {
if (tokenId > _tokenSplitOffset) return tokenId < _nextTokenId;
return _owners[tokenId] != address(0);
}
function _approve(address to, uint256 tokenId, address owner) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(owner, to, tokenId);
}
function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data) private returns (bool) {
if (to.isContract()) {
try
IERC721Receiver(to).onERC721Received(
_msgSender(),
from,
tokenId,
_data
)
returns (bytes4 retval) {
return retval == IERC721Receiver.onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert TransferToNonERC721ReceiverImplementer();
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
}
文件 6 的 13:IERC165.sol
pragma solidity ^0.8.0;
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
文件 7 的 13:IERC2981.sol
pragma solidity ^0.8.0;
import "./IERC165.sol";
interface IERC2981 is IERC165 {
function royaltyInfo(uint256 tokenId, uint256 salePrice)
external
view
returns (address receiver, uint256 royaltyAmount);
}
文件 8 的 13:IERC721.sol
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
interface IERC721 is IERC165 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
function balanceOf(address owner) external view returns (uint256 balance);
function ownerOf(uint256 tokenId) external view returns (address owner);
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
function approve(address to, uint256 tokenId) external;
function getApproved(uint256 tokenId) external view returns (address operator);
function setApprovalForAll(address operator, bool _approved) external;
function isApprovedForAll(address owner, address operator) external view returns (bool);
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
文件 9 的 13: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);
}
文件 10 的 13:IERC721Receiver.sol
pragma solidity ^0.8.0;
interface IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
文件 11 的 13: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 的 13: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);
}
}
文件 13 的 13:TheArtOfSeasons.sol
pragma solidity ^0.8.12;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/interfaces/IERC2981.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "./ERC721SZNS.sol";
error SummerTokensClaimClosed();
error SeasonsMintClosed();
error NoContractMints();
error MaxMintExceeded();
error InvalidSignature();
error NotEnoughEth();
error InncorrectLengths();
error BaseURILocked();
error RoyaltyInfoForNonexistentToken();
error TransferFailed();
contract TheArtOfSeasons is Ownable, ERC721SZNS, IERC2981 {
using ECDSA for bytes32;
event PermanentURI(string _value, uint256 indexed _id);
uint256 public constant SUMMER_MAX_TOKEN_ID = 8564;
uint256 public constant MAX_SEASONS_COUNT = 6304;
uint256 public constant CLAIMER_MINT_PRICE = 0.04 ether;
uint256 public constant MINT_PRICE = 0.08 ether;
uint256 public constant MAX_MINT_DURING_CLAIM = 2;
uint256 public constant MAX_MINT_PER_TX = 8;
bool public summerTokensClaimable;
bool public seasonsMintOpen;
address public sigSigner = 0x68cBE370A1b35f3f185172c063BBbabF836d7Ecc;
address public royaltyAddress;
uint256 public royaltyPercent;
string private _baseTokenURI;
bool public locked;
constructor() ERC721SZNS("The Art of Seasons", "TAOS", SUMMER_MAX_TOKEN_ID) {
royaltyAddress = owner();
royaltyPercent = 5;
}
function mintSeason(uint256 quantity) external payable {
if (!seasonsMintOpen) revert SeasonsMintClosed();
if (quantity > MAX_MINT_PER_TX) revert MaxMintExceeded();
if (tx.origin != msg.sender) revert NoContractMints();
if (tokensMinted() + quantity > MAX_SEASONS_COUNT) revert MaxMintExceeded();
_mint(msg.sender, quantity);
_refundOverPayment(MINT_PRICE * quantity);
}
function mintForSummerHolder(bytes calldata ticketSignature, uint256 ticket, uint256 quantity) external payable {
if (!summerTokensClaimable) revert SummerTokensClaimClosed();
if (quantity > MAX_MINT_DURING_CLAIM) revert MaxMintExceeded();
if (tx.origin != msg.sender) revert NoContractMints();
if (tokensMinted() + quantity > MAX_SEASONS_COUNT) revert MaxMintExceeded();
_claimSummerMintTicket(ticketSignature, ticket, quantity);
_mint(msg.sender, quantity);
_refundOverPayment(CLAIMER_MINT_PRICE * quantity);
}
function claimSummer(
bytes calldata claimSignature,
uint256[] calldata tokens,
uint256[] calldata claimIdxs
) external payable {
if (!summerTokensClaimable) revert SummerTokensClaimClosed();
if (tx.origin != msg.sender) revert NoContractMints();
uint256 len = claimIdxs.length;
if (len - 1 > tokens.length) revert InncorrectLengths();
_verifyClaimSignature(claimSignature, tokens);
for (uint256 i = 0; i < len; i++) {
uint256 tokenId = tokens[claimIdxs[i]];
_claim(msg.sender, tokenId);
}
}
function claimSummerAndMint(
bytes calldata claimSignature,
bytes calldata ticketSignature,
uint256[] calldata tokens,
uint256[] calldata claimIdxs,
uint256 ticket,
uint256 mintQty
) external payable {
if (!summerTokensClaimable) revert SummerTokensClaimClosed();
if (mintQty > MAX_MINT_DURING_CLAIM) revert MaxMintExceeded();
if (tx.origin != msg.sender) revert NoContractMints();
if (tokensMinted() + mintQty > MAX_SEASONS_COUNT) revert MaxMintExceeded();
uint256 len = claimIdxs.length;
if (len - 1 > tokens.length) revert InncorrectLengths();
_verifyClaimSignature(claimSignature, tokens);
for (uint256 i = 0; i < len; i++) {
uint256 tokenId = tokens[claimIdxs[i]];
_claim(msg.sender, tokenId);
}
if (mintQty == 0) return;
_claimSummerMintTicket(ticketSignature, ticket, mintQty);
_mint(msg.sender, mintQty);
_refundOverPayment(CLAIMER_MINT_PRICE * mintQty);
}
function claimAllSummer(bytes calldata signature, uint256[] calldata tokens) external payable {
if (!summerTokensClaimable) revert SummerTokensClaimClosed();
if (tx.origin != msg.sender) revert NoContractMints();
_verifyClaimSignature(signature, tokens);
uint256 len = tokens.length;
for (uint256 i = 0; i < len; i++) {
_claim(msg.sender, tokens[i]);
}
}
function claimAllSummerAndMint(
bytes calldata claimSignature,
bytes calldata ticketSignature,
uint256[] calldata tokens,
uint256 ticket,
uint256 mintQty
) external payable {
if (!summerTokensClaimable) revert SummerTokensClaimClosed();
if (mintQty > MAX_MINT_DURING_CLAIM) revert MaxMintExceeded();
if (tx.origin != msg.sender) revert NoContractMints();
if (tokensMinted() + mintQty > MAX_SEASONS_COUNT) revert MaxMintExceeded();
_verifyClaimSignature(claimSignature, tokens);
uint256 len = tokens.length;
for (uint256 i = 0; i < len; i++) {
_claim(msg.sender, tokens[i]);
}
if (mintQty == 0) return;
_claimSummerMintTicket(ticketSignature, ticket, mintQty);
_mint(msg.sender, mintQty);
_refundOverPayment(CLAIMER_MINT_PRICE * mintQty);
}
function _refundOverPayment(uint256 amount) internal {
if (msg.value < amount) revert NotEnoughEth();
if (msg.value > amount) {
payable(msg.sender).transfer(msg.value - amount);
}
}
function setSigSigner(address signer) external onlyOwner {
if (signer == address(0)) revert OwnerIsZeroAddress();
sigSigner = signer;
}
function _verifyClaimSignature(bytes calldata signature, uint256[] calldata tokens) internal view {
address signedAddr = keccak256(abi.encodePacked(msg.sender, tokens))
.toEthSignedMessageHash()
.recover(signature);
if (sigSigner != signedAddr) revert InvalidSignature();
}
uint256 private constant MAX_INT = 2**256-1;
uint256 private mintGroup0 = MAX_INT;
uint256 private mintGroup1 = MAX_INT;
uint256 private mintGroup2 = MAX_INT;
uint256 private mintGroup3 = MAX_INT;
uint256 private mintGroup4 = MAX_INT;
uint256 private mintGroup5 = MAX_INT;
function _getBitForTicket(uint256 ticket) internal view returns(uint256) {
uint256 slot;
uint256 offsetInSlot;
uint256 localGroup;
unchecked {
slot = ticket / 256;
offsetInSlot = ticket % 256;
}
assembly {
slot := add(mintGroup0.slot, slot)
localGroup := sload(slot)
}
return (localGroup >> offsetInSlot) & uint256(1);
}
function _useBitForTicket(uint256 ticket) internal {
uint256 slot;
uint256 offsetInSlot;
uint256 localGroup;
unchecked {
slot = ticket / 256;
offsetInSlot = ticket % 256;
}
assembly {
slot := add(mintGroup0.slot, slot)
localGroup := sload(slot)
}
localGroup = localGroup & ~(uint256(1) << offsetInSlot);
assembly {
sstore(slot, localGroup)
}
}
function _claimSummerMintTicket(bytes calldata signature, uint256 ticket, uint256 mintQty) internal {
address signedAddr = keccak256(abi.encodePacked(msg.sender, ticket))
.toEthSignedMessageHash()
.recover(signature);
if (sigSigner != signedAddr) revert InvalidSignature();
uint256 storedBit1 = _getBitForTicket(ticket);
if (storedBit1 == 0) revert MaxMintExceeded();
uint256 secondTicket = ticket + 1;
uint256 storedBit2 = _getBitForTicket(secondTicket);
if (storedBit2 == 1) {
_useBitForTicket(secondTicket);
if (mintQty == 2) {
_useBitForTicket(ticket);
}
} else {
if (mintQty == 2) revert MaxMintExceeded();
_useBitForTicket(ticket);
}
}
function numberMintedDuringClaim(uint256 ticket) external view returns (uint256) {
uint256 storedBit1 = _getBitForTicket(ticket);
if (storedBit1 == 0) return 2;
uint256 storedBit2 = _getBitForTicket(ticket + 1);
if (storedBit2 == 0) return 1;
return 0;
}
function toggleClaiming() external onlyOwner {
summerTokensClaimable = !summerTokensClaimable;
}
function toggleMint() external onlyOwner {
seasonsMintOpen = !seasonsMintOpen;
}
function setRoyaltyReceiver(address royaltyReceiver) external onlyOwner {
royaltyAddress = royaltyReceiver;
}
function setRoyaltyPercentage(uint256 royaltyPercentage) external onlyOwner {
royaltyPercent = royaltyPercentage;
}
function royaltyInfo(uint256 tokenId, uint256 salePrice) external view override returns (address receiver, uint256 royaltyAmount) {
if (!_exists(tokenId)) revert RoyaltyInfoForNonexistentToken();
return (royaltyAddress, salePrice * royaltyPercent / 100);
}
function _baseURI() internal view virtual override returns (string memory) {
return _baseTokenURI;
}
function setBaseURI(string calldata baseURI_) external onlyOwner {
if (locked) revert BaseURILocked();
_baseTokenURI = baseURI_;
}
function lockBaseURI() external onlyOwner {
if (locked) revert BaseURILocked();
locked = true;
}
function withdraw() external onlyOwner {
(bool success, ) = msg.sender.call{value: address(this).balance}("");
if (!success) revert TransferFailed();
}
function devClaimForHolder(uint256 tokenId, address to) external onlyOwner {
_claim(to, tokenId);
}
function devMint(uint256 quantity, address to) external onlyOwner {
if (tokensMinted() + quantity > MAX_SEASONS_COUNT) revert MaxMintExceeded();
_mint(to, quantity);
}
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721SZNS, IERC165) returns(bool) {
return super.supportsInterface(interfaceId) || interfaceId == type(IERC2981).interfaceId;
}
}
{
"compilationTarget": {
"contracts/TheArtOfSeasons.sol": "TheArtOfSeasons"
},
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 800
},
"remappings": []
}
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"ApprovalToCurrentOwner","type":"error"},{"inputs":[],"name":"ApproveToCaller","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"BaseURILocked","type":"error"},{"inputs":[],"name":"InncorrectLengths","type":"error"},{"inputs":[],"name":"InvalidSignature","type":"error"},{"inputs":[],"name":"MaxMintExceeded","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"NoContractMints","type":"error"},{"inputs":[],"name":"NotEnoughEth","type":"error"},{"inputs":[],"name":"OwnerIsZeroAddress","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"RoyaltyInfoForNonexistentToken","type":"error"},{"inputs":[],"name":"SeasonsMintClosed","type":"error"},{"inputs":[],"name":"SummerTokensClaimClosed","type":"error"},{"inputs":[],"name":"TokenAlreadyExists","type":"error"},{"inputs":[],"name":"TokenNotClaimable","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFailed","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","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":false,"internalType":"string","name":"_value","type":"string"},{"indexed":true,"internalType":"uint256","name":"_id","type":"uint256"}],"name":"PermanentURI","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":[],"name":"CLAIMER_MINT_PRICE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_MINT_DURING_CLAIM","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_MINT_PER_TX","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_SEASONS_COUNT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINT_PRICE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SUMMER_MAX_TOKEN_ID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"uint256[]","name":"tokens","type":"uint256[]"}],"name":"claimAllSummer","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes","name":"claimSignature","type":"bytes"},{"internalType":"bytes","name":"ticketSignature","type":"bytes"},{"internalType":"uint256[]","name":"tokens","type":"uint256[]"},{"internalType":"uint256","name":"ticket","type":"uint256"},{"internalType":"uint256","name":"mintQty","type":"uint256"}],"name":"claimAllSummerAndMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes","name":"claimSignature","type":"bytes"},{"internalType":"uint256[]","name":"tokens","type":"uint256[]"},{"internalType":"uint256[]","name":"claimIdxs","type":"uint256[]"}],"name":"claimSummer","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes","name":"claimSignature","type":"bytes"},{"internalType":"bytes","name":"ticketSignature","type":"bytes"},{"internalType":"uint256[]","name":"tokens","type":"uint256[]"},{"internalType":"uint256[]","name":"claimIdxs","type":"uint256[]"},{"internalType":"uint256","name":"ticket","type":"uint256"},{"internalType":"uint256","name":"mintQty","type":"uint256"}],"name":"claimSummerAndMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"devClaimForHolder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"devMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"locked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"ticketSignature","type":"bytes"},{"internalType":"uint256","name":"ticket","type":"uint256"},{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"mintForSummerHolder","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"mintSeason","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"ticket","type":"uint256"}],"name":"numberMintedDuringClaim","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"royaltyAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","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":[],"name":"royaltyPercent","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":"seasonsMintOpen","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":"royaltyPercentage","type":"uint256"}],"name":"setRoyaltyPercentage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"royaltyReceiver","type":"address"}],"name":"setRoyaltyReceiver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"signer","type":"address"}],"name":"setSigSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sigSigner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"summerTokensClaimable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":[],"name":"toggleClaiming","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"toggleMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokensClaimed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokensMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]