编译器
0.8.12+commit.f00d7308
文件 1 的 19:Address.sol
pragma solidity ^0.8.1;
library Address {
function isContract(address account) internal view returns (bool) {
return account.code.length > 0;
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
文件 2 的 19:ArrayFind.sol
pragma solidity ^0.8.12;
import "./Types.sol";
library ArrayFind {
function find(
uint256[] memory arr,
uint value
) internal pure returns (uint256) {
uint256 ind = IndexNotFound;
for (uint256 i = 0; i < arr.length; i++) {
if (arr[i] == value) {
ind = i;
break;
}
}
return ind;
}
function find(
bytes32[] memory arr,
bytes32 value
) internal pure returns (uint256) {
uint256 ind = IndexNotFound;
for (uint i = 0; i < arr.length; i++) {
if (arr[i] == value) {
ind = i;
break;
}
}
return ind;
}
function find(
address[] memory arr,
address value
) internal pure returns (uint256) {
uint256 ind = IndexNotFound;
for (uint i = 0; i < arr.length; i++) {
if (arr[i] == value) {
ind = i;
break;
}
}
return ind;
}
function exist(
address[] memory arr,
address value
) internal pure returns (bool) {
return find(arr, value) != IndexNotFound;
}
function checkForDublicates(
address[] memory arr
) internal pure returns (bool) {
for (uint i = 0; i < arr.length; i++) {
address _val = arr[i];
for (uint j = i + 1; j < arr.length; j++) {
if (arr[j] == _val) return true;
}
}
return false;
}
}
文件 3 的 19: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 的 19:DefaultOperatorFilterer.sol
pragma solidity ^0.8.12;
import {OperatorFilterer} from "./OperatorFilterer.sol";
contract DefaultOperatorFilterer is OperatorFilterer {
}
文件 5 的 19:ERC1155.sol
pragma solidity ^0.8.0;
import "./IERC1155.sol";
import "./IERC1155Receiver.sol";
import "./extensions/IERC1155MetadataURI.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/introspection/ERC165.sol";
contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
using Address for address;
mapping(uint256 => mapping(address => uint256)) private _balances;
mapping(address => mapping(address => bool)) private _operatorApprovals;
string private _uri;
constructor(string memory uri_) {
_setURI(uri_);
}
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC1155).interfaceId ||
interfaceId == type(IERC1155MetadataURI).interfaceId ||
super.supportsInterface(interfaceId);
}
function uri(uint256) public view virtual override returns (string memory) {
return _uri;
}
function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {
require(account != address(0), "ERC1155: address zero is not a valid owner");
return _balances[id][account];
}
function balanceOfBatch(address[] memory accounts, uint256[] memory ids)
public
view
virtual
override
returns (uint256[] memory)
{
require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch");
uint256[] memory batchBalances = new uint256[](accounts.length);
for (uint256 i = 0; i < accounts.length; ++i) {
batchBalances[i] = balanceOf(accounts[i], ids[i]);
}
return batchBalances;
}
function setApprovalForAll(address operator, bool approved) public virtual override {
_setApprovalForAll(_msgSender(), operator, approved);
}
function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {
return _operatorApprovals[account][operator];
}
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) public virtual override {
require(
from == _msgSender() || isApprovedForAll(from, _msgSender()),
"ERC1155: caller is not token owner nor approved"
);
_safeTransferFrom(from, to, id, amount, data);
}
function safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) public virtual override {
require(
from == _msgSender() || isApprovedForAll(from, _msgSender()),
"ERC1155: caller is not token owner nor approved"
);
_safeBatchTransferFrom(from, to, ids, amounts, data);
}
function _safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: transfer to the zero address");
address operator = _msgSender();
uint256[] memory ids = _asSingletonArray(id);
uint256[] memory amounts = _asSingletonArray(amount);
_beforeTokenTransfer(operator, from, to, ids, amounts, data);
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
unchecked {
_balances[id][from] = fromBalance - amount;
}
_balances[id][to] += amount;
emit TransferSingle(operator, from, to, id, amount);
_afterTokenTransfer(operator, from, to, ids, amounts, data);
_doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);
}
function _safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
require(to != address(0), "ERC1155: transfer to the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, from, to, ids, amounts, data);
for (uint256 i = 0; i < ids.length; ++i) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
unchecked {
_balances[id][from] = fromBalance - amount;
}
_balances[id][to] += amount;
}
emit TransferBatch(operator, from, to, ids, amounts);
_afterTokenTransfer(operator, from, to, ids, amounts, data);
_doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);
}
function _setURI(string memory newuri) internal virtual {
_uri = newuri;
}
function _mint(
address to,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
address operator = _msgSender();
uint256[] memory ids = _asSingletonArray(id);
uint256[] memory amounts = _asSingletonArray(amount);
_beforeTokenTransfer(operator, address(0), to, ids, amounts, data);
_balances[id][to] += amount;
emit TransferSingle(operator, address(0), to, id, amount);
_afterTokenTransfer(operator, address(0), to, ids, amounts, data);
_doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);
}
function _mintBatch(
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address operator = _msgSender();
_beforeTokenTransfer(operator, address(0), to, ids, amounts, data);
for (uint256 i = 0; i < ids.length; i++) {
_balances[ids[i]][to] += amounts[i];
}
emit TransferBatch(operator, address(0), to, ids, amounts);
_afterTokenTransfer(operator, address(0), to, ids, amounts, data);
_doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
}
function _burn(
address from,
uint256 id,
uint256 amount
) internal virtual {
require(from != address(0), "ERC1155: burn from the zero address");
address operator = _msgSender();
uint256[] memory ids = _asSingletonArray(id);
uint256[] memory amounts = _asSingletonArray(amount);
_beforeTokenTransfer(operator, from, address(0), ids, amounts, "");
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
unchecked {
_balances[id][from] = fromBalance - amount;
}
emit TransferSingle(operator, from, address(0), id, amount);
_afterTokenTransfer(operator, from, address(0), ids, amounts, "");
}
function _burnBatch(
address from,
uint256[] memory ids,
uint256[] memory amounts
) internal virtual {
require(from != address(0), "ERC1155: burn from the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address operator = _msgSender();
_beforeTokenTransfer(operator, from, address(0), ids, amounts, "");
for (uint256 i = 0; i < ids.length; i++) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
unchecked {
_balances[id][from] = fromBalance - amount;
}
}
emit TransferBatch(operator, from, address(0), ids, amounts);
_afterTokenTransfer(operator, from, address(0), ids, amounts, "");
}
function _setApprovalForAll(
address owner,
address operator,
bool approved
) internal virtual {
require(owner != operator, "ERC1155: setting approval status for self");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
function _beforeTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {}
function _afterTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {}
function _doSafeTransferAcceptanceCheck(
address operator,
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) private {
if (to.isContract()) {
try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {
if (response != IERC1155Receiver.onERC1155Received.selector) {
revert("ERC1155: ERC1155Receiver rejected tokens");
}
} catch Error(string memory reason) {
revert(reason);
} catch {
revert("ERC1155: transfer to non ERC1155Receiver implementer");
}
}
}
function _doSafeBatchTransferAcceptanceCheck(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) private {
if (to.isContract()) {
try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (
bytes4 response
) {
if (response != IERC1155Receiver.onERC1155BatchReceived.selector) {
revert("ERC1155: ERC1155Receiver rejected tokens");
}
} catch Error(string memory reason) {
revert(reason);
} catch {
revert("ERC1155: transfer to non ERC1155Receiver implementer");
}
}
}
function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {
uint256[] memory array = new uint256[](1);
array[0] = element;
return array;
}
}
文件 6 的 19: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;
}
}
文件 7 的 19:ERC2981.sol
pragma solidity ^0.8.0;
import "../../interfaces/IERC2981.sol";
import "../../utils/introspection/ERC165.sol";
abstract contract ERC2981 is IERC2981, ERC165 {
struct RoyaltyInfo {
address receiver;
uint96 royaltyFraction;
}
RoyaltyInfo private _defaultRoyaltyInfo;
mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo;
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) {
return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId);
}
function royaltyInfo(uint256 _tokenId, uint256 _salePrice) public view virtual override returns (address, uint256) {
RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId];
if (royalty.receiver == address(0)) {
royalty = _defaultRoyaltyInfo;
}
uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator();
return (royalty.receiver, royaltyAmount);
}
function _feeDenominator() internal pure virtual returns (uint96) {
return 10000;
}
function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {
require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
require(receiver != address(0), "ERC2981: invalid receiver");
_defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
}
function _deleteDefaultRoyalty() internal virtual {
delete _defaultRoyaltyInfo;
}
function _setTokenRoyalty(
uint256 tokenId,
address receiver,
uint96 feeNumerator
) internal virtual {
require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
require(receiver != address(0), "ERC2981: Invalid parameters");
_tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);
}
function _resetTokenRoyalty(uint256 tokenId) internal virtual {
delete _tokenRoyaltyInfo[tokenId];
}
}
文件 8 的 19: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;
}
文件 9 的 19:IERC1155MetadataURI.sol
pragma solidity ^0.8.0;
import "../IERC1155.sol";
interface IERC1155MetadataURI is IERC1155 {
function uri(uint256 id) external view returns (string memory);
}
文件 10 的 19:IERC1155Receiver.sol
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
interface IERC1155Receiver is IERC165 {
function onERC1155Received(
address operator,
address from,
uint256 id,
uint256 value,
bytes calldata data
) external returns (bytes4);
function onERC1155BatchReceived(
address operator,
address from,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external returns (bytes4);
}
文件 11 的 19:IERC165.sol
pragma solidity ^0.8.0;
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
文件 12 的 19:IERC20.sol
pragma solidity ^0.8.0;
interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address to, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}
文件 13 的 19:IERC2981.sol
pragma solidity ^0.8.0;
import "../utils/introspection/IERC165.sol";
interface IERC2981 is IERC165 {
function royaltyInfo(uint256 tokenId, uint256 salePrice)
external
view
returns (address receiver, uint256 royaltyAmount);
}
文件 14 的 19:IOperatorFilterRegistry.sol
pragma solidity ^0.8.12;
interface IOperatorFilterRegistry {
function isOperatorAllowed(address registrant, address operator) external view returns (bool);
function register(address registrant) external;
function unregister(address addr) external;
function registerAndSubscribe(address registrant, address subscription) external;
function registerAndCopyEntries(address registrant, address registrantToCopy) external;
function updateOperator(address registrant, address operator, bool filtered) external;
function updateOperators(address registrant, address[] calldata operators, bool filtered) external;
function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external;
function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered) external;
function subscribe(address registrant, address registrantToSubscribe) external;
function unsubscribe(address registrant, bool copyExistingEntries) external;
function subscriptionOf(address addr) external returns (address registrant);
function subscribers(address registrant) external returns (address[] memory);
function subscriberAt(address registrant, uint256 index) external returns (address);
function copyEntriesOf(address registrant, address registrantToCopy) external;
function isOperatorFiltered(address registrant, address operator) external returns (bool);
function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool);
function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool);
function filteredOperators(address addr) external returns (address[] memory);
function filteredCodeHashes(address addr) external returns (bytes32[] memory);
function filteredOperatorAt(address registrant, uint256 index) external returns (address);
function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32);
function isRegistered(address addr) external returns (bool);
function codeHashOf(address addr) external returns (bytes32);
}
文件 15 的 19:MallCard.sol
pragma solidity ^0.8.12;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/common/ERC2981.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "./operatorfilterer/DefaultOperatorFilterer.sol";
contract MallCard is ERC1155, ERC2981, DefaultOperatorFilterer, Ownable {
struct ClaimDefinition {
bytes32 merkleRootHash;
uint256 startTime;
uint256 endTime;
bool revoked;
}
struct ClaimData {
uint256 claimRecordIndex;
uint256 silverAmount;
uint256 goldAmount;
uint256 diamondAmount;
uint256 userExpireDate;
bytes32[] merkleProof;
}
struct ReflinkUsage {
address from;
address to;
uint256 token;
uint256 amount;
uint256 price;
uint256 discount;
string refCode;
}
struct Token {
uint256 maxSupply;
uint256 totalClaim;
uint256 totalSale;
mapping(uint256 => uint256) tierSales;
uint256[] limits;
uint256[] prices;
}
struct TokenSummary {
uint256 token;
uint256 currentPrice;
uint256 discount;
uint256 currentTier;
uint256 maxSupply;
uint256 totalClaim;
uint256 totalSale;
uint256[] tierSales;
uint256[] limits;
uint256[] prices;
}
struct TokenAmount {
uint256 token;
uint256 amount;
}
ClaimDefinition[] public claimDefinitions;
mapping(uint256 => mapping(address => bool)) public claimRecords;
uint256 public constant SILVER = 0;
uint256 public constant GOLD = 1;
uint256 public constant DIAMOND = 2;
uint private constant TOKEN_LEN = 3;
IERC20 public tokenContract;
ReflinkUsage[] public reflinkRecords;
mapping(uint256 => bool) public paused;
mapping(uint256 => Token) public tokens;
mapping(uint256 => uint256) public discountRates;
mapping(address => uint256[]) public reflinkSourceRecords;
mapping(uint256 => string) public tokenURIs;
bool public useTicketBasedDiscountRates;
uint256 public publicSaleStart;
uint256 public transferOpenDate;
uint256 public discountRate;
address public mintIncomeWaletContract;
string public name = "MallCard Genesis Edition";
string public symbol = "mCard";
event Claim(address indexed owner, TokenAmount[] claimed);
event TokenMint(
address indexed owner,
uint256 token,
uint256 amount,
uint256 price,
uint256 discount,
address reflinkOwner,
string refCode
);
event SetPrices(uint256[][] prices, uint256[][] limits);
event Pause(uint256[] ids);
event UnPause(uint256[] ids);
event SetURI(uint256 indexed id, string uri);
event SetTokenContract(address tokenContract);
event SetDiscountRate(uint256 discountRate);
event SetPublicSaleStart(uint256 transferOpenDate);
event SetTransferOpenDate(uint256 publicSaleStart);
event SetMaxSupplies(uint256 silver, uint256 gold, uint256 diamond);
event SetMintIncomeWalletContract(address mintIncomeWaletContract);
event SetRoyaltyInfo(address receiver, uint96 feeNumerator);
event CreateClaim(ClaimDefinition claims);
event RevokeClaim(uint256 indexed index);
constructor(
address _tokenContract,
address _royaltyWaletContract,
address _mintIncomeWalletContract,
uint256 _publicSaleStart,
uint96 _royalty,
uint256 _discountRate
) ERC1155("") {
require(_tokenContract != address(0), "MallCard: tokenContract zero address");
require(_royaltyWaletContract != address(0), "MallCard: royaltyWaletContract zero address");
require(_mintIncomeWalletContract != address(0), "MallCard: mintIncomeWalletContract zero address");
if (_publicSaleStart == 0) {
setPublicSaleStart(block.timestamp);
} else {
setPublicSaleStart(_publicSaleStart);
}
discountRate = _discountRate;
mintIncomeWaletContract = _mintIncomeWalletContract;
_setDefaultRoyalty(_royaltyWaletContract, _royalty);
tokenContract = IERC20(_tokenContract);
}
modifier salesOpen(uint256 _id) {
require(!paused[_id], "Sale is currently closed, please try again later");
require(block.timestamp > publicSaleStart, "Public sale not started, please try again on the public sale date");
_;
}
function setURI(uint256 _id, string calldata _uri) public onlyOwner {
require(bytes(_uri).length > 0, "MallCard: uri empty");
require(_id < TOKEN_LEN, "MallCard: invalid id");
tokenURIs[_id] = _uri;
emit SetURI(_id, _uri);
}
function setURIs(string[] calldata _uris) external onlyOwner {
for (uint256 i = 0; i < _uris.length; i++) {
setURI(i, _uris[i]);
}
}
function setTokenContract(address _tokenContract) external onlyOwner {
require(address(0) != _tokenContract, "MallCard: zero _tokenContract");
tokenContract = IERC20(_tokenContract);
emit SetTokenContract(_tokenContract);
}
function setDiscountRate(uint256 _discountRate) external onlyOwner {
discountRate = _discountRate;
emit SetDiscountRate(_discountRate);
}
function setTicketBasedDiscountRates(uint256[] calldata _discountRates, bool _enabled) external onlyOwner {
require(_discountRates.length == TOKEN_LEN, "MallCard: _discountRates length mismatch");
useTicketBasedDiscountRates = _enabled;
for (uint256 r = 0; r < _discountRates.length; r++) {
discountRates[r] = _discountRates[r];
}
}
function setTransferOpenDate(uint256 _transferOpenDate) external onlyOwner {
require(_transferOpenDate > block.timestamp, "MallCard: invalid _transferOpenDate");
transferOpenDate = _transferOpenDate;
emit SetTransferOpenDate(_transferOpenDate);
}
function setPublicSaleStart(uint256 _publicSaleStart) public onlyOwner {
require(_publicSaleStart >= block.timestamp, "MallCard: invalid _publicSaleStart");
publicSaleStart = _publicSaleStart;
emit SetPublicSaleStart(_publicSaleStart);
}
function setMaxSupplies(uint256 _silver, uint256 _gold, uint256 _diamond) external onlyOwner {
tokens[SILVER].maxSupply = _silver;
tokens[GOLD].maxSupply = _gold;
tokens[DIAMOND].maxSupply = _diamond;
emit SetMaxSupplies(_silver, _gold, _diamond);
}
function setMintIncomeWalletContract(address _mintIncomeWaletContract) external onlyOwner {
require(_mintIncomeWaletContract != address(0), "MallCard: to zero mintIncomeWaletContract");
mintIncomeWaletContract = _mintIncomeWaletContract;
emit SetMintIncomeWalletContract(_mintIncomeWaletContract);
}
function setRoyaltyInfo(address _receiver, uint96 _feeNumerator) external onlyOwner {
_setDefaultRoyalty(_receiver, _feeNumerator);
emit SetRoyaltyInfo(_receiver, _feeNumerator);
}
function setPrices(uint256[][] calldata _prices, uint256[][] calldata _limits) external onlyOwner {
require(_prices.length == TOKEN_LEN, "MallCard: _prices length mismatch");
require(_limits.length == TOKEN_LEN, "MallCard: _limits length mismatch");
for (uint256 r = 0; r < _prices.length; r++) {
require(_limits[r].length == _prices[r].length, "MallCard: _limit and _price length mismatch");
tokens[r].prices = _prices[r];
tokens[r].limits = _limits[r];
}
emit SetPrices(_prices, _limits);
}
function pause(uint256[] calldata _ids) external onlyOwner {
require(_ids.length <= TOKEN_LEN, "MallCard: claim _ids length mismatch");
for (uint256 r = 0; r < _ids.length; r++) {
paused[_ids[r]] = true;
}
emit Pause(_ids);
}
function unPause(uint256[] calldata _ids) external onlyOwner {
require(_ids.length <= TOKEN_LEN, "MallCard: claim _ids length mismatch");
for (uint256 i = 0; i < _ids.length; i++) {
paused[_ids[i]] = false;
}
emit UnPause(_ids);
}
function createClaim(bytes32 _merkleRootHash, uint256 _startTime, uint256 _endTime) external onlyOwner {
require(_merkleRootHash.length > 0, "MallCard: invalid merkle root hash");
require(_startTime > block.timestamp, "MallCard: start time must be in the future");
require(_endTime > _startTime, "MallCard: end time must be later then start time");
ClaimDefinition memory _claimRecord = ClaimDefinition({
merkleRootHash: _merkleRootHash,
startTime: _startTime,
endTime: _endTime,
revoked: false
});
claimDefinitions.push(_claimRecord);
emit CreateClaim(_claimRecord);
}
function revokeClaim(uint256 _index) external onlyOwner {
require(_index >= 0 && _index < claimDefinitions.length, "MallCard: invalid claim definition index");
require(!claimDefinitions[_index].revoked, "MallCard: already revoked");
require(claimDefinitions[_index].endTime > block.timestamp, "MallCard: already expired");
claimDefinitions[_index].revoked = true;
emit RevokeClaim(_index);
}
function mint(uint256 _id) external salesOpen(_id) {
(uint256 _price, , uint256 _tier) = getCurrentPrice(_id, address(0));
require(_hasTokenSupply(_id, _tier));
require(
tokenContract.transferFrom(msg.sender, mintIncomeWaletContract, _price),
"Sorry, your wallet does not have enough balance to complete this transaction"
);
_mint(msg.sender, _id, 1, "");
tokens[_id].totalSale = tokens[_id].totalSale + 1;
tokens[_id].tierSales[_tier] = tokens[_id].tierSales[_tier] + 1;
emit TokenMint(msg.sender, _id, 1, _price, 0, address(0), "");
}
function mintWithReflink(address _referral, uint256 _id, string calldata _refCode) external salesOpen(_id) {
require(_referral != address(0), "Invalid referral code, your transaction could not be completed. Try again");
require(
bytes(_refCode).length > 0,
"Referral code is required, your transaction could not be processed. Try again"
);
(uint256 _price, uint256 _discount, uint256 _tier) = getCurrentPrice(_id, _referral);
require(_hasTokenSupply(_id, _tier));
require(
tokenContract.transferFrom(msg.sender, mintIncomeWaletContract, _price - _discount),
"Sorry, your wallet does not have enough balance to complete this transaction"
);
_mint(msg.sender, _id, 1, bytes(_refCode));
tokens[_id].totalSale = tokens[_id].totalSale + 1;
tokens[_id].tierSales[_tier] = tokens[_id].tierSales[_tier] + 1;
if (_discount > 0) {
ReflinkUsage memory _reflinkRecord = ReflinkUsage({
from: _referral,
to: msg.sender,
token: _id,
refCode: _refCode,
amount: 1,
price: _price,
discount: _discount
});
reflinkSourceRecords[_reflinkRecord.from].push(reflinkRecords.length);
reflinkRecords.push(_reflinkRecord);
}
emit TokenMint(msg.sender, _id, 1, _price, _discount, _referral, _refCode);
}
function claim(ClaimData[] calldata _claimDatas) external {
require(_claimDatas.length > 0, "MallCard: empty claim parameter data");
uint256 _claimedSilverAmount = 0;
uint256 _claimedGoldAmount = 0;
uint256 _claimedDiamondAmount = 0;
for (uint i = 0; i < _claimDatas.length; i++) {
ClaimData memory _claimData = _claimDatas[i];
uint256 _claimRecordIndex = _claimData.claimRecordIndex;
require(claimRecords[_claimRecordIndex][msg.sender] == false, "MallCard: already claimed");
claimRecords[_claimRecordIndex][msg.sender] = true;
require(claimDefinitions[_claimRecordIndex].startTime < block.timestamp, "MallCard: claim not started");
require(claimDefinitions[_claimRecordIndex].endTime > block.timestamp, "MallCard: claim expired");
require(!claimDefinitions[_claimRecordIndex].revoked, "MallCard: claim definition revoked");
uint256 _userExpireDate = _claimData.userExpireDate;
require(_userExpireDate > block.timestamp, "MallCard: user claim definition expired");
uint256 _silverAmount = _claimData.silverAmount;
uint256 _goldAmount = _claimData.goldAmount;
uint256 _diamondAmount = _claimData.diamondAmount;
bytes32[] memory _merkleProof = _claimData.merkleProof;
bytes32 _leaf = keccak256(
abi.encodePacked(
msg.sender,
_claimRecordIndex,
_silverAmount,
_goldAmount,
_diamondAmount,
_userExpireDate
)
);
require(
MerkleProof.verify(_merkleProof, claimDefinitions[_claimRecordIndex].merkleRootHash, _leaf),
"MallCard: invalid claim data or no allocation"
);
_claimedSilverAmount += _silverAmount;
_claimedGoldAmount += _goldAmount;
_claimedDiamondAmount += _diamondAmount;
}
_claimedSilverAmount = _minSupply(SILVER, _claimedSilverAmount);
_claimedGoldAmount = _minSupply(GOLD, _claimedGoldAmount);
_claimedDiamondAmount = _minSupply(DIAMOND, _claimedDiamondAmount);
uint256 _totalClaim = _claimedSilverAmount + _claimedGoldAmount + _claimedDiamondAmount;
require(
_totalClaim > 0,
"Sorry, no valid claim allocation was found for your wallet address. The expiration date may have passed or you may have already claimed all your tokens."
);
uint256[] memory _amounts = new uint256[](TOKEN_LEN);
uint256[] memory _ids = new uint256[](TOKEN_LEN);
_amounts[0] = _claimedSilverAmount;
_amounts[1] = _claimedGoldAmount;
_amounts[2] = _claimedDiamondAmount;
TokenAmount[] memory _claimed = new TokenAmount[](TOKEN_LEN);
for (uint256 i = 0; i < TOKEN_LEN; i++) {
require(tokens[i].maxSupply == 0 || _amounts[i] <= _remainingToken(i), "MallCard: exceeds max supply");
_ids[i] = i;
_claimed[i] = TokenAmount({token: i, amount: _amounts[i]});
tokens[i].totalClaim = tokens[i].totalClaim + _amounts[i];
}
_mintBatch(msg.sender, _ids, _amounts, "");
emit Claim(msg.sender, _claimed);
}
function getClaimRecordCount() public view returns (uint256) {
return claimDefinitions.length;
}
function getTokenInfo(
uint256 _id
)
public
view
returns (
uint256 maxSupply,
uint256 totalClaim,
uint256 totalSale,
uint256[] memory tierSales,
uint256[] memory limits,
uint256[] memory prices
)
{
maxSupply = tokens[_id].maxSupply;
totalClaim = tokens[_id].totalClaim;
totalSale = tokens[_id].totalSale;
tierSales = new uint256[](tokens[_id].limits.length);
limits = new uint256[](tokens[_id].limits.length);
prices = new uint256[](tokens[_id].limits.length);
for (uint256 i = 0; i < limits.length; i++) {
tierSales[i] = tokens[_id].tierSales[i];
limits[i] = tokens[_id].limits[i];
prices[i] = tokens[_id].prices[i];
}
}
function getTokenSummary(address _referral) public view returns (TokenSummary[] memory total) {
total = new TokenSummary[](TOKEN_LEN);
for (uint256 i = 0; i < TOKEN_LEN; i++) {
(uint256 _price, uint256 _discount, uint256 _tier) = getCurrentPrice(i, _referral);
(
uint256 _maxSupply,
uint256 _totalClaim,
uint256 _totalSale,
uint256[] memory _tierSales,
uint256[] memory _limits,
uint256[] memory _prices
) = getTokenInfo(i);
TokenSummary memory _s = TokenSummary({
token: i,
currentPrice: _price,
discount: _discount,
currentTier: _tier,
maxSupply: _maxSupply,
totalClaim: _totalClaim,
totalSale: _totalSale,
tierSales: _tierSales,
limits: _limits,
prices: _prices
});
total[i] = _s;
}
}
function getBalanceInfo(address _address) public view returns (TokenAmount[] memory amounts) {
amounts = new TokenAmount[](TOKEN_LEN);
for (uint256 i = 0; i < TOKEN_LEN; i++) {
amounts[i] = TokenAmount({token: i, amount: balanceOf(_address, i)});
}
}
function uri(uint256 _id) public view virtual override returns (string memory) {
return tokenURIs[_id];
}
function reflinkUsageCount() external view returns (uint256) {
return reflinkRecords.length;
}
function userReflinkRecords(address _referral) external view returns (uint256[] memory) {
return reflinkSourceRecords[_referral];
}
function userReflinkCount(address _referral) external view returns (uint256) {
return reflinkSourceRecords[_referral].length;
}
function getCurrentPrice(
uint256 _id,
address _referral
) public view returns (uint256 price, uint256 discount, uint256 tier) {
tier = _currentTier(_id);
price = tokens[_id].prices[tier];
if (_referral != address(0) && tier == (tokens[_id].limits.length - 1)) {
discount = _getReflinkDiscount(_referral, price);
}
}
function _minSupply(uint256 _id, uint256 _requested) private view returns (uint256 _min) {
if (_requested > 0) {
uint256 _max = tokens[_id].maxSupply > 0 ? _remainingToken(_id) : _requested;
_min = _requested < _max ? _requested : _max;
}
}
function _remainingToken(uint256 _id) private view returns (uint256 _remaining) {
if (tokens[_id].maxSupply > 0 && tokens[_id].maxSupply > (tokens[_id].totalClaim + tokens[_id].totalSale)) {
_remaining = tokens[_id].maxSupply - tokens[_id].totalClaim - tokens[_id].totalSale;
}
}
function _hasTokenSupply(uint256 _id, uint256 _tier) private view returns (bool) {
require(
tokens[_id].maxSupply == 0 || _remainingToken(_id) > 0,
"Sorry, insufficient NFT supply, your transaction cannot be completed"
);
require(
tokens[_id].limits[_tier] == 0 || tokens[_id].limits[_tier] > (tokens[_id].tierSales[_tier]),
"Sorry, insufficient NFT supply, your transaction cannot be completed"
);
return true;
}
function _getReflinkDiscount(address _from, uint256 _price) private view returns (uint256) {
require(_from != msg.sender, "You cannot refer yourself, the transaction has been rejected");
uint256 _discountRate = 0;
if (useTicketBasedDiscountRates) {
for (uint256 r = TOKEN_LEN; r > 0; r--) {
uint256 _balance = balanceOf(_from, r - 1);
if (_balance > 0) {
_discountRate = discountRates[r - 1];
break;
}
}
} else {
_discountRate = discountRate;
}
return (_price * _discountRate) / _feeDenominator();
}
function _currentTier(uint256 _id) private view returns (uint256 _tier) {
_tier = tokens[_id].limits.length - 1;
for (uint256 i = 0; i < tokens[_id].limits.length; i++) {
if (tokens[_id].limits[i] == 0 || tokens[_id].tierSales[i] < tokens[_id].limits[i]) {
_tier = i;
break;
}
}
}
function _beforeTokenTransfer(
address,
address from,
address,
uint256[] memory ids,
uint256[] memory,
bytes memory
) internal virtual override(ERC1155) {
if (from != address(0)) {
require(transferOpenDate > 0, "MallCard: ticket transfer not open!");
require(transferOpenDate < block.timestamp, "MallCard: ticket transfer not open!");
for (uint256 i = 0; i < ids.length; i++) {
require(ids[i] != SILVER, "MallCard: transfer not allowed for SILVER ticket!");
}
}
}
function setOperatorFiltering(bool enabled) public onlyOwner {
_operatorFiltering = enabled;
}
function registerOperatorFilter(
address registry,
address subscriptionOrRegistrantToCopy,
bool subscribe
) public onlyOwner {
_registerOperatorFilter(registry, subscriptionOrRegistrantToCopy, subscribe);
}
function unregisterOperatorFilter(address registry) public onlyOwner {
_unregisterOperatorFilter(registry);
}
function setApprovalForAll(
address operator,
bool approved
) public override(ERC1155) onlyAllowedOperatorApproval(operator) {
ERC1155.setApprovalForAll(operator, approved);
}
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) public override(ERC1155) onlyAllowedOperator(from) {
ERC1155.safeTransferFrom(from, to, id, amount, data);
}
function safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) public override(ERC1155) onlyAllowedOperator(from) {
ERC1155.safeBatchTransferFrom(from, to, ids, amounts, data);
}
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC1155, ERC2981) returns (bool) {
return ERC1155.supportsInterface(interfaceId) || ERC2981.supportsInterface(interfaceId);
}
}
文件 16 的 19:MerkleProof.sol
pragma solidity ^0.8.0;
library MerkleProof {
function verify(
bytes32[] memory proof,
bytes32 root,
bytes32 leaf
) internal pure returns (bool) {
return processProof(proof, leaf) == root;
}
function verifyCalldata(
bytes32[] calldata proof,
bytes32 root,
bytes32 leaf
) internal pure returns (bool) {
return processProofCalldata(proof, leaf) == root;
}
function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = _hashPair(computedHash, proof[i]);
}
return computedHash;
}
function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = _hashPair(computedHash, proof[i]);
}
return computedHash;
}
function multiProofVerify(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProof(proof, proofFlags, leaves) == root;
}
function multiProofVerifyCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProofCalldata(proof, proofFlags, leaves) == root;
}
function processMultiProof(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32[] memory leaves
) internal pure returns (bytes32 merkleRoot) {
uint256 leavesLen = leaves.length;
uint256 totalHashes = proofFlags.length;
require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof");
bytes32[] memory hashes = new bytes32[](totalHashes);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
for (uint256 i = 0; i < totalHashes; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];
hashes[i] = _hashPair(a, b);
}
if (totalHashes > 0) {
return hashes[totalHashes - 1];
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
function processMultiProofCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32[] memory leaves
) internal pure returns (bytes32 merkleRoot) {
uint256 leavesLen = leaves.length;
uint256 totalHashes = proofFlags.length;
require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof");
bytes32[] memory hashes = new bytes32[](totalHashes);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
for (uint256 i = 0; i < totalHashes; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];
hashes[i] = _hashPair(a, b);
}
if (totalHashes > 0) {
return hashes[totalHashes - 1];
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {
return a < b ? _efficientHash(a, b) : _efficientHash(b, a);
}
function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
assembly {
mstore(0x00, a)
mstore(0x20, b)
value := keccak256(0x00, 0x40)
}
}
}
文件 17 的 19:OperatorFilterer.sol
pragma solidity ^0.8.12;
import {IOperatorFilterRegistry} from "./IOperatorFilterRegistry.sol";
import "../v1/util/ArrayFind.sol";
import "../v1/util/Types.sol";
abstract contract OperatorFilterer {
error OperatorNotAllowed(address operator);
using ArrayFind for address;
OperatorRegistry[] public _operatorRegistries;
bool _operatorFiltering = true;
function _registerOperatorFilter(
address registry,
address subscriptionOrRegistrantToCopy,
bool subscribe
) internal virtual {
if (registry.code.length == 0) return;
IOperatorFilterRegistry filterRegistry = IOperatorFilterRegistry(
registry
);
if (subscribe) {
filterRegistry.registerAndSubscribe(
address(this),
subscriptionOrRegistrantToCopy
);
} else {
if (subscriptionOrRegistrantToCopy != address(0)) {
filterRegistry.registerAndCopyEntries(
address(this),
subscriptionOrRegistrantToCopy
);
} else {
filterRegistry.register(address(this));
}
}
_operatorRegistries.push(
OperatorRegistry(
registry,
subscribe ? subscriptionOrRegistrantToCopy : address(0)
)
);
}
function _unregisterOperatorFilter(address registry) internal virtual {
IOperatorFilterRegistry(registry).unregister(address(this));
uint256 ind;
uint256 len = _operatorRegistries.length;
for (uint i = 0; i < len; i++) {
if (_operatorRegistries[i].registry == registry) {
ind = i + 1;
break;
}
}
if (ind == 0) return;
if (ind < len)
_operatorRegistries[ind - 1] = _operatorRegistries[len - 1];
_operatorRegistries.pop();
}
modifier onlyAllowedOperator(address from) virtual {
if (from != msg.sender) {
_checkFilterOperator(msg.sender);
}
_;
}
modifier onlyAllowedOperatorApproval(address operator) virtual {
_checkFilterOperator(operator);
_;
}
function _checkFilterOperator(address operator) internal view virtual {
if (!_operatorFiltering) return;
bool ok = false;
for (uint i = 0; i < _operatorRegistries.length; i++) {
address registry = _operatorRegistries[i].registry;
ok = IOperatorFilterRegistry(registry).isOperatorAllowed(
address(this),
operator
);
if (ok) break;
}
if (!ok) {
revert OperatorNotAllowed(operator);
}
}
}
struct OperatorRegistry {
address registry;
address subscription;
}
文件 18 的 19:Ownable.sol
pragma solidity ^0.8.0;
import "../utils/Context.sol";
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
modifier onlyOwner() {
_checkOwner();
_;
}
function owner() public view virtual returns (address) {
return _owner;
}
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
文件 19 的 19:Types.sol
pragma solidity ^0.8.12;
uint256 constant IndexNotFound = 2 ^ (256 - 1);
{
"compilationTarget": {
"contracts/MallCard.sol": "MallCard"
},
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": []
}
[{"inputs":[{"internalType":"address","name":"_tokenContract","type":"address"},{"internalType":"address","name":"_royaltyWaletContract","type":"address"},{"internalType":"address","name":"_mintIncomeWalletContract","type":"address"},{"internalType":"uint256","name":"_publicSaleStart","type":"uint256"},{"internalType":"uint96","name":"_royalty","type":"uint96"},{"internalType":"uint256","name":"_discountRate","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"OperatorNotAllowed","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"components":[{"internalType":"uint256","name":"token","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"indexed":false,"internalType":"struct MallCard.TokenAmount[]","name":"claimed","type":"tuple[]"}],"name":"Claim","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"bytes32","name":"merkleRootHash","type":"bytes32"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"bool","name":"revoked","type":"bool"}],"indexed":false,"internalType":"struct MallCard.ClaimDefinition","name":"claims","type":"tuple"}],"name":"CreateClaim","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"index","type":"uint256"}],"name":"RevokeClaim","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"discountRate","type":"uint256"}],"name":"SetDiscountRate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"silver","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"gold","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"diamond","type":"uint256"}],"name":"SetMaxSupplies","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"mintIncomeWaletContract","type":"address"}],"name":"SetMintIncomeWalletContract","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256[][]","name":"prices","type":"uint256[][]"},{"indexed":false,"internalType":"uint256[][]","name":"limits","type":"uint256[][]"}],"name":"SetPrices","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"transferOpenDate","type":"uint256"}],"name":"SetPublicSaleStart","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint96","name":"feeNumerator","type":"uint96"}],"name":"SetRoyaltyInfo","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"tokenContract","type":"address"}],"name":"SetTokenContract","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"publicSaleStart","type":"uint256"}],"name":"SetTransferOpenDate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"string","name":"uri","type":"string"}],"name":"SetURI","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"token","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"discount","type":"uint256"},{"indexed":false,"internalType":"address","name":"reflinkOwner","type":"address"},{"indexed":false,"internalType":"string","name":"refCode","type":"string"}],"name":"TokenMint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"values","type":"uint256[]"}],"name":"TransferBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"TransferSingle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"value","type":"string"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"URI","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"UnPause","type":"event"},{"inputs":[],"name":"DIAMOND","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GOLD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SILVER","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"_operatorRegistries","outputs":[{"internalType":"address","name":"registry","type":"address"},{"internalType":"address","name":"subscription","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"balanceOfBatch","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"claimRecordIndex","type":"uint256"},{"internalType":"uint256","name":"silverAmount","type":"uint256"},{"internalType":"uint256","name":"goldAmount","type":"uint256"},{"internalType":"uint256","name":"diamondAmount","type":"uint256"},{"internalType":"uint256","name":"userExpireDate","type":"uint256"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"}],"internalType":"struct MallCard.ClaimData[]","name":"_claimDatas","type":"tuple[]"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"claimDefinitions","outputs":[{"internalType":"bytes32","name":"merkleRootHash","type":"bytes32"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"bool","name":"revoked","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"claimRecords","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_merkleRootHash","type":"bytes32"},{"internalType":"uint256","name":"_startTime","type":"uint256"},{"internalType":"uint256","name":"_endTime","type":"uint256"}],"name":"createClaim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"discountRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"discountRates","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"getBalanceInfo","outputs":[{"components":[{"internalType":"uint256","name":"token","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct MallCard.TokenAmount[]","name":"amounts","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getClaimRecordCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"address","name":"_referral","type":"address"}],"name":"getCurrentPrice","outputs":[{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"discount","type":"uint256"},{"internalType":"uint256","name":"tier","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"getTokenInfo","outputs":[{"internalType":"uint256","name":"maxSupply","type":"uint256"},{"internalType":"uint256","name":"totalClaim","type":"uint256"},{"internalType":"uint256","name":"totalSale","type":"uint256"},{"internalType":"uint256[]","name":"tierSales","type":"uint256[]"},{"internalType":"uint256[]","name":"limits","type":"uint256[]"},{"internalType":"uint256[]","name":"prices","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_referral","type":"address"}],"name":"getTokenSummary","outputs":[{"components":[{"internalType":"uint256","name":"token","type":"uint256"},{"internalType":"uint256","name":"currentPrice","type":"uint256"},{"internalType":"uint256","name":"discount","type":"uint256"},{"internalType":"uint256","name":"currentTier","type":"uint256"},{"internalType":"uint256","name":"maxSupply","type":"uint256"},{"internalType":"uint256","name":"totalClaim","type":"uint256"},{"internalType":"uint256","name":"totalSale","type":"uint256"},{"internalType":"uint256[]","name":"tierSales","type":"uint256[]"},{"internalType":"uint256[]","name":"limits","type":"uint256[]"},{"internalType":"uint256[]","name":"prices","type":"uint256[]"}],"internalType":"struct MallCard.TokenSummary[]","name":"total","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"mintIncomeWaletContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_referral","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"string","name":"_refCode","type":"string"}],"name":"mintWithReflink","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_ids","type":"uint256[]"}],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"publicSaleStart","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"reflinkRecords","outputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"token","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"discount","type":"uint256"},{"internalType":"string","name":"refCode","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"reflinkSourceRecords","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"reflinkUsageCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"registry","type":"address"},{"internalType":"address","name":"subscriptionOrRegistrantToCopy","type":"address"},{"internalType":"bool","name":"subscribe","type":"bool"}],"name":"registerOperatorFilter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"revokeClaim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeBatchTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","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":"uint256","name":"_discountRate","type":"uint256"}],"name":"setDiscountRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_silver","type":"uint256"},{"internalType":"uint256","name":"_gold","type":"uint256"},{"internalType":"uint256","name":"_diamond","type":"uint256"}],"name":"setMaxSupplies","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_mintIncomeWaletContract","type":"address"}],"name":"setMintIncomeWalletContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"enabled","type":"bool"}],"name":"setOperatorFiltering","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[][]","name":"_prices","type":"uint256[][]"},{"internalType":"uint256[][]","name":"_limits","type":"uint256[][]"}],"name":"setPrices","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_publicSaleStart","type":"uint256"}],"name":"setPublicSaleStart","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint96","name":"_feeNumerator","type":"uint96"}],"name":"setRoyaltyInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_discountRates","type":"uint256[]"},{"internalType":"bool","name":"_enabled","type":"bool"}],"name":"setTicketBasedDiscountRates","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenContract","type":"address"}],"name":"setTokenContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_transferOpenDate","type":"uint256"}],"name":"setTransferOpenDate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"string","name":"_uri","type":"string"}],"name":"setURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string[]","name":"_uris","type":"string[]"}],"name":"setURIs","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":[],"name":"tokenContract","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenURIs","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokens","outputs":[{"internalType":"uint256","name":"maxSupply","type":"uint256"},{"internalType":"uint256","name":"totalClaim","type":"uint256"},{"internalType":"uint256","name":"totalSale","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"transferOpenDate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_ids","type":"uint256[]"}],"name":"unPause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"registry","type":"address"}],"name":"unregisterOperatorFilter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"uri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"useTicketBasedDiscountRates","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_referral","type":"address"}],"name":"userReflinkCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_referral","type":"address"}],"name":"userReflinkRecords","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"}]