文件 1 的 17: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 的 17:Context.sol
pragma solidity ^0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
文件 3 的 17:ECDSA.sol
pragma solidity ^0.8.0;
import "../Strings.sol";
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV
}
function _throwError(RecoverError error) private pure {
if (error == RecoverError.NoError) {
return;
} else if (error == RecoverError.InvalidSignature) {
revert("ECDSA: invalid signature");
} else if (error == RecoverError.InvalidSignatureLength) {
revert("ECDSA: invalid signature length");
} else if (error == RecoverError.InvalidSignatureS) {
revert("ECDSA: invalid signature 's' value");
} else if (error == RecoverError.InvalidSignatureV) {
revert("ECDSA: invalid signature 'v' value");
}
}
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else if (signature.length == 64) {
bytes32 r;
bytes32 vs;
assembly {
r := mload(add(signature, 0x20))
vs := mload(add(signature, 0x40))
}
return tryRecover(hash, r, vs);
} else {
return (address(0), RecoverError.InvalidSignatureLength);
}
}
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
return recovered;
}
function tryRecover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address, RecoverError) {
bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
uint8 v = uint8((uint256(vs) >> 255) + 27);
return tryRecover(hash, v, r, s);
}
function recover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, r, vs);
_throwError(error);
return recovered;
}
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address, RecoverError) {
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS);
}
if (v != 27 && v != 28) {
return (address(0), RecoverError.InvalidSignatureV);
}
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature);
}
return (signer, RecoverError.NoError);
}
function recover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, v, r, s);
_throwError(error);
return recovered;
}
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
}
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
}
}
文件 4 的 17:ERC165.sol
pragma solidity ^0.8.0;
import "./IERC165.sol";
abstract contract ERC165 is IERC165 {
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
文件 5 的 17: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 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, IERC721Enumerable {
using Address for address;
using Strings for uint256;
struct TokenOwnership {
address addr;
uint64 startTimestamp;
bool burned;
}
struct AddressData {
uint64 balance;
uint64 numberMinted;
uint64 numberBurned;
}
uint128 internal _currentIndex;
uint128 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_;
}
function totalSupply() public view override returns (uint256) {
unchecked {
return _currentIndex - _burnCounter;
}
}
function tokenByIndex(uint256 index) public view override returns (uint256) {
uint256 numMintedSoFar = _currentIndex;
uint256 tokenIdsIdx;
unchecked {
for (uint256 i; i < numMintedSoFar; i++) {
TokenOwnership memory ownership = _ownerships[i];
if (!ownership.burned) {
if (tokenIdsIdx == index) {
return i;
}
tokenIdsIdx++;
}
}
}
revert TokenIndexOutOfBounds();
}
function tokenOfOwnerByIndex(address owner, uint256 index) public view override returns (uint256) {
if (index >= balanceOf(owner)) revert OwnerIndexOutOfBounds();
uint256 numMintedSoFar = _currentIndex;
uint256 tokenIdsIdx;
address currOwnershipAddr;
unchecked {
for (uint256 i; i < numMintedSoFar; i++) {
TokenOwnership memory ownership = _ownerships[i];
if (ownership.burned) {
continue;
}
if (ownership.addr != address(0)) {
currOwnershipAddr = ownership.addr;
}
if (currOwnershipAddr == owner) {
if (tokenIdsIdx == index) {
return i;
}
tokenIdsIdx++;
}
}
}
revert();
}
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
interfaceId == type(IERC721Enumerable).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 ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) {
uint256 curr = tokenId;
unchecked {
if (curr < _currentIndex) {
TokenOwnership memory ownership = _ownerships[curr];
if (!ownership.burned) {
if (ownership.addr != address(0)) {
return ownership;
}
while (true) {
curr--;
ownership = _ownerships[curr];
if (ownership.addr != address(0)) {
return ownership;
}
}
}
}
}
revert OwnerQueryForNonexistentToken();
}
function ownerOf(uint256 tokenId) public view override returns (address) {
return ownershipOf(tokenId).addr;
}
function name() public view virtual override returns (string memory) {
return _name;
}
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
string memory baseURI = _baseURI();
return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : '';
}
function _baseURI() internal view virtual returns (string memory) {
return '';
}
function approve(address to, uint256 tokenId) public 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 (!_checkOnERC721Received(from, to, tokenId, _data)) {
revert TransferToNonERC721ReceiverImplementer();
}
}
function _exists(uint256 tokenId) internal view returns (bool) {
return 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;
for (uint256 i; i < quantity; i++) {
emit Transfer(address(0), to, updatedIndex);
if (safe && !_checkOnERC721Received(address(0), to, updatedIndex, _data)) {
revert TransferToNonERC721ReceiverImplementer();
}
updatedIndex++;
}
_currentIndex = uint128(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 _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver(to).onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert TransferToNonERC721ReceiverImplementer();
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
}
文件 6 的 17:IERC165.sol
pragma solidity ^0.8.0;
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
文件 7 的 17: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;
}
文件 8 的 17: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);
}
文件 9 的 17:IERC721Metadata.sol
pragma solidity ^0.8.0;
import "../IERC721.sol";
interface IERC721Metadata is IERC721 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function tokenURI(uint256 tokenId) external view returns (string memory);
}
文件 10 的 17:IERC721Receiver.sol
pragma solidity ^0.8.0;
interface IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
文件 11 的 17:IMintverseWord.sol
pragma solidity ^0.8.4;
import "./IWord.sol";
interface IMintverseWord is IWord {
function verify(uint256 maxQuantity, bytes calldata SIGNATURE) external view returns(bool);
function mintGiveawayDictionary(address to, bool addon) external;
function mintGiveawayWord(address to, uint16 wordId, uint48 mintTimestamp) external;
function mintWhitelistWord(uint256 quantity, uint256 maxClaimNum, bool addon, bytes calldata SIGNATURE) external payable;
function mintPublicWord(bool addon) external payable;
function defineWord(uint256 tokenId, string calldata definer, uint8 partOfSpeech1, uint8 partOfSpeech2, string calldata relatedWord, string calldata description) external;
function settleExpiredWord(uint256 startTokenId, uint256 endTokenId) external;
function getTokenProperties(uint256 tokenId) external view returns(string memory definer, uint256 wordId, uint256 categoryId, uint256 partOfSpeechId1, uint256 partOfSpeechId2, string memory relatedWord, string memory description);
function getTokenExpirationTime(uint256 tokenId) external view returns(uint256 expirationTime);
function getTokenStatus(uint256 tokenId) external view returns(bool writtenOrNot);
function getTokenPropertiesByOwner(address owner) external view returns(TokenInfo[] memory tokenInfos);
function getTokenExpirationTimeByOwner(address owner) external view returns(uint256[] memory expirationTimes);
function getTokenStatusByOwner(address owner) external view returns(bool[] memory writtenOrNot);
function getAddonStatusByOwner(address owner) external view returns(bool addon);
function tokensOfOwner(address owner) external view returns(uint256[] memory);
function getTotalDictionary() external view returns (uint256 amount);
function setWLMintPhase(bool hasWLMintStarted, uint256 wlMintTimestamp) external;
function setPublicMintPhase(bool hasPublicMintStarted, uint256 publicMintTimestamp) external;
function setDictPrice(uint256 price) external;
function setExpirationTime(uint48 expirationPeriod) external;
function setRevealTimestamp(uint48 newRevealTimestamp) external;
function setCategoryByTokenId(uint256 tokenId, uint8 categoryId) external;
function setMaxRandomWordTokenAmt(uint256 amount) external;
function setMaxGiveawayWordTokenAmt(uint256 amount) external;
function setMaxDictAmt(uint256 amount) external;
function setHeadRandomWordId(uint16 index) external;
function setTailRandomWordId(uint16 index) external;
function setSettleHeadRandomWordId(uint16 index) external;
function setWordIdOffset(uint16 offsetAmount) external;
function setTokenWordIdByTokenId(uint256 tokenId, uint16 wordId) external;
function setTokenMintTimeByTokenId(uint256 tokenId, uint48 mintTimestamp) external;
function setTokenDefineStatusByTokenId(uint256 tokenId, bool definedOrNot) external;
function setBaseTokenURI(string calldata newBaseTokenURI) external;
function setLegalDocumentURI(string calldata newLegalDocumentURI) external;
function setSystemMechanismDocumentURI(string calldata newSystemMechanismDocumentURI) external;
function setAnimationCodeDocumentURI(string calldata newAnimationCodeDocumentURI) external;
function setVisualRebuildDocumentURI(string calldata newVisualRebuildDocumentURI) external;
function setERC721ATechinalDocumentURI(string calldata newERC721ATechinalDocumentURI) external;
function setWordIdMappingDocumnetURI(string calldata newWordIdMappingDocumnetURI) external;
function setPartOfSpeechIdMappingDocumentURI(string calldata newPartOfSpeechIdMappingDocumentURI) external;
function setCategoryIdMappingDocumentURI(string calldata newCategoryIdMappingDocumentURI) external;
function setMetadataMappingDocumentURI(string calldata newMetadataMappingDocumentURI) external;
function setTreasury(address treasury) external;
function withdrawAll() external payable;
event mintWordEvent(address owner, uint256 quantity, uint256 totalSupply);
event wordDefinedEvent(uint256 tokenId);
event moveWordToTheBack(uint256 oriWordId, uint256 newWordId);
}
文件 12 的 17:IWord.sol
pragma solidity ^0.8.4;
interface IWord {
struct TokenInfo {
string definerPart;
string relatedWordPart;
string descriptionPart;
uint16 wordPart;
uint8 categoryPart;
uint8 partOfSpeechPart1;
uint8 partOfSpeechPart2;
uint48 mintTime;
bool defined;
}
}
文件 13 的 17:MintverseWord.sol
pragma solidity ^0.8.4;
import './libraries/ERC721A.sol';
import "./interfaces/IWord.sol";
import "./interfaces/IMintverseWord.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
contract IMintverseWordStorage is IWord {
mapping(uint256 => TokenInfo) public tokenItem;
mapping(address => bool) public mintedByAddress;
mapping(address => bool) public purchaseDictionaryCheckByAddress;
mapping(address => uint256) public whitelistMintAmount;
bool public mintWhitelistEnable;
bool public mintPublicEnable;
uint256 public mintWhitelistTimestamp;
uint256 public mintPublicTimestamp;
uint48 public revealTimestamp;
uint16 public totalDictionary;
uint16 public totalWordGiveaway;
uint16 public totalWordWhitelist;
uint256 public MAX_MINTVERSE_RANDOM_WORD;
uint256 public MAX_MINTVERSE_GIVEAWAY_WORD;
uint256 public MAX_MINTVERSE_DICTIONARY;
uint256 public DICT_ADDON_PRICE;
uint48 public WORD_EXPIRATION_TIME;
uint16 public HEAD_RANDOM_WORDID;
uint16 public TAIL_RANDOM_WORDID;
uint16 public SETTLE_HEAD_TOKENID;
uint16 public DESIGNATED_WORDID_OFFSET;
address public treasury;
string public baseTokenURI;
string public legalDocumentURI;
string public systemMechanismDocumentURI;
string public animationCodeDocumentURI;
string public visualRebuildDocumentURI;
string public ERC721ATechinalDocumentURI;
string public wordIdMappingDocumnetURI;
string public partOfSpeechIdMappingDocumentURI;
string public categoryIdMappingDocumentURI;
string public metadataMappingDocumentURI;
}
contract MintverseWord is IMintverseWord, IMintverseWordStorage, Ownable, EIP712, ERC721A {
using SafeMath for uint16;
using SafeMath for uint48;
using SafeMath for uint256;
using Strings for uint256;
constructor()
EIP712("MintverseWord", "1.0.0")
ERC721A("MintverseWord", "MVW")
{
mintWhitelistEnable = true;
mintPublicEnable = true;
mintWhitelistTimestamp = 1651752000;
mintPublicTimestamp = 1652155200;
revealTimestamp = 1652068800;
MAX_MINTVERSE_RANDOM_WORD = 1900;
MAX_MINTVERSE_GIVEAWAY_WORD = 200;
MAX_MINTVERSE_DICTIONARY = 185;
DICT_ADDON_PRICE = 0.15 ether;
WORD_EXPIRATION_TIME = 42 hours;
TAIL_RANDOM_WORDID = 1900;
SETTLE_HEAD_TOKENID = TAIL_RANDOM_WORDID;
DESIGNATED_WORDID_OFFSET = uint16(TAIL_RANDOM_WORDID.mul(2));
treasury = 0xbA53C6831B496c8a40c02A3c2d1366DfC6503F4e;
baseTokenURI = "https://api.mintverse.world/word/metadata/";
legalDocumentURI = "";
systemMechanismDocumentURI = "";
animationCodeDocumentURI = "";
visualRebuildDocumentURI = "";
ERC721ATechinalDocumentURI = "";
wordIdMappingDocumnetURI = "";
partOfSpeechIdMappingDocumentURI = "";
categoryIdMappingDocumentURI = "";
metadataMappingDocumentURI = "";
}
modifier onlyTokenOwner(uint256 tokenId) {
require(ownershipOf(tokenId).addr == msg.sender, "Can't define - Not the word owner");
_;
}
modifier mintWhitelistActive() {
require(mintWhitelistEnable == true, "Can't mint - WL mint phase hasn't enable");
require(block.timestamp >= mintWhitelistTimestamp, "Can't mint - WL mint phase hasn't started");
_;
}
modifier mintPublicActive() {
require(mintPublicEnable == true, "Can't mint - Public mint phase hasn't enable");
require(block.timestamp >= mintPublicTimestamp, "Can't mint - Public mint phase hasn't started");
_;
}
modifier callerIsUser() {
require(tx.origin == msg.sender, "Invalid caller - Caller is a Contract");
_;
}
modifier wordNotExpired(uint256 tokenId){
require((block.timestamp > tokenItem[tokenId].mintTime) || tokenItem[tokenId].defined, "Invalid Block Time - Mint time shouldn't be larger than current time");
require((block.timestamp <= (tokenItem[tokenId].mintTime + WORD_EXPIRATION_TIME)) || tokenItem[tokenId].defined, "Invalid Block Time - This token is expired");
_;
}
function verify(
uint256 maxQuantity,
bytes calldata SIGNATURE
)
public
override
view
returns(bool)
{
address recoveredAddr = ECDSA.recover(_hashTypedDataV4(keccak256(abi.encode(keccak256("NFT(address addressForClaim,uint256 maxQuantity)"), _msgSender(), maxQuantity))), SIGNATURE);
return owner() == recoveredAddr;
}
function mintGiveawayDictionary(
address to,
bool addon
)
external
override
onlyOwner
{
_mintGiveawayDictionary(to, addon);
}
function mintGiveawayWord(
address to,
uint16 wordId,
uint48 mintTimestamp
)
external
override
onlyOwner
{
require(totalWordGiveaway.add(1) <= MAX_MINTVERSE_GIVEAWAY_WORD, "Exceed maximum word amount");
totalWordGiveaway = uint16(totalWordGiveaway.add(1));
_mintDesignatedWord(to, wordId, mintTimestamp);
emit mintWordEvent(to, 1, totalSupply());
}
function mintWhitelistWord(
uint256 quantity,
uint256 maxClaimNum,
bool addon,
bytes calldata SIGNATURE
)
external
payable
override
mintWhitelistActive
callerIsUser
{
require(verify(maxClaimNum, SIGNATURE), "Can't claim - Not eligible");
require(_getRandomWordMintCnt().add(quantity) <= MAX_MINTVERSE_RANDOM_WORD, "Exceed maximum word amount");
require(quantity > 0 && whitelistMintAmount[msg.sender].add(quantity) <= maxClaimNum, "Exceed maximum mintable whitelist amount");
mintedByAddress[msg.sender] = true;
whitelistMintAmount[msg.sender] = whitelistMintAmount[msg.sender].add(quantity);
totalWordWhitelist = uint16(totalWordWhitelist.add(quantity));
_mintPublicDictionary(msg.sender, addon);
for(uint16 index=0; index < quantity; index++) {
_mintRandomWord(msg.sender);
}
emit mintWordEvent(msg.sender, quantity, totalSupply());
}
function mintPublicWord(
bool addon
)
external
payable
override
mintPublicActive
callerIsUser
{
require(mintedByAddress[msg.sender]==false, "Already minted you naughty, leave some word for others");
require(_getRandomWordMintCnt().add(1) <= MAX_MINTVERSE_RANDOM_WORD, "Exceed maximum word amount");
mintedByAddress[msg.sender] = true;
_mintPublicDictionary(msg.sender, addon);
_mintRandomWord(msg.sender);
emit mintWordEvent(msg.sender, 1, totalSupply());
}
function _getRandomWordMintCnt()
private
view
returns(uint16 randomWordMintCnt)
{
return uint16(totalSupply().sub(totalWordGiveaway));
}
function _getCurWordTimestamp()
private
view
returns(uint48 curWordTimestamp)
{
if(block.timestamp <= revealTimestamp) return revealTimestamp;
else return uint48(block.timestamp);
}
function _getCurWordId()
private
view
returns(uint16 curWordId)
{
if(_getRandomWordMintCnt() < TAIL_RANDOM_WORDID) return HEAD_RANDOM_WORDID % TAIL_RANDOM_WORDID;
else return uint16(_getRandomWordMintCnt());
}
function _setHeadWordId()
private
{
HEAD_RANDOM_WORDID = uint16(uint256(keccak256(abi.encodePacked(block.timestamp, msg.sender)))) % TAIL_RANDOM_WORDID;
}
function _mintRandomWord(address to)
private
{
if((totalSupply() - totalWordGiveaway) == 0) _setHeadWordId();
HEAD_RANDOM_WORDID = uint16(HEAD_RANDOM_WORDID.add(1));
_mintWord(to, _getCurWordId(), _getCurWordTimestamp());
}
function _mintDesignatedWord(
address to,
uint16 designatedWordId,
uint48 mintTimestamp
)
private
{
require(designatedWordId >= DESIGNATED_WORDID_OFFSET, "Invalid wordId - This Id belongs to random Id");
_mintWord(to, designatedWordId, mintTimestamp);
}
function _mintWord(
address to,
uint16 wordId,
uint48 mintTimestamp
)
private
{
string memory nullString;
_safeMint(to, 1);
tokenItem[totalSupply().sub(1)] = TokenInfo(nullString, nullString, nullString, wordId, 1, 1, 1, mintTimestamp, false);
}
function _mintPublicDictionary(
address to,
bool addon
)
private
{
_mintDictionary(to, addon, false);
}
function _mintGiveawayDictionary(
address to,
bool addon
)
private
{
_mintDictionary(to, addon, true);
}
function _mintDictionary(
address to,
bool addon,
bool giveaway
)
private
{
require(totalDictionary.add(1) <= MAX_MINTVERSE_DICTIONARY, "Exceed maximum dictionary amount");
if((addon == true) && !(purchaseDictionaryCheckByAddress[to])) {
if(giveaway == false) require(msg.value == DICT_ADDON_PRICE, "Not the right amount of ether");
totalDictionary = uint16(totalDictionary.add(1));
purchaseDictionaryCheckByAddress[to] = addon;
}
}
function defineWord(
uint256 tokenId,
string calldata definer,
uint8 partOfSpeech1,
uint8 partOfSpeech2,
string calldata relatedWord,
string calldata description
)
external
override
onlyTokenOwner(tokenId)
wordNotExpired(tokenId)
{
tokenItem[tokenId].definerPart = definer;
tokenItem[tokenId].relatedWordPart = relatedWord;
tokenItem[tokenId].descriptionPart = description;
tokenItem[tokenId].partOfSpeechPart1 = partOfSpeech1;
tokenItem[tokenId].partOfSpeechPart2 = partOfSpeech2;
tokenItem[tokenId].defined = true;
if (tokenItem[tokenId].categoryPart == 2) tokenItem[tokenId].categoryPart = 1;
emit wordDefinedEvent(tokenId);
}
function getTokenProperties(uint256 tokenId)
public
view
override
returns (
string memory definer,
uint256 wordId,
uint256 categoryId,
uint256 partOfSpeechId1,
uint256 partOfSpeechId2,
string memory relatedWord,
string memory description
)
{
return (
tokenItem[tokenId].definerPart,
tokenItem[tokenId].wordPart,
tokenItem[tokenId].categoryPart,
tokenItem[tokenId].partOfSpeechPart1,
tokenItem[tokenId].partOfSpeechPart2,
tokenItem[tokenId].relatedWordPart,
tokenItem[tokenId].descriptionPart
);
}
function getTokenExpirationTime(uint256 tokenId)
public
view
override
returns(uint256 expirationTime)
{
return tokenItem[tokenId].mintTime.add(WORD_EXPIRATION_TIME);
}
function getTokenStatus(uint256 tokenId)
public
view
override
returns(bool writtenOrNot)
{
return tokenItem[tokenId].defined;
}
function getTokenPropertiesByOwner(address owner)
public
view
override
returns (TokenInfo[] memory tokenInfos)
{
uint256 tokenCount = balanceOf(owner);
if (tokenCount == 0) {
return new TokenInfo[](0);
} else {
TokenInfo[] memory result = new TokenInfo[](tokenCount);
for (uint256 index = 0; index < tokenCount; index++) {
uint256 tokenId = tokenOfOwnerByIndex(owner, index);
result[index] = tokenItem[tokenId];
}
return result;
}
}
function getTokenExpirationTimeByOwner(address owner)
public
view
override
returns (uint256[] memory expirationTimes)
{
uint256 tokenCount = balanceOf(owner);
if (tokenCount == 0) {
return new uint256[](0);
} else {
uint256[] memory result = new uint256[](tokenCount);
for (uint256 index = 0; index < tokenCount; index++) {
uint256 tokenId = tokenOfOwnerByIndex(owner, index);
result[index] = tokenItem[tokenId].mintTime.add(WORD_EXPIRATION_TIME);
}
return result;
}
}
function getTokenStatusByOwner(address owner)
public
view
override
returns (bool[] memory writtenOrNot)
{
uint256 tokenCount = balanceOf(owner);
if (tokenCount == 0) {
return new bool[](0);
} else {
bool[] memory result = new bool[](tokenCount);
for (uint256 index = 0; index < tokenCount; index++) {
uint256 tokenId = tokenOfOwnerByIndex(owner, index);
result[index] = tokenItem[tokenId].defined;
}
return result;
}
}
function getAddonStatusByOwner(address owner)
public
view
override
returns (bool addon)
{
return purchaseDictionaryCheckByAddress[owner];
}
function tokenURI(uint256 tokenId)
public
view
override
returns (string memory curTokenURI)
{
require(_exists(tokenId), "Token doesn't exist");
return string(abi.encodePacked(baseTokenURI, tokenId.toString()));
}
function tokensOfOwner(address owner)
external
view
override
returns(uint256[] memory)
{
uint256 tokenCount = balanceOf(owner);
if (tokenCount == 0) {
return new uint256[](0);
} else {
uint256[] memory result = new uint256[](tokenCount);
for (uint256 index = 0; index < tokenCount; index++) {
result[index] = tokenOfOwnerByIndex(owner, index);
}
return result;
}
}
function getTotalDictionary()
public
view
override
returns (uint256 amount)
{
return uint256(totalDictionary);
}
function settleExpiredWord(
uint256 startTokenId,
uint256 endTokenId
)
override
external
onlyOwner
{
for(uint256 index = startTokenId; index <= endTokenId; index++) {
if(!(tokenItem[index].defined) && (block.timestamp > (tokenItem[index].mintTime + WORD_EXPIRATION_TIME))) {
emit moveWordToTheBack(SETTLE_HEAD_TOKENID, tokenItem[index].wordPart);
SETTLE_HEAD_TOKENID = uint16(SETTLE_HEAD_TOKENID.add(1));
MAX_MINTVERSE_RANDOM_WORD = MAX_MINTVERSE_RANDOM_WORD.add(1);
}
}
}
function setWLMintPhase(
bool _hasWLMintStarted,
uint256 _wlMintTimestamp
)
override
external
onlyOwner
{
mintWhitelistEnable = _hasWLMintStarted;
mintWhitelistTimestamp = _wlMintTimestamp;
}
function setPublicMintPhase(
bool _hasPublicMintStarted,
uint256 _publicMintTimestamp
)
override
external
onlyOwner
{
mintPublicEnable = _hasPublicMintStarted;
mintPublicTimestamp = _publicMintTimestamp;
}
function setDictPrice(uint256 price)
override
external
onlyOwner
{
DICT_ADDON_PRICE = price;
}
function setRevealTimestamp(uint48 newRevealTimestamp)
override
external
onlyOwner
{
revealTimestamp = newRevealTimestamp;
}
function setExpirationTime(uint48 newExpirationPeriod)
override
external
onlyOwner
{
WORD_EXPIRATION_TIME = newExpirationPeriod;
}
function setCategoryByTokenId(
uint256 tokenId,
uint8 categoryId
)
override
external
onlyOwner
{
tokenItem[tokenId].categoryPart = categoryId;
}
function setMaxRandomWordTokenAmt(uint256 amount)
override
external
onlyOwner
{
MAX_MINTVERSE_RANDOM_WORD = amount;
}
function setMaxGiveawayWordTokenAmt(uint256 amount)
override
external
onlyOwner
{
MAX_MINTVERSE_GIVEAWAY_WORD = amount;
}
function setMaxDictAmt(uint256 amount)
override
external
onlyOwner
{
MAX_MINTVERSE_DICTIONARY = amount;
}
function setHeadRandomWordId(uint16 index)
override
external
onlyOwner
{
HEAD_RANDOM_WORDID = index;
}
function setTailRandomWordId(uint16 index)
override
external
onlyOwner
{
TAIL_RANDOM_WORDID = index;
}
function setSettleHeadRandomWordId(uint16 index)
override
external
onlyOwner
{
SETTLE_HEAD_TOKENID = index;
}
function setWordIdOffset(uint16 offsetAmount)
override
external
onlyOwner
{
DESIGNATED_WORDID_OFFSET = offsetAmount;
}
function setTokenWordIdByTokenId(
uint256 tokenId,
uint16 wordId
)
override
external
onlyOwner
{
tokenItem[tokenId].wordPart = wordId;
}
function setTokenMintTimeByTokenId(
uint256 tokenId,
uint48 mintTimestamp
)
override
external
onlyOwner
{
tokenItem[tokenId].mintTime = mintTimestamp;
}
function setTokenDefineStatusByTokenId(
uint256 tokenId,
bool definedOrNot
)
override
external
onlyOwner
{
tokenItem[tokenId].defined = definedOrNot;
}
function setBaseTokenURI(string calldata newBaseTokenURI)
override
external
onlyOwner
{
baseTokenURI = newBaseTokenURI;
}
function setLegalDocumentURI(string calldata newLegalDocumentURI)
override
external
onlyOwner
{
legalDocumentURI = newLegalDocumentURI;
}
function setSystemMechanismDocumentURI(string calldata newSystemMechanismDocumentURI)
override
external
onlyOwner
{
systemMechanismDocumentURI = newSystemMechanismDocumentURI;
}
function setAnimationCodeDocumentURI(string calldata newAnimationCodeDocumentURI)
override
external
onlyOwner
{
animationCodeDocumentURI = newAnimationCodeDocumentURI;
}
function setVisualRebuildDocumentURI(string calldata newVisualRebuildDocumentURI)
override
external
onlyOwner
{
visualRebuildDocumentURI = newVisualRebuildDocumentURI;
}
function setERC721ATechinalDocumentURI(string calldata newERC721ATechinalDocumentURI)
override
external
onlyOwner
{
ERC721ATechinalDocumentURI = newERC721ATechinalDocumentURI;
}
function setWordIdMappingDocumnetURI(string calldata newWordIdMappingDocumnetURI)
override
external
onlyOwner
{
wordIdMappingDocumnetURI = newWordIdMappingDocumnetURI;
}
function setPartOfSpeechIdMappingDocumentURI(string calldata newPartOfSpeechIdMappingDocumentURI)
override
external
onlyOwner
{
partOfSpeechIdMappingDocumentURI = newPartOfSpeechIdMappingDocumentURI;
}
function setCategoryIdMappingDocumentURI(string calldata newCategoryIdMappingDocumentURI)
override
external
onlyOwner
{
categoryIdMappingDocumentURI = newCategoryIdMappingDocumentURI;
}
function setMetadataMappingDocumentURI(string calldata newMetadataMappingDocumentURI)
override
external
onlyOwner
{
metadataMappingDocumentURI = newMetadataMappingDocumentURI;
}
function setTreasury(address _treasury)
override
external
onlyOwner
{
require(_treasury != address(0), "Invalid address - Zero address");
treasury = _treasury;
}
function withdrawAll()
override
external
payable
onlyOwner
{
payable(treasury).transfer(address(this).balance);
}
}
文件 14 的 17: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);
}
}
文件 15 的 17:SafeMath.sol
pragma solidity ^0.8.0;
library SafeMath {
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
文件 16 的 17: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);
}
}
文件 17 的 17:draft-EIP712.sol
pragma solidity ^0.8.0;
import "./ECDSA.sol";
abstract contract EIP712 {
bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;
uint256 private immutable _CACHED_CHAIN_ID;
address private immutable _CACHED_THIS;
bytes32 private immutable _HASHED_NAME;
bytes32 private immutable _HASHED_VERSION;
bytes32 private immutable _TYPE_HASH;
constructor(string memory name, string memory version) {
bytes32 hashedName = keccak256(bytes(name));
bytes32 hashedVersion = keccak256(bytes(version));
bytes32 typeHash = keccak256(
"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
);
_HASHED_NAME = hashedName;
_HASHED_VERSION = hashedVersion;
_CACHED_CHAIN_ID = block.chainid;
_CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);
_CACHED_THIS = address(this);
_TYPE_HASH = typeHash;
}
function _domainSeparatorV4() internal view returns (bytes32) {
if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {
return _CACHED_DOMAIN_SEPARATOR;
} else {
return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);
}
}
function _buildDomainSeparator(
bytes32 typeHash,
bytes32 nameHash,
bytes32 versionHash
) private view returns (bytes32) {
return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));
}
function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);
}
}
{
"compilationTarget": {
"contracts/MintverseWord.sol": "MintverseWord"
},
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 100
},
"remappings": []
}
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"ApprovalToCurrentOwner","type":"error"},{"inputs":[],"name":"ApproveToCaller","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"OwnerIndexOutOfBounds","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"TokenIndexOutOfBounds","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"quantity","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalSupply","type":"uint256"}],"name":"mintWordEvent","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oriWordId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newWordId","type":"uint256"}],"name":"moveWordToTheBack","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"wordDefinedEvent","type":"event"},{"inputs":[],"name":"DESIGNATED_WORDID_OFFSET","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DICT_ADDON_PRICE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ERC721ATechinalDocumentURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"HEAD_RANDOM_WORDID","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_MINTVERSE_DICTIONARY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_MINTVERSE_GIVEAWAY_WORD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_MINTVERSE_RANDOM_WORD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SETTLE_HEAD_TOKENID","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TAIL_RANDOM_WORDID","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WORD_EXPIRATION_TIME","outputs":[{"internalType":"uint48","name":"","type":"uint48"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"animationCodeDocumentURI","outputs":[{"internalType":"string","name":"","type":"string"}],"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":[],"name":"baseTokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"categoryIdMappingDocumentURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"definer","type":"string"},{"internalType":"uint8","name":"partOfSpeech1","type":"uint8"},{"internalType":"uint8","name":"partOfSpeech2","type":"uint8"},{"internalType":"string","name":"relatedWord","type":"string"},{"internalType":"string","name":"description","type":"string"}],"name":"defineWord","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"getAddonStatusByOwner","outputs":[{"internalType":"bool","name":"addon","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getTokenExpirationTime","outputs":[{"internalType":"uint256","name":"expirationTime","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"getTokenExpirationTimeByOwner","outputs":[{"internalType":"uint256[]","name":"expirationTimes","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getTokenProperties","outputs":[{"internalType":"string","name":"definer","type":"string"},{"internalType":"uint256","name":"wordId","type":"uint256"},{"internalType":"uint256","name":"categoryId","type":"uint256"},{"internalType":"uint256","name":"partOfSpeechId1","type":"uint256"},{"internalType":"uint256","name":"partOfSpeechId2","type":"uint256"},{"internalType":"string","name":"relatedWord","type":"string"},{"internalType":"string","name":"description","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"getTokenPropertiesByOwner","outputs":[{"components":[{"internalType":"string","name":"definerPart","type":"string"},{"internalType":"string","name":"relatedWordPart","type":"string"},{"internalType":"string","name":"descriptionPart","type":"string"},{"internalType":"uint16","name":"wordPart","type":"uint16"},{"internalType":"uint8","name":"categoryPart","type":"uint8"},{"internalType":"uint8","name":"partOfSpeechPart1","type":"uint8"},{"internalType":"uint8","name":"partOfSpeechPart2","type":"uint8"},{"internalType":"uint48","name":"mintTime","type":"uint48"},{"internalType":"bool","name":"defined","type":"bool"}],"internalType":"struct IWord.TokenInfo[]","name":"tokenInfos","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getTokenStatus","outputs":[{"internalType":"bool","name":"writtenOrNot","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"getTokenStatusByOwner","outputs":[{"internalType":"bool[]","name":"writtenOrNot","type":"bool[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalDictionary","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"legalDocumentURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"metadataMappingDocumentURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"bool","name":"addon","type":"bool"}],"name":"mintGiveawayDictionary","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint16","name":"wordId","type":"uint16"},{"internalType":"uint48","name":"mintTimestamp","type":"uint48"}],"name":"mintGiveawayWord","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"mintPublicEnable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mintPublicTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"addon","type":"bool"}],"name":"mintPublicWord","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"mintWhitelistEnable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mintWhitelistTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"uint256","name":"maxClaimNum","type":"uint256"},{"internalType":"bool","name":"addon","type":"bool"},{"internalType":"bytes","name":"SIGNATURE","type":"bytes"}],"name":"mintWhitelistWord","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"mintedByAddress","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":"partOfSpeechIdMappingDocumentURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"purchaseDictionaryCheckByAddress","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"revealTimestamp","outputs":[{"internalType":"uint48","name":"","type":"uint48"}],"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":"string","name":"newAnimationCodeDocumentURI","type":"string"}],"name":"setAnimationCodeDocumentURI","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":"newBaseTokenURI","type":"string"}],"name":"setBaseTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint8","name":"categoryId","type":"uint8"}],"name":"setCategoryByTokenId","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newCategoryIdMappingDocumentURI","type":"string"}],"name":"setCategoryIdMappingDocumentURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"price","type":"uint256"}],"name":"setDictPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newERC721ATechinalDocumentURI","type":"string"}],"name":"setERC721ATechinalDocumentURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint48","name":"newExpirationPeriod","type":"uint48"}],"name":"setExpirationTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"index","type":"uint16"}],"name":"setHeadRandomWordId","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newLegalDocumentURI","type":"string"}],"name":"setLegalDocumentURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"setMaxDictAmt","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"setMaxGiveawayWordTokenAmt","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"setMaxRandomWordTokenAmt","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newMetadataMappingDocumentURI","type":"string"}],"name":"setMetadataMappingDocumentURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newPartOfSpeechIdMappingDocumentURI","type":"string"}],"name":"setPartOfSpeechIdMappingDocumentURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_hasPublicMintStarted","type":"bool"},{"internalType":"uint256","name":"_publicMintTimestamp","type":"uint256"}],"name":"setPublicMintPhase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint48","name":"newRevealTimestamp","type":"uint48"}],"name":"setRevealTimestamp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"index","type":"uint16"}],"name":"setSettleHeadRandomWordId","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newSystemMechanismDocumentURI","type":"string"}],"name":"setSystemMechanismDocumentURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"index","type":"uint16"}],"name":"setTailRandomWordId","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bool","name":"definedOrNot","type":"bool"}],"name":"setTokenDefineStatusByTokenId","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint48","name":"mintTimestamp","type":"uint48"}],"name":"setTokenMintTimeByTokenId","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint16","name":"wordId","type":"uint16"}],"name":"setTokenWordIdByTokenId","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_treasury","type":"address"}],"name":"setTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newVisualRebuildDocumentURI","type":"string"}],"name":"setVisualRebuildDocumentURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_hasWLMintStarted","type":"bool"},{"internalType":"uint256","name":"_wlMintTimestamp","type":"uint256"}],"name":"setWLMintPhase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newWordIdMappingDocumnetURI","type":"string"}],"name":"setWordIdMappingDocumnetURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"offsetAmount","type":"uint16"}],"name":"setWordIdOffset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"startTokenId","type":"uint256"},{"internalType":"uint256","name":"endTokenId","type":"uint256"}],"name":"settleExpiredWord","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":"systemMechanismDocumentURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenItem","outputs":[{"internalType":"string","name":"definerPart","type":"string"},{"internalType":"string","name":"relatedWordPart","type":"string"},{"internalType":"string","name":"descriptionPart","type":"string"},{"internalType":"uint16","name":"wordPart","type":"uint16"},{"internalType":"uint8","name":"categoryPart","type":"uint8"},{"internalType":"uint8","name":"partOfSpeechPart1","type":"uint8"},{"internalType":"uint8","name":"partOfSpeechPart2","type":"uint8"},{"internalType":"uint48","name":"mintTime","type":"uint48"},{"internalType":"bool","name":"defined","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"curTokenURI","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"tokensOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalDictionary","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalWordGiveaway","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalWordWhitelist","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"maxQuantity","type":"uint256"},{"internalType":"bytes","name":"SIGNATURE","type":"bytes"}],"name":"verify","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"visualRebuildDocumentURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelistMintAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawAll","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"wordIdMappingDocumnetURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}]