文件 1 的 18: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 的 18: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 的 18:ContextMixin.sol
pragma solidity 0.8.7;
abstract contract ContextMixin {
function msgSender()
internal
view
returns(address payable sender)
{
if (msg.sender == address(this)) {
bytes memory array = msg.data;
uint256 index = msg.data.length;
assembly {
sender := and(
mload(add(array, index)),
0xffffffffffffffffffffffffffffffffffffffff
)
}
} else {
sender = payable(msg.sender);
}
return sender;
}
}
文件 4 的 18: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 的 18:ERC721.sol
pragma solidity ^0.8.0;
import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
string private _name;
string private _symbol;
mapping(uint256 => address) private _owners;
mapping(address => uint256) private _balances;
mapping(uint256 => address) private _tokenApprovals;
mapping(address => mapping(address => bool)) private _operatorApprovals;
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _balances[owner];
}
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _owners[tokenId];
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
function name() public view virtual override returns (string memory) {
return _name;
}
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
}
function _baseURI() internal view virtual returns (string memory) {
return "";
}
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
function setApprovalForAll(address operator, bool approved) public virtual override {
_setApprovalForAll(_msgSender(), operator, approved);
}
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_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 {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_safeTransfer(from, to, tokenId, _data);
}
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);
}
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
_afterTokenTransfer(address(0), to, tokenId);
}
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
_afterTokenTransfer(owner, address(0), tokenId);
}
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
_approve(address(0), tokenId);
_balances[from] -= 1;
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
_afterTokenTransfer(from, to, tokenId);
}
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
function _setApprovalForAll(
address owner,
address operator,
bool approved
) internal virtual {
require(owner != operator, "ERC721: approve to caller");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver.onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: transfer to non ERC721Receiver implementer");
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
function _afterTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
}
文件 6 的 18:ERC721Enumerable.sol
pragma solidity ^0.8.0;
import "../ERC721.sol";
import "./IERC721Enumerable.sol";
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
mapping(address => mapping(uint256 => uint256)) private _ownedTokens;
mapping(uint256 => uint256) private _ownedTokensIndex;
uint256[] private _allTokens;
mapping(uint256 => uint256) private _allTokensIndex;
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {
return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);
}
function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
return _ownedTokens[owner][index];
}
function totalSupply() public view virtual override returns (uint256) {
return _allTokens.length;
}
function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds");
return _allTokens[index];
}
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual override {
super._beforeTokenTransfer(from, to, tokenId);
if (from == address(0)) {
_addTokenToAllTokensEnumeration(tokenId);
} else if (from != to) {
_removeTokenFromOwnerEnumeration(from, tokenId);
}
if (to == address(0)) {
_removeTokenFromAllTokensEnumeration(tokenId);
} else if (to != from) {
_addTokenToOwnerEnumeration(to, tokenId);
}
}
function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
uint256 length = ERC721.balanceOf(to);
_ownedTokens[to][length] = tokenId;
_ownedTokensIndex[tokenId] = length;
}
function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
_allTokensIndex[tokenId] = _allTokens.length;
_allTokens.push(tokenId);
}
function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
uint256 tokenIndex = _ownedTokensIndex[tokenId];
if (tokenIndex != lastTokenIndex) {
uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];
_ownedTokens[from][tokenIndex] = lastTokenId;
_ownedTokensIndex[lastTokenId] = tokenIndex;
}
delete _ownedTokensIndex[tokenId];
delete _ownedTokens[from][lastTokenIndex];
}
function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
uint256 lastTokenIndex = _allTokens.length - 1;
uint256 tokenIndex = _allTokensIndex[tokenId];
uint256 lastTokenId = _allTokens[lastTokenIndex];
_allTokens[tokenIndex] = lastTokenId;
_allTokensIndex[lastTokenId] = tokenIndex;
delete _allTokensIndex[tokenId];
_allTokens.pop();
}
}
文件 7 的 18:ERC721URIStorage.sol
pragma solidity ^0.8.0;
import "../ERC721.sol";
abstract contract ERC721URIStorage is ERC721 {
using Strings for uint256;
mapping(uint256 => string) private _tokenURIs;
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721URIStorage: URI query for nonexistent token");
string memory _tokenURI = _tokenURIs[tokenId];
string memory base = _baseURI();
if (bytes(base).length == 0) {
return _tokenURI;
}
if (bytes(_tokenURI).length > 0) {
return string(abi.encodePacked(base, _tokenURI));
}
return super.tokenURI(tokenId);
}
function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
require(_exists(tokenId), "ERC721URIStorage: URI set of nonexistent token");
_tokenURIs[tokenId] = _tokenURI;
}
function _burn(uint256 tokenId) internal virtual override {
super._burn(tokenId);
if (bytes(_tokenURIs[tokenId]).length != 0) {
delete _tokenURIs[tokenId];
}
}
}
文件 8 的 18:Hokago.sol
pragma solidity ^0.8.7;
import "./HokagoCore.sol";
contract Hokago is HokagoCore{
using Strings for uint256;
uint64 public preSalePrice;
uint64 public publicSalePrice;
uint64 public saleLimit;
uint64 public allowListCount;
bool public isPublicSale;
bool public isPreSale;
string public baseTokenURI;
mapping(address => uint256) private _allowList;
mapping(address => uint256) private _numberMinted;
constructor(uint64 _preSalePriceWei, uint64 _publicSalePriceWei, uint64 _saleLimit, string memory _baseTokenURI)
HokagoCore("Hokago", "HOKAGO")
{
preSalePrice = _preSalePriceWei;
publicSalePrice = _publicSalePriceWei;
saleLimit = _saleLimit;
baseTokenURI = _baseTokenURI;
}
function startPreSale()
public
virtual
onlyOwner
{
isPublicSale = false;
isPreSale = true;
}
function startPublicSale()
public
virtual
onlyOwner
{
isPublicSale = true;
isPreSale = false;
}
function pausePreSale()
public
virtual
onlyOwner
{
isPreSale = false;
}
function pausePublicSale()
public
virtual
onlyOwner
{
isPublicSale = false;
}
function updateSaleLimit(uint64 limit)
external
virtual
onlyOwner
{
saleLimit = limit;
}
function deleteAllowList(address addr)
public
virtual
onlyOwner
{
allowListCount = allowListCount - uint64(_allowList[addr]);
delete(_allowList[addr]);
}
function changeAllowList(address addr, uint256 maxMint)
public
virtual
onlyOwner
{
allowListCount = allowListCount - uint64(_allowList[addr]);
_allowList[addr] = maxMint;
allowListCount = allowListCount + uint64(maxMint);
}
function pushAllowListAddresses(address[] memory list)
public
virtual
onlyOwner
{
for (uint i = 0; i < list.length; i++) {
_allowList[list[i]]++;
allowListCount++;
}
}
function devMint(uint256[] memory list)
external
virtual
onlyOwner
{
for (uint256 i = 0; i<list.length; i++) {
_safeMint(_msgSender(), list[i]);
}
}
function preSaleMint(uint256 requestTokenID)
external
virtual
payable
callerIsUser
{
uint256 price = uint256(preSalePrice);
require(!_exists(requestTokenID), "Request token has already been minted");
require(requestTokenID != 0, "Can not mintable ID (=0)");
require(msg.value >= price, "Need to send more ETH");
require(isPreSale, "Presale has not begun yet");
require(_allowList[_msgSender()] > 0, "Not eligible for allowlist mint");
require(requestTokenID <= uint256(saleLimit), "Request character is not available yet");
_safeMint(_msgSender(), requestTokenID);
_allowList[_msgSender()]--;
_numberMinted[_msgSender()]++;
}
function publicSaleMint(uint256 requestTokenID)
external
virtual
payable
callerIsUser
{
uint256 price = uint256(publicSalePrice);
require(!_exists(requestTokenID), "Request token has already been minted");
require(requestTokenID != 0, "Can not mintable ID (=0)");
require(msg.value >= price, "Need to send more ETH");
require(isPublicSale, "Publicsale has not begun yet");
require(requestTokenID <= uint256(saleLimit), "Request character is not available yet");
require(_numberMinted[_msgSender()] < 50, "Reached mint limit (=50)");
_safeMint(_msgSender(), requestTokenID);
_numberMinted[_msgSender()]++;
}
function generateRandTokenID(uint256 characterNo, uint256 jsTimestamp)
public
view
returns (uint256)
{
uint256 randNumber;
uint256 counter = 0;
uint256 startNo = ((characterNo-1) * 400) + 1;
uint256 endNo = characterNo * 400;
uint256[] memory mintableIDs = new uint256[](400);
require(endNo <= uint256(saleLimit), "Request character is not available yet");
for(uint256 i=startNo; i<=endNo; i++) {
if(!_exists(i)) {
mintableIDs[counter] = i;
counter++;
}
}
if(counter == 0){
return 0;
}
else{
randNumber = uint256(keccak256(abi.encodePacked(block.timestamp, block.difficulty, jsTimestamp))) % counter;
return mintableIDs[randNumber];
}
}
function setBaseURI(string memory baseURI)
external
virtual
onlyOwner
{
baseTokenURI = baseURI;
}
function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
return string(abi.encodePacked(baseTokenURI, tokenId.toString(), '.json'));
}
function allowListCountOfOwner(address owner)
external
view
returns(uint256)
{
return _allowList[owner];
}
function mintedTokens()
external
view
onlyOwner
returns (uint256[] memory)
{
uint256 array_length = totalSupply();
uint256[] memory arrayMemory = new uint256[](array_length);
for(uint256 i=0; i<array_length; i++){
arrayMemory[i] = tokenByIndex(i);
}
return arrayMemory;
}
function mintableTokensByCharacter(uint256 characterNo)
public
view
onlyOwner
returns (uint256[] memory)
{
uint256 counter = 0;
uint256 startNo = ((characterNo-1) * 400) + 1;
uint256 endNo = characterNo * 400;
uint256[] memory mintableIDs = new uint256[](400);
for(uint256 i=startNo; i<=endNo; i++) {
if(!_exists(i)) {
mintableIDs[counter] = i;
counter++;
}
}
return mintableIDs;
}
function numberMintedOfOwner(address owner)
external
view
returns (uint256)
{
require(owner != address(0), "Number minted query for the zero address");
return _numberMinted[owner];
}
}
文件 9 的 18:HokagoCore.sol
pragma solidity ^0.8.7;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./ContextMixin.sol";
import "./Royalty.sol";
contract HokagoCore is
ERC721,
ERC721Enumerable,
ERC721URIStorage,
Ownable,
ContextMixin,
HasSecondarySaleFees,
ReentrancyGuard
{
constructor(string memory name_, string memory symbol_)
ERC721(name_, symbol_)
HasSecondarySaleFees(new address payable[](0), new uint256[](0))
{
address payable[] memory thisAddressInArray = new address payable[](1);
thisAddressInArray[0] = payable(address(this));
uint256[] memory royaltyWithTwoDecimals = new uint256[](1);
royaltyWithTwoDecimals[0] = 800;
_setCommonRoyalties(thisAddressInArray, royaltyWithTwoDecimals);
}
event levelUp(uint256 indexed tokenId, string indexed levelName, uint32 oldLevel, uint32 newLevel);
event changeCharacterSheet(address indexed changer, uint256 indexed characterNo, string indexed key, string oldValue, string newValue);
event addDiary(uint256 indexed tokenId, string diaryStr);
modifier callerIsUser() {
require(tx.origin == msg.sender, "The caller is another contract");
_;
}
function _msgSender()
internal
override
view
returns (address sender)
{
return ContextMixin.msgSender();
}
function withdrawETH()
external
onlyOwner
nonReentrant
{
(bool success, ) = msg.sender.call{value: address(this).balance}("");
require(success, "Transfer failed.");
}
function _beforeTokenTransfer(address from, address to, uint256 tokenId)
internal
override(ERC721, ERC721Enumerable)
{
super._beforeTokenTransfer(from, to, tokenId);
_transactionTimestamp[tokenId] = block.timestamp;
if(from == address(0)){
_setRandLevels(tokenId);
}
else if (tx.origin != msg.sender) {
_communicationLevelUp(tokenId);
}
}
function isApprovedForAll(address _owner, address _operator)
public
override
view
returns(bool isOperator)
{
return ERC721.isApprovedForAll(_owner, _operator);
}
function safeTransferFrom(
address from,
address to,
uint256 tokenId
)
public
virtual
override(ERC721)
{
super.safeTransferFrom(from, to, tokenId);
}
function _burn(uint256 tokenId)
internal
onlyOwner
override(ERC721, ERC721URIStorage)
{
super._burn(tokenId);
}
function _setTokenURI(uint256 tokenId, string memory itemName)
internal
virtual
override(ERC721URIStorage)
{
super._setTokenURI(tokenId, itemName);
}
function tokenURI(uint256 tokenId)
public
view
virtual
override(ERC721, ERC721URIStorage)
returns (string memory)
{
return super.tokenURI(tokenId);
}
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC721, ERC721Enumerable, HasSecondarySaleFees)
returns (bool)
{
return ERC721.supportsInterface(interfaceId) ||
HasSecondarySaleFees.supportsInterface(interfaceId);
}
struct level{
uint32 Creativity;
uint32 Intelligence;
uint32 Energy;
uint32 Luck;
uint32 CommunicationSkills;
}
mapping(uint256 => level) private _characterLevels;
mapping(uint256 => string[]) private _ownerDiaries;
mapping(uint256 => uint256) private _transactionTimestamp;
mapping(uint256 => mapping(string => string)) private _characterSheet;
bool public isLevelUp = false;
address public fanFictionContract;
function viewCharacterLevels(uint256 tokenId)
public
view
returns (uint32[] memory)
{
uint32[] memory arrayMemory = new uint32[](5);
arrayMemory[0] = _characterLevels[tokenId].Creativity;
arrayMemory[1] = _characterLevels[tokenId].Intelligence;
arrayMemory[2] = _characterLevels[tokenId].Energy;
arrayMemory[3] = _characterLevels[tokenId].Luck;
arrayMemory[4] = _characterLevels[tokenId].CommunicationSkills;
return arrayMemory;
}
function viewLevelsByCharacter(uint256 characterNo)
public
view
returns (uint32[] memory)
{
uint256 length = 2000;
uint32[] memory arrayMemory = new uint32[](length);
uint256 delta = (characterNo-1) * 400;
for(uint256 i=1; i<=400; i++){
uint256 baseNo = (i-1) * 5;
arrayMemory[baseNo+0] = _characterLevels[i+delta].Creativity;
arrayMemory[baseNo+1] = _characterLevels[i+delta].Intelligence;
arrayMemory[baseNo+2] = _characterLevels[i+delta].Energy;
arrayMemory[baseNo+3] = _characterLevels[i+delta].Luck;
arrayMemory[baseNo+4] = _characterLevels[i+delta].CommunicationSkills;
}
return arrayMemory;
}
function generateRandLevels(uint256 tokenId)
public
view
returns(uint256[] memory)
{
uint256[] memory arrayMemory = new uint256[](5);
for(uint256 i=0; i<5; i++){
arrayMemory[i] = uint256(keccak256(abi.encodePacked(address(this), i, tokenId))) % 4;
}
return arrayMemory;
}
function _setRandLevels(uint256 tokenId) private
{
uint256[] memory arrayMemory = new uint256[](5);
arrayMemory = generateRandLevels(tokenId);
_characterLevels[tokenId].Creativity = uint32(arrayMemory[0]);
_characterLevels[tokenId].Intelligence = uint32(arrayMemory[1]);
_characterLevels[tokenId].Energy = uint32(arrayMemory[2]);
_characterLevels[tokenId].Luck = uint32(arrayMemory[3]);
_characterLevels[tokenId].CommunicationSkills = uint32(arrayMemory[4]);
}
function viewDiary(uint256 tokenId)
external
view
returns (string[] memory)
{
return _ownerDiaries[tokenId];
}
function setDiary(uint256 tokenId, string memory diaryStr) external {
require(_msgSender() == ownerOf(tokenId), "you don't own this token");
_ownerDiaries[tokenId].push(diaryStr);
emit addDiary(tokenId, diaryStr);
}
function deleteDiary(uint256 tokenId, uint256 arrayNo)
external
onlyOwner
{
_ownerDiaries[tokenId][arrayNo] = "";
}
function startLevelUp()
external
onlyOwner
{
isLevelUp = true;
}
function stopLevelUp()
external
onlyOwner
{
isLevelUp = false;
}
function setFanFictionContractAddress(address contractAddress)
external
onlyOwner
{
fanFictionContract = contractAddress;
}
function devLevelUp(uint256[] memory tokenIds, uint256 abilityNo, uint32 levelUpSize)
external
onlyOwner
{
for (uint256 i=0; i<tokenIds.length; i++) {
uint256 tokenId = tokenIds[i];
if(abilityNo == 1){
_characterLevels[tokenId].Creativity += levelUpSize;
if(_characterLevels[tokenId].Creativity > 10){
_characterLevels[tokenId].Creativity = 10;
}
}
if(abilityNo == 2){
_characterLevels[tokenId].Intelligence += levelUpSize;
if(_characterLevels[tokenId].Intelligence > 10){
_characterLevels[tokenId].Intelligence = 10;
}
}
if(abilityNo == 3){
_characterLevels[tokenId].Energy += levelUpSize;
if(_characterLevels[tokenId].Energy > 10){
_characterLevels[tokenId].Energy = 10;
}
}
if(abilityNo == 4){
uint32 oldLevel = _characterLevels[tokenId].Luck;
_characterLevels[tokenId].Luck += levelUpSize;
if(_characterLevels[tokenId].Luck > 10){
_characterLevels[tokenId].Luck = 10;
}
emit levelUp(tokenId, "Luck", oldLevel, _characterLevels[tokenId].Luck);
}
if(abilityNo == 5){
_characterLevels[tokenId].CommunicationSkills += levelUpSize;
if(_characterLevels[tokenId].CommunicationSkills > 10){
_characterLevels[tokenId].CommunicationSkills = 10;
}
}
}
}
function intelligenceLevelUp(uint256 tokenId, uint32 levelUpSize)
external
payable
callerIsUser
{
uint256 Price = 20000000000000000 * uint256(levelUpSize);
require(isLevelUp, "levelup is not available yet");
require(msg.value >= Price, "need to send more ETH");
require(_msgSender() == ownerOf(tokenId), "you don't own this token");
require((_characterLevels[tokenId].Intelligence + levelUpSize) <= 10, "request levelup size is over max level");
uint32 oldLevel = _characterLevels[tokenId].Intelligence;
_characterLevels[tokenId].Intelligence += levelUpSize;
emit levelUp(tokenId, "Intelligence", oldLevel, _characterLevels[tokenId].Intelligence);
}
function _communicationLevelUp(uint256 tokenId) private {
if(isLevelUp){
if(_characterLevels[tokenId].CommunicationSkills < 10){
uint32 oldLevel = _characterLevels[tokenId].CommunicationSkills;
_characterLevels[tokenId].CommunicationSkills++;
emit levelUp(tokenId, "CommunicationSkills", oldLevel, _characterLevels[tokenId].CommunicationSkills);
}
}
}
function energyLevelUp(uint256 tokenId) external {
require(isLevelUp, "Levelup is not available yet");
require(_msgSender() == ownerOf(tokenId), "You don't own this token");
require(_characterLevels[tokenId].Energy < 10, "Already max level");
uint256 period = 2592000;
uint256 levelUpCount = (block.timestamp - _transactionTimestamp[tokenId]) / period;
if(levelUpCount > 0){
uint32 oldLevel = _characterLevels[tokenId].Energy;
_characterLevels[tokenId].Energy += uint32(levelUpCount);
if(_characterLevels[tokenId].Energy > 10){
_characterLevels[tokenId].Energy = 10;
}
emit levelUp(tokenId, "Energy", oldLevel, _characterLevels[tokenId].Energy);
}
}
function creativityLevelUp(uint256 tokenId) external {
require(_msgSender() == fanFictionContract, "Not specific contract");
if(isLevelUp){
if(_characterLevels[tokenId].Creativity < 10){
uint32 oldLevel = _characterLevels[tokenId].Creativity;
_characterLevels[tokenId].Creativity++;
emit levelUp(tokenId, "Creativity", oldLevel, _characterLevels[tokenId].Creativity);
}
}
}
function viewOwnershipPeriod(uint256 tokenId)
external
view
returns (uint256)
{
if(_transactionTimestamp[tokenId] == 0){
return 0;
}
else{
return (block.timestamp - _transactionTimestamp[tokenId]) / 86400;
}
}
function setCharacterSheet(uint256 characterNo, string memory key, string memory value) external {
bool isTokenOwner = false;
uint256 lastTokenIndex = balanceOf(_msgSender());
uint256 startNo = ((characterNo-1) * 400) + 1;
uint256 endNo = characterNo * 400;
string memory oldValue;
for(uint256 i=0; i<lastTokenIndex; i++){
uint256 tokenId = tokenOfOwnerByIndex(_msgSender(), i);
if((startNo <= tokenId) && (tokenId <= endNo)){
isTokenOwner = true;
}
}
require(isTokenOwner, "You don't own this character token");
oldValue = _characterSheet[characterNo][key];
_characterSheet[characterNo][key] = value;
emit changeCharacterSheet(_msgSender(), characterNo, key, oldValue, value);
}
function viewCharacterSheet(uint256 characterNo, string memory key)
public
view
returns(string memory)
{
return _characterSheet[characterNo][key];
}
receive() external payable {}
}
文件 10 的 18:IERC165.sol
pragma solidity ^0.8.0;
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
文件 11 的 18:IERC721.sol
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
interface IERC721 is IERC165 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
function balanceOf(address owner) external view returns (uint256 balance);
function ownerOf(uint256 tokenId) external view returns (address owner);
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
function approve(address to, uint256 tokenId) external;
function setApprovalForAll(address operator, bool _approved) external;
function getApproved(uint256 tokenId) external view returns (address operator);
function isApprovedForAll(address owner, address operator) external view returns (bool);
}
文件 12 的 18: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);
}
文件 13 的 18: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);
}
文件 14 的 18:IERC721Receiver.sol
pragma solidity ^0.8.0;
interface IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
文件 15 的 18: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);
}
}
文件 16 的 18:ReentrancyGuard.sol
pragma solidity ^0.8.0;
abstract contract ReentrancyGuard {
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
modifier nonReentrant() {
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
_status = _ENTERED;
_;
_status = _NOT_ENTERED;
}
}
文件 17 的 18:Royalty.sol
pragma solidity 0.8.7;
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
interface IHasSecondarySaleFees {
function getFeeBps(uint256 id) external view returns (uint256[] memory);
function getFeeRecipients(uint256 id) external view returns (address payable[] memory);
}
contract HasSecondarySaleFees is IERC165, IHasSecondarySaleFees {
event ChangeCommonRoyalty(
address payable[] royaltyAddresses,
uint256[] royaltiesWithTwoDecimals
);
event ChangeRoyalty(
uint256 id,
address payable[] royaltyAddresses,
uint256[] royaltiesWithTwoDecimals
);
struct RoyaltyInfo {
bool isPresent;
address payable[] royaltyAddresses;
uint256[] royaltiesWithTwoDecimals;
}
mapping(bytes32 => RoyaltyInfo) royaltyInfoMap;
mapping(uint256 => bytes32) tokenRoyaltyMap;
address payable[] public commonRoyaltyAddresses;
uint256[] public commonRoyaltiesWithTwoDecimals;
constructor(
address payable[] memory _commonRoyaltyAddresses,
uint256[] memory _commonRoyaltiesWithTwoDecimals
) {
_setCommonRoyalties(_commonRoyaltyAddresses, _commonRoyaltiesWithTwoDecimals);
}
function _setRoyaltiesOf(
uint256 _tokenId,
address payable[] memory _royaltyAddresses,
uint256[] memory _royaltiesWithTwoDecimals
) internal {
require(_royaltyAddresses.length == _royaltiesWithTwoDecimals.length, "input length must be same");
bytes32 key = 0x0;
for (uint256 i = 0; i < _royaltyAddresses.length; i++) {
require(_royaltyAddresses[i] != address(0), "Must not be zero-address");
key = keccak256(abi.encodePacked(key, _royaltyAddresses[i], _royaltiesWithTwoDecimals[i]));
}
tokenRoyaltyMap[_tokenId] = key;
emit ChangeRoyalty(_tokenId, _royaltyAddresses, _royaltiesWithTwoDecimals);
if (royaltyInfoMap[key].isPresent) {
return;
}
royaltyInfoMap[key] = RoyaltyInfo(
true,
_royaltyAddresses,
_royaltiesWithTwoDecimals
);
}
function _setCommonRoyalties(
address payable[] memory _commonRoyaltyAddresses,
uint256[] memory _commonRoyaltiesWithTwoDecimals
) internal {
require(_commonRoyaltyAddresses.length == _commonRoyaltiesWithTwoDecimals.length, "input length must be same");
for (uint256 i = 0; i < _commonRoyaltyAddresses.length; i++) {
require(_commonRoyaltyAddresses[i] != address(0), "Must not be zero-address");
}
commonRoyaltyAddresses = _commonRoyaltyAddresses;
commonRoyaltiesWithTwoDecimals = _commonRoyaltiesWithTwoDecimals;
emit ChangeCommonRoyalty(_commonRoyaltyAddresses, _commonRoyaltiesWithTwoDecimals);
}
function getFeeRecipients(uint256 _tokenId)
public view override returns (address payable[] memory)
{
RoyaltyInfo memory royaltyInfo = royaltyInfoMap[tokenRoyaltyMap[_tokenId]];
if (!royaltyInfo.isPresent) {
return commonRoyaltyAddresses;
}
uint256 length = commonRoyaltyAddresses.length + royaltyInfo.royaltyAddresses.length;
address payable[] memory recipients = new address payable[](length);
for (uint256 i = 0; i < commonRoyaltyAddresses.length; i++) {
recipients[i] = commonRoyaltyAddresses[i];
}
for (uint256 i = 0; i < royaltyInfo.royaltyAddresses.length; i++) {
recipients[i + commonRoyaltyAddresses.length] = royaltyInfo.royaltyAddresses[i];
}
return recipients;
}
function getFeeBps(uint256 _tokenId) public view override returns (uint256[] memory) {
RoyaltyInfo memory royaltyInfo = royaltyInfoMap[tokenRoyaltyMap[_tokenId]];
if (!royaltyInfo.isPresent) {
return commonRoyaltiesWithTwoDecimals;
}
uint256 length = commonRoyaltiesWithTwoDecimals.length + royaltyInfo.royaltiesWithTwoDecimals.length;
uint256[] memory fees = new uint256[](length);
for (uint256 i = 0; i < commonRoyaltiesWithTwoDecimals.length; i++) {
fees[i] = commonRoyaltiesWithTwoDecimals[i];
}
for (uint256 i = 0; i < royaltyInfo.royaltiesWithTwoDecimals.length; i++) {
fees[i + commonRoyaltyAddresses.length] = royaltyInfo.royaltiesWithTwoDecimals[i];
}
return fees;
}
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(IERC165)
returns (bool)
{
return interfaceId == type(IHasSecondarySaleFees).interfaceId;
}
}
文件 18 的 18:Strings.sol
pragma solidity ^0.8.0;
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
function toString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
{
"compilationTarget": {
"source/Hokago.sol": "Hokago"
},
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": []
}
[{"inputs":[{"internalType":"uint64","name":"_preSalePriceWei","type":"uint64"},{"internalType":"uint64","name":"_publicSalePriceWei","type":"uint64"},{"internalType":"uint64","name":"_saleLimit","type":"uint64"},{"internalType":"string","name":"_baseTokenURI","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address payable[]","name":"royaltyAddresses","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"royaltiesWithTwoDecimals","type":"uint256[]"}],"name":"ChangeCommonRoyalty","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"address payable[]","name":"royaltyAddresses","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"royaltiesWithTwoDecimals","type":"uint256[]"}],"name":"ChangeRoyalty","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":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"string","name":"diaryStr","type":"string"}],"name":"addDiary","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"changer","type":"address"},{"indexed":true,"internalType":"uint256","name":"characterNo","type":"uint256"},{"indexed":true,"internalType":"string","name":"key","type":"string"},{"indexed":false,"internalType":"string","name":"oldValue","type":"string"},{"indexed":false,"internalType":"string","name":"newValue","type":"string"}],"name":"changeCharacterSheet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"string","name":"levelName","type":"string"},{"indexed":false,"internalType":"uint32","name":"oldLevel","type":"uint32"},{"indexed":false,"internalType":"uint32","name":"newLevel","type":"uint32"}],"name":"levelUp","type":"event"},{"inputs":[],"name":"allowListCount","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"allowListCountOfOwner","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint256","name":"maxMint","type":"uint256"}],"name":"changeAllowList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"commonRoyaltiesWithTwoDecimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"commonRoyaltyAddresses","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"creativityLevelUp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"deleteAllowList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"arrayNo","type":"uint256"}],"name":"deleteDiary","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"internalType":"uint256","name":"abilityNo","type":"uint256"},{"internalType":"uint32","name":"levelUpSize","type":"uint32"}],"name":"devLevelUp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"list","type":"uint256[]"}],"name":"devMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"energyLevelUp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"fanFictionContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"generateRandLevels","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"characterNo","type":"uint256"},{"internalType":"uint256","name":"jsTimestamp","type":"uint256"}],"name":"generateRandTokenID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"getFeeBps","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getFeeRecipients","outputs":[{"internalType":"address payable[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint32","name":"levelUpSize","type":"uint32"}],"name":"intelligenceLevelUp","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"isOperator","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isLevelUp","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isPreSale","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isPublicSale","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"characterNo","type":"uint256"}],"name":"mintableTokensByCharacter","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mintedTokens","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"numberMintedOfOwner","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"pausePreSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pausePublicSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"requestTokenID","type":"uint256"}],"name":"preSaleMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"preSalePrice","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"requestTokenID","type":"uint256"}],"name":"publicSaleMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"publicSalePrice","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"list","type":"address[]"}],"name":"pushAllowListAddresses","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","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":[],"name":"saleLimit","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","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":"baseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"characterNo","type":"uint256"},{"internalType":"string","name":"key","type":"string"},{"internalType":"string","name":"value","type":"string"}],"name":"setCharacterSheet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"diaryStr","type":"string"}],"name":"setDiary","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"}],"name":"setFanFictionContractAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startLevelUp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startPreSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startPublicSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stopLevelUp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"limit","type":"uint64"}],"name":"updateSaleLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"viewCharacterLevels","outputs":[{"internalType":"uint32[]","name":"","type":"uint32[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"characterNo","type":"uint256"},{"internalType":"string","name":"key","type":"string"}],"name":"viewCharacterSheet","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"viewDiary","outputs":[{"internalType":"string[]","name":"","type":"string[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"characterNo","type":"uint256"}],"name":"viewLevelsByCharacter","outputs":[{"internalType":"uint32[]","name":"","type":"uint32[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"viewOwnershipPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]