文件 1 的 27:AccessControl.sol
pragma solidity ^0.8.0;
import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";
abstract contract AccessControl is Context, IAccessControl, ERC165 {
struct RoleData {
mapping(address => bool) members;
bytes32 adminRole;
}
mapping(bytes32 => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
modifier onlyRole(bytes32 role) {
_checkRole(role, _msgSender());
_;
}
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
}
function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
return _roles[role].members[account];
}
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert(
string(
abi.encodePacked(
"AccessControl: account ",
Strings.toHexString(uint160(account), 20),
" is missing role ",
Strings.toHexString(uint256(role), 32)
)
)
);
}
}
function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
return _roles[role].adminRole;
}
function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
function renounceRole(bytes32 role, address account) public virtual override {
require(account == _msgSender(), "AccessControl: can only renounce roles for self");
_revokeRole(role, account);
}
function _setupRole(bytes32 role, address account) internal virtual {
_grantRole(role, account);
}
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
function _grantRole(bytes32 role, address account) internal virtual {
if (!hasRole(role, account)) {
_roles[role].members[account] = true;
emit RoleGranted(role, account, _msgSender());
}
}
function _revokeRole(bytes32 role, address account) internal virtual {
if (hasRole(role, account)) {
_roles[role].members[account] = false;
emit RoleRevoked(role, account, _msgSender());
}
}
}
文件 2 的 27:Address.sol
pragma solidity ^0.8.1;
library Address {
function isContract(address account) internal view returns (bool) {
return account.code.length > 0;
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
文件 3 的 27: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 的 27:ECDSA.sol
pragma solidity ^0.8.0;
import "../Strings.sol";
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV
}
function _throwError(RecoverError error) private pure {
if (error == RecoverError.NoError) {
return;
} else if (error == RecoverError.InvalidSignature) {
revert("ECDSA: invalid signature");
} else if (error == RecoverError.InvalidSignatureLength) {
revert("ECDSA: invalid signature length");
} else if (error == RecoverError.InvalidSignatureS) {
revert("ECDSA: invalid signature 's' value");
} else if (error == RecoverError.InvalidSignatureV) {
revert("ECDSA: invalid signature 'v' value");
}
}
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else if (signature.length == 64) {
bytes32 r;
bytes32 vs;
assembly {
r := mload(add(signature, 0x20))
vs := mload(add(signature, 0x40))
}
return tryRecover(hash, r, vs);
} else {
return (address(0), RecoverError.InvalidSignatureLength);
}
}
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
return recovered;
}
function tryRecover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address, RecoverError) {
bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
uint8 v = uint8((uint256(vs) >> 255) + 27);
return tryRecover(hash, v, r, s);
}
function recover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, r, vs);
_throwError(error);
return recovered;
}
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address, RecoverError) {
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS);
}
if (v != 27 && v != 28) {
return (address(0), RecoverError.InvalidSignatureV);
}
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature);
}
return (signer, RecoverError.NoError);
}
function recover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, v, r, s);
_throwError(error);
return recovered;
}
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
}
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
}
}
文件 5 的 27:ERC165.sol
pragma solidity ^0.8.0;
import "./IERC165.sol";
abstract contract ERC165 is IERC165 {
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
文件 6 的 27:ERC721A.sol
pragma solidity ^0.8.4;
import '@openzeppelin/contracts/token/ERC721/IERC721.sol';
import '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol';
import '@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol';
import '@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol';
import '@openzeppelin/contracts/utils/Address.sol';
import '@openzeppelin/contracts/utils/Context.sol';
import '@openzeppelin/contracts/utils/Strings.sol';
import '@openzeppelin/contracts/utils/introspection/ERC165.sol';
error ApprovalCallerNotOwnerNorApproved();
error ApprovalQueryForNonexistentToken();
error ApproveToCaller();
error ApprovalToCurrentOwner();
error BalanceQueryForZeroAddress();
error MintedQueryForZeroAddress();
error BurnedQueryForZeroAddress();
error AuxQueryForZeroAddress();
error MintToZeroAddress();
error MintZeroQuantity();
error OwnerIndexOutOfBounds();
error OwnerQueryForNonexistentToken();
error TokenIndexOutOfBounds();
error TransferCallerNotOwnerNorApproved();
error TransferFromIncorrectOwner();
error TransferToNonERC721ReceiverImplementer();
error TransferToZeroAddress();
error URIQueryForNonexistentToken();
contract ERC721A is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
struct TokenOwnership {
address addr;
uint64 startTimestamp;
bool burned;
}
struct AddressData {
uint64 balance;
uint64 numberMinted;
uint64 numberBurned;
uint64 aux;
}
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 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, IERC165) 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) {
if (owner == address(0)) revert MintedQueryForZeroAddress();
return uint256(_addressData[owner].numberMinted);
}
function _numberBurned(address owner) internal view returns (uint256) {
if (owner == address(0)) revert BurnedQueryForZeroAddress();
return uint256(_addressData[owner].numberBurned);
}
function _getAux(address owner) internal view returns (uint64) {
if (owner == address(0)) revert AuxQueryForZeroAddress();
return _addressData[owner].aux;
}
function _setAux(address owner, uint64 aux) internal {
if (owner == address(0)) revert AuxQueryForZeroAddress();
_addressData[owner].aux = aux;
}
function ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) {
uint256 curr = tokenId;
unchecked {
if (_startTokenId() <= curr && 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 override {
address owner = ERC721A.ownerOf(tokenId);
if (to == owner) revert ApprovalToCurrentOwner();
if (_msgSender() != owner && !isApprovedForAll(owner, _msgSender())) {
revert ApprovalCallerNotOwnerNorApproved();
}
_approve(to, tokenId, owner);
}
function getApproved(uint256 tokenId) public view override returns (address) {
if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();
return _tokenApprovals[tokenId];
}
function setApprovalForAll(address operator, bool approved) public 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() && !_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 {
_mint(to, quantity, _data, true);
}
function _mint(
address to,
uint256 quantity,
bytes memory _data,
bool safe
) 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 (safe && 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 _transfer(
address from,
address to,
uint256 tokenId
) private {
TokenOwnership memory prevOwnership = ownershipOf(tokenId);
bool isApprovedOrOwner = (_msgSender() == prevOwnership.addr ||
isApprovedForAll(prevOwnership.addr, _msgSender()) ||
getApproved(tokenId) == _msgSender());
if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
if (prevOwnership.addr != from) revert TransferFromIncorrectOwner();
if (to == address(0)) revert TransferToZeroAddress();
_beforeTokenTransfers(from, to, tokenId, 1);
_approve(address(0), tokenId, prevOwnership.addr);
unchecked {
_addressData[from].balance -= 1;
_addressData[to].balance += 1;
_ownerships[tokenId].addr = to;
_ownerships[tokenId].startTimestamp = uint64(block.timestamp);
uint256 nextTokenId = tokenId + 1;
if (_ownerships[nextTokenId].addr == address(0)) {
if (nextTokenId < _currentIndex) {
_ownerships[nextTokenId].addr = prevOwnership.addr;
_ownerships[nextTokenId].startTimestamp = prevOwnership.startTimestamp;
}
}
}
emit Transfer(from, to, tokenId);
_afterTokenTransfers(from, to, tokenId, 1);
}
function _burn(uint256 tokenId) internal virtual {
TokenOwnership memory prevOwnership = ownershipOf(tokenId);
_beforeTokenTransfers(prevOwnership.addr, address(0), tokenId, 1);
_approve(address(0), tokenId, prevOwnership.addr);
unchecked {
_addressData[prevOwnership.addr].balance -= 1;
_addressData[prevOwnership.addr].numberBurned += 1;
_ownerships[tokenId].addr = prevOwnership.addr;
_ownerships[tokenId].startTimestamp = uint64(block.timestamp);
_ownerships[tokenId].burned = true;
uint256 nextTokenId = tokenId + 1;
if (_ownerships[nextTokenId].addr == address(0)) {
if (nextTokenId < _currentIndex) {
_ownerships[nextTokenId].addr = prevOwnership.addr;
_ownerships[nextTokenId].startTimestamp = prevOwnership.startTimestamp;
}
}
}
emit Transfer(prevOwnership.addr, address(0), tokenId);
_afterTokenTransfers(prevOwnership.addr, 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 {}
}
文件 7 的 27:IAccessControl.sol
pragma solidity ^0.8.0;
interface IAccessControl {
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;
}
文件 8 的 27:IContractURI.sol
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
interface IContractURI is IERC165 {
function contractURI() external view returns (string memory);
}
文件 9 的 27:IERC1155.sol
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
interface IERC1155 is IERC165 {
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
uint256[] values
);
event ApprovalForAll(address indexed account, address indexed operator, bool approved);
event URI(string value, uint256 indexed id);
function balanceOf(address account, uint256 id) external view returns (uint256);
function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
external
view
returns (uint256[] memory);
function setApprovalForAll(address operator, bool approved) external;
function isApprovedForAll(address account, address operator) external view returns (bool);
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes calldata data
) external;
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata amounts,
bytes calldata data
) external;
}
文件 10 的 27:IERC165.sol
pragma solidity ^0.8.0;
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
文件 11 的 27:IERC20.sol
pragma solidity ^0.8.0;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address to, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
文件 12 的 27:IERC20Metadata.sol
pragma solidity ^0.8.0;
import "../IERC20.sol";
interface IERC20Metadata is IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
文件 13 的 27:IERC2981.sol
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
interface IERC2981 is IERC165 {
function royaltyInfo(uint256 _tokenId, uint256 _salePrice)
external
view
returns (address receiver, uint256 royaltyAmount);
}
文件 14 的 27:IERC721.sol
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
interface IERC721 is IERC165 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
function balanceOf(address owner) external view returns (uint256 balance);
function ownerOf(uint256 tokenId) external view returns (address owner);
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
function approve(address to, uint256 tokenId) external;
function getApproved(uint256 tokenId) external view returns (address operator);
function setApprovalForAll(address operator, bool _approved) external;
function isApprovedForAll(address owner, address operator) external view returns (bool);
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
文件 15 的 27:IERC721Enumerable.sol
pragma solidity ^0.8.0;
import "../IERC721.sol";
interface IERC721Enumerable is IERC721 {
function totalSupply() external view returns (uint256);
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);
function tokenByIndex(uint256 index) external view returns (uint256);
}
文件 16 的 27:IERC721Metadata.sol
pragma solidity ^0.8.0;
import "../IERC721.sol";
interface IERC721Metadata is IERC721 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function tokenURI(uint256 tokenId) external view returns (string memory);
}
文件 17 的 27:IERC721Receiver.sol
pragma solidity ^0.8.0;
interface IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
文件 18 的 27:IJungle.sol
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
interface IJungle is IERC1155, IERC20, IERC20Metadata {
function getStakedTokens(address staker)
external
view
returns (uint256[] memory);
function getStakedAmount(address staker) external view returns (uint256);
function getStaker(uint256 tokenId) external view returns (address);
function getAllRewards(address staker) external view returns (uint256);
function getLegendariesRewards(address staker)
external
view
returns (uint256);
function stakeById(uint256[] calldata tokenIds) external;
function legendariesStaked(address)
external
view
returns (
uint32 cotfAccumulatedTime,
uint32 mtfmAccumulatedTime,
uint32 cotfLastStaked,
uint32 mtfmLastStaked,
uint8 cotfStaked,
uint8 mtfmStaked
);
function stakeLegendaries(uint8 cotf, uint8 mtfm) external;
function unstakeLegendaries(uint8 cotf, uint8 mtfm) external;
function claimLegendaries() external;
function unstakeByIds(uint256[] calldata tokenIds) external;
function unstakeAll() external;
function claimAll() external;
function mint(address to, uint256 amount) external;
function burn(address from, uint256 amount) external;
function setController(address controller, bool authorized) external;
function setAuthorizedAddress(address authorizedAddress, bool authorized)
external;
}
文件 19 的 27:JungleFreaksMotorClub.sol
pragma solidity 0.8.4;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@massless/smart-contract-library/contracts/token/ERC721/ERC721A.sol";
import "@massless/smart-contract-library/contracts/royalty/Royalty.sol";
import "@massless/smart-contract-library/contracts/interfaces/IContractURI.sol";
import "@massless/smart-contract-library/contracts/sale/SaleState.sol";
import "@massless/smart-contract-library/contracts/signature/Signature.sol";
import "./JungleFreaksMotorClubWithdrawal.sol";
import "./interfaces/IJungle.sol";
error NotModeratorOrOwner();
error ProofFailed();
error SoldOut();
error AllowListSoldOut();
error IncorrectEthValue();
error MintAddressUsed();
error NotHoldingJungleFreaks();
error ReserveLimitExceeded();
error MustMintMinimumOne();
error TransactionMintLimit(uint256 limit);
error ArrayLengthMismatch();
error NoTrailingSlash();
error IncorrectValueJungle();
contract JungleFreaksMotorClub is
JungleFreaksMotorClubWithdrawal,
AccessControl,
ERC721A,
Royalty,
Signature,
SaleState
{
uint256 public constant SALE_PRICE = 0.1 ether;
uint32 public constant MAX_SUPPLY = 8888;
uint32 public constant ALLOW_LIST_SUPPLY = 3333;
uint32 public constant MAX_BATCH_MINT = 5;
uint32 public constant MAX_ALLOW_LIST_MINT = 2;
uint32 public reserved = 100;
uint32 public allowListQuantity;
bytes32 public merkleRoot;
string private _baseURI_ = "https://jfmc-api-hxs7r5kyjq-uc.a.run.app/";
IERC721 private _jfContract;
IJungle private _jungleContract;
IERC1155 private _jflContract;
uint256 private constant _LEGENDARY_COTF =
64396628092031731206525383750081342765665389133291640817070595755125256486927;
uint256 private constant _LEGENDARY_MTFM =
64396628092031731206525383750081342765665389133291640817070595754025744859163;
address public constant JUNGLE_BANK =
0x8e5F332a0662C8c06BDD1Eed105Ba1C4800d4c2f;
bytes32 public constant MODERATOR = keccak256("MODERATOR");
event SetBaseURI(string _baseURI_);
event AllowListMintBegins();
event HoldersGuaranteeMintBegins();
event HoldersMintBegins();
event PublicMintBegins();
event MintEnds();
constructor(
address signer_,
address moderator_,
address royaltyReceiver_,
IERC721 jfContract_,
IERC1155 jflContract_,
IJungle jungleContract_
)
ERC721A("Jungle Freaks Motor Club", "JFMC")
Royalty(royaltyReceiver_, 500)
Signature(signer_)
{
_jfContract = jfContract_;
_jflContract = jflContract_;
_jungleContract = jungleContract_;
_grantRole(DEFAULT_ADMIN_ROLE, _msgSender());
_grantRole(MODERATOR, moderator_);
}
modifier maxSupplyLimit(uint256 quantity_) {
uint256 supplyLimit = MAX_SUPPLY - reserved - _totalMinted();
if (quantity_ == 0) revert MustMintMinimumOne();
if (quantity_ > supplyLimit) revert SoldOut();
_;
}
modifier onlyAdmin() {
if (!(owner() == _msgSender() || hasRole(MODERATOR, _msgSender())))
revert NotModeratorOrOwner();
_;
}
function allowListMint(
bytes calldata signature_,
bytes8 salt_,
bytes32[] calldata merkleProof_,
uint8 quantity_
)
external
payable
whenSaleIsActive("AllowListMint")
maxSupplyLimit(quantity_)
onlySignedTx(
keccak256(
abi.encodePacked(_msgSender(), salt_, merkleProof_, quantity_)
),
signature_
)
{
uint256 supplyLimit = ALLOW_LIST_SUPPLY - allowListQuantity;
if (quantity_ > supplyLimit) revert AllowListSoldOut();
if (msg.value != SALE_PRICE * quantity_) revert IncorrectEthValue();
if (quantity_ > MAX_ALLOW_LIST_MINT)
revert TransactionMintLimit(MAX_ALLOW_LIST_MINT);
(, uint256 stakedQuanitity) = getTotalHoldings(_msgSender());
if (stakedQuanitity == 0) {
bool proofVerified = MerkleProof.verify(
merkleProof_,
merkleRoot,
keccak256(abi.encodePacked(_msgSender()))
);
if (!proofVerified) revert ProofFailed();
}
allowListQuantity += quantity_;
_safeMint(_msgSender(), quantity_);
}
function holdersGuaranteeMint(
bytes calldata signature_,
bytes8 salt_,
uint256 jungle_
)
external
payable
whenSaleIsActive("HoldersGuaranteeMint")
maxSupplyLimit(1)
onlySignedTx(
keccak256(abi.encodePacked(_msgSender(), salt_, jungle_)),
signature_
)
{
(uint256 tokenHoldings, ) = getTotalHoldings(_msgSender());
if (tokenHoldings == 0) revert NotHoldingJungleFreaks();
if (getHoldersGuaranteeUsed(_msgSender())) revert MintAddressUsed();
uint256 ethPrice = holdersEthPrice(jungle_, 1);
if (msg.value != ethPrice) revert IncorrectEthValue();
if (jungle_ > 0) {
_jungleContract.transferFrom(_msgSender(), JUNGLE_BANK, jungle_);
}
_setHoldersGuaranteeUsed();
_safeMint(_msgSender(), 1);
}
function holdersMint(
bytes calldata signature_,
bytes8 salt_,
uint256 jungle_,
uint8 quantity_
)
external
payable
whenSaleIsActive("HoldersMint")
maxSupplyLimit(quantity_)
onlySignedTx(
keccak256(
abi.encodePacked(_msgSender(), salt_, jungle_, quantity_)
),
signature_
)
{
uint256 txAllowance = getHoldersTxAllowance(_msgSender());
if (txAllowance == 0) revert NotHoldingJungleFreaks();
if (quantity_ > txAllowance) revert TransactionMintLimit(txAllowance);
uint256 ethPrice = holdersEthPrice(jungle_, quantity_);
if (msg.value != ethPrice) revert IncorrectEthValue();
if (jungle_ > 0) {
_jungleContract.transferFrom(_msgSender(), JUNGLE_BANK, jungle_);
}
_safeMint(_msgSender(), quantity_);
}
function publicMint(
bytes calldata signature_,
bytes8 salt_,
uint256 jungle_,
uint8 quantity_
)
external
payable
whenSaleIsActive("PublicMint")
maxSupplyLimit(quantity_)
onlySignedTx(
keccak256(
abi.encodePacked(_msgSender(), salt_, jungle_, quantity_)
),
signature_
)
{
if (quantity_ > MAX_BATCH_MINT)
revert TransactionMintLimit(MAX_BATCH_MINT);
(uint256 tokenHoldings, ) = getTotalHoldings(_msgSender());
if (tokenHoldings == 0) jungle_ = 0;
uint256 ethPrice = publicEthPrice(jungle_, quantity_);
if (msg.value != ethPrice) revert IncorrectEthValue();
if (jungle_ > 0) {
_jungleContract.transferFrom(_msgSender(), JUNGLE_BANK, jungle_);
}
_safeMint(_msgSender(), quantity_);
}
function reservedMint(address to_, uint32 quantity_)
public
onlyOwner
maxSupplyLimit(quantity_)
{
if (quantity_ > reserved) revert ReserveLimitExceeded();
reserved -= quantity_;
_safeMint(to_, quantity_);
}
function giveawayMint(address[] calldata to_, uint32[] calldata quantity_)
public
onlyOwner
maxSupplyLimit(sumArray(quantity_))
{
if (to_.length != quantity_.length) revert ArrayLengthMismatch();
for (uint256 i; i < to_.length; i++) {
_safeMint(to_[i], quantity_[i]);
}
}
function burn(uint256 tokenId) public {
TokenOwnership memory prevOwnership = ownershipOf(tokenId);
bool isApprovedOrOwner = (_msgSender() == prevOwnership.addr ||
isApprovedForAll(prevOwnership.addr, _msgSender()) ||
getApproved(tokenId) == _msgSender());
if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
_burn(tokenId);
}
function startAllowListMint() external onlyAdmin {
_setSaleType("AllowListMint");
_setSaleState(State.ACTIVE);
emit AllowListMintBegins();
}
function startHoldersGuaranteeMint() external onlyAdmin {
_setSaleType("HoldersGuaranteeMint");
_setSaleState(State.ACTIVE);
emit HoldersGuaranteeMintBegins();
}
function startHoldersMint() external onlyAdmin {
_setSaleType("HoldersMint");
_setSaleState(State.ACTIVE);
emit HoldersMintBegins();
}
function startPublicMint() external onlyAdmin {
_setSaleType("PublicMint");
_setSaleState(State.ACTIVE);
emit PublicMintBegins();
}
function unpauseMint() external onlyAdmin {
_unpause();
}
function pauseMint() external onlyAdmin {
_pause();
}
function endMint() external onlyAdmin {
if (getSaleState() != State.ACTIVE) revert NoActiveSale();
_setSaleState(State.FINISHED);
emit MintEnds();
}
function setBaseURI(string memory _uri) public onlyAdmin {
if (bytes(_uri)[bytes(_uri).length - 1] != bytes1("/"))
revert NoTrailingSlash();
_baseURI_ = _uri;
emit SetBaseURI(_uri);
}
function tokenURI(uint256 tokenId)
public
view
override
returns (string memory)
{
require(_exists(tokenId), "URI query for nonexistent token");
return
string(
abi.encodePacked(
_baseURI_,
"token/",
toString(tokenId),
".json"
)
);
}
function contractURI() public view returns (string memory) {
return string(abi.encodePacked(_baseURI_, "contract.json"));
}
function setMerkleRoot(bytes32 _merkleRoot) public onlyAdmin {
merkleRoot = _merkleRoot;
}
function totalMinted() public view returns (uint256) {
return _totalMinted();
}
function sumArray(uint32[] calldata array_)
private
pure
returns (uint256 result)
{
for (uint256 i; i < array_.length; i++) {
result += array_[i];
}
}
function holdersEthPrice(uint256 j_, uint256 q_)
public
pure
returns (uint256)
{
if (j_ == 0 ether) return 0.08 ether * q_;
if (j_ == 75 ether * q_) return 0.06 ether * q_;
if (j_ == 150 ether * q_) return 0.04 ether * q_;
if (j_ == 300 ether * q_) return 0 ether;
revert IncorrectValueJungle();
}
function publicEthPrice(uint256 j_, uint256 q_)
public
pure
returns (uint256)
{
if (j_ == 0 ether) return 0.1 ether * q_;
if (j_ == 90 ether * q_) return 0.075 ether * q_;
if (j_ == 185 ether * q_) return 0.05 ether * q_;
if (j_ == 375 ether * q_) return 0 ether;
revert IncorrectValueJungle();
}
function getHoldersTxAllowance(address address_)
public
view
returns (uint256 txAllowance)
{
(uint256 tokenHoldings, uint256 stakedHoldings) = getTotalHoldings(
address_
);
if (tokenHoldings == 0) return 0;
else if (tokenHoldings < 5) txAllowance = 1;
else if (tokenHoldings < 10) txAllowance = 2;
else txAllowance = 3;
if (stakedHoldings > 0) txAllowance += 2;
}
function getTotalHoldings(address address_)
public
view
returns (uint256 totalTokenHoldings, uint256 stakedHoldings)
{
{
(, , , , uint8 cotfStaked, uint8 mtfmStaked) = _jungleContract
.legendariesStaked(address_);
stakedHoldings = _jungleContract.getStakedAmount(address_);
stakedHoldings += cotfStaked + mtfmStaked;
}
{
totalTokenHoldings += stakedHoldings;
totalTokenHoldings += _jfContract.balanceOf(address_);
totalTokenHoldings += _jflContract.balanceOf(
address_,
_LEGENDARY_COTF
);
totalTokenHoldings += _jflContract.balanceOf(
address_,
_LEGENDARY_MTFM
);
}
}
function _setHoldersGuaranteeUsed() private {
_setAux(_msgSender(), 1);
}
function getHoldersGuaranteeUsed(address address_)
public
view
returns (bool)
{
return (_getAux(address_) & uint64(1)) == 1 ? true : false;
}
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 setSignerAddress(address signerAddress_) public onlyAdmin {
_setSignerAddress(signerAddress_);
}
function setRoyaltyReceiver(address royaltyReceiver_) public onlyOwner {
_setRoyaltyReceiver(royaltyReceiver_);
}
function setRoyaltyBasisPoints(uint32 royaltyBasisPoints_)
public
onlyOwner
{
_setRoyaltyBasisPoints(royaltyBasisPoints_);
}
function transferOwnership(address newOwner)
public
virtual
override
onlyOwner
{
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
_grantRole(DEFAULT_ADMIN_ROLE, newOwner);
_revokeRole(DEFAULT_ADMIN_ROLE, owner());
_transferOwnership(newOwner);
}
function supportsInterface(bytes4 interfaceId)
public
view
override(ERC721A, Royalty, AccessControl)
returns (bool)
{
return
interfaceId == type(IAccessControl).interfaceId ||
interfaceId == type(IERC2981).interfaceId ||
interfaceId == type(IContractURI).interfaceId ||
interfaceId == type(IERC721Enumerable).interfaceId ||
super.supportsInterface(interfaceId);
}
}
文件 20 的 27:JungleFreaksMotorClubWithdrawal.sol
pragma solidity 0.8.4;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
error WithdrawalFailedUser1();
error WithdrawalFailedUser2();
error WithdrawalFailedUser3();
error WithdrawalFailedUser4();
error WithdrawalFailedUser5();
error WithdrawalFailedUser6();
error ZeroBalance();
error ZeroAddress();
contract JungleFreaksMotorClubWithdrawal is Ownable, ReentrancyGuard {
address public user1;
address public user2;
address public user3;
address public user4;
address public user5;
address public user6;
constructor() {
user1 = 0x8e5F332a0662C8c06BDD1Eed105Ba1C4800d4c2f;
user2 = 0x954BfE5137c8D2816cE018EFd406757f9a060e5f;
user3 = 0x2E7D93e2AdFC4a36E2B3a3e23dE7c35212471CfB;
user4 = 0x6fA183959B387a57b4869eAa34c2540Ff237886F;
user5 = 0x901FC05c4a4bC027a8979089D716b6793052Cc16;
user6 = 0xd196e0aFacA3679C27FC05ba8C9D3ABBCD353b5D;
}
receive() external payable {}
function calculateSplit(uint256 balance)
public
pure
returns (
uint256 user1Amount,
uint256 user2Amount,
uint256 user3Amount,
uint256 user4Amount,
uint256 user5Amount,
uint256 user6Amount
)
{
uint256 rest = balance;
user1Amount = (balance * 4000) / 10000;
rest -= user1Amount;
user2Amount = (balance * 1500) / 10000;
rest -= user2Amount;
user3Amount = (balance * 1000) / 10000;
rest -= user3Amount;
user4Amount = (balance * 500) / 10000;
rest -= user4Amount;
user5Amount = (balance * 1000) / 10000;
rest -= user5Amount;
user6Amount = rest;
}
function withdrawErc20(IERC20 token) public nonReentrant {
uint256 totalBalance = token.balanceOf(address(this));
if (totalBalance == 0) revert ZeroBalance();
(
uint256 user1Amount,
uint256 user2Amount,
uint256 user3Amount,
uint256 user4Amount,
uint256 user5Amount,
uint256 user6Amount
) = calculateSplit(totalBalance);
if (!token.transfer(user1, user1Amount)) revert WithdrawalFailedUser1();
if (!token.transfer(user2, user2Amount)) revert WithdrawalFailedUser2();
if (!token.transfer(user3, user3Amount)) revert WithdrawalFailedUser3();
if (!token.transfer(user4, user4Amount)) revert WithdrawalFailedUser4();
if (!token.transfer(user5, user5Amount)) revert WithdrawalFailedUser5();
if (!token.transfer(user6, user6Amount)) revert WithdrawalFailedUser6();
}
function withdrawEth() public nonReentrant {
uint256 totalBalance = address(this).balance;
if (totalBalance == 0) revert ZeroBalance();
(
uint256 user1Amount,
uint256 user2Amount,
uint256 user3Amount,
uint256 user4Amount,
uint256 user5Amount,
uint256 user6Amount
) = calculateSplit(totalBalance);
if (!payable(user1).send(user1Amount)) revert WithdrawalFailedUser1();
if (!payable(user2).send(user2Amount)) revert WithdrawalFailedUser2();
if (!payable(user3).send(user3Amount)) revert WithdrawalFailedUser3();
if (!payable(user4).send(user4Amount)) revert WithdrawalFailedUser4();
if (!payable(user5).send(user5Amount)) revert WithdrawalFailedUser5();
if (!payable(user6).send(user6Amount)) revert WithdrawalFailedUser6();
}
function setUser1(address address_) external onlyOwner {
if (address_ == address(0)) revert ZeroAddress();
user1 = address_;
}
function setUser2(address address_) external onlyOwner {
if (address_ == address(0)) revert ZeroAddress();
user2 = address_;
}
function setUser3(address address_) external onlyOwner {
if (address_ == address(0)) revert ZeroAddress();
user3 = address_;
}
function setUser4(address address_) external onlyOwner {
if (address_ == address(0)) revert ZeroAddress();
user4 = address_;
}
function setUser5(address address_) external onlyOwner {
if (address_ == address(0)) revert ZeroAddress();
user5 = address_;
}
function setUser6(address address_) external onlyOwner {
if (address_ == address(0)) revert ZeroAddress();
user6 = address_;
}
}
文件 21 的 27:MerkleProof.sol
pragma solidity ^0.8.0;
library MerkleProof {
function verify(
bytes32[] memory proof,
bytes32 root,
bytes32 leaf
) internal pure returns (bool) {
return processProof(proof, leaf) == root;
}
function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
bytes32 proofElement = proof[i];
if (computedHash <= proofElement) {
computedHash = _efficientHash(computedHash, proofElement);
} else {
computedHash = _efficientHash(proofElement, computedHash);
}
}
return computedHash;
}
function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
assembly {
mstore(0x00, a)
mstore(0x20, b)
value := keccak256(0x00, 0x40)
}
}
}
文件 22 的 27:Ownable.sol
pragma solidity ^0.8.0;
import "../utils/Context.sol";
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
文件 23 的 27:ReentrancyGuard.sol
pragma solidity ^0.8.0;
abstract contract ReentrancyGuard {
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
modifier nonReentrant() {
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
_status = _ENTERED;
_;
_status = _NOT_ENTERED;
}
}
文件 24 的 27:Royalty.sol
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "./IERC2981.sol";
abstract contract Royalty is ERC165, IERC2981 {
address public royaltyReceiver;
uint32 public royaltyBasisPoints;
constructor(address receiver_, uint32 basisPoints_) {
royaltyReceiver = receiver_;
royaltyBasisPoints = basisPoints_;
}
function _setRoyaltyReceiver(address receiver_) internal {
royaltyReceiver = receiver_;
}
function _setRoyaltyBasisPoints(uint32 basisPoints_)
internal
{
royaltyBasisPoints = basisPoints_;
}
function royaltyInfo(uint256, uint256 salePrice_)
public
view
virtual
override
returns (address receiver, uint256 amount)
{
uint256 royaltyAmount = (salePrice_ * royaltyBasisPoints) / 10000;
return (royaltyReceiver, royaltyAmount);
}
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC165, IERC165)
returns (bool)
{
return
interfaceId == type(IERC2981).interfaceId ||
super.supportsInterface(interfaceId);
}
}
文件 25 的 27:SaleState.sol
pragma solidity ^0.8.4;
error NoActiveSale();
error IncorrectSaleType();
error AllSalesFinished();
error NoPausedSale();
abstract contract SaleState {
enum State {
NOT_STARTED,
ACTIVE,
PAUSED,
FINISHED
}
struct Sale{
State state;
string saleType;
}
event StateOfSale(State _state);
event TypeOfSale(string _saleType);
event IsPaused(bool _paused);
Sale private _sale = Sale({saleType: "None", state: State.NOT_STARTED});
modifier whenSaleIsActive(string memory saleType) {
if (_sale.state != State.ACTIVE) revert NoActiveSale();
if (keccak256(bytes(_sale.saleType)) != keccak256(bytes(saleType))) revert IncorrectSaleType();
_;
}
function _setSaleState(State state) internal {
if (_sale.state == State.FINISHED) revert AllSalesFinished();
_sale.state = state;
if (state == State.FINISHED) {
_sale.saleType = "Finished";
emit TypeOfSale(_sale.saleType);
}
emit StateOfSale(_sale.state);
}
function _setSaleType(string memory saleType) internal {
if (_sale.state == State.FINISHED) revert AllSalesFinished();
_sale.saleType = saleType;
_sale.state = State.NOT_STARTED;
emit TypeOfSale(_sale.saleType);
}
function getSaleState() public view returns (State) {
return _sale.state;
}
function getSaleType() public view returns (string memory) {
return _sale.saleType;
}
function _pause() internal {
if (_sale.state != State.ACTIVE) revert NoActiveSale();
_sale.state = State.PAUSED;
emit IsPaused(true);
}
function _unpause() internal {
if (_sale.state != State.PAUSED) revert NoPausedSale();
_sale.state = State.ACTIVE;
emit IsPaused(false);
}
}
文件 26 的 27:Signature.sol
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
error HashUsed();
error SignatureFailed(address signatureAddress, address signer);
abstract contract Signature {
using ECDSA for bytes32;
address private _signer;
mapping(bytes32 => bool) private _isHashUsed;
constructor(address signerAddress_){
_signer = signerAddress_;
}
function _setSignerAddress(address signerAddress_) internal {
_signer = signerAddress_;
}
function signerAddress() public view returns(address) {
return _signer;
}
modifier onlySignedTx(
bytes32 hash_,
bytes calldata signature_
) {
if (_isHashUsed[hash_]) revert HashUsed();
address signatureAddress = hash_
.toEthSignedMessageHash()
.recover(signature_);
if (signatureAddress != _signer) revert SignatureFailed(signatureAddress, _signer);
_isHashUsed[hash_] = true;
_;
}
}
文件 27 的 27:Strings.sol
pragma solidity ^0.8.0;
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
function toString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
{
"compilationTarget": {
"contracts/JungleFreaksMotorClub.sol": "JungleFreaksMotorClub"
},
"evmVersion": "istanbul",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": []
}
[{"inputs":[{"internalType":"address","name":"signer_","type":"address"},{"internalType":"address","name":"moderator_","type":"address"},{"internalType":"address","name":"royaltyReceiver_","type":"address"},{"internalType":"contract IERC721","name":"jfContract_","type":"address"},{"internalType":"contract IERC1155","name":"jflContract_","type":"address"},{"internalType":"contract IJungle","name":"jungleContract_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AllSalesFinished","type":"error"},{"inputs":[],"name":"AllowListSoldOut","type":"error"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"ApprovalToCurrentOwner","type":"error"},{"inputs":[],"name":"ApproveToCaller","type":"error"},{"inputs":[],"name":"ArrayLengthMismatch","type":"error"},{"inputs":[],"name":"AuxQueryForZeroAddress","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"HashUsed","type":"error"},{"inputs":[],"name":"IncorrectEthValue","type":"error"},{"inputs":[],"name":"IncorrectSaleType","type":"error"},{"inputs":[],"name":"IncorrectValueJungle","type":"error"},{"inputs":[],"name":"MintAddressUsed","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"MustMintMinimumOne","type":"error"},{"inputs":[],"name":"NoActiveSale","type":"error"},{"inputs":[],"name":"NoPausedSale","type":"error"},{"inputs":[],"name":"NoTrailingSlash","type":"error"},{"inputs":[],"name":"NotHoldingJungleFreaks","type":"error"},{"inputs":[],"name":"NotModeratorOrOwner","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"ProofFailed","type":"error"},{"inputs":[],"name":"ReserveLimitExceeded","type":"error"},{"inputs":[{"internalType":"address","name":"signatureAddress","type":"address"},{"internalType":"address","name":"signer","type":"address"}],"name":"SignatureFailed","type":"error"},{"inputs":[],"name":"SoldOut","type":"error"},{"inputs":[{"internalType":"uint256","name":"limit","type":"uint256"}],"name":"TransactionMintLimit","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"WithdrawalFailedUser1","type":"error"},{"inputs":[],"name":"WithdrawalFailedUser2","type":"error"},{"inputs":[],"name":"WithdrawalFailedUser3","type":"error"},{"inputs":[],"name":"WithdrawalFailedUser4","type":"error"},{"inputs":[],"name":"WithdrawalFailedUser5","type":"error"},{"inputs":[],"name":"WithdrawalFailedUser6","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"inputs":[],"name":"ZeroBalance","type":"error"},{"anonymous":false,"inputs":[],"name":"AllowListMintBegins","type":"event"},{"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":[],"name":"HoldersGuaranteeMintBegins","type":"event"},{"anonymous":false,"inputs":[],"name":"HoldersMintBegins","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"_paused","type":"bool"}],"name":"IsPaused","type":"event"},{"anonymous":false,"inputs":[],"name":"MintEnds","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[],"name":"PublicMintBegins","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":false,"internalType":"string","name":"_baseURI_","type":"string"}],"name":"SetBaseURI","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"enum SaleState.State","name":"_state","type":"uint8"}],"name":"StateOfSale","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"_saleType","type":"string"}],"name":"TypeOfSale","type":"event"},{"inputs":[],"name":"ALLOW_LIST_SUPPLY","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"JUNGLE_BANK","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_ALLOW_LIST_MINT","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_BATCH_MINT","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_SUPPLY","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MODERATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SALE_PRICE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"signature_","type":"bytes"},{"internalType":"bytes8","name":"salt_","type":"bytes8"},{"internalType":"bytes32[]","name":"merkleProof_","type":"bytes32[]"},{"internalType":"uint8","name":"quantity_","type":"uint8"}],"name":"allowListMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"allowListQuantity","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"name":"calculateSplit","outputs":[{"internalType":"uint256","name":"user1Amount","type":"uint256"},{"internalType":"uint256","name":"user2Amount","type":"uint256"},{"internalType":"uint256","name":"user3Amount","type":"uint256"},{"internalType":"uint256","name":"user4Amount","type":"uint256"},{"internalType":"uint256","name":"user5Amount","type":"uint256"},{"internalType":"uint256","name":"user6Amount","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"endMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"address_","type":"address"}],"name":"getHoldersGuaranteeUsed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"address_","type":"address"}],"name":"getHoldersTxAllowance","outputs":[{"internalType":"uint256","name":"txAllowance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSaleState","outputs":[{"internalType":"enum SaleState.State","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSaleType","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"address_","type":"address"}],"name":"getTotalHoldings","outputs":[{"internalType":"uint256","name":"totalTokenHoldings","type":"uint256"},{"internalType":"uint256","name":"stakedHoldings","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"to_","type":"address[]"},{"internalType":"uint32[]","name":"quantity_","type":"uint32[]"}],"name":"giveawayMint","outputs":[],"stateMutability":"nonpayable","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":"uint256","name":"j_","type":"uint256"},{"internalType":"uint256","name":"q_","type":"uint256"}],"name":"holdersEthPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes","name":"signature_","type":"bytes"},{"internalType":"bytes8","name":"salt_","type":"bytes8"},{"internalType":"uint256","name":"jungle_","type":"uint256"}],"name":"holdersGuaranteeMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes","name":"signature_","type":"bytes"},{"internalType":"bytes8","name":"salt_","type":"bytes8"},{"internalType":"uint256","name":"jungle_","type":"uint256"},{"internalType":"uint8","name":"quantity_","type":"uint8"}],"name":"holdersMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"merkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pauseMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"j_","type":"uint256"},{"internalType":"uint256","name":"q_","type":"uint256"}],"name":"publicEthPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes","name":"signature_","type":"bytes"},{"internalType":"bytes8","name":"salt_","type":"bytes8"},{"internalType":"uint256","name":"jungle_","type":"uint256"},{"internalType":"uint8","name":"quantity_","type":"uint8"}],"name":"publicMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reserved","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to_","type":"address"},{"internalType":"uint32","name":"quantity_","type":"uint32"}],"name":"reservedMint","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":[],"name":"royaltyBasisPoints","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"salePrice_","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"royaltyReceiver","outputs":[{"internalType":"address","name":"","type":"address"}],"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":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_merkleRoot","type":"bytes32"}],"name":"setMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"royaltyBasisPoints_","type":"uint32"}],"name":"setRoyaltyBasisPoints","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"royaltyReceiver_","type":"address"}],"name":"setRoyaltyReceiver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"signerAddress_","type":"address"}],"name":"setSignerAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"address_","type":"address"}],"name":"setUser1","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"address_","type":"address"}],"name":"setUser2","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"address_","type":"address"}],"name":"setUser3","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"address_","type":"address"}],"name":"setUser4","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"address_","type":"address"}],"name":"setUser5","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"address_","type":"address"}],"name":"setUser6","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"signerAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"startAllowListMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startHoldersGuaranteeMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startHoldersMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startPublicMint","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":"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":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpauseMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"user1","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"user2","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"user3","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"user4","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"user5","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"user6","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"withdrawErc20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawEth","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]