编译器
0.8.19+commit.7dd6d404
文件 1 的 35: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 的 35:ArrayFind.sol
pragma solidity 0.8.19;
import "./Types.sol";
library ArrayFind {
function find(
uint256[] memory arr,
uint value
) internal pure returns (uint256) {
uint256 ind = IndexNotFound;
for (uint256 i = 0; i < arr.length; i++) {
if (arr[i] == value) {
ind = i;
break;
}
}
return ind;
}
function find(
bytes32[] memory arr,
bytes32 value
) internal pure returns (uint256) {
uint256 ind = IndexNotFound;
for (uint i = 0; i < arr.length; i++) {
if (arr[i] == value) {
ind = i;
break;
}
}
return ind;
}
function find(
address[] memory arr,
address value
) internal pure returns (uint256) {
uint256 ind = IndexNotFound;
for (uint i = 0; i < arr.length; i++) {
if (arr[i] == value) {
ind = i;
break;
}
}
return ind;
}
function exist(
address[] memory arr,
address value
) internal pure returns (bool) {
return find(arr, value) != IndexNotFound;
}
function checkForDublicates(
address[] memory arr
) internal pure returns (bool) {
for (uint i = 0; i < arr.length; i++) {
address _val = arr[i];
for (uint j = i + 1; j < arr.length; j++) {
if (arr[j] == _val) return true;
}
}
return false;
}
}
文件 3 的 35:CashCollector.sol
pragma solidity 0.8.19;
import "../../../ext-contracts/@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "../util/Errors.sol";
abstract contract CashCollector {
IERC20[] _paymentTokens;
bool internal _locked;
address public _accountOwner;
constructor(address accountOwner, IERC20[] memory paymentTokens) {
_setAccountOwner(accountOwner);
for (uint i = 0; i < paymentTokens.length; i++)
_addRemovePaymentToken(paymentTokens[i], false);
}
receive() external payable {
emit Receive(msg.sender, msg.value);
}
function _setAccountOwner(address accountOwner) internal {
if (accountOwner == address(0)) revert ZeroAddress();
_accountOwner = accountOwner;
}
function _addRemovePaymentToken(IERC20 paymentToken, bool remove) internal {
if (address(paymentToken) == address(0)) revert ZeroAddress();
uint256 ind;
for (uint i = 0; i < _paymentTokens.length; i++) {
if (address(_paymentTokens[i]) == address(paymentToken)) {
ind = i + 1;
break;
}
}
if (!remove && ind == 0) _paymentTokens.push(paymentToken);
else if (remove && ind > 0) {
if (ind < _paymentTokens.length)
_paymentTokens[ind - 1] = _paymentTokens[
_paymentTokens.length - 1
];
_paymentTokens.pop();
}
}
function getPaymentTokens() public view returns (IERC20[] memory) {
return _paymentTokens;
}
function _withdraw() internal virtual noReentrant onlyAccountOwner {
if (_accountOwner == address(0)) revert ZeroAddress();
uint256 balance = address(this).balance;
if (balance > 0) {
payable(_accountOwner).call{value: balance}("");
}
uint256[] memory tokenBalances = new uint256[](_paymentTokens.length);
for (uint256 i = 0; i < _paymentTokens.length; i++) {
IERC20 paymentToken = _paymentTokens[i];
balance = paymentToken.balanceOf(address(this));
if (balance > 0) {
paymentToken.transfer(_accountOwner, balance);
}
tokenBalances[i] = balance;
}
emit Withdrawn(_accountOwner, balance, _paymentTokens, tokenBalances);
}
event Withdrawn(
address receiver,
uint256 balance,
IERC20[] paymentTokens,
uint256[] tokenBalances
);
event Receive(address sender, uint256 amount);
error NoReEntrancy();
modifier onlyAccountOwner() {
if (msg.sender != _accountOwner) revert Unauthorized();
_;
}
modifier noReentrant() {
if (_locked) revert NoReEntrancy();
_locked = true;
_;
_locked = false;
}
}
文件 4 的 35: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;
}
}
文件 5 的 35:Counters.sol
pragma solidity ^0.8.0;
library Counters {
struct Counter {
uint256 _value;
}
function current(Counter storage counter) internal view returns (uint256) {
return counter._value;
}
function increment(Counter storage counter) internal {
unchecked {
counter._value += 1;
}
}
function decrement(Counter storage counter) internal {
uint256 value = counter._value;
require(value > 0, "Counter: decrement overflow");
unchecked {
counter._value = value - 1;
}
}
function reset(Counter storage counter) internal {
counter._value = 0;
}
}
文件 6 的 35:DefaultOperatorFilterer.sol
pragma solidity ^0.8.13;
import {OperatorFilterer} from "./OperatorFilterer.sol";
contract DefaultOperatorFilterer is OperatorFilterer {
}
文件 7 的 35: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;
}
}
文件 8 的 35: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;
error ERC2981InvalidParameters();
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());
require(receiver != address(0));
_defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
}
function _deleteDefaultRoyalty() internal virtual {
delete _defaultRoyaltyInfo;
}
function _setTokenRoyalty(
uint256 tokenId,
address receiver,
uint96 feeNumerator
) internal virtual {
require(feeNumerator <= _feeDenominator());
if(receiver == address(0)) revert ERC2981InvalidParameters();
_tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);
}
function _resetTokenRoyalty(uint256 tokenId) internal virtual {
delete _tokenRoyaltyInfo[tokenId];
}
}
文件 9 的 35: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;
error ERC721AddressZeroIsNotAValidOwner();
error ERC721InvalidTokenID();
error ERC721ApprovalToCurrentOwner();
error ERC721ApproveCallerIsNotTokenOwnerOrApprovedForAll();
error ERC721CallerIsNotTokenOwnerOrApproved();
error ERC721TransferToNonERC721ReceiverImplementer();
error ERC721MintToTheZeroAddress();
error ERC721TokenAlreadyMinted();
error ERC721TransferFromIncorrectOwner();
error ERC721TransferToTheZeroAddress();
error ERC721ApproveToCaller();
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) {
if(owner == address(0)) revert ERC721AddressZeroIsNotAValidOwner();
return _balances[owner];
}
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _ownerOf(tokenId);
if(owner == address(0)) revert ERC721InvalidTokenID();
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);
if(to == owner) revert ERC721ApprovalToCurrentOwner();
if(!(_msgSender() == owner || isApprovedForAll(owner, _msgSender())))
revert ERC721ApproveCallerIsNotTokenOwnerOrApprovedForAll();
_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 {
if(!_isApprovedOrOwner(_msgSender(), tokenId)) revert ERC721CallerIsNotTokenOwnerOrApproved();
_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 {
if(!_isApprovedOrOwner(_msgSender(), tokenId)) revert ERC721CallerIsNotTokenOwnerOrApproved();
_safeTransfer(from, to, tokenId, data);
}
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory data
) internal virtual {
_transfer(from, to, tokenId);
if(!_checkOnERC721Received(from, to, tokenId, data)) revert ERC721TransferToNonERC721ReceiverImplementer();
}
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);
if(!_checkOnERC721Received(address(0), to, tokenId, data)) revert ERC721TransferToNonERC721ReceiverImplementer();
}
function _mint(address to, uint256 tokenId) internal virtual {
if(to == address(0)) revert ERC721MintToTheZeroAddress();
if(_exists(tokenId)) revert ERC721TokenAlreadyMinted();
_beforeTokenTransfer(address(0), to, tokenId, 1);
if(_exists(tokenId)) revert ERC721TokenAlreadyMinted();
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 {
if(ERC721.ownerOf(tokenId) != from) revert ERC721TransferFromIncorrectOwner();
if(to == address(0)) revert ERC721TransferToTheZeroAddress();
_beforeTokenTransfer(from, to, tokenId, 1);
if(ERC721.ownerOf(tokenId) != from) revert ERC721TransferFromIncorrectOwner();
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 {
if(owner == operator) revert ERC721ApproveToCaller();
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
function _requireMinted(uint256 tokenId) internal view virtual {
if(!_exists(tokenId)) revert ERC721InvalidTokenID();
}
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 ERC721TransferToNonERC721ReceiverImplementer();
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
function _beforeTokenTransfer(
address from,
address to,
uint256,
uint256 batchSize
) internal virtual {
if (batchSize > 1) {
if (from != address(0)) {
_balances[from] -= batchSize;
}
if (to != address(0)) {
_balances[to] += batchSize;
}
}
}
function _afterTokenTransfer(
address from,
address to,
uint256 firstTokenId,
uint256 batchSize
) internal virtual {}
}
文件 10 的 35:ERC721Enumerable.sol
pragma solidity ^0.8.0;
import "../ERC721.sol";
import "./IERC721Enumerable.sol";
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
mapping(address => mapping(uint256 => uint256)) private _ownedTokens;
mapping(uint256 => uint256) private _ownedTokensIndex;
uint256[] private _allTokens;
mapping(uint256 => uint256) private _allTokensIndex;
error ERC721EnumerableOwnerIndexOutOfBounds();
error ERC721EnumerableGlobalIndexOutOfBounds();
error ERC721EnumerableConsecutiveTransfersNotSupported();
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {
return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);
}
function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
if(!(index < ERC721.balanceOf(owner))) revert ERC721EnumerableOwnerIndexOutOfBounds();
return _ownedTokens[owner][index];
}
function totalSupply() public view virtual override returns (uint256) {
return _allTokens.length;
}
function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
if(!(index < ERC721Enumerable.totalSupply())) revert ERC721EnumerableGlobalIndexOutOfBounds();
return _allTokens[index];
}
function _beforeTokenTransfer(
address from,
address to,
uint256 firstTokenId,
uint256 batchSize
) internal virtual override {
super._beforeTokenTransfer(from, to, firstTokenId, batchSize);
if (batchSize > 1) {
revert ERC721EnumerableConsecutiveTransfersNotSupported();
}
uint256 tokenId = firstTokenId;
if (from == address(0)) {
_addTokenToAllTokensEnumeration(tokenId);
} else if (from != to) {
_removeTokenFromOwnerEnumeration(from, tokenId);
}
if (to == address(0)) {
_removeTokenFromAllTokensEnumeration(tokenId);
} else if (to != from) {
_addTokenToOwnerEnumeration(to, tokenId);
}
}
function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
uint256 length = ERC721.balanceOf(to);
_ownedTokens[to][length] = tokenId;
_ownedTokensIndex[tokenId] = length;
}
function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
_allTokensIndex[tokenId] = _allTokens.length;
_allTokens.push(tokenId);
}
function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
uint256 tokenIndex = _ownedTokensIndex[tokenId];
if (tokenIndex != lastTokenIndex) {
uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];
_ownedTokens[from][tokenIndex] = lastTokenId;
_ownedTokensIndex[lastTokenId] = tokenIndex;
}
delete _ownedTokensIndex[tokenId];
delete _ownedTokens[from][lastTokenIndex];
}
function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
uint256 lastTokenIndex = _allTokens.length - 1;
uint256 tokenIndex = _allTokensIndex[tokenId];
uint256 lastTokenId = _allTokens[lastTokenIndex];
_allTokens[tokenIndex] = lastTokenId;
_allTokensIndex[lastTokenId] = tokenIndex;
delete _allTokensIndex[tokenId];
_allTokens.pop();
}
}
文件 11 的 35:ERC721URIStorage.sol
pragma solidity ^0.8.0;
import "../ERC721.sol";
abstract contract ERC721URIStorage is ERC721 {
using Strings for uint256;
mapping(uint256 => string) private _tokenURIs;
error ERC721URIStorageURISetOfNonexistentToken();
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
_requireMinted(tokenId);
string memory _tokenURI = _tokenURIs[tokenId];
string memory base = _baseURI();
if (bytes(base).length == 0) {
return _tokenURI;
}
if (bytes(_tokenURI).length > 0) {
return string(abi.encodePacked(base, _tokenURI));
}
return super.tokenURI(tokenId);
}
function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
if(!_exists(tokenId)) revert ERC721URIStorageURISetOfNonexistentToken();
_tokenURIs[tokenId] = _tokenURI;
}
function _burn(uint256 tokenId) internal virtual override {
super._burn(tokenId);
if (bytes(_tokenURIs[tokenId]).length != 0) {
delete _tokenURIs[tokenId];
}
}
}
文件 12 的 35:Errors.sol
pragma solidity 0.8.19;
import "./StringHelper.sol";
error Failed(bytes reason);
error TransferFailed(bytes reason);
error ZeroAddress();
error AlreadyExist();
error ZeroValue();
error ZeroBalance();
error EmptyValue();
error InsufficientAmount();
error GreaterThanZero();
error Ownership();
error NotFound();
error InvalidTokenType();
error MustBeLaterThanNow();
error MustBeLaterThan(uint64 time);
error NotStarted();
error Ended();
error Incomplete();
error NotRefundable();
error NoRefundFound();
error MustBeHigherThanPreviousOne();
error MustBeLowerThanPreviousOne();
error LengthMismatch();
error MaxSupplyReached();
error MaxAmountReached();
error InvalidDate();
error InvalidAmount();
error InvalidValue();
error InvalidCall();
error Unauthorized();
error NotImplemented();
error Required();
library ErrorHelper {
using StringHelper for string;
function checkAddress(address addr) internal pure {
if (addr == address(0)) revert ZeroAddress();
}
function checkZero(uint256 _value) internal pure {
if (_value == 0) revert ZeroValue();
}
function checkEmpty(string memory _s) internal pure {
if (_s.isEmpty()) revert EmptyValue();
}
}
文件 13 的 35:IERC165.sol
pragma solidity ^0.8.0;
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
文件 14 的 35:IERC20.sol
pragma solidity ^0.8.0;
interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address to, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}
文件 15 的 35: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);
}
文件 16 的 35: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);
}
文件 17 的 35:IERC721Enumerable.sol
pragma solidity ^0.8.0;
import "../IERC721.sol";
interface IERC721Enumerable is IERC721 {
function totalSupply() external view returns (uint256);
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);
function tokenByIndex(uint256 index) external view returns (uint256);
}
文件 18 的 35: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);
}
文件 19 的 35:IERC721Receiver.sol
pragma solidity ^0.8.0;
interface IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
文件 20 的 35: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 unregister(address addr) 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);
}
文件 21 的 35:LimitedNFT.sol
pragma solidity 0.8.19;
import "../../../ext-contracts/@openzeppelin/contracts/utils/Counters.sol";
import "../../../ext-contracts/@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "../util/Errors.sol";
abstract contract LimitedNFT is ERC721Enumerable {
mapping(address => uint256) _mintCounter;
uint256 public _maxMintCountForPerAddress;
uint256 public _maxSupply;
error MaxMintCountExceed();
constructor(uint256 maxSupply, uint256 maxMintCountForPerAddress) {
_maxSupply = maxSupply;
_maxMintCountForPerAddress = maxMintCountForPerAddress;
}
function _mint(address to, uint256 tokenId) internal virtual override {
if (
_maxMintCountForPerAddress > 0 &&
_mintCounter[to] == _maxMintCountForPerAddress
) revert MaxMintCountExceed();
if (_maxSupply > 0 && totalSupply() == _maxSupply)
revert MaxSupplyReached();
ERC721._mint(to, tokenId);
_mintCounter[to]++;
}
function getMintCount(address tokenOwner) public view returns (uint256) {
return _mintCounter[tokenOwner];
}
}
文件 22 的 35: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);
}
}
}
文件 23 的 35: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 totalHashes = proofFlags.length;
require(leavesLen + proof.length - 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) {
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 totalHashes = proofFlags.length;
require(leavesLen + proof.length - 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) {
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)
}
}
}
文件 24 的 35:MerkleVerifier.sol
pragma solidity 0.8.19;
import "../../../ext-contracts/@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
abstract contract MerkleVerifier {
error MerkleVerificationEror();
function verifyMerkle(
bytes32 leaf,
bytes32[] calldata merkleProof,
bytes32 merkleRootHash
) internal pure {
if (!MerkleProof.verifyCalldata(merkleProof, merkleRootHash, leaf))
revert MerkleVerificationEror();
}
function isMerkleValid(
bytes32 leaf,
bytes32[] calldata merkleProof,
bytes32 merkleRootHash
) internal pure returns(bool) {
return MerkleProof.verifyCalldata(merkleProof, merkleRootHash, leaf);
}
}
文件 25 的 35:OperatorFilterer.sol
pragma solidity ^0.8.13;
import {IOperatorFilterRegistry} from "./IOperatorFilterRegistry.sol";
import "../../contracts/v1/util/ArrayFind.sol";
import "../../contracts/v1/util/Types.sol";
abstract contract OperatorFilterer {
error OperatorNotAllowed(address operator);
using ArrayFind for address;
OperatorRegistry[] public _operatorRegistries;
bool _operatorFiltering = true;
function _registerOperatorFilter(
address registry,
address subscriptionOrRegistrantToCopy,
bool subscribe
) internal virtual {
if (registry.code.length == 0) return;
IOperatorFilterRegistry filterRegistry = IOperatorFilterRegistry(
registry
);
if (subscribe) {
filterRegistry.registerAndSubscribe(
address(this),
subscriptionOrRegistrantToCopy
);
} else {
if (subscriptionOrRegistrantToCopy != address(0)) {
filterRegistry.registerAndCopyEntries(
address(this),
subscriptionOrRegistrantToCopy
);
} else {
filterRegistry.register(address(this));
}
}
_operatorRegistries.push(
OperatorRegistry(
registry,
subscribe ? subscriptionOrRegistrantToCopy : address(0)
)
);
}
function _unregisterOperatorFilter(address registry) internal virtual {
IOperatorFilterRegistry(registry).unregister(address(this));
uint256 ind;
uint256 len = _operatorRegistries.length;
for (uint i = 0; i < len; i++) {
if (_operatorRegistries[i].registry == registry) {
ind = i + 1;
break;
}
}
if (ind == 0) return;
if (ind < len)
_operatorRegistries[ind - 1] = _operatorRegistries[len - 1];
_operatorRegistries.pop();
}
modifier onlyAllowedOperator(address from) virtual {
if (from != msg.sender) {
_checkFilterOperator(msg.sender);
}
_;
}
modifier onlyAllowedOperatorApproval(address operator) virtual {
_checkFilterOperator(operator);
_;
}
function _checkFilterOperator(address operator) internal view virtual {
if (!_operatorFiltering) return;
bool ok = false;
for (uint i = 0; i < _operatorRegistries.length; i++) {
address registry = _operatorRegistries[i].registry;
ok = IOperatorFilterRegistry(registry).isOperatorAllowed(
address(this),
operator
);
if (ok) break;
}
if (!ok) {
revert OperatorNotAllowed(operator);
}
}
}
struct OperatorRegistry {
address registry;
address subscription;
}
文件 26 的 35: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);
error OwnableCallerIsNotTheOwner();
error OwnableNewOwnerIsTheZeroAddress();
constructor() {
_transferOwnership(_msgSender());
}
modifier onlyOwner() {
_checkOwner();
_;
}
function owner() public view virtual returns (address) {
return _owner;
}
function _checkOwner() internal view virtual {
if(owner() != _msgSender()) revert OwnableCallerIsNotTheOwner();
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
if(newOwner == address(0)) revert OwnableNewOwnerIsTheZeroAddress();
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
文件 27 的 35:PausableTopic.sol
pragma solidity 0.8.19;
abstract contract PausableTopic {
mapping(uint8 => bool) public _pausableTopics;
error TopicPaused();
error TopicNotPaused();
modifier whenPaused(uint8 topic) {
if (!_pausableTopics[topic]) revert TopicNotPaused();
_;
}
modifier whenNotPaused(uint8 topic) {
if (_pausableTopics[topic]) revert TopicPaused();
_;
}
function isPaused(uint8 topic) public view returns(bool) {
return _pausableTopics[topic];
}
}
文件 28 的 35:PhasedSales.sol
pragma solidity 0.8.19;
import "../../../ext-contracts/@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "../access/MerkleVerifier.sol";
import "../util/TimeRangeLib.sol";
import "../util/Errors.sol";
abstract contract PhasedSales is MerkleVerifier {
SalesPhase[] public _salesPhases;
mapping(uint8 => mapping(address => uint256)) public _usages;
IERC20 public _salesToken;
constructor(IERC20 salesToken) {
_salesToken = salesToken;
}
function _setSalesPhases(SalesPhase[] memory salesPhases) internal {
while (_salesPhases.length > salesPhases.length) _salesPhases.pop();
if (_salesPhases.length >= salesPhases.length) {
for (uint i = 0; i < salesPhases.length; i++)
_salesPhases[i] = salesPhases[i];
}
uint256 ind = _salesPhases.length;
for (uint i = ind; i < salesPhases.length; i++)
_salesPhases.push(salesPhases[i]);
}
function getSalesPhases() public view returns (SalesPhase[] memory) {
return _salesPhases;
}
function _updateSalesPhase(
uint8 phaseIndex,
SalesPhase memory salesPhase
) internal {
if (_salesPhases.length <= phaseIndex) revert InvalidValue();
_salesPhases[phaseIndex] = salesPhase;
}
function _buy(
uint8 phaseIndex,
uint256 amount,
uint256 requestedAmount
) internal {
if (phaseIndex + 1 > _salesPhases.length) revert InvalidValue();
SalesPhase memory salesPhase = _salesPhases[phaseIndex];
if (salesPhase.merkleRootHash != bytes32(0x0)) revert InvalidCall();
uint256 price = salesPhase.price;
TimeRangeLib.check(salesPhase.timeRange);
if (
salesPhase.amountLimiting &&
_usages[phaseIndex][msg.sender] >= amount
) revert MaxAmountReached();
_receivePayment(
amount,
requestedAmount,
salesPhase.amountLimiting,
price,
phaseIndex
);
}
function _buy(
uint8 phaseIndex,
uint256 amount,
uint256 requestedAmount,
bytes32[] calldata merkleProof
) internal {
if (phaseIndex + 1 > _salesPhases.length) revert InvalidValue();
SalesPhase memory salesPhase = _salesPhases[phaseIndex];
uint256 price = salesPhase.price;
if (price == 0 && salesPhase.merkleRootHash == bytes32(0x0))
revert InvalidValue();
TimeRangeLib.check(salesPhase.timeRange);
if (
salesPhase.amountLimiting &&
_usages[phaseIndex][msg.sender] >= amount
) revert MaxAmountReached();
bytes32 leaf = keccak256(abi.encodePacked(msg.sender, amount));
bool valid = isMerkleValid(
leaf,
merkleProof,
salesPhase.merkleRootHash
);
if (!valid && phaseIndex > 0) {
for (uint8 i = phaseIndex; i > 0; i--) {
salesPhase = _salesPhases[i - 1];
uint256[] memory prices = salesPhase.phasePrices;
if (phaseIndex + 1 > prices.length) continue;
price = prices[phaseIndex];
bool amountOK = !salesPhase.amountLimiting;
if (salesPhase.amountLimiting) {
uint256 usedAmount = _usages[i - 1][msg.sender];
uint256 remainingAmount = amount - usedAmount;
if (requestedAmount <= remainingAmount) amountOK = true;
}
if (amountOK) {
valid = isMerkleValid(
leaf,
merkleProof,
salesPhase.merkleRootHash
);
if (valid) break;
}
}
}
if (!valid) revert MerkleVerificationEror();
_receivePayment(
amount,
requestedAmount,
salesPhase.amountLimiting,
price,
phaseIndex
);
}
function _receivePayment(
uint256 amount,
uint256 requestedAmount,
bool amountLimiting,
uint256 price,
uint8 phaseIndex
) private {
if (amountLimiting) {
uint256 usedAmount = _usages[phaseIndex][msg.sender];
uint256 remainingAmount = amount - usedAmount;
if (requestedAmount > remainingAmount) revert InvalidAmount();
}
_usages[phaseIndex][msg.sender] += requestedAmount;
uint256 totalAmount = requestedAmount * price;
if (totalAmount == 0) return;
if (address(_salesToken) != address(0)) {
bool transferOK = _salesToken.transferFrom(
msg.sender,
address(this),
totalAmount
);
if (!transferOK) revert TransferFailed("");
} else if (msg.value < totalAmount) {
revert InsufficientAmount();
}
}
}
struct SalesPhase {
bytes32 merkleRootHash;
uint256 price;
uint256[] phasePrices;
StartEndTime timeRange;
bool amountLimiting;
}
文件 29 的 35:RoyaltyReceiver.sol
pragma solidity 0.8.19;
import "../../../ext-contracts/@openzeppelin/contracts/token/common/ERC2981.sol";
import "./CashCollector.sol";
abstract contract RoyaltyReceiver is CashCollector, ERC2981 {
constructor(
address accountOwner,
uint96 numerator,
IERC20[] memory paymentTokens
) CashCollector(accountOwner, paymentTokens) {
_setDefaultRoyalty(address(this), numerator);
}
function feeDenominator() public pure returns (uint96) {
return _feeDenominator();
}
}
文件 30 的 35:StringHelper.sol
pragma solidity 0.8.19;
library StringHelper {
function toHash(string memory _s) internal pure returns (bytes32) {
return keccak256(abi.encode(_s));
}
function isEmpty(string memory _s) internal pure returns (bool) {
return length(_s) == 0;
}
function length(string memory _s) internal pure returns (uint256) {
return bytes(_s).length;
}
}
文件 31 的 35:Strings.sol
pragma solidity ^0.8.0;
import "./math/Math.sol";
library Strings {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
error StringsHexLengthInsufficient();
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;
}
if(value != 0) revert StringsHexLengthInsufficient();
return string(buffer);
}
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
}
文件 32 的 35:TimeRangeLib.sol
pragma solidity 0.8.19;
import "./Errors.sol";
struct StartEndTime {
uint64 start;
uint64 end;
}
library TimeRangeLib {
function isStarted(StartEndTime memory time)
internal
view
returns (bool)
{
return time.start <= block.timestamp;
}
function isEnded(StartEndTime memory time)
internal
view
returns (bool)
{
return time.end <= block.timestamp;
}
function isItIn(StartEndTime memory time)
internal
view
returns (bool)
{
return isStarted(time) && !isEnded(time);
}
function checkStarted(StartEndTime memory time)
internal
view
{
if (!isStarted(time)) revert NotStarted();
}
function checkEnded(StartEndTime memory time)
internal
view
{
if (isEnded(time)) revert Ended();
}
function check(StartEndTime memory time)
internal
view
{
checkStarted(time);
checkEnded(time);
}
}
文件 33 的 35:Types.sol
pragma solidity 0.8.19;
uint256 constant IndexNotFound = 2 ^ (256 - 1);
文件 34 的 35:UnfetteredBaseToken.sol
pragma solidity 0.8.19;
import "../../ext-contracts/@openzeppelin/contracts/access/Ownable.sol";
import "../../ext-contracts/@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "../../ext-contracts/operator-filter-registry/DefaultOperatorFilterer.sol";
import "../v1/money/RoyaltyReceiver.sol";
import "../v1/token/LimitedNFT.sol";
import "../v1/access/PausableTopic.sol";
abstract contract UnfetteredBaseToken is
ERC721URIStorage,
PausableTopic,
RoyaltyReceiver,
LimitedNFT,
DefaultOperatorFilterer,
Ownable
{
string public _baseUri;
string public _defaultMetadataURI;
constructor(
address accountOwner,
string memory name,
string memory symbol,
string memory defaultMetadataURI,
uint96 numerator,
IERC20[] memory paymentTokens,
uint256 maxSupply,
uint256 maxMintCountForPerAddress
)
ERC721(name, symbol)
RoyaltyReceiver(accountOwner, numerator, paymentTokens)
LimitedNFT(maxSupply, maxMintCountForPerAddress)
{
_defaultMetadataURI = defaultMetadataURI;
}
function setPaused(uint8 topic, bool paused) public onlyOwner {
_pausableTopics[topic] = paused;
}
function setAccountOwner(address accountOwner) public onlyOwner {
_setAccountOwner(accountOwner);
}
function addRemovePaymentToken(
IERC20 paymentToken,
bool remove
) public onlyOwner {
_addRemovePaymentToken(paymentToken, remove);
}
function withdraw() external onlyAccountOwner {
_withdraw();
}
function _mint(
address to,
uint256 tokenId
) internal virtual override(ERC721, LimitedNFT) whenNotPaused(MintPauseTopicID) {
LimitedNFT._mint(to, tokenId);
}
function _baseURI() internal view virtual override returns (string memory) {
return _baseUri;
}
function setBaseURI(string calldata uri) external onlyOwner {
_baseUri = uri;
}
function tokenURI(
uint256 tokenId
)
public
view
virtual
override(ERC721, ERC721URIStorage)
returns (string memory)
{
string memory uri = ERC721URIStorage.tokenURI(tokenId);
if (bytes(uri).length > 0)
return uri;
return _defaultMetadataURI;
}
function setTokenURI(
uint256 tokenId,
string memory _tokenURI
) public onlyOwner {
ERC721URIStorage._setTokenURI(tokenId, _tokenURI);
}
function setMaxMintCountForPerAddress(
uint256 max
) public virtual onlyOwner {
_maxMintCountForPerAddress = max;
}
function setOperatorFiltering(bool enabled) public onlyOwner {
_operatorFiltering = enabled;
}
function registerOperatorFilter(
address registry,
address subscriptionOrRegistrantToCopy,
bool subscribe
) public onlyOwner {
_registerOperatorFilter(
registry,
subscriptionOrRegistrantToCopy,
subscribe
);
}
function unregisterOperatorFilter(address registry) public onlyOwner {
_unregisterOperatorFilter(registry);
}
function setApprovalForAll(
address operator,
bool approved
) public override(ERC721, IERC721) onlyAllowedOperatorApproval(operator) {
ERC721.setApprovalForAll(operator, approved);
}
function approve(
address operator,
uint256 tokenId
) public override(ERC721, IERC721) onlyAllowedOperatorApproval(operator) {
ERC721.approve(operator, tokenId);
}
function transferFrom(
address from,
address to,
uint256 tokenId
) public override(ERC721, IERC721) onlyAllowedOperator(from) {
ERC721.transferFrom(from, to, tokenId);
}
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public override(ERC721, IERC721) onlyAllowedOperator(from) {
ERC721.safeTransferFrom(from, to, tokenId);
}
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory data
) public override(ERC721, IERC721) onlyAllowedOperator(from) {
ERC721.safeTransferFrom(from, to, tokenId, data);
}
function _beforeTokenTransfer(
address from,
address to,
uint256 firstTokenId,
uint256 batchSize
) internal override(ERC721, ERC721Enumerable) {
if (from != address(0) && isPaused(TransferPauseTopicID))
revert TopicPaused();
ERC721Enumerable._beforeTokenTransfer(
from,
to,
firstTokenId,
batchSize
);
}
function supportsInterface(
bytes4 interfaceId
) public view override(ERC721, ERC721Enumerable, ERC2981) returns (bool) {
return
ERC721Enumerable.supportsInterface(interfaceId) ||
ERC2981.supportsInterface(interfaceId);
}
function _burn(
uint256 tokenId
) internal virtual override(ERC721, ERC721URIStorage) {
ERC721URIStorage._burn(tokenId);
}
}
uint8 constant MintPauseTopicID = 1;
uint8 constant TransferPauseTopicID = 2;
文件 35 的 35:UnfetteredFounderPass.sol
pragma solidity 0.8.19;
import "./UnfetteredBaseToken.sol";
import "../v1/access/MerkleVerifier.sol";
import "../v1/util/TimeRangeLib.sol";
import "../v1/util/Errors.sol";
import "../v1/token/PhasedSales.sol";
contract UnfetteredFounderPass is UnfetteredBaseToken, PhasedSales {
address public treasuryWallet;
constructor(
address accountOwner,
string memory name,
string memory symbol,
string memory baseURI,
uint96 numerator,
IERC20 salesToken,
IERC20[] memory paymentTokens,
uint256 maxSupply,
uint256 maxMintCountForPerAddress
)
UnfetteredBaseToken(
accountOwner,
name,
symbol,
baseURI,
numerator,
paymentTokens,
maxSupply,
maxMintCountForPerAddress
)
PhasedSales(salesToken)
{
if (address(salesToken) != address(0)) {
_addRemovePaymentToken(salesToken, false);
}
}
function setTreasuryWallet(address addr) public onlyOwner {
treasuryWallet = addr;
}
function setMaxSupply(uint256 maxSupply) public onlyOwner {
_maxSupply = maxSupply;
}
function setSalesPhases(
SalesPhase[] memory salesPhases
) external onlyOwner {
_setSalesPhases(salesPhases);
}
function updateSalesPhase(
uint8 phaseIndex,
SalesPhase memory salesPhase
) public onlyOwner {
_updateSalesPhase(phaseIndex, salesPhase);
}
function mintToTreasury(uint256 amount) public onlyOwner {
for (uint i = 0; i < amount; i++) _mint(treasuryWallet, totalSupply());
}
function mint(
uint8 phaseIndex,
uint256 amount,
uint256 requestedAmount,
bytes32[] calldata merkleProof
) public payable whenNotPaused(SalePauseTopicID) {
_buy(phaseIndex, amount, requestedAmount, merkleProof);
for (uint i = 0; i < requestedAmount; i++)
_mint(msg.sender, totalSupply());
}
function mint(
uint8 phaseIndex,
uint256 amount,
uint256 requestedAmount
) public payable whenNotPaused(SalePauseTopicID) {
_buy(phaseIndex, amount, requestedAmount);
for (uint i = 0; i < requestedAmount; i++)
_mint(msg.sender, totalSupply());
}
}
uint8 constant SalePauseTopicID = 101;
{
"compilationTarget": {
"contracts/nft/UnfetteredFounderPass.sol": "UnfetteredFounderPass"
},
"evmVersion": "paris",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": []
}
[{"inputs":[{"internalType":"address","name":"accountOwner","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"string","name":"baseURI","type":"string"},{"internalType":"uint96","name":"numerator","type":"uint96"},{"internalType":"contract IERC20","name":"salesToken","type":"address"},{"internalType":"contract IERC20[]","name":"paymentTokens","type":"address[]"},{"internalType":"uint256","name":"maxSupply","type":"uint256"},{"internalType":"uint256","name":"maxMintCountForPerAddress","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ERC2981InvalidParameters","type":"error"},{"inputs":[],"name":"ERC721AddressZeroIsNotAValidOwner","type":"error"},{"inputs":[],"name":"ERC721ApprovalToCurrentOwner","type":"error"},{"inputs":[],"name":"ERC721ApproveCallerIsNotTokenOwnerOrApprovedForAll","type":"error"},{"inputs":[],"name":"ERC721ApproveToCaller","type":"error"},{"inputs":[],"name":"ERC721CallerIsNotTokenOwnerOrApproved","type":"error"},{"inputs":[],"name":"ERC721EnumerableConsecutiveTransfersNotSupported","type":"error"},{"inputs":[],"name":"ERC721EnumerableGlobalIndexOutOfBounds","type":"error"},{"inputs":[],"name":"ERC721EnumerableOwnerIndexOutOfBounds","type":"error"},{"inputs":[],"name":"ERC721InvalidTokenID","type":"error"},{"inputs":[],"name":"ERC721MintToTheZeroAddress","type":"error"},{"inputs":[],"name":"ERC721TokenAlreadyMinted","type":"error"},{"inputs":[],"name":"ERC721TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"ERC721TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"ERC721TransferToTheZeroAddress","type":"error"},{"inputs":[],"name":"ERC721URIStorageURISetOfNonexistentToken","type":"error"},{"inputs":[],"name":"Ended","type":"error"},{"inputs":[],"name":"InsufficientAmount","type":"error"},{"inputs":[],"name":"InvalidAmount","type":"error"},{"inputs":[],"name":"InvalidCall","type":"error"},{"inputs":[],"name":"InvalidValue","type":"error"},{"inputs":[],"name":"MaxAmountReached","type":"error"},{"inputs":[],"name":"MaxMintCountExceed","type":"error"},{"inputs":[],"name":"MaxSupplyReached","type":"error"},{"inputs":[],"name":"MerkleVerificationEror","type":"error"},{"inputs":[],"name":"NoReEntrancy","type":"error"},{"inputs":[],"name":"NotStarted","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"OperatorNotAllowed","type":"error"},{"inputs":[],"name":"OwnableCallerIsNotTheOwner","type":"error"},{"inputs":[],"name":"OwnableNewOwnerIsTheZeroAddress","type":"error"},{"inputs":[],"name":"TopicNotPaused","type":"error"},{"inputs":[],"name":"TopicPaused","type":"error"},{"inputs":[{"internalType":"bytes","name":"reason","type":"bytes"}],"name":"TransferFailed","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"inputs":[],"name":"ZeroAddress","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":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Receive","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"balance","type":"uint256"},{"indexed":false,"internalType":"contract IERC20[]","name":"paymentTokens","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"tokenBalances","type":"uint256[]"}],"name":"Withdrawn","type":"event"},{"inputs":[],"name":"_accountOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_baseUri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_defaultMetadataURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_maxMintCountForPerAddress","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":"uint256","name":"","type":"uint256"}],"name":"_operatorRegistries","outputs":[{"internalType":"address","name":"registry","type":"address"},{"internalType":"address","name":"subscription","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"","type":"uint8"}],"name":"_pausableTopics","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"_salesPhases","outputs":[{"internalType":"bytes32","name":"merkleRootHash","type":"bytes32"},{"internalType":"uint256","name":"price","type":"uint256"},{"components":[{"internalType":"uint64","name":"start","type":"uint64"},{"internalType":"uint64","name":"end","type":"uint64"}],"internalType":"struct StartEndTime","name":"timeRange","type":"tuple"},{"internalType":"bool","name":"amountLimiting","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_salesToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"","type":"uint8"},{"internalType":"address","name":"","type":"address"}],"name":"_usages","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"paymentToken","type":"address"},{"internalType":"bool","name":"remove","type":"bool"}],"name":"addRemovePaymentToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeDenominator","outputs":[{"internalType":"uint96","name":"","type":"uint96"}],"stateMutability":"pure","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":"tokenOwner","type":"address"}],"name":"getMintCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPaymentTokens","outputs":[{"internalType":"contract IERC20[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSalesPhases","outputs":[{"components":[{"internalType":"bytes32","name":"merkleRootHash","type":"bytes32"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256[]","name":"phasePrices","type":"uint256[]"},{"components":[{"internalType":"uint64","name":"start","type":"uint64"},{"internalType":"uint64","name":"end","type":"uint64"}],"internalType":"struct StartEndTime","name":"timeRange","type":"tuple"},{"internalType":"bool","name":"amountLimiting","type":"bool"}],"internalType":"struct SalesPhase[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"topic","type":"uint8"}],"name":"isPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"phaseIndex","type":"uint8"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"requestedAmount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint8","name":"phaseIndex","type":"uint8"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"requestedAmount","type":"uint256"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mintToTreasury","outputs":[],"stateMutability":"nonpayable","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":[{"internalType":"address","name":"registry","type":"address"},{"internalType":"address","name":"subscriptionOrRegistrantToCopy","type":"address"},{"internalType":"bool","name":"subscribe","type":"bool"}],"name":"registerOperatorFilter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","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":"accountOwner","type":"address"}],"name":"setAccountOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"uri","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"max","type":"uint256"}],"name":"setMaxMintCountForPerAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"maxSupply","type":"uint256"}],"name":"setMaxSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"enabled","type":"bool"}],"name":"setOperatorFiltering","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"topic","type":"uint8"},{"internalType":"bool","name":"paused","type":"bool"}],"name":"setPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32","name":"merkleRootHash","type":"bytes32"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256[]","name":"phasePrices","type":"uint256[]"},{"components":[{"internalType":"uint64","name":"start","type":"uint64"},{"internalType":"uint64","name":"end","type":"uint64"}],"internalType":"struct StartEndTime","name":"timeRange","type":"tuple"},{"internalType":"bool","name":"amountLimiting","type":"bool"}],"internalType":"struct SalesPhase[]","name":"salesPhases","type":"tuple[]"}],"name":"setSalesPhases","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"_tokenURI","type":"string"}],"name":"setTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"setTreasuryWallet","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":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","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":"treasuryWallet","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"registry","type":"address"}],"name":"unregisterOperatorFilter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"phaseIndex","type":"uint8"},{"components":[{"internalType":"bytes32","name":"merkleRootHash","type":"bytes32"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256[]","name":"phasePrices","type":"uint256[]"},{"components":[{"internalType":"uint64","name":"start","type":"uint64"},{"internalType":"uint64","name":"end","type":"uint64"}],"internalType":"struct StartEndTime","name":"timeRange","type":"tuple"},{"internalType":"bool","name":"amountLimiting","type":"bool"}],"internalType":"struct SalesPhase","name":"salesPhase","type":"tuple"}],"name":"updateSalesPhase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]