编译器
0.8.21+commit.d9974bed
文件 1 的 47:BatchMintMetadata.sol
pragma solidity ^0.8.0;
contract BatchMintMetadata {
uint256[] private batchIds;
mapping(uint256 => string) private baseURI;
function getBaseURICount() public view returns (uint256) {
return batchIds.length;
}
function getBatchIdAtIndex(uint256 _index) public view returns (uint256) {
if (_index >= getBaseURICount()) {
revert("Invalid index");
}
return batchIds[_index];
}
function _getBatchId(uint256 _tokenId) internal view returns (uint256 batchId, uint256 index) {
uint256 numOfTokenBatches = getBaseURICount();
uint256[] memory indices = batchIds;
for (uint256 i = 0; i < numOfTokenBatches; i += 1) {
if (_tokenId < indices[i]) {
index = i;
batchId = indices[i];
return (batchId, index);
}
}
revert("Invalid tokenId");
}
function _getBaseURI(uint256 _tokenId) internal view returns (string memory) {
uint256 numOfTokenBatches = getBaseURICount();
uint256[] memory indices = batchIds;
for (uint256 i = 0; i < numOfTokenBatches; i += 1) {
if (_tokenId < indices[i]) {
return baseURI[indices[i]];
}
}
revert("Invalid tokenId");
}
function _setBaseURI(uint256 _batchId, string memory _baseURI) internal {
baseURI[_batchId] = _baseURI;
}
function _batchMintMetadata(
uint256 _startId,
uint256 _amountToMint,
string memory _baseURIForTokens
) internal returns (uint256 nextTokenIdToMint, uint256 batchId) {
batchId = _startId + _amountToMint;
nextTokenIdToMint = batchId;
batchIds.push(batchId);
baseURI[batchId] = _baseURIForTokens;
}
}
文件 2 的 47:BookDEA.sol
pragma solidity ^0.8.0;
import "@thirdweb-dev/contracts/lib/TWStrings.sol";
import "@thirdweb-dev/contracts/base/ERC721SignatureMint.sol";
import "@thirdweb-dev/contracts/extension/PermissionsEnumerable.sol";
import "@thirdweb-dev/contracts/extension/LazyMint.sol";
import "./RandomSignatureMint.sol";
using TWStrings for uint256;
contract BookDEA is
PermissionsEnumerable,
RandomSignatureMint
{
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes16 public mediaId;
constructor(
address _defaultAdmin,
string memory _name,
string memory _symbol,
address _royaltyRecipient,
uint16 _royaltyBps,
address _primarySaleRecipient,
bytes16 _mediaId
)
RandomSignatureMint(
_defaultAdmin,
_name,
_symbol,
_royaltyRecipient,
_royaltyBps,
_primarySaleRecipient
)
{
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
_setupRole(MINTER_ROLE, msg.sender);
mediaId = _mediaId;
}
function _canSignAnyRequest(address _signer) internal view virtual override returns (bool) {
return hasRole(MINTER_ROLE, _signer);
}
function _canSetPrimarySaleRecipient() internal view override returns (bool) {
return hasRole(DEFAULT_ADMIN_ROLE, _msgSender());
}
function _canSetOwner() internal view override returns (bool) {
return hasRole(DEFAULT_ADMIN_ROLE, _msgSender());
}
function _canSetRoyaltyInfo() internal view override(ERC721Base, Royalty) returns (bool) {
return hasRole(DEFAULT_ADMIN_ROLE, _msgSender());
}
function _canSetContractURI() internal view override returns (bool) {
return hasRole(DEFAULT_ADMIN_ROLE, _msgSender());
}
function _canLazyMint() internal view virtual override returns (bool) {
return hasRole(MINTER_ROLE, _msgSender());
}
function _canChangeRandomizedMinting() internal view virtual override returns (bool) {
return hasRole(DEFAULT_ADMIN_ROLE, _msgSender());
}
function _canChangeCoolMint() internal view virtual override returns (bool) {
return hasRole(DEFAULT_ADMIN_ROLE, _msgSender());
}
function lazyMint(
uint256 _amount,
string calldata _baseURIForTokens,
bytes calldata _data
) public override returns (uint256 batchId) {
if (isRandomized) {
for (uint256 i = 0; i < _amount; i++) {
remainingMintableTokens.push(nextTokenIdToLazyMint + i);
}
}
return super.lazyMint(_amount, _baseURIForTokens, _data);
}
function totalMinted() external view returns (uint256) {
unchecked {
return _currentIndex - _startTokenId();
}
}
function totalLazyMinted() external view returns (uint256) {
return nextTokenIdToLazyMint;
}
function mintRequestPrice(MintRequest calldata _req, bytes calldata _signature)
public
view
returns (uint256) {
(bool isValid,) = verify(_req, _signature);
require(isValid, "Invalid signature");
return _req.pricePerToken;
}
function randMintRequestPrice(RandomMintRequest calldata _req, bytes calldata _signature)
public
view
returns (uint256) {
(bool isValid,) = verifyRandom(_req, _signature);
require(isValid, "Invalid signature");
return _req.pricePerToken;
}
}
文件 3 的 47:Context.sol
pragma solidity ^0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
文件 4 的 47:ContractMetadata.sol
pragma solidity ^0.8.0;
import "./interface/IContractMetadata.sol";
abstract contract ContractMetadata is IContractMetadata {
string public override contractURI;
function setContractURI(string memory _uri) external override {
if (!_canSetContractURI()) {
revert("Not authorized");
}
_setupContractURI(_uri);
}
function _setupContractURI(string memory _uri) internal {
string memory prevURI = contractURI;
contractURI = _uri;
emit ContractURIUpdated(prevURI, _uri);
}
function _canSetContractURI() internal view virtual returns (bool);
}
文件 5 的 47:CurrencyTransferLib.sol
pragma solidity ^0.8.0;
import { IWETH } from "../infra/interface/IWETH.sol";
import "../external-deps/openzeppelin/token/ERC20/utils/SafeERC20.sol";
library CurrencyTransferLib {
using SafeERC20 for IERC20;
address public constant NATIVE_TOKEN = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
function transferCurrency(
address _currency,
address _from,
address _to,
uint256 _amount
) internal {
if (_amount == 0) {
return;
}
if (_currency == NATIVE_TOKEN) {
safeTransferNativeToken(_to, _amount);
} else {
safeTransferERC20(_currency, _from, _to, _amount);
}
}
function transferCurrencyWithWrapper(
address _currency,
address _from,
address _to,
uint256 _amount,
address _nativeTokenWrapper
) internal {
if (_amount == 0) {
return;
}
if (_currency == NATIVE_TOKEN) {
if (_from == address(this)) {
IWETH(_nativeTokenWrapper).withdraw(_amount);
safeTransferNativeTokenWithWrapper(_to, _amount, _nativeTokenWrapper);
} else if (_to == address(this)) {
require(_amount == msg.value, "msg.value != amount");
IWETH(_nativeTokenWrapper).deposit{ value: _amount }();
} else {
safeTransferNativeTokenWithWrapper(_to, _amount, _nativeTokenWrapper);
}
} else {
safeTransferERC20(_currency, _from, _to, _amount);
}
}
function safeTransferERC20(
address _currency,
address _from,
address _to,
uint256 _amount
) internal {
if (_from == _to) {
return;
}
if (_from == address(this)) {
IERC20(_currency).safeTransfer(_to, _amount);
} else {
IERC20(_currency).safeTransferFrom(_from, _to, _amount);
}
}
function safeTransferNativeToken(address to, uint256 value) internal {
(bool success, ) = to.call{ value: value }("");
require(success, "native token transfer failed");
}
function safeTransferNativeTokenWithWrapper(
address to,
uint256 value,
address _nativeTokenWrapper
) internal {
(bool success, ) = to.call{ value: value }("");
if (!success) {
IWETH(_nativeTokenWrapper).deposit{ value: value }();
IERC20(_nativeTokenWrapper).safeTransfer(to, value);
}
}
}
文件 6 的 47:DefaultOperatorFilterer.sol
pragma solidity ^0.8.0;
import { OperatorFilterer } from "./OperatorFilterer.sol";
abstract contract DefaultOperatorFilterer is OperatorFilterer {
address constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6);
constructor() OperatorFilterer(DEFAULT_SUBSCRIPTION, true) {}
function subscribeToRegistry(address _subscription) external {
require(_canSetOperatorRestriction(), "Not authorized to subscribe to registry.");
_register(_subscription, true);
}
}
文件 7 的 47:ECDSA.sol
pragma solidity ^0.8.0;
import "../../../../lib/TWStrings.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");
}
}
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 {
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);
}
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 message) {
assembly {
mstore(0x00, "\x19Ethereum Signed Message:\n32")
mstore(0x1c, hash)
message := keccak256(0x00, 0x3c)
}
}
function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", TWStrings.toString(s.length), s));
}
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {
assembly {
let ptr := mload(0x40)
mstore(ptr, "\x19\x01")
mstore(add(ptr, 0x02), domainSeparator)
mstore(add(ptr, 0x22), structHash)
data := keccak256(ptr, 0x42)
}
}
function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x00", validator, data));
}
}
文件 8 的 47:EIP712.sol
pragma solidity ^0.8.0;
import "./ECDSA.sol";
abstract contract EIP712 {
bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;
uint256 private immutable _CACHED_CHAIN_ID;
address private immutable _CACHED_THIS;
bytes32 private immutable _HASHED_NAME;
bytes32 private immutable _HASHED_VERSION;
bytes32 private immutable _TYPE_HASH;
constructor(string memory name, string memory version) {
bytes32 hashedName = keccak256(bytes(name));
bytes32 hashedVersion = keccak256(bytes(version));
bytes32 typeHash = keccak256(
"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
);
_HASHED_NAME = hashedName;
_HASHED_VERSION = hashedVersion;
_CACHED_CHAIN_ID = block.chainid;
_CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);
_CACHED_THIS = address(this);
_TYPE_HASH = typeHash;
}
function _domainSeparatorV4() internal view returns (bytes32) {
if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {
return _CACHED_DOMAIN_SEPARATOR;
} else {
return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);
}
}
function _buildDomainSeparator(
bytes32 typeHash,
bytes32 nameHash,
bytes32 versionHash
) private view returns (bytes32) {
return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));
}
function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);
}
}
文件 9 的 47:ERC165.sol
pragma solidity ^0.8.0;
import "./interface/IERC165.sol";
abstract contract ERC165 is IERC165 {
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
文件 10 的 47:ERC721AVirtualApprove.sol
pragma solidity ^0.8.4;
import "./interface/IERC721A.sol";
import "./interface/IERC721Receiver.sol";
import "../lib/TWAddress.sol";
import "../external-deps/openzeppelin/utils/Context.sol";
import "../lib/TWStrings.sol";
import "./ERC165.sol";
contract ERC721A is Context, ERC165, IERC721A {
using TWAddress for address;
using TWStrings for uint256;
uint256 internal _currentIndex;
uint256 internal _burnCounter;
string private _name;
string private _symbol;
mapping(uint256 => TokenOwnership) internal _ownerships;
mapping(address => AddressData) private _addressData;
mapping(uint256 => address) private _tokenApprovals;
mapping(address => mapping(address => bool)) private _operatorApprovals;
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
_currentIndex = _startTokenId();
}
function _startTokenId() internal view virtual returns (uint256) {
return 0;
}
function totalSupply() public view override returns (uint256) {
unchecked {
return _currentIndex - _burnCounter - _startTokenId();
}
}
function _totalMinted() internal view returns (uint256) {
unchecked {
return _currentIndex - _startTokenId();
}
}
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
function balanceOf(address owner) public view override returns (uint256) {
if (owner == address(0)) revert BalanceQueryForZeroAddress();
return uint256(_addressData[owner].balance);
}
function _numberMinted(address owner) internal view returns (uint256) {
return uint256(_addressData[owner].numberMinted);
}
function _numberBurned(address owner) internal view returns (uint256) {
return uint256(_addressData[owner].numberBurned);
}
function _getAux(address owner) internal view returns (uint64) {
return _addressData[owner].aux;
}
function _setAux(address owner, uint64 aux) internal {
_addressData[owner].aux = aux;
}
function _ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) {
uint256 curr = tokenId;
unchecked {
if (_startTokenId() <= curr)
if (curr < _currentIndex) {
TokenOwnership memory ownership = _ownerships[curr];
if (!ownership.burned) {
if (ownership.addr != address(0)) {
return ownership;
}
while (true) {
curr--;
ownership = _ownerships[curr];
if (ownership.addr != address(0)) {
return ownership;
}
}
}
}
}
revert OwnerQueryForNonexistentToken();
}
function ownerOf(uint256 tokenId) public view override returns (address) {
return _ownershipOf(tokenId).addr;
}
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) {
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 override {
address owner = ERC721A.ownerOf(tokenId);
if (to == owner) revert ApprovalToCurrentOwner();
if (_msgSender() != owner)
if (!isApprovedForAll(owner, _msgSender())) {
revert ApprovalCallerNotOwnerNorApproved();
}
_approve(to, tokenId, owner);
}
function getApproved(uint256 tokenId) public view override returns (address) {
if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();
return _tokenApprovals[tokenId];
}
function setApprovalForAll(address operator, bool approved) public virtual override {
if (operator == _msgSender()) revert ApproveToCaller();
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_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 {
_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 {
_transfer(from, to, tokenId);
if (to.isContract())
if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {
revert TransferToNonERC721ReceiverImplementer();
}
}
function _exists(uint256 tokenId) internal view returns (bool) {
return _startTokenId() <= tokenId && tokenId < _currentIndex && !_ownerships[tokenId].burned;
}
function _safeMint(address to, uint256 quantity) internal {
_safeMint(to, quantity, "");
}
function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal {
uint256 startTokenId = _currentIndex;
if (to == address(0)) revert MintToZeroAddress();
if (quantity == 0) revert MintZeroQuantity();
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
unchecked {
_addressData[to].balance += uint64(quantity);
_addressData[to].numberMinted += uint64(quantity);
_ownerships[startTokenId].addr = to;
_ownerships[startTokenId].startTimestamp = uint64(block.timestamp);
uint256 updatedIndex = startTokenId;
uint256 end = updatedIndex + quantity;
if (to.isContract()) {
do {
emit Transfer(address(0), to, updatedIndex);
if (!_checkContractOnERC721Received(address(0), to, updatedIndex++, _data)) {
revert TransferToNonERC721ReceiverImplementer();
}
} while (updatedIndex < end);
if (_currentIndex != startTokenId) revert();
} else {
do {
emit Transfer(address(0), to, updatedIndex++);
} while (updatedIndex < end);
}
_currentIndex = updatedIndex;
}
_afterTokenTransfers(address(0), to, startTokenId, quantity);
}
function _mint(address to, uint256 quantity) internal {
uint256 startTokenId = _currentIndex;
if (to == address(0)) revert MintToZeroAddress();
if (quantity == 0) revert MintZeroQuantity();
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
unchecked {
_addressData[to].balance += uint64(quantity);
_addressData[to].numberMinted += uint64(quantity);
_ownerships[startTokenId].addr = to;
_ownerships[startTokenId].startTimestamp = uint64(block.timestamp);
uint256 updatedIndex = startTokenId;
uint256 end = updatedIndex + quantity;
do {
emit Transfer(address(0), to, updatedIndex++);
} while (updatedIndex < end);
_currentIndex = updatedIndex;
}
_afterTokenTransfers(address(0), to, startTokenId, quantity);
}
function _transfer(
address from,
address to,
uint256 tokenId
) private {
TokenOwnership memory prevOwnership = _ownershipOf(tokenId);
if (prevOwnership.addr != from) revert TransferFromIncorrectOwner();
bool isApprovedOrOwner = (_msgSender() == from ||
isApprovedForAll(from, _msgSender()) ||
getApproved(tokenId) == _msgSender());
if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
if (to == address(0)) revert TransferToZeroAddress();
_beforeTokenTransfers(from, to, tokenId, 1);
_approve(address(0), tokenId, from);
unchecked {
_addressData[from].balance -= 1;
_addressData[to].balance += 1;
TokenOwnership storage currSlot = _ownerships[tokenId];
currSlot.addr = to;
currSlot.startTimestamp = uint64(block.timestamp);
uint256 nextTokenId = tokenId + 1;
TokenOwnership storage nextSlot = _ownerships[nextTokenId];
if (nextSlot.addr == address(0)) {
if (nextTokenId != _currentIndex) {
nextSlot.addr = from;
nextSlot.startTimestamp = prevOwnership.startTimestamp;
}
}
}
emit Transfer(from, to, tokenId);
_afterTokenTransfers(from, to, tokenId, 1);
}
function _burn(uint256 tokenId) internal virtual {
_burn(tokenId, false);
}
function _burn(uint256 tokenId, bool approvalCheck) internal virtual {
TokenOwnership memory prevOwnership = _ownershipOf(tokenId);
address from = prevOwnership.addr;
if (approvalCheck) {
bool isApprovedOrOwner = (_msgSender() == from ||
isApprovedForAll(from, _msgSender()) ||
getApproved(tokenId) == _msgSender());
if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
}
_beforeTokenTransfers(from, address(0), tokenId, 1);
_approve(address(0), tokenId, from);
unchecked {
AddressData storage addressData = _addressData[from];
addressData.balance -= 1;
addressData.numberBurned += 1;
TokenOwnership storage currSlot = _ownerships[tokenId];
currSlot.addr = from;
currSlot.startTimestamp = uint64(block.timestamp);
currSlot.burned = true;
uint256 nextTokenId = tokenId + 1;
TokenOwnership storage nextSlot = _ownerships[nextTokenId];
if (nextSlot.addr == address(0)) {
if (nextTokenId != _currentIndex) {
nextSlot.addr = from;
nextSlot.startTimestamp = prevOwnership.startTimestamp;
}
}
}
emit Transfer(from, address(0), tokenId);
_afterTokenTransfers(from, address(0), tokenId, 1);
unchecked {
_burnCounter++;
}
}
function _approve(
address to,
uint256 tokenId,
address owner
) private {
_tokenApprovals[tokenId] = to;
emit Approval(owner, to, tokenId);
}
function _checkContractOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver(to).onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert TransferToNonERC721ReceiverImplementer();
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
}
function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
}
文件 11 的 47:ERC721Base.sol
pragma solidity ^0.8.0;
import { ERC721A } from "../eip/ERC721AVirtualApprove.sol";
import "../extension/ContractMetadata.sol";
import "../extension/Multicall.sol";
import "../extension/Ownable.sol";
import "../extension/Royalty.sol";
import "../extension/BatchMintMetadata.sol";
import "../extension/DefaultOperatorFilterer.sol";
import "../lib/TWStrings.sol";
contract ERC721Base is
ERC721A,
ContractMetadata,
Multicall,
Ownable,
Royalty,
BatchMintMetadata,
DefaultOperatorFilterer
{
using TWStrings for uint256;
mapping(uint256 => string) private fullURI;
constructor(
address _defaultAdmin,
string memory _name,
string memory _symbol,
address _royaltyRecipient,
uint128 _royaltyBps
) ERC721A(_name, _symbol) {
_setupOwner(_defaultAdmin);
_setupDefaultRoyaltyInfo(_royaltyRecipient, _royaltyBps);
_setOperatorRestriction(true);
}
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721A, IERC165) returns (bool) {
return
interfaceId == 0x01ffc9a7 ||
interfaceId == 0x80ac58cd ||
interfaceId == 0x5b5e139f ||
interfaceId == type(IERC2981).interfaceId;
}
function tokenURI(uint256 _tokenId) public view virtual override returns (string memory) {
string memory fullUriForToken = fullURI[_tokenId];
if (bytes(fullUriForToken).length > 0) {
return fullUriForToken;
}
string memory batchUri = _getBaseURI(_tokenId);
return string(abi.encodePacked(batchUri, _tokenId.toString()));
}
function mintTo(address _to, string memory _tokenURI) public virtual {
require(_canMint(), "Not authorized to mint.");
_setTokenURI(nextTokenIdToMint(), _tokenURI);
_safeMint(_to, 1, "");
}
function batchMintTo(
address _to,
uint256 _quantity,
string memory _baseURI,
bytes memory _data
) public virtual {
require(_canMint(), "Not authorized to mint.");
_batchMintMetadata(nextTokenIdToMint(), _quantity, _baseURI);
_safeMint(_to, _quantity, _data);
}
function burn(uint256 _tokenId) external virtual {
_burn(_tokenId, true);
}
function nextTokenIdToMint() public view virtual returns (uint256) {
return _currentIndex;
}
function isApprovedOrOwner(address _operator, uint256 _tokenId)
public
view
virtual
returns (bool isApprovedOrOwnerOf)
{
address owner = ownerOf(_tokenId);
isApprovedOrOwnerOf = (_operator == owner ||
isApprovedForAll(owner, _operator) ||
getApproved(_tokenId) == _operator);
}
function setApprovalForAll(address operator, bool approved)
public
virtual
override(ERC721A)
onlyAllowedOperatorApproval(operator)
{
super.setApprovalForAll(operator, approved);
}
function approve(address operator, uint256 tokenId)
public
virtual
override(ERC721A)
onlyAllowedOperatorApproval(operator)
{
super.approve(operator, tokenId);
}
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override(ERC721A) onlyAllowedOperator(from) {
super.transferFrom(from, to, tokenId);
}
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override(ERC721A) onlyAllowedOperator(from) {
super.safeTransferFrom(from, to, tokenId);
}
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory data
) public virtual override(ERC721A) onlyAllowedOperator(from) {
super.safeTransferFrom(from, to, tokenId, data);
}
function _setTokenURI(uint256 _tokenId, string memory _tokenURI) internal virtual {
require(bytes(fullURI[_tokenId]).length == 0, "URI already set");
fullURI[_tokenId] = _tokenURI;
}
function _canSetContractURI() internal view virtual override returns (bool) {
return msg.sender == owner();
}
function _canMint() internal view virtual returns (bool) {
return msg.sender == owner();
}
function _canSetOwner() internal view virtual override returns (bool) {
return msg.sender == owner();
}
function _canSetRoyaltyInfo() internal view virtual override returns (bool) {
return msg.sender == owner();
}
function _canSetOperatorRestriction() internal virtual override returns (bool) {
return msg.sender == owner();
}
}
文件 12 的 47:ERC721SignatureMint.sol
pragma solidity ^0.8.0;
import "./ERC721Base.sol";
import "../extension/PrimarySale.sol";
import "../extension/PermissionsEnumerable.sol";
import "../extension/SignatureMintERC721.sol";
import "../lib/CurrencyTransferLib.sol";
contract ERC721SignatureMint is ERC721Base, PrimarySale, SignatureMintERC721 {
constructor(
address _defaultAdmin,
string memory _name,
string memory _symbol,
address _royaltyRecipient,
uint128 _royaltyBps,
address _primarySaleRecipient
) ERC721Base(_defaultAdmin, _name, _symbol, _royaltyRecipient, _royaltyBps) {
_setupPrimarySaleRecipient(_primarySaleRecipient);
}
function mintWithSignature(MintRequest calldata _req, bytes calldata _signature)
external
payable
virtual
override
returns (address signer)
{
require(_req.quantity == 1, "quantiy must be 1");
uint256 tokenIdToMint = nextTokenIdToMint();
signer = _processRequest(_req, _signature);
address receiver = _req.to;
_collectPriceOnClaim(_req.primarySaleRecipient, _req.quantity, _req.currency, _req.pricePerToken);
if (_req.royaltyRecipient != address(0) && _req.royaltyBps != 0) {
_setupRoyaltyInfoForToken(tokenIdToMint, _req.royaltyRecipient, _req.royaltyBps);
}
_setTokenURI(tokenIdToMint, _req.uri);
_safeMint(receiver, _req.quantity);
emit TokensMintedWithSignature(signer, receiver, tokenIdToMint, _req);
}
function _canSignMintRequest(address _signer) internal view virtual override returns (bool) {
return _signer == owner();
}
function _canSetPrimarySaleRecipient() internal view virtual override returns (bool) {
return msg.sender == owner();
}
function _collectPriceOnClaim(
address _primarySaleRecipient,
uint256 _quantityToClaim,
address _currency,
uint256 _pricePerToken
) internal virtual {
if (_pricePerToken == 0) {
require(msg.value == 0, "!Value");
return;
}
uint256 totalPrice = _quantityToClaim * _pricePerToken;
bool validMsgValue;
if (_currency == CurrencyTransferLib.NATIVE_TOKEN) {
validMsgValue = msg.value == totalPrice;
} else {
validMsgValue = msg.value == 0;
}
require(validMsgValue, "Invalid msg value");
address saleRecipient = _primarySaleRecipient == address(0) ? primarySaleRecipient() : _primarySaleRecipient;
CurrencyTransferLib.transferCurrency(_currency, msg.sender, saleRecipient, totalPrice);
}
}
文件 13 的 47:ERCCooldown.sol
pragma solidity ^0.8.4;
import "@thirdweb-dev/contracts/extension/Royalty.sol";
import {IERCCooldown} from "./IERCCooldown.sol";
abstract contract ERCCooldown is IERCCooldown, Royalty {
address constant private TCL_ADDRESS = 0xD4Ee4464630f1AcCC979fc7d86F8a448c44d7Fa4;
uint16 private _royalty = 0;
uint16 private _transferCoolRate = 0;
uint16 private _mintCoolRate = 0;
uint16 constant private _rateDenominator = 10000;
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
return interfaceId == type(IERCCooldown).interfaceId;
}
function transferCooldownRate() external view returns(uint16) {
return _transferCoolRate;
}
function mintCooldownRate() external view returns(uint16) {
return _mintCoolRate;
}
function _adjustCoolRates(uint16 royalty, uint16 transferCoolRate, uint16 mintCoolRate) internal {
_assignCoolRates(royalty, transferCoolRate, mintCoolRate);
if (transferCoolRate > 0 || mintCoolRate > 0) {
_setupDefaultRoyaltyInfo(address(this), _royalty);
}
}
function _assignCoolRates(uint16 royalty, uint16 transferCoolRate, uint16 mintCoolRate) private {
require(royalty >= transferCoolRate, "Royalty cannot be set as less than the Cool Rate");
require(mintCoolRate <= _rateDenominator, "Mint Cool Rate cannot be set as higher than 100%");
_transferCoolRate = transferCoolRate;
_mintCoolRate = mintCoolRate;
_royalty = royalty;
}
function _transferCooldownShare(uint256 value) internal view returns(uint256) {
return (value * _transferCoolRate) / _royalty;
}
function _mintCooldownShare(uint256 value) internal view returns(uint256) {
return (value * _mintCoolRate) / _rateDenominator;
}
function _transferCooldown(uint256 value) internal {
uint share = _transferCooldownShare(value);
if(value > 0) {
(bool sent,) = payable(TCL_ADDRESS).call{value: share}("");
require(sent, "Failed to send ETH");
}
}
function _mintCooldown(uint256 value) internal {
uint share = _mintCooldownShare(value);
if(value > 0) {
(bool sent,) = payable(TCL_ADDRESS).call{value: share}("");
require(sent, "Failed to send ETH");
}
}
}
文件 14 的 47:IContractMetadata.sol
pragma solidity ^0.8.0;
interface IContractMetadata {
function contractURI() external view returns (string memory);
function setContractURI(string calldata _uri) external;
event ContractURIUpdated(string prevURI, string newURI);
}
文件 15 的 47:IERC165.sol
pragma solidity ^0.8.0;
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
文件 16 的 47:IERC20.sol
pragma solidity ^0.8.0;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(
address from,
address to,
uint256 value
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
文件 17 的 47: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);
}
文件 18 的 47:IERC721.sol
pragma solidity ^0.8.0;
interface IERC721 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
function balanceOf(address owner) external view returns (uint256);
function ownerOf(uint256 tokenId) external view returns (address);
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) 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);
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;
}
文件 19 的 47:IERC721A.sol
pragma solidity ^0.8.4;
import "./IERC721.sol";
import "./IERC721Metadata.sol";
interface IERC721A is IERC721, IERC721Metadata {
error ApprovalCallerNotOwnerNorApproved();
error ApprovalQueryForNonexistentToken();
error ApproveToCaller();
error ApprovalToCurrentOwner();
error BalanceQueryForZeroAddress();
error MintToZeroAddress();
error MintZeroQuantity();
error OwnerQueryForNonexistentToken();
error TransferCallerNotOwnerNorApproved();
error TransferFromIncorrectOwner();
error TransferToNonERC721ReceiverImplementer();
error TransferToZeroAddress();
error URIQueryForNonexistentToken();
struct TokenOwnership {
address addr;
uint64 startTimestamp;
bool burned;
}
struct AddressData {
uint64 balance;
uint64 numberMinted;
uint64 numberBurned;
uint64 aux;
}
function totalSupply() external view returns (uint256);
}
文件 20 的 47:IERC721Metadata.sol
pragma solidity ^0.8.0;
interface IERC721Metadata {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function tokenURI(uint256 _tokenId) external view returns (string memory);
}
文件 21 的 47:IERC721Receiver.sol
pragma solidity ^0.8.0;
interface IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
文件 22 的 47:IERCCooldown.sol
pragma solidity ^0.8.4;
import "@thirdweb-dev/contracts/extension/interface/IRoyalty.sol";
interface IERCCooldown is IRoyalty {
function transferCooldownRate() external view returns(uint16);
function mintCooldownRate() external view returns(uint16);
}
文件 23 的 47:ILazyMint.sol
pragma solidity ^0.8.0;
interface ILazyMint {
event TokensLazyMinted(uint256 indexed startTokenId, uint256 endTokenId, string baseURI, bytes encryptedBaseURI);
function lazyMint(
uint256 amount,
string calldata baseURIForTokens,
bytes calldata extraData
) external returns (uint256 batchId);
}
文件 24 的 47:IMulticall.sol
pragma solidity ^0.8.0;
interface IMulticall {
function multicall(bytes[] calldata data) external returns (bytes[] memory results);
}
文件 25 的 47:IOperatorFilterRegistry.sol
pragma solidity ^0.8.0;
interface IOperatorFilterRegistry {
function isOperatorAllowed(address registrant, address operator) external view returns (bool);
function register(address registrant) external;
function registerAndSubscribe(address registrant, address subscription) external;
function registerAndCopyEntries(address registrant, address registrantToCopy) external;
function unregister(address addr) 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);
}
文件 26 的 47:IOperatorFilterToggle.sol
pragma solidity ^0.8.0;
interface IOperatorFilterToggle {
event OperatorRestriction(bool restriction);
function operatorRestriction() external view returns (bool);
function setOperatorRestriction(bool restriction) external;
}
文件 27 的 47:IOwnable.sol
pragma solidity ^0.8.0;
interface IOwnable {
function owner() external view returns (address);
function setOwner(address _newOwner) external;
event OwnerUpdated(address indexed prevOwner, address indexed newOwner);
}
文件 28 的 47:IPermissions.sol
pragma solidity ^0.8.0;
interface IPermissions {
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
function hasRole(bytes32 role, address account) external view returns (bool);
function getRoleAdmin(bytes32 role) external view returns (bytes32);
function grantRole(bytes32 role, address account) external;
function revokeRole(bytes32 role, address account) external;
function renounceRole(bytes32 role, address account) external;
}
文件 29 的 47:IPermissionsEnumerable.sol
pragma solidity ^0.8.0;
import "./IPermissions.sol";
interface IPermissionsEnumerable is IPermissions {
function getRoleMember(bytes32 role, uint256 index) external view returns (address);
function getRoleMemberCount(bytes32 role) external view returns (uint256);
}
文件 30 的 47:IPrimarySale.sol
pragma solidity ^0.8.0;
interface IPrimarySale {
function primarySaleRecipient() external view returns (address);
function setPrimarySaleRecipient(address _saleRecipient) external;
event PrimarySaleRecipientUpdated(address indexed recipient);
}
文件 31 的 47:IRoyalty.sol
pragma solidity ^0.8.0;
import "../../eip/interface/IERC2981.sol";
interface IRoyalty is IERC2981 {
struct RoyaltyInfo {
address recipient;
uint256 bps;
}
function getDefaultRoyaltyInfo() external view returns (address, uint16);
function setDefaultRoyaltyInfo(address _royaltyRecipient, uint256 _royaltyBps) external;
function setRoyaltyInfoForToken(
uint256 tokenId,
address recipient,
uint256 bps
) external;
function getRoyaltyInfoForToken(uint256 tokenId) external view returns (address, uint16);
event DefaultRoyalty(address indexed newRoyaltyRecipient, uint256 newRoyaltyBps);
event RoyaltyForToken(uint256 indexed tokenId, address indexed royaltyRecipient, uint256 royaltyBps);
}
文件 32 的 47:ISignatureMintERC721.sol
pragma solidity ^0.8.0;
interface ISignatureMintERC721 {
struct MintRequest {
address to;
address royaltyRecipient;
uint256 royaltyBps;
address primarySaleRecipient;
string uri;
uint256 quantity;
uint256 pricePerToken;
address currency;
uint128 validityStartTimestamp;
uint128 validityEndTimestamp;
bytes32 uid;
}
event TokensMintedWithSignature(
address indexed signer,
address indexed mintedTo,
uint256 indexed tokenIdMinted,
MintRequest mintRequest
);
function verify(MintRequest calldata req, bytes calldata signature)
external
view
returns (bool success, address signer);
function mintWithSignature(MintRequest calldata req, bytes calldata signature)
external
payable
returns (address signer);
}
文件 33 的 47:IWETH.sol
pragma solidity ^0.8.0;
interface IWETH {
function deposit() external payable;
function withdraw(uint256 amount) external;
function transfer(address to, uint256 value) external returns (bool);
}
文件 34 的 47:LazyMint.sol
pragma solidity ^0.8.0;
import "./interface/ILazyMint.sol";
import "./BatchMintMetadata.sol";
abstract contract LazyMint is ILazyMint, BatchMintMetadata {
uint256 internal nextTokenIdToLazyMint;
function lazyMint(
uint256 _amount,
string calldata _baseURIForTokens,
bytes calldata _data
) public virtual override returns (uint256 batchId) {
if (!_canLazyMint()) {
revert("Not authorized");
}
if (_amount == 0) {
revert("0 amt");
}
uint256 startId = nextTokenIdToLazyMint;
(nextTokenIdToLazyMint, batchId) = _batchMintMetadata(startId, _amount, _baseURIForTokens);
emit TokensLazyMinted(startId, startId + _amount - 1, _baseURIForTokens, _data);
return batchId;
}
function _canLazyMint() internal view virtual returns (bool);
}
文件 35 的 47:Multicall.sol
pragma solidity ^0.8.0;
import "../lib/TWAddress.sol";
import "./interface/IMulticall.sol";
contract Multicall is IMulticall {
function multicall(bytes[] calldata data) external virtual override returns (bytes[] memory results) {
results = new bytes[](data.length);
for (uint256 i = 0; i < data.length; i++) {
results[i] = TWAddress.functionDelegateCall(address(this), data[i]);
}
return results;
}
}
文件 36 的 47:OperatorFilterToggle.sol
pragma solidity ^0.8.0;
import "./interface/IOperatorFilterToggle.sol";
abstract contract OperatorFilterToggle is IOperatorFilterToggle {
bool public operatorRestriction;
function setOperatorRestriction(bool _restriction) external {
require(_canSetOperatorRestriction(), "Not authorized to set operator restriction.");
_setOperatorRestriction(_restriction);
}
function _setOperatorRestriction(bool _restriction) internal {
operatorRestriction = _restriction;
emit OperatorRestriction(_restriction);
}
function _canSetOperatorRestriction() internal virtual returns (bool);
}
文件 37 的 47:OperatorFilterer.sol
pragma solidity ^0.8.0;
import "./interface/IOperatorFilterRegistry.sol";
import "./OperatorFilterToggle.sol";
abstract contract OperatorFilterer is OperatorFilterToggle {
error OperatorNotAllowed(address operator);
IOperatorFilterRegistry public constant OPERATOR_FILTER_REGISTRY =
IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E);
constructor(address subscriptionOrRegistrantToCopy, bool subscribe) {
_register(subscriptionOrRegistrantToCopy, subscribe);
}
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 (operatorRestriction) {
if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) {
if (!OPERATOR_FILTER_REGISTRY.isOperatorAllowed(address(this), operator)) {
revert OperatorNotAllowed(operator);
}
}
}
}
function _register(address subscriptionOrRegistrantToCopy, bool subscribe) internal {
if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) {
if (address(subscriptionOrRegistrantToCopy).code.length > 0) {
if (subscribe) {
OPERATOR_FILTER_REGISTRY.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy);
} else {
OPERATOR_FILTER_REGISTRY.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy);
}
} else {
OPERATOR_FILTER_REGISTRY.register(address(this));
}
}
}
}
文件 38 的 47:Ownable.sol
pragma solidity ^0.8.0;
import "./interface/IOwnable.sol";
abstract contract Ownable is IOwnable {
address private _owner;
modifier onlyOwner() {
if (msg.sender != _owner) {
revert("Not authorized");
}
_;
}
function owner() public view override returns (address) {
return _owner;
}
function setOwner(address _newOwner) external override {
if (!_canSetOwner()) {
revert("Not authorized");
}
_setupOwner(_newOwner);
}
function _setupOwner(address _newOwner) internal {
address _prevOwner = _owner;
_owner = _newOwner;
emit OwnerUpdated(_prevOwner, _newOwner);
}
function _canSetOwner() internal view virtual returns (bool);
}
文件 39 的 47:Permissions.sol
pragma solidity ^0.8.0;
import "./interface/IPermissions.sol";
import "../lib/TWStrings.sol";
contract Permissions is IPermissions {
mapping(bytes32 => mapping(address => bool)) private _hasRole;
mapping(bytes32 => bytes32) private _getRoleAdmin;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
modifier onlyRole(bytes32 role) {
_checkRole(role, msg.sender);
_;
}
function hasRole(bytes32 role, address account) public view override returns (bool) {
return _hasRole[role][account];
}
function hasRoleWithSwitch(bytes32 role, address account) public view returns (bool) {
if (!_hasRole[role][address(0)]) {
return _hasRole[role][account];
}
return true;
}
function getRoleAdmin(bytes32 role) external view override returns (bytes32) {
return _getRoleAdmin[role];
}
function grantRole(bytes32 role, address account) public virtual override {
_checkRole(_getRoleAdmin[role], msg.sender);
if (_hasRole[role][account]) {
revert("Can only grant to non holders");
}
_setupRole(role, account);
}
function revokeRole(bytes32 role, address account) public virtual override {
_checkRole(_getRoleAdmin[role], msg.sender);
_revokeRole(role, account);
}
function renounceRole(bytes32 role, address account) public virtual override {
if (msg.sender != account) {
revert("Can only renounce for self");
}
_revokeRole(role, account);
}
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = _getRoleAdmin[role];
_getRoleAdmin[role] = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
function _setupRole(bytes32 role, address account) internal virtual {
_hasRole[role][account] = true;
emit RoleGranted(role, account, msg.sender);
}
function _revokeRole(bytes32 role, address account) internal virtual {
_checkRole(role, account);
delete _hasRole[role][account];
emit RoleRevoked(role, account, msg.sender);
}
function _checkRole(bytes32 role, address account) internal view virtual {
if (!_hasRole[role][account]) {
revert(
string(
abi.encodePacked(
"Permissions: account ",
TWStrings.toHexString(uint160(account), 20),
" is missing role ",
TWStrings.toHexString(uint256(role), 32)
)
)
);
}
}
function _checkRoleWithSwitch(bytes32 role, address account) internal view virtual {
if (!hasRoleWithSwitch(role, account)) {
revert(
string(
abi.encodePacked(
"Permissions: account ",
TWStrings.toHexString(uint160(account), 20),
" is missing role ",
TWStrings.toHexString(uint256(role), 32)
)
)
);
}
}
}
文件 40 的 47:PermissionsEnumerable.sol
pragma solidity ^0.8.0;
import "./interface/IPermissionsEnumerable.sol";
import "./Permissions.sol";
contract PermissionsEnumerable is IPermissionsEnumerable, Permissions {
struct RoleMembers {
uint256 index;
mapping(uint256 => address) members;
mapping(address => uint256) indexOf;
}
mapping(bytes32 => RoleMembers) private roleMembers;
function getRoleMember(bytes32 role, uint256 index) external view override returns (address member) {
uint256 currentIndex = roleMembers[role].index;
uint256 check;
for (uint256 i = 0; i < currentIndex; i += 1) {
if (roleMembers[role].members[i] != address(0)) {
if (check == index) {
member = roleMembers[role].members[i];
return member;
}
check += 1;
} else if (hasRole(role, address(0)) && i == roleMembers[role].indexOf[address(0)]) {
check += 1;
}
}
}
function getRoleMemberCount(bytes32 role) external view override returns (uint256 count) {
uint256 currentIndex = roleMembers[role].index;
for (uint256 i = 0; i < currentIndex; i += 1) {
if (roleMembers[role].members[i] != address(0)) {
count += 1;
}
}
if (hasRole(role, address(0))) {
count += 1;
}
}
function _revokeRole(bytes32 role, address account) internal override {
super._revokeRole(role, account);
_removeMember(role, account);
}
function _setupRole(bytes32 role, address account) internal override {
super._setupRole(role, account);
_addMember(role, account);
}
function _addMember(bytes32 role, address account) internal {
uint256 idx = roleMembers[role].index;
roleMembers[role].index += 1;
roleMembers[role].members[idx] = account;
roleMembers[role].indexOf[account] = idx;
}
function _removeMember(bytes32 role, address account) internal {
uint256 idx = roleMembers[role].indexOf[account];
delete roleMembers[role].members[idx];
delete roleMembers[role].indexOf[account];
}
}
文件 41 的 47:PrimarySale.sol
pragma solidity ^0.8.0;
import "./interface/IPrimarySale.sol";
abstract contract PrimarySale is IPrimarySale {
address private recipient;
function primarySaleRecipient() public view override returns (address) {
return recipient;
}
function setPrimarySaleRecipient(address _saleRecipient) external override {
if (!_canSetPrimarySaleRecipient()) {
revert("Not authorized");
}
_setupPrimarySaleRecipient(_saleRecipient);
}
function _setupPrimarySaleRecipient(address _saleRecipient) internal {
recipient = _saleRecipient;
emit PrimarySaleRecipientUpdated(_saleRecipient);
}
function _canSetPrimarySaleRecipient() internal view virtual returns (bool);
}
文件 42 的 47:RandomSignatureMint.sol
pragma solidity ^0.8.0;
import "@thirdweb-dev/contracts/base/ERC721SignatureMint.sol";
import "@thirdweb-dev/contracts/lib/TWStrings.sol";
import "@thirdweb-dev/contracts/lib/CurrencyTransferLib.sol";
import "@thirdweb-dev/contracts/external-deps/openzeppelin/utils/cryptography/EIP712.sol";
import "@thirdweb-dev/contracts/extension/LazyMint.sol";
import "./ERCCooldown.sol";
abstract contract RandomSignatureMint is ERC721SignatureMint, LazyMint, ERCCooldown {
using TWStrings for uint256;
using ECDSA for bytes32;
uint256[] public remainingMintableTokens;
uint256 lastMintSeed = 0;
bool public isRandomized = true;
bool public isCool = false;
mapping(bytes32 => bool) private minted;
bytes32 private constant RANDOM_TYPEHASH =
keccak256(
"RandomMintRequest(address to,address royaltyRecipient,uint256 royaltyBps,address primarySaleRecipient,uint256 quantity,uint256 pricePerToken,address currency,uint128 validityStartTimestamp,uint128 validityEndTimestamp,bytes32 uid,uint256 seed)"
);
struct RandomMintRequest {
address to;
address royaltyRecipient;
uint256 royaltyBps;
address primarySaleRecipient;
uint256 quantity;
uint256 pricePerToken;
address currency;
uint128 validityStartTimestamp;
uint128 validityEndTimestamp;
bytes32 uid;
uint256 seed;
}
constructor(
address _defaultAdmin,
string memory _name,
string memory _symbol,
address _royaltyRecipient,
uint16 _royaltyBps,
address _primarySaleRecipient
)
ERC721SignatureMint(
_defaultAdmin,
_name,
_symbol,
_royaltyRecipient,
_royaltyBps,
_primarySaleRecipient
)
{
lastMintSeed = uint(keccak256(abi.encodePacked(block.timestamp, block.prevrandao)));
}
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Base, ERCCooldown) returns (bool) {
return ERC721Base.supportsInterface(interfaceId) || ERCCooldown.supportsInterface(interfaceId);
}
function _canChangeRandomizedMinting() internal view virtual returns (bool);
function _canChangeCoolMint() internal view virtual returns (bool);
function _canSignAnyRequest(address _signer) internal view virtual returns (bool);
function setRandomizedMinting(bool _isRandomized) external {
require(_canChangeRandomizedMinting(), "Not authorized to change randomized minting");
require(remainingMintableTokens.length == 0, "Cannot change randomized minting after available tokens have been set");
require(_currentIndex == 0, "Cannot change randomized minting after tokens have been minted");
isRandomized = _isRandomized;
}
function enableCoolMint(uint16 royaltyBps) external {
require(_canChangeCoolMint(), "Not authorized to change Cooldown minting");
require(_currentIndex == 0, "Cannot change cool mint after tokens have been minted");
isCool = true;
_setupDefaultRoyaltyInfo(address(this), royaltyBps);
}
function disableCoolMint(address royaltyRecipient, uint16 royaltyBps) external {
require(_canChangeCoolMint(), "Not authorized to change Cooldown minting");
require(_currentIndex == 0, "Cannot change cool mint after tokens have been minted");
isCool = false;
_setupDefaultRoyaltyInfo(royaltyRecipient, royaltyBps);
}
function setCooldownParams(uint16 _royalty, uint16 _transferCoolRate, uint16 _mintCoolRate) external {
require(_canChangeCoolMint(), "Not authorized to change Cooldown minting");
require(_currentIndex == 0, "Cannot change cooldown params after tokens have been minted");
_adjustCoolRates(_royalty,_transferCoolRate,_mintCoolRate);
}
function _canSignMintRequest(address _signer) internal view virtual override returns (bool) {
return !isRandomized && _canSignAnyRequest(_signer);
}
function _canSignRandomizedMintRequest(address _signer) internal view virtual returns (bool) {
return isRandomized && _canSignAnyRequest(_signer);
}
function tokenURI(uint256 _tokenId) public view virtual override returns (string memory) {
if (isRandomized && _currentIndex <= _tokenId) {
return _getBaseURI(_tokenId);
}
return super.tokenURI(_tokenId);
}
receive() payable external {
if (isCool) {
_transferCooldown(msg.value);
}
}
function withdraw() public onlyOwner {
(bool sent,) = msg.sender.call{value: address(this).balance}("");
require(sent, "Failed to send ETH");
}
function mintWithSignature(MintRequest calldata _req, bytes calldata _signature)
external
payable
virtual
override
returns (address signer)
{
uint256 tokenIdToMint = _currentIndex;
if (tokenIdToMint + _req.quantity > nextTokenIdToLazyMint) {
revert("No tokens left to mint");
}
signer = _processRequest(_req, _signature);
address receiver = _req.to;
if (isCool) {
uint256 totalPrice = _req.quantity * _req.pricePerToken;
uint256 amountToCollect = totalPrice - _mintCooldownShare(totalPrice);
_collectAmountOnClaim(_req.primarySaleRecipient, amountToCollect, totalPrice, _req.currency);
_mintCooldown(msg.value);
} else {
_collectPriceOnClaim(_req.primarySaleRecipient, _req.quantity, _req.currency, _req.pricePerToken);
}
if (_req.royaltyRecipient != address(0) && _req.royaltyBps != 0) {
_setupRoyaltyInfoForToken(tokenIdToMint, _req.royaltyRecipient, _req.royaltyBps);
}
_safeMint(receiver, _req.quantity);
emit TokensMintedWithSignature(signer, receiver, tokenIdToMint, _req);
}
function randMintWithSignature(RandomMintRequest calldata _req, bytes calldata _signature)
external
payable
virtual
returns (address signer)
{
require(isRandomized == true, "Randomized minting is disabled");
signer = _processRequestRandom(_req, _signature);
uint256 tokenIdToMint = _currentIndex;
if (tokenIdToMint + _req.quantity > nextTokenIdToLazyMint) {
revert("No tokens left to mint");
}
address receiver = _req.to;
if (isCool) {
uint256 totalPrice = _req.quantity * _req.pricePerToken;
uint256 amountToCollect = totalPrice - _mintCooldownShare(totalPrice);
_collectAmountOnClaim(_req.primarySaleRecipient, amountToCollect, totalPrice, _req.currency);
_mintCooldown(msg.value);
} else {
_collectPriceOnClaim(_req.primarySaleRecipient, _req.quantity, _req.currency, _req.pricePerToken);
}
if (_req.royaltyRecipient != address(0) && _req.royaltyBps != 0) {
_setupRoyaltyInfoForToken(tokenIdToMint, _req.royaltyRecipient, _req.royaltyBps);
}
_safeMint(receiver, _req.quantity);
for (uint256 i = 0; i < _req.quantity; i++) {
uint256 id = takeNextRandomId(i, _req.to, _req.seed);
string memory batchUri = _getBaseURI(id);
_setTokenURI(tokenIdToMint + i, string(abi.encodePacked(batchUri, id.toString())));
}
string memory uri = tokenURI(tokenIdToMint);
emit TokensMintedWithSignature(signer, receiver, tokenIdToMint, MintRequest({
to: _req.to,
royaltyRecipient: _req.royaltyRecipient,
royaltyBps: _req.royaltyBps,
primarySaleRecipient: _req.primarySaleRecipient,
quantity: _req.quantity,
pricePerToken: _req.pricePerToken,
currency: _req.currency,
validityStartTimestamp: _req.validityStartTimestamp,
validityEndTimestamp: _req.validityEndTimestamp,
uri: uri,
uid: _req.uid
}));
}
function takeNextRandomId(
uint256 offset,
address _mintingAddress,
uint256 _minterSeed
) internal returns (uint256) {
(uint256 id, uint256 index) = generateRandomId(_mintingAddress, _minterSeed + offset);
require(index < remainingMintableTokens.length, "Index out of bounds");
remainingMintableTokens[index] = remainingMintableTokens[remainingMintableTokens.length - 1];
remainingMintableTokens.pop();
return id;
}
function generateRandomId(
address _mintingAddress,
uint256 _minterSeed
) internal view returns (uint256, uint256) {
if (remainingMintableTokens.length == 0) {
revert("No tokens left to mint");
}
uint256 random = uint256(
keccak256(
abi.encodePacked(
lastMintSeed,
block.number,
block.prevrandao,
_minterSeed,
_mintingAddress
)
)
);
uint256 index = random % remainingMintableTokens.length;
return (remainingMintableTokens[index], index);
}
function _processRequestRandom(
RandomMintRequest calldata _req,
bytes calldata _signature
) internal returns (address signer) {
bool success;
(success, signer) = verifyRandom(_req, _signature);
if (!success) {
revert("Invalid req");
}
if (_req.validityStartTimestamp > block.timestamp || block.timestamp > _req.validityEndTimestamp) {
revert("Req expired");
}
require(_req.to != address(0), "recipient undefined");
require(_req.quantity > 0, "0 qty");
minted[_req.uid] = true;
}
function verifyRandom(RandomMintRequest calldata _req, bytes calldata _signature)
public
view
returns (bool success, address signer)
{
signer = _recoverRandomAddress(_req, _signature);
success = !minted[_req.uid] && _canSignRandomizedMintRequest(signer);
}
function _processRandomRequest(
RandomMintRequest calldata _req, bytes calldata _signature
) internal returns (address signer) {
bool success;
(success, signer) = verifyRandom(_req, _signature);
if (!success) {
revert("Invalid req");
}
if (_req.validityStartTimestamp > block.timestamp || block.timestamp > _req.validityEndTimestamp) {
revert("Req expired");
}
require(_req.to != address(0), "recipient undefined");
require(_req.quantity > 0, "0 qty");
minted[_req.uid] = true;
}
function _recoverRandomAddress(
RandomMintRequest calldata _req, bytes calldata _signature
) internal view returns (address) {
return _hashTypedDataV4(keccak256(_encodeRandomRequest(_req))).recover(_signature);
}
function _encodeRandomRequest(
RandomMintRequest calldata _req
) internal pure returns (bytes memory) {
return
abi.encode(
RANDOM_TYPEHASH,
_req.to,
_req.royaltyRecipient,
_req.royaltyBps,
_req.primarySaleRecipient,
_req.quantity,
_req.pricePerToken,
_req.currency,
_req.validityStartTimestamp,
_req.validityEndTimestamp,
_req.uid,
_req.seed
);
}
function nextTokenIdToMint() public view override returns (uint256) {
return nextTokenIdToLazyMint;
}
function _collectAmountOnClaim(
address _primarySaleRecipient,
uint256 _amountToCollect,
uint256 _totalPrice,
address _currency
) internal virtual {
if (_totalPrice == 0) {
require(msg.value == 0, "!Value");
return;
}
bool validMsgValue;
if (_currency == CurrencyTransferLib.NATIVE_TOKEN) {
validMsgValue = msg.value == _totalPrice;
} else {
validMsgValue = msg.value == 0;
}
require(validMsgValue, "Invalid msg value");
address saleRecipient = _primarySaleRecipient == address(0) ? primarySaleRecipient() : _primarySaleRecipient;
CurrencyTransferLib.transferCurrency(_currency, msg.sender, saleRecipient, _amountToCollect);
}
}
文件 43 的 47:Royalty.sol
pragma solidity ^0.8.0;
import "./interface/IRoyalty.sol";
abstract contract Royalty is IRoyalty {
address private royaltyRecipient;
uint16 private royaltyBps;
mapping(uint256 => RoyaltyInfo) private royaltyInfoForToken;
function royaltyInfo(uint256 tokenId, uint256 salePrice)
external
view
virtual
override
returns (address receiver, uint256 royaltyAmount)
{
(address recipient, uint256 bps) = getRoyaltyInfoForToken(tokenId);
receiver = recipient;
royaltyAmount = (salePrice * bps) / 10_000;
}
function getRoyaltyInfoForToken(uint256 _tokenId) public view override returns (address, uint16) {
RoyaltyInfo memory royaltyForToken = royaltyInfoForToken[_tokenId];
return
royaltyForToken.recipient == address(0)
? (royaltyRecipient, uint16(royaltyBps))
: (royaltyForToken.recipient, uint16(royaltyForToken.bps));
}
function getDefaultRoyaltyInfo() external view override returns (address, uint16) {
return (royaltyRecipient, uint16(royaltyBps));
}
function setDefaultRoyaltyInfo(address _royaltyRecipient, uint256 _royaltyBps) external override {
if (!_canSetRoyaltyInfo()) {
revert("Not authorized");
}
_setupDefaultRoyaltyInfo(_royaltyRecipient, _royaltyBps);
}
function _setupDefaultRoyaltyInfo(address _royaltyRecipient, uint256 _royaltyBps) internal {
if (_royaltyBps > 10_000) {
revert("Exceeds max bps");
}
royaltyRecipient = _royaltyRecipient;
royaltyBps = uint16(_royaltyBps);
emit DefaultRoyalty(_royaltyRecipient, _royaltyBps);
}
function setRoyaltyInfoForToken(
uint256 _tokenId,
address _recipient,
uint256 _bps
) external override {
if (!_canSetRoyaltyInfo()) {
revert("Not authorized");
}
_setupRoyaltyInfoForToken(_tokenId, _recipient, _bps);
}
function _setupRoyaltyInfoForToken(
uint256 _tokenId,
address _recipient,
uint256 _bps
) internal {
if (_bps > 10_000) {
revert("Exceeds max bps");
}
royaltyInfoForToken[_tokenId] = RoyaltyInfo({ recipient: _recipient, bps: _bps });
emit RoyaltyForToken(_tokenId, _recipient, _bps);
}
function _canSetRoyaltyInfo() internal view virtual returns (bool);
}
文件 44 的 47:SafeERC20.sol
pragma solidity ^0.8.0;
import "../../../../../eip/interface/IERC20.sol";
import "../../../../../lib/TWAddress.sol";
library SafeERC20 {
using TWAddress for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
function _callOptionalReturn(IERC20 token, bytes memory data) private {
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
文件 45 的 47:SignatureMintERC721.sol
pragma solidity ^0.8.0;
import "./interface/ISignatureMintERC721.sol";
import "../external-deps/openzeppelin/utils/cryptography/EIP712.sol";
abstract contract SignatureMintERC721 is EIP712, ISignatureMintERC721 {
using ECDSA for bytes32;
bytes32 private constant TYPEHASH =
keccak256(
"MintRequest(address to,address royaltyRecipient,uint256 royaltyBps,address primarySaleRecipient,string uri,uint256 quantity,uint256 pricePerToken,address currency,uint128 validityStartTimestamp,uint128 validityEndTimestamp,bytes32 uid)"
);
mapping(bytes32 => bool) private minted;
constructor() EIP712("SignatureMintERC721", "1") {}
function verify(MintRequest calldata _req, bytes calldata _signature)
public
view
override
returns (bool success, address signer)
{
signer = _recoverAddress(_req, _signature);
success = !minted[_req.uid] && _canSignMintRequest(signer);
}
function _canSignMintRequest(address _signer) internal view virtual returns (bool);
function _processRequest(MintRequest calldata _req, bytes calldata _signature) internal returns (address signer) {
bool success;
(success, signer) = verify(_req, _signature);
if (!success) {
revert("Invalid req");
}
if (_req.validityStartTimestamp > block.timestamp || block.timestamp > _req.validityEndTimestamp) {
revert("Req expired");
}
require(_req.to != address(0), "recipient undefined");
require(_req.quantity > 0, "0 qty");
minted[_req.uid] = true;
}
function _recoverAddress(MintRequest calldata _req, bytes calldata _signature) internal view returns (address) {
return _hashTypedDataV4(keccak256(_encodeRequest(_req))).recover(_signature);
}
function _encodeRequest(MintRequest calldata _req) internal pure returns (bytes memory) {
return
abi.encode(
TYPEHASH,
_req.to,
_req.royaltyRecipient,
_req.royaltyBps,
_req.primarySaleRecipient,
keccak256(bytes(_req.uri)),
_req.quantity,
_req.pricePerToken,
_req.currency,
_req.validityStartTimestamp,
_req.validityEndTimestamp,
_req.uid
);
}
}
文件 46 的 47:TWAddress.sol
pragma solidity ^0.8.0;
library TWAddress {
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);
}
}
}
}
文件 47 的 47:TWStrings.sol
pragma solidity ^0.8.0;
library TWStrings {
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);
}
}
{
"compilationTarget": {
"src/BookDEA.sol": "BookDEA"
},
"evmVersion": "paris",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": [
":@thirdweb-dev/=node_modules/@thirdweb-dev/",
":ds-test/=lib/forge-std/lib/ds-test/src/",
":forge-std/=lib/forge-std/src/"
]
}
[{"inputs":[{"internalType":"address","name":"_defaultAdmin","type":"address"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"address","name":"_royaltyRecipient","type":"address"},{"internalType":"uint16","name":"_royaltyBps","type":"uint16"},{"internalType":"address","name":"_primarySaleRecipient","type":"address"},{"internalType":"bytes16","name":"_mediaId","type":"bytes16"}],"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":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"OperatorNotAllowed","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","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":false,"internalType":"string","name":"prevURI","type":"string"},{"indexed":false,"internalType":"string","name":"newURI","type":"string"}],"name":"ContractURIUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newRoyaltyRecipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"newRoyaltyBps","type":"uint256"}],"name":"DefaultRoyalty","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"restriction","type":"bool"}],"name":"OperatorRestriction","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"prevOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"recipient","type":"address"}],"name":"PrimarySaleRecipientUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"royaltyRecipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"royaltyBps","type":"uint256"}],"name":"RoyaltyForToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"startTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"endTokenId","type":"uint256"},{"indexed":false,"internalType":"string","name":"baseURI","type":"string"},{"indexed":false,"internalType":"bytes","name":"encryptedBaseURI","type":"bytes"}],"name":"TokensLazyMinted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"signer","type":"address"},{"indexed":true,"internalType":"address","name":"mintedTo","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenIdMinted","type":"uint256"},{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"royaltyRecipient","type":"address"},{"internalType":"uint256","name":"royaltyBps","type":"uint256"},{"internalType":"address","name":"primarySaleRecipient","type":"address"},{"internalType":"string","name":"uri","type":"string"},{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"uint256","name":"pricePerToken","type":"uint256"},{"internalType":"address","name":"currency","type":"address"},{"internalType":"uint128","name":"validityStartTimestamp","type":"uint128"},{"internalType":"uint128","name":"validityEndTimestamp","type":"uint128"},{"internalType":"bytes32","name":"uid","type":"bytes32"}],"indexed":false,"internalType":"struct ISignatureMintERC721.MintRequest","name":"mintRequest","type":"tuple"}],"name":"TokensMintedWithSignature","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":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR_FILTER_REGISTRY","outputs":[{"internalType":"contract IOperatorFilterRegistry","name":"","type":"address"}],"stateMutability":"view","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":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_quantity","type":"uint256"},{"internalType":"string","name":"_baseURI","type":"string"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"batchMintTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"royaltyRecipient","type":"address"},{"internalType":"uint16","name":"royaltyBps","type":"uint16"}],"name":"disableCoolMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"royaltyBps","type":"uint16"}],"name":"enableCoolMint","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":[],"name":"getBaseURICount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"getBatchIdAtIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDefaultRoyaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"member","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"count","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getRoyaltyInfoForToken","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRoleWithSwitch","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":"address","name":"_operator","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"isApprovedOrOwner","outputs":[{"internalType":"bool","name":"isApprovedOrOwnerOf","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isCool","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isRandomized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"string","name":"_baseURIForTokens","type":"string"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"lazyMint","outputs":[{"internalType":"uint256","name":"batchId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"mediaId","outputs":[{"internalType":"bytes16","name":"","type":"bytes16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mintCooldownRate","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"royaltyRecipient","type":"address"},{"internalType":"uint256","name":"royaltyBps","type":"uint256"},{"internalType":"address","name":"primarySaleRecipient","type":"address"},{"internalType":"string","name":"uri","type":"string"},{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"uint256","name":"pricePerToken","type":"uint256"},{"internalType":"address","name":"currency","type":"address"},{"internalType":"uint128","name":"validityStartTimestamp","type":"uint128"},{"internalType":"uint128","name":"validityEndTimestamp","type":"uint128"},{"internalType":"bytes32","name":"uid","type":"bytes32"}],"internalType":"struct ISignatureMintERC721.MintRequest","name":"_req","type":"tuple"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"mintRequestPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"string","name":"_tokenURI","type":"string"}],"name":"mintTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"royaltyRecipient","type":"address"},{"internalType":"uint256","name":"royaltyBps","type":"uint256"},{"internalType":"address","name":"primarySaleRecipient","type":"address"},{"internalType":"string","name":"uri","type":"string"},{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"uint256","name":"pricePerToken","type":"uint256"},{"internalType":"address","name":"currency","type":"address"},{"internalType":"uint128","name":"validityStartTimestamp","type":"uint128"},{"internalType":"uint128","name":"validityEndTimestamp","type":"uint128"},{"internalType":"bytes32","name":"uid","type":"bytes32"}],"internalType":"struct ISignatureMintERC721.MintRequest","name":"_req","type":"tuple"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"mintWithSignature","outputs":[{"internalType":"address","name":"signer","type":"address"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextTokenIdToMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"operatorRestriction","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":"primarySaleRecipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"royaltyRecipient","type":"address"},{"internalType":"uint256","name":"royaltyBps","type":"uint256"},{"internalType":"address","name":"primarySaleRecipient","type":"address"},{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"uint256","name":"pricePerToken","type":"uint256"},{"internalType":"address","name":"currency","type":"address"},{"internalType":"uint128","name":"validityStartTimestamp","type":"uint128"},{"internalType":"uint128","name":"validityEndTimestamp","type":"uint128"},{"internalType":"bytes32","name":"uid","type":"bytes32"},{"internalType":"uint256","name":"seed","type":"uint256"}],"internalType":"struct RandomSignatureMint.RandomMintRequest","name":"_req","type":"tuple"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"randMintRequestPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"royaltyRecipient","type":"address"},{"internalType":"uint256","name":"royaltyBps","type":"uint256"},{"internalType":"address","name":"primarySaleRecipient","type":"address"},{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"uint256","name":"pricePerToken","type":"uint256"},{"internalType":"address","name":"currency","type":"address"},{"internalType":"uint128","name":"validityStartTimestamp","type":"uint128"},{"internalType":"uint128","name":"validityEndTimestamp","type":"uint128"},{"internalType":"bytes32","name":"uid","type":"bytes32"},{"internalType":"uint256","name":"seed","type":"uint256"}],"internalType":"struct RandomSignatureMint.RandomMintRequest","name":"_req","type":"tuple"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"randMintWithSignature","outputs":[{"internalType":"address","name":"signer","type":"address"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"remainingMintableTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"royaltyAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_uri","type":"string"}],"name":"setContractURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_royalty","type":"uint16"},{"internalType":"uint16","name":"_transferCoolRate","type":"uint16"},{"internalType":"uint16","name":"_mintCoolRate","type":"uint16"}],"name":"setCooldownParams","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_royaltyRecipient","type":"address"},{"internalType":"uint256","name":"_royaltyBps","type":"uint256"}],"name":"setDefaultRoyaltyInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_restriction","type":"bool"}],"name":"setOperatorRestriction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"setOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_saleRecipient","type":"address"}],"name":"setPrimarySaleRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_isRandomized","type":"bool"}],"name":"setRandomizedMinting","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"_bps","type":"uint256"}],"name":"setRoyaltyInfoForToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_subscription","type":"address"}],"name":"subscribeToRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalLazyMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"transferCooldownRate","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"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":[{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"royaltyRecipient","type":"address"},{"internalType":"uint256","name":"royaltyBps","type":"uint256"},{"internalType":"address","name":"primarySaleRecipient","type":"address"},{"internalType":"string","name":"uri","type":"string"},{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"uint256","name":"pricePerToken","type":"uint256"},{"internalType":"address","name":"currency","type":"address"},{"internalType":"uint128","name":"validityStartTimestamp","type":"uint128"},{"internalType":"uint128","name":"validityEndTimestamp","type":"uint128"},{"internalType":"bytes32","name":"uid","type":"bytes32"}],"internalType":"struct ISignatureMintERC721.MintRequest","name":"_req","type":"tuple"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"verify","outputs":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"address","name":"signer","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"royaltyRecipient","type":"address"},{"internalType":"uint256","name":"royaltyBps","type":"uint256"},{"internalType":"address","name":"primarySaleRecipient","type":"address"},{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"uint256","name":"pricePerToken","type":"uint256"},{"internalType":"address","name":"currency","type":"address"},{"internalType":"uint128","name":"validityStartTimestamp","type":"uint128"},{"internalType":"uint128","name":"validityEndTimestamp","type":"uint128"},{"internalType":"bytes32","name":"uid","type":"bytes32"},{"internalType":"uint256","name":"seed","type":"uint256"}],"internalType":"struct RandomSignatureMint.RandomMintRequest","name":"_req","type":"tuple"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"verifyRandom","outputs":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"address","name":"signer","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]