编译器
0.8.20+commit.a1b79de6
文件 1 的 15:Context.sol
pragma solidity ^0.8.20;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
文件 2 的 15:ERC165.sol
pragma solidity ^0.8.20;
import {IERC165} from "./IERC165.sol";
abstract contract ERC165 is IERC165 {
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
文件 3 的 15:ERC721.sol
pragma solidity ^0.8.20;
import {IERC721} from "./IERC721.sol";
import {IERC721Receiver} from "./IERC721Receiver.sol";
import {IERC721Metadata} from "./extensions/IERC721Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {Strings} from "../../utils/Strings.sol";
import {IERC165, ERC165} from "../../utils/introspection/ERC165.sol";
import {IERC721Errors} from "../../interfaces/draft-IERC6093.sol";
abstract contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Errors {
using Strings for uint256;
string private _name;
string private _symbol;
mapping(uint256 tokenId => address) private _owners;
mapping(address owner => uint256) private _balances;
mapping(uint256 tokenId => address) private _tokenApprovals;
mapping(address owner => mapping(address operator => 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 returns (uint256) {
if (owner == address(0)) {
revert ERC721InvalidOwner(address(0));
}
return _balances[owner];
}
function ownerOf(uint256 tokenId) public view virtual returns (address) {
return _requireOwned(tokenId);
}
function name() public view virtual returns (string memory) {
return _name;
}
function symbol() public view virtual returns (string memory) {
return _symbol;
}
function tokenURI(uint256 tokenId) public view virtual returns (string memory) {
_requireOwned(tokenId);
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string.concat(baseURI, tokenId.toString()) : "";
}
function _baseURI() internal view virtual returns (string memory) {
return "";
}
function approve(address to, uint256 tokenId) public virtual {
_approve(to, tokenId, _msgSender());
}
function getApproved(uint256 tokenId) public view virtual returns (address) {
_requireOwned(tokenId);
return _getApproved(tokenId);
}
function setApprovalForAll(address operator, bool approved) public virtual {
_setApprovalForAll(_msgSender(), operator, approved);
}
function isApprovedForAll(address owner, address operator) public view virtual returns (bool) {
return _operatorApprovals[owner][operator];
}
function transferFrom(address from, address to, uint256 tokenId) public virtual {
if (to == address(0)) {
revert ERC721InvalidReceiver(address(0));
}
address previousOwner = _update(to, tokenId, _msgSender());
if (previousOwner != from) {
revert ERC721IncorrectOwner(from, tokenId, previousOwner);
}
}
function safeTransferFrom(address from, address to, uint256 tokenId) public {
safeTransferFrom(from, to, tokenId, "");
}
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual {
transferFrom(from, to, tokenId);
_checkOnERC721Received(from, to, tokenId, data);
}
function _ownerOf(uint256 tokenId) internal view virtual returns (address) {
return _owners[tokenId];
}
function _getApproved(uint256 tokenId) internal view virtual returns (address) {
return _tokenApprovals[tokenId];
}
function _isAuthorized(address owner, address spender, uint256 tokenId) internal view virtual returns (bool) {
return
spender != address(0) &&
(owner == spender || isApprovedForAll(owner, spender) || _getApproved(tokenId) == spender);
}
function _checkAuthorized(address owner, address spender, uint256 tokenId) internal view virtual {
if (!_isAuthorized(owner, spender, tokenId)) {
if (owner == address(0)) {
revert ERC721NonexistentToken(tokenId);
} else {
revert ERC721InsufficientApproval(spender, tokenId);
}
}
}
function _increaseBalance(address account, uint128 value) internal virtual {
unchecked {
_balances[account] += value;
}
}
function _update(address to, uint256 tokenId, address auth) internal virtual returns (address) {
address from = _ownerOf(tokenId);
if (auth != address(0)) {
_checkAuthorized(from, auth, tokenId);
}
if (from != address(0)) {
_approve(address(0), tokenId, address(0), false);
unchecked {
_balances[from] -= 1;
}
}
if (to != address(0)) {
unchecked {
_balances[to] += 1;
}
}
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
return from;
}
function _mint(address to, uint256 tokenId) internal {
if (to == address(0)) {
revert ERC721InvalidReceiver(address(0));
}
address previousOwner = _update(to, tokenId, address(0));
if (previousOwner != address(0)) {
revert ERC721InvalidSender(address(0));
}
}
function _safeMint(address to, uint256 tokenId) internal {
_safeMint(to, tokenId, "");
}
function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {
_mint(to, tokenId);
_checkOnERC721Received(address(0), to, tokenId, data);
}
function _burn(uint256 tokenId) internal {
address previousOwner = _update(address(0), tokenId, address(0));
if (previousOwner == address(0)) {
revert ERC721NonexistentToken(tokenId);
}
}
function _transfer(address from, address to, uint256 tokenId) internal {
if (to == address(0)) {
revert ERC721InvalidReceiver(address(0));
}
address previousOwner = _update(to, tokenId, address(0));
if (previousOwner == address(0)) {
revert ERC721NonexistentToken(tokenId);
} else if (previousOwner != from) {
revert ERC721IncorrectOwner(from, tokenId, previousOwner);
}
}
function _safeTransfer(address from, address to, uint256 tokenId) internal {
_safeTransfer(from, to, tokenId, "");
}
function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {
_transfer(from, to, tokenId);
_checkOnERC721Received(from, to, tokenId, data);
}
function _approve(address to, uint256 tokenId, address auth) internal {
_approve(to, tokenId, auth, true);
}
function _approve(address to, uint256 tokenId, address auth, bool emitEvent) internal virtual {
if (emitEvent || auth != address(0)) {
address owner = _requireOwned(tokenId);
if (auth != address(0) && owner != auth && !isApprovedForAll(owner, auth)) {
revert ERC721InvalidApprover(auth);
}
if (emitEvent) {
emit Approval(owner, to, tokenId);
}
}
_tokenApprovals[tokenId] = to;
}
function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {
if (operator == address(0)) {
revert ERC721InvalidOperator(operator);
}
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
function _requireOwned(uint256 tokenId) internal view returns (address) {
address owner = _ownerOf(tokenId);
if (owner == address(0)) {
revert ERC721NonexistentToken(tokenId);
}
return owner;
}
function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory data) private {
if (to.code.length > 0) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {
if (retval != IERC721Receiver.onERC721Received.selector) {
revert ERC721InvalidReceiver(to);
}
} catch (bytes memory reason) {
if (reason.length == 0) {
revert ERC721InvalidReceiver(to);
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
}
}
}
文件 4 的 15:ERC721URIStorage.sol
pragma solidity ^0.8.20;
import {ERC721} from "../ERC721.sol";
import {Strings} from "../../../utils/Strings.sol";
import {IERC4906} from "../../../interfaces/IERC4906.sol";
import {IERC165} from "../../../interfaces/IERC165.sol";
abstract contract ERC721URIStorage is IERC4906, ERC721 {
using Strings for uint256;
bytes4 private constant ERC4906_INTERFACE_ID = bytes4(0x49064906);
mapping(uint256 tokenId => string) private _tokenURIs;
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721, IERC165) returns (bool) {
return interfaceId == ERC4906_INTERFACE_ID || super.supportsInterface(interfaceId);
}
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
_requireOwned(tokenId);
string memory _tokenURI = _tokenURIs[tokenId];
string memory base = _baseURI();
if (bytes(base).length == 0) {
return _tokenURI;
}
if (bytes(_tokenURI).length > 0) {
return string.concat(base, _tokenURI);
}
return super.tokenURI(tokenId);
}
function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
_tokenURIs[tokenId] = _tokenURI;
emit MetadataUpdate(tokenId);
}
}
文件 5 的 15:IERC165.sol
pragma solidity ^0.8.20;
import {IERC165} from "../utils/introspection/IERC165.sol";
文件 6 的 15:IERC4906.sol
pragma solidity ^0.8.20;
import {IERC165} from "./IERC165.sol";
import {IERC721} from "./IERC721.sol";
interface IERC4906 is IERC165, IERC721 {
event MetadataUpdate(uint256 _tokenId);
event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId);
}
文件 7 的 15:IERC721.sol
pragma solidity ^0.8.20;
import {IERC165} from "../../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);
}
文件 8 的 15:IERC721Metadata.sol
pragma solidity ^0.8.20;
import {IERC721} from "../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);
}
文件 9 的 15:IERC721Receiver.sol
pragma solidity ^0.8.20;
interface IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
文件 10 的 15:Math.sol
pragma solidity ^0.8.20;
library Math {
error MathOverflowedMulDiv();
enum Rounding {
Floor,
Ceil,
Trunc,
Expand
}
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 max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
function average(uint256 a, uint256 b) internal pure returns (uint256) {
return (a & b) + (a ^ b) / 2;
}
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
if (b == 0) {
return a / b;
}
return a == 0 ? 0 : (a - 1) / b + 1;
}
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
uint256 prod0 = x * y;
uint256 prod1;
assembly {
let mm := mulmod(x, y, not(0))
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
if (prod1 == 0) {
return prod0 / denominator;
}
if (denominator <= prod1) {
revert MathOverflowedMulDiv();
}
uint256 remainder;
assembly {
remainder := mulmod(x, y, denominator)
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
uint256 twos = denominator & (0 - denominator);
assembly {
denominator := div(denominator, twos)
prod0 := div(prod0, twos)
twos := add(div(sub(0, twos), twos), 1)
}
prod0 |= prod1 * twos;
uint256 inverse = (3 * denominator) ^ 2;
inverse *= 2 - denominator * inverse;
inverse *= 2 - denominator * inverse;
inverse *= 2 - denominator * inverse;
inverse *= 2 - denominator * inverse;
inverse *= 2 - denominator * inverse;
inverse *= 2 - denominator * inverse;
result = prod0 * inverse;
return result;
}
}
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 result = 1 << (log2(a) >> 1);
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
}
}
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
}
}
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
}
}
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
}
}
function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
return uint8(rounding) % 2 == 1;
}
}
文件 11 的 15:NFT.sol
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract NFT is ERC721URIStorage {
uint256 private _tokenIds;
bool public _isTransferContract;
mapping(address => bool) private _operator;
mapping(address => bool) private _contractAddrerss;
mapping(uint256 => DataToken) private _dataTokens;
mapping(string => uint256) private eventType;
string public _baseUri = "";
struct DataToken {
uint256 tokenId;
address creator;
string ipfsId;
uint256 package;
uint256 numberTransfer;
uint256 startAt;
uint256 expriedAt;
uint256 status;
uint256 stakingStatus;
}
event EventToken(
uint256 tokenId,
address creator,
string ipfsId,
uint256 package,
uint256 startAt,
uint256 expriedAt,
uint256 status,
uint256 stakingStatus,
uint256 eventTypeCode
);
constructor(
address addressOperator,
string memory baseURI,
string memory _name,
string memory _symbol
) ERC721(_name, _symbol) {
_operator[addressOperator] = true;
_operator[msg.sender] = true;
_baseUri = baseURI;
_isTransferContract = false;
eventType["mint"] = 1;
eventType["buy"] = 2;
eventType["update"] = 3;
eventType["transfer_operator"] = 4;
}
function onlyContractAddress(address contractAddress) internal view returns (bool) {
if (_contractAddrerss[contractAddress] || address(this) == contractAddress){
return true;
}
return false;
}
modifier onlyOperator() {
require(_operator[msg.sender], "Not a minter");
_;
}
function setOperator(address operator, bool status) external onlyOperator {
_operator[operator] = status;
}
function setContractAddress(address contractAddress, bool status) external onlyOperator {
_contractAddrerss[contractAddress] = status;
}
function setTransferContract(bool status) external onlyOperator {
_isTransferContract = status;
}
modifier onlyStaking {
require(_contractAddrerss[msg.sender], "Only the specified staking contract will be executed");
_;
}
function mintTokens(
string[] memory ipfsIds,
address creator
) public onlyOperator returns (uint256[] memory) {
require(ipfsIds.length > 0, "Token URIs must not be empty");
uint256[] memory tokenIds = new uint256[](ipfsIds.length);
for (uint256 i = 0; i < ipfsIds.length; i++) {
require(bytes(ipfsIds[i]).length != 0, "tokenURI must be nonzero");
_tokenIds += 1;
uint256 tokenId = _tokenIds;
_safeMint(creator, tokenId);
uint256 package = 1;
uint256 numberTransfer = 0;
uint256 startAt = 0;
uint256 expriedAt = 0;
uint256 status = 1;
uint256 stakingStatus = 2;
_dataTokens[tokenId] = DataToken(tokenId, creator, ipfsIds[i], package, numberTransfer, startAt, expriedAt, status, stakingStatus);
tokenIds[i] = tokenId;
}
setApprovalForAll(address(this), true);
for (uint256 j = 0; j < tokenIds.length; j++) {
emitEventToken(tokenIds[j], eventType["mint"]);
}
return tokenIds;
}
function mintToCasinoOwner(
address buytor_address,
uint256 package,
string memory ipfsId,
uint256 startAt,
uint256 expriedAt
) public onlyOperator returns (uint256) {
_tokenIds += 1;
uint256 tokenId = _tokenIds;
_safeMint(buytor_address, tokenId);
uint256 numberTransfer = 0;
uint256 status = 2;
uint256 stakingStatus = 2;
_dataTokens[tokenId] = DataToken(tokenId, buytor_address, ipfsId, package, numberTransfer, startAt, expriedAt, status, stakingStatus);
setApprovalForAll(address(this), true);
emitEventToken(tokenId, eventType["mint"]);
return tokenId;
}
function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
require(_dataTokens[tokenId].tokenId > 0, "ERC721Metadata: URI query for nonexistent token");
return string(abi.encodePacked(_baseUri, _dataTokens[tokenId].ipfsId));
}
function setBaseURI(string memory baseUri) public onlyOperator {
_baseUri = baseUri;
}
function getTokenId() public view returns (uint256) {
return _tokenIds;
}
function getTokensOwnedByMe() public view returns (uint256[] memory) {
uint256 numberOfExistingTokens = _tokenIds;
uint256 numberOfTokensOwned = balanceOf(msg.sender);
uint256[] memory ownedTokenIds = new uint256[](numberOfTokensOwned);
uint256 currentIndex = 0;
for (uint256 i = 0; i < numberOfExistingTokens; i++) {
uint256 tokenId = i + 1;
if (ownerOf(tokenId) != msg.sender) continue;
ownedTokenIds[currentIndex] = tokenId;
currentIndex += 1;
}
return ownedTokenIds;
}
function getTokensOwnedByAddress(address walletAddress) public view returns (uint256[] memory) {
uint256 numberOfExistingTokens = _tokenIds;
uint256 numberOfTokensOwned = balanceOf(walletAddress);
uint256[] memory ownedTokenIds = new uint256[](numberOfTokensOwned);
uint256 currentIndex = 0;
for (uint256 i = 0; i < numberOfExistingTokens; i++) {
uint256 tokenId = i + 1;
if (ownerOf(tokenId) != walletAddress) continue;
ownedTokenIds[currentIndex] = tokenId;
currentIndex += 1;
}
return ownedTokenIds;
}
function getTokenCreatorById(uint256 tokenId) public view returns (address) {
return _dataTokens[tokenId].creator;
}
function isTokenId(uint256 tokenId) public view returns (bool) {
if (_dataTokens[tokenId].tokenId > 0) {
return true;
}
return false;
}
function getTokensCreatedByMe() public view returns (uint256[] memory) {
uint256 numberOfExistingTokens = _tokenIds;
uint256 numberOfTokensCreated = 0;
for (uint256 i = 0; i < numberOfExistingTokens; i++) {
uint256 tokenId = i + 1;
if (_dataTokens[tokenId].creator != msg.sender) continue;
numberOfTokensCreated += 1;
}
uint256[] memory createdTokenIds = new uint256[](numberOfTokensCreated);
uint256 currentIndex = 0;
for (uint256 i = 0; i < numberOfExistingTokens; i++) {
uint256 tokenId = i + 1;
if (_dataTokens[tokenId].creator != msg.sender) continue;
createdTokenIds[currentIndex] = tokenId;
currentIndex += 1;
}
return createdTokenIds;
}
function getAllTokenNft() public view returns (uint256, uint256[] memory) {
uint256 numberOfExistingTokens = _tokenIds;
uint256[] memory createdTokenIds = new uint256[](numberOfExistingTokens);
uint256 currentIndex = 0;
for (uint256 i = 0; i < numberOfExistingTokens; i++) {
uint256 tokenId = i + 1;
createdTokenIds[currentIndex] = tokenId;
currentIndex += 1;
}
return (numberOfExistingTokens, createdTokenIds);
}
function getAllTokenNftMint() public view returns (uint256, uint256[] memory) {
uint256 numberOfExistingTokens = _tokenIds;
uint256 numberOfTokensMint = 0;
for (uint256 i = 0; i < numberOfExistingTokens; i++) {
uint256 tokenId = i + 1;
if (_dataTokens[tokenId].status == 1){
numberOfTokensMint += 1;
}
}
uint256[] memory createdTokenIds = new uint256[](numberOfTokensMint);
uint256 currentIndex = 0;
for (uint256 i = 0; i < numberOfExistingTokens; i++) {
uint256 tokenId = i + 1;
if (_dataTokens[tokenId].status == 1) {
createdTokenIds[currentIndex] = tokenId;
currentIndex += 1;
}
}
return (numberOfTokensMint, createdTokenIds);
}
function getAllTokenNftTransferCasinoOwner() public view returns (uint256, uint256[] memory) {
uint256 numberOfExistingTokens = _tokenIds;
uint256 numberOfTokensTCO = 0;
for (uint256 i = 0; i < numberOfExistingTokens; i++) {
uint256 tokenId = i + 1;
if (_dataTokens[tokenId].status == 2){
numberOfTokensTCO += 1;
}
}
uint256[] memory createdTokenIds = new uint256[](numberOfTokensTCO);
uint256 currentIndex = 0;
for (uint256 i = 0; i < numberOfExistingTokens; i++) {
uint256 tokenId = i + 1;
if (_dataTokens[tokenId].status == 2) {
createdTokenIds[currentIndex] = tokenId;
currentIndex += 1;
}
}
return (numberOfTokensTCO, createdTokenIds);
}
function getAllTokenNftTransferOperator() public view returns (uint256, uint256[] memory) {
uint256 numberOfExistingTokens = _tokenIds;
uint256 numberOfTokensTO = 0;
for (uint256 i = 0; i < numberOfExistingTokens; i++) {
uint256 tokenId = i + 1;
if (_dataTokens[tokenId].status == 3){
numberOfTokensTO += 1;
}
}
uint256[] memory createdTokenIds = new uint256[](numberOfTokensTO);
uint256 currentIndex = 0;
for (uint256 i = 0; i < numberOfExistingTokens; i++) {
uint256 tokenId = i + 1;
if (_dataTokens[tokenId].status == 3) {
createdTokenIds[currentIndex] = tokenId;
currentIndex += 1;
}
}
return (numberOfTokensTO, createdTokenIds);
}
function upgradePackage(
uint256 tokenId,
string memory ipfsId,
uint256 package,
uint256 expriedAt
) public payable onlyOperator returns (uint256){
_dataTokens[tokenId].ipfsId = ipfsId;
_dataTokens[tokenId].package = package;
_dataTokens[tokenId].expriedAt = expriedAt;
emitEventToken(tokenId, eventType["update"]);
return tokenId;
}
function emitEventToken(uint256 tokenId, uint256 eventTypeCode) internal {
DataToken storage marketItem = _dataTokens[tokenId];
emit EventToken(
marketItem.tokenId,
marketItem.creator,
marketItem.ipfsId,
marketItem.package,
marketItem.startAt,
marketItem.expriedAt,
marketItem.status,
marketItem.stakingStatus,
eventTypeCode
);
}
function getDataToken(uint256 tokenId)
public
view
returns (DataToken memory)
{
return _dataTokens[tokenId];
}
function buyNft(
uint256 tokenId,
address buytor_address,
address owner_address,
uint256 package,
string memory ipfsId,
uint256 startAt,
uint256 expriedAt
) public payable onlyOperator returns (uint256){
require(_dataTokens[tokenId].tokenId > 0 , "Token not found");
transferFrom(owner_address, buytor_address, tokenId);
_dataTokens[tokenId].package = package;
_dataTokens[tokenId].ipfsId = ipfsId;
_dataTokens[tokenId].creator = buytor_address;
_dataTokens[tokenId].startAt = startAt;
_dataTokens[tokenId].expriedAt = expriedAt;
_dataTokens[tokenId].status = 2;
emitEventToken(tokenId, eventType["buy"]);
return tokenId;
}
function transferToOperator(
uint256 tokenId,
address operator
) public payable returns (uint256) {
require(_dataTokens[tokenId].tokenId > 0, "NFT not found");
address owner = ownerOf(tokenId);
transferFrom(owner, operator, tokenId);
_dataTokens[tokenId].package = 1;
_dataTokens[tokenId].creator = payable(operator);
_dataTokens[tokenId].startAt = 0;
_dataTokens[tokenId].expriedAt = 0;
_dataTokens[tokenId].status = 3;
emitEventToken(tokenId, eventType["transfer_operator"]);
return tokenId;
}
function updataDataToken(
uint256 tokenId,
string memory ipfsId,
uint256 package,
uint256 startAt,
uint256 expriedAt
) public onlyOperator {
_dataTokens[tokenId].ipfsId = ipfsId;
_dataTokens[tokenId].package = package;
_dataTokens[tokenId].startAt = startAt;
_dataTokens[tokenId].expriedAt = expriedAt;
emitEventToken(tokenId, eventType["uprage"]);
}
function updataStakingStatus(
uint256 tokenId,
uint256 status
) external onlyStaking {
_dataTokens[tokenId].stakingStatus = status;
emitEventToken(tokenId, eventType["uprage"]);
}
function getNFTStatus(
uint256 tokenId
) public view returns (bool, uint256, string memory) {
require(tokenId > 0, "tokenId is required.");
bool status = false;
if (_dataTokens[tokenId].numberTransfer == 0) {
status = true;
}
return (status, _dataTokens[tokenId].package, tokenURI(tokenId));
}
function checkLockupNFT(
uint256 tokenId
) public view returns (bool, uint256, uint256) {
require(tokenId > 0, "tokenId is required.");
bool isExpred = false;
if (_dataTokens[tokenId].expriedAt != 0 && block.timestamp < _dataTokens[tokenId].expriedAt) {
isExpred = true;
}
return (isExpred, _dataTokens[tokenId].package, block.timestamp);
}
function transferFrom(address from, address to, uint256 tokenId) public override(ERC721, IERC721) {
if (!_isTransferContract && isContract(to) && !onlyContractAddress(to)) {
revert("Not a contract address or token is pending during lockup");
}
if (_dataTokens[tokenId].status == 2 && _dataTokens[tokenId].expriedAt > 0 && block.timestamp < _dataTokens[tokenId].expriedAt) {
revert("Currently in lockup period");
}
if (_dataTokens[tokenId].stakingStatus == 1) {
revert("NFT is staking so transfer is not allowed");
}
super.transferFrom(from, to, tokenId);
_dataTokens[tokenId].numberTransfer = (_dataTokens[tokenId].numberTransfer + 1);
}
function isContract(address contractAddress) public view returns (bool) {
uint32 size;
assembly {
size := extcodesize(contractAddress)
}
return (size > 0);
}
}
文件 12 的 15:Ownable.sol
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
abstract contract Ownable is Context {
address private _owner;
error OwnableUnauthorizedAccount(address account);
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
modifier onlyOwner() {
_checkOwner();
_;
}
function owner() public view virtual returns (address) {
return _owner;
}
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
文件 13 的 15:SignedMath.sol
pragma solidity ^0.8.20;
library SignedMath {
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
function average(int256 a, int256 b) internal pure returns (int256) {
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
function abs(int256 n) internal pure returns (uint256) {
unchecked {
return uint256(n >= 0 ? n : -n);
}
}
}
文件 14 的 15:Strings.sol
pragma solidity ^0.8.20;
import {Math} from "./math/Math.sol";
import {SignedMath} from "./math/SignedMath.sol";
library Strings {
bytes16 private constant HEX_DIGITS = "0123456789abcdef";
uint8 private constant ADDRESS_LENGTH = 20;
error StringsInsufficientHexLength(uint256 value, uint256 length);
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
assembly {
mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
function toStringSigned(int256 value) internal pure returns (string memory) {
return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value)));
}
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
uint256 localValue = value;
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_DIGITS[localValue & 0xf];
localValue >>= 4;
}
if (localValue != 0) {
revert StringsInsufficientHexLength(value, length);
}
return string(buffer);
}
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH);
}
function equal(string memory a, string memory b) internal pure returns (bool) {
return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));
}
}
文件 15 的 15:draft-IERC6093.sol
pragma solidity ^0.8.20;
interface IERC20Errors {
error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);
error ERC20InvalidSender(address sender);
error ERC20InvalidReceiver(address receiver);
error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);
error ERC20InvalidApprover(address approver);
error ERC20InvalidSpender(address spender);
}
interface IERC721Errors {
error ERC721InvalidOwner(address owner);
error ERC721NonexistentToken(uint256 tokenId);
error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);
error ERC721InvalidSender(address sender);
error ERC721InvalidReceiver(address receiver);
error ERC721InsufficientApproval(address operator, uint256 tokenId);
error ERC721InvalidApprover(address approver);
error ERC721InvalidOperator(address operator);
}
interface IERC1155Errors {
error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);
error ERC1155InvalidSender(address sender);
error ERC1155InvalidReceiver(address receiver);
error ERC1155MissingApprovalForAll(address operator, address owner);
error ERC1155InvalidApprover(address approver);
error ERC1155InvalidOperator(address operator);
error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}
{
"compilationTarget": {
"contracts/mlm/NFT.sol": "NFT"
},
"evmVersion": "paris",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": []
}
[{"inputs":[{"internalType":"address","name":"addressOperator","type":"address"},{"internalType":"string","name":"baseURI","type":"string"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"owner","type":"address"}],"name":"ERC721IncorrectOwner","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC721InsufficientApproval","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC721InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"ERC721InvalidOperator","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"ERC721InvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC721InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC721InvalidSender","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC721NonexistentToken","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_toTokenId","type":"uint256"}],"name":"BatchMetadataUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"creator","type":"address"},{"indexed":false,"internalType":"string","name":"ipfsId","type":"string"},{"indexed":false,"internalType":"uint256","name":"package","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"startAt","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"expriedAt","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"status","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"stakingStatus","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"eventTypeCode","type":"uint256"}],"name":"EventToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"MetadataUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"_baseUri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_isTransferContract","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"buytor_address","type":"address"},{"internalType":"address","name":"owner_address","type":"address"},{"internalType":"uint256","name":"package","type":"uint256"},{"internalType":"string","name":"ipfsId","type":"string"},{"internalType":"uint256","name":"startAt","type":"uint256"},{"internalType":"uint256","name":"expriedAt","type":"uint256"}],"name":"buyNft","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"checkLockupNFT","outputs":[{"internalType":"bool","name":"","type":"bool"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllTokenNft","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllTokenNftMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllTokenNftTransferCasinoOwner","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllTokenNftTransferOperator","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"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":"getDataToken","outputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"creator","type":"address"},{"internalType":"string","name":"ipfsId","type":"string"},{"internalType":"uint256","name":"package","type":"uint256"},{"internalType":"uint256","name":"numberTransfer","type":"uint256"},{"internalType":"uint256","name":"startAt","type":"uint256"},{"internalType":"uint256","name":"expriedAt","type":"uint256"},{"internalType":"uint256","name":"status","type":"uint256"},{"internalType":"uint256","name":"stakingStatus","type":"uint256"}],"internalType":"struct NFT.DataToken","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getNFTStatus","outputs":[{"internalType":"bool","name":"","type":"bool"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getTokenCreatorById","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTokensCreatedByMe","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"walletAddress","type":"address"}],"name":"getTokensOwnedByAddress","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTokensOwnedByMe","outputs":[{"internalType":"uint256[]","name":"","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":[{"internalType":"address","name":"contractAddress","type":"address"}],"name":"isContract","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"isTokenId","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"buytor_address","type":"address"},{"internalType":"uint256","name":"package","type":"uint256"},{"internalType":"string","name":"ipfsId","type":"string"},{"internalType":"uint256","name":"startAt","type":"uint256"},{"internalType":"uint256","name":"expriedAt","type":"uint256"}],"name":"mintToCasinoOwner","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string[]","name":"ipfsIds","type":"string[]"},{"internalType":"address","name":"creator","type":"address"}],"name":"mintTokens","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"baseUri","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"},{"internalType":"bool","name":"status","type":"bool"}],"name":"setContractAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"status","type":"bool"}],"name":"setOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"status","type":"bool"}],"name":"setTransferContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"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":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"operator","type":"address"}],"name":"transferToOperator","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"ipfsId","type":"string"},{"internalType":"uint256","name":"package","type":"uint256"},{"internalType":"uint256","name":"startAt","type":"uint256"},{"internalType":"uint256","name":"expriedAt","type":"uint256"}],"name":"updataDataToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"status","type":"uint256"}],"name":"updataStakingStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"ipfsId","type":"string"},{"internalType":"uint256","name":"package","type":"uint256"},{"internalType":"uint256","name":"expriedAt","type":"uint256"}],"name":"upgradePackage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"}]