From 978892ec611dd9afa65de96755a840086bce7ff6 Mon Sep 17 00:00:00 2001 From: anhnh12 Date: Mon, 8 Jul 2024 01:17:58 +0700 Subject: [PATCH] feat: neko holder fetcher --- abi/neko.json | 839 +++++++ abi/neko_staking.json | 561 +++++ ...uct_changelog_snapshot_add_is_publish.sql} | 0 ...20240702155729-modify_user_nft_balance.sql | 16 + pkg/consts/neko.go | 4 + pkg/contract/neko/neko.go | 2031 +++++++++++++++++ pkg/contract/nekostaking/nekostaking.go | 1380 +++++++++++ pkg/contracts/nekostaking/neko_staking.json | 561 +++++ pkg/entities/nfts.go | 315 ++- pkg/entities/setting.go | 2 +- pkg/entities/user.go | 4 +- pkg/entities/vault.go | 4 +- pkg/entities/wallet.go | 5 +- pkg/handler/nft/interface.go | 1 + pkg/handler/nft/nft.go | 24 + pkg/job/update_user_nft_balance.go | 104 +- pkg/model/nft_collection.go | 29 +- pkg/model/user_nft_balance.go | 35 +- pkg/model/wallet_snapshot.go | 1 + pkg/repo/nft_collection/pg.go | 10 + pkg/repo/nft_collection/store.go | 2 + pkg/repo/user_nft_balance/pg.go | 45 +- pkg/repo/user_nft_balance/query.go | 6 + pkg/repo/user_nft_balance/store.go | 3 + pkg/request/nft.go | 5 + pkg/response/nft.go | 12 + pkg/routes/v1.go | 4 + pkg/service/mochiprofile/mochiprofile.go | 8 +- pkg/service/mochiprofile/service.go | 2 +- pkg/util/map/map.go | 26 + pkg/util/slice/slice.go | 47 + 31 files changed, 6020 insertions(+), 66 deletions(-) create mode 100644 abi/neko.json create mode 100644 abi/neko_staking.json rename migrations/schemas/{20242301162030-alter_product_changelog_snapshot_add_is_publish.sql => 20240123162030-alter_product_changelog_snapshot_add_is_publish.sql} (100%) create mode 100644 migrations/schemas/20240702155729-modify_user_nft_balance.sql create mode 100644 pkg/consts/neko.go create mode 100644 pkg/contract/neko/neko.go create mode 100644 pkg/contract/nekostaking/nekostaking.go create mode 100644 pkg/contracts/nekostaking/neko_staking.json create mode 100644 pkg/repo/user_nft_balance/query.go create mode 100644 pkg/util/map/map.go diff --git a/abi/neko.json b/abi/neko.json new file mode 100644 index 000000000..f629f0e53 --- /dev/null +++ b/abi/neko.json @@ -0,0 +1,839 @@ +[ + { + "inputs": [], + "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": 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" + }, + { + "inputs": [], + "name": "MAX_NEKO", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "NR_OF_SUPPORTED_TOKEN", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "WHITELIST_PRICE", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "addresses", + "type": "address[]" + } + ], + "name": "addWhitelists", + "outputs": [], + "stateMutability": "nonpayable", + "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": "base", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "numNeko", + "type": "uint256" + } + ], + "name": "calculatePrice", + "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": [], + "name": "hasSaleStarted", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "hasWhitelistStarted", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "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": "uint256", + "name": "numNeko", + "type": "uint256" + } + ], + "name": "mintNeko", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "numNeko", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "tokenId", + "type": "uint8" + } + ], + "name": "mintNekoByCustomToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "mintWhitelist", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "tokenId", + "type": "uint8" + } + ], + "name": "mintWhitelistByCustomToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pauseSale", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "pauseWhitelistSale", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "addresses", + "type": "address[]" + } + ], + "name": "removeWhitelist", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "numNeko", + "type": "uint256" + } + ], + "name": "reserveGiveaway", + "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": [ + { + "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": "contract IAddressRevealer", + "name": "_revealer", + "type": "address" + } + ], + "name": "setRevealer", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "tokenId", + "type": "uint8" + }, + { + "internalType": "contract IERC20", + "name": "tokenAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "conversionRate", + "type": "uint256" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + } + ], + "name": "setSupportedToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "startSale", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "startWhitelistSale", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "name": "supportedToken", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "tokenAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "conversionRate", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "tokenId", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "bool", + "name": "initialized", + "type": "bool" + }, + { + "internalType": "bool", + "name": "supported", + "type": "bool" + } + ], + "stateMutability": "view", + "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": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "name": "tokensOfOwner", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "tokenId", + "type": "uint8" + } + ], + "name": "turnOffSupportedToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "tokenId", + "type": "uint8" + } + ], + "name": "turnOnSupportedToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "whitelister", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "withdrawAll", + "outputs": [], + "stateMutability": "payable", + "type": "function" + } +] diff --git a/abi/neko_staking.json b/abi/neko_staking.json new file mode 100644 index 000000000..a961ce604 --- /dev/null +++ b/abi/neko_staking.json @@ -0,0 +1,561 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + } + ], + "name": "Staked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + } + ], + "name": "Unstaked", + "type": "event" + }, + { + "inputs": [], + "name": "NekoContract", + "outputs": [ + { + "internalType": "contract IERC721", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_duration", + "type": "uint256" + } + ], + "name": "addRewardToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "balances", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "disableStaking", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "disableUnstaking", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "earned", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC721", + "name": "_neko", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isPrizeToken", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "lastTimeRewardApplicable", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + } + ], + "name": "notifyRewardAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "onERC721Received", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "owners", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "rewardInfo", + "outputs": [ + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "periodFinish", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardPerTokenStored", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardBalance", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "rewardPerToken", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardTokenLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "rewards", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "stake", + "type": "bool" + }, + { + "internalType": "bool", + "name": "unstake", + "type": "bool" + } + ], + "name": "setDisable", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardDuration", + "type": "uint256" + } + ], + "name": "setRewardDuration", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "tokenIds", + "type": "uint256[]" + }, + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "stakeNekosFor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "tokenIds", + "type": "uint256[]" + } + ], + "name": "unstakeNekos", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "userRewardPerTokenPaid", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } +] diff --git a/migrations/schemas/20242301162030-alter_product_changelog_snapshot_add_is_publish.sql b/migrations/schemas/20240123162030-alter_product_changelog_snapshot_add_is_publish.sql similarity index 100% rename from migrations/schemas/20242301162030-alter_product_changelog_snapshot_add_is_publish.sql rename to migrations/schemas/20240123162030-alter_product_changelog_snapshot_add_is_publish.sql diff --git a/migrations/schemas/20240702155729-modify_user_nft_balance.sql b/migrations/schemas/20240702155729-modify_user_nft_balance.sql new file mode 100644 index 000000000..26ec77d50 --- /dev/null +++ b/migrations/schemas/20240702155729-modify_user_nft_balance.sql @@ -0,0 +1,16 @@ + +-- +migrate Up +ALTER TABLE user_nft_balances ADD COLUMN IF NOT EXISTS profile_id text not null default ''; +ALTER TABLE user_nft_balances ADD COLUMN IF NOT EXISTS updated_at timestamptz not null default (now() at time zone 'utc'); +ALTER TABLE user_nft_balances ADD COLUMN IF NOT EXISTS metadata jsonb not null default '{}'; +ALTER TABLE user_nft_balances DROP COLUMN IF EXISTS token_id; + +ALTER TABLE user_nft_balances ADD CONSTRAINT user_nft_balances_collection_id_address UNIQUE (nft_collection_id, user_address); + +-- +migrate Down +ALTER TABLE user_nft_balances ADD COLUMN IF NOT EXISTS token_id TEXT not null default ''; +ALTER TABLE user_nft_balances DROP COLUMN IF EXISTS updated_at; +ALTER TABLE user_nft_balances DROP COLUMN IF EXISTS profile_id; +ALTER TABLE user_nft_balances DROP COLUMN IF EXISTS metadata; + +ALTER TABLE user_nft_balances DROP CONSTRAINT IF EXISTS user_nft_balances_collection_id_address; diff --git a/pkg/consts/neko.go b/pkg/consts/neko.go new file mode 100644 index 000000000..33649391a --- /dev/null +++ b/pkg/consts/neko.go @@ -0,0 +1,4 @@ +package consts + +var NekoContractAddress = "0x7aCeE5D0acC520faB33b3Ea25D4FEEF1FfebDE73" +var NekoStakingContractAddress = "0xD28Cf82b9B8ee25E3C82923aDF6aA6CC2f220932" diff --git a/pkg/contract/neko/neko.go b/pkg/contract/neko/neko.go new file mode 100644 index 000000000..24bb887ed --- /dev/null +++ b/pkg/contract/neko/neko.go @@ -0,0 +1,2031 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package neko + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription +) + +// NekoMetaData contains all meta data concerning the Neko contract. +var NekoMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[],\"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\":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\"},{\"inputs\":[],\"name\":\"MAX_NEKO\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"NR_OF_SUPPORTED_TOKEN\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WHITELIST_PRICE\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"addresses\",\"type\":\"address[]\"}],\"name\":\"addWhitelists\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"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\":\"base\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"numNeko\",\"type\":\"uint256\"}],\"name\":\"calculatePrice\",\"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\":[],\"name\":\"hasSaleStarted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"hasWhitelistStarted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"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\":\"uint256\",\"name\":\"numNeko\",\"type\":\"uint256\"}],\"name\":\"mintNeko\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"numNeko\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"tokenId\",\"type\":\"uint8\"}],\"name\":\"mintNekoByCustomToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"mintWhitelist\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"tokenId\",\"type\":\"uint8\"}],\"name\":\"mintWhitelistByCustomToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pauseSale\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pauseWhitelistSale\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"addresses\",\"type\":\"address[]\"}],\"name\":\"removeWhitelist\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"numNeko\",\"type\":\"uint256\"}],\"name\":\"reserveGiveaway\",\"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\":[{\"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\":\"contractIAddressRevealer\",\"name\":\"_revealer\",\"type\":\"address\"}],\"name\":\"setRevealer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"tokenId\",\"type\":\"uint8\"},{\"internalType\":\"contractIERC20\",\"name\":\"tokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"conversionRate\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"}],\"name\":\"setSupportedToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"startSale\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"startWhitelistSale\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"name\":\"supportedToken\",\"outputs\":[{\"internalType\":\"contractIERC20\",\"name\":\"tokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"conversionRate\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"tokenId\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"bool\",\"name\":\"initialized\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"supported\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"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\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"tokensOfOwner\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"tokenId\",\"type\":\"uint8\"}],\"name\":\"turnOffSupportedToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"tokenId\",\"type\":\"uint8\"}],\"name\":\"turnOnSupportedToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"whitelister\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"withdrawAll\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", +} + +// NekoABI is the input ABI used to generate the binding from. +// Deprecated: Use NekoMetaData.ABI instead. +var NekoABI = NekoMetaData.ABI + +// Neko is an auto generated Go binding around an Ethereum contract. +type Neko struct { + NekoCaller // Read-only binding to the contract + NekoTransactor // Write-only binding to the contract + NekoFilterer // Log filterer for contract events +} + +// NekoCaller is an auto generated read-only Go binding around an Ethereum contract. +type NekoCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// NekoTransactor is an auto generated write-only Go binding around an Ethereum contract. +type NekoTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// NekoFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type NekoFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// NekoSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type NekoSession struct { + Contract *Neko // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// NekoCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type NekoCallerSession struct { + Contract *NekoCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// NekoTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type NekoTransactorSession struct { + Contract *NekoTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// NekoRaw is an auto generated low-level Go binding around an Ethereum contract. +type NekoRaw struct { + Contract *Neko // Generic contract binding to access the raw methods on +} + +// NekoCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type NekoCallerRaw struct { + Contract *NekoCaller // Generic read-only contract binding to access the raw methods on +} + +// NekoTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type NekoTransactorRaw struct { + Contract *NekoTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewNeko creates a new instance of Neko, bound to a specific deployed contract. +func NewNeko(address common.Address, backend bind.ContractBackend) (*Neko, error) { + contract, err := bindNeko(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &Neko{NekoCaller: NekoCaller{contract: contract}, NekoTransactor: NekoTransactor{contract: contract}, NekoFilterer: NekoFilterer{contract: contract}}, nil +} + +// NewNekoCaller creates a new read-only instance of Neko, bound to a specific deployed contract. +func NewNekoCaller(address common.Address, caller bind.ContractCaller) (*NekoCaller, error) { + contract, err := bindNeko(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &NekoCaller{contract: contract}, nil +} + +// NewNekoTransactor creates a new write-only instance of Neko, bound to a specific deployed contract. +func NewNekoTransactor(address common.Address, transactor bind.ContractTransactor) (*NekoTransactor, error) { + contract, err := bindNeko(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &NekoTransactor{contract: contract}, nil +} + +// NewNekoFilterer creates a new log filterer instance of Neko, bound to a specific deployed contract. +func NewNekoFilterer(address common.Address, filterer bind.ContractFilterer) (*NekoFilterer, error) { + contract, err := bindNeko(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &NekoFilterer{contract: contract}, nil +} + +// bindNeko binds a generic wrapper to an already deployed contract. +func bindNeko(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(NekoABI)) + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Neko *NekoRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Neko.Contract.NekoCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Neko *NekoRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Neko.Contract.NekoTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Neko *NekoRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Neko.Contract.NekoTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Neko *NekoCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Neko.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Neko *NekoTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Neko.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Neko *NekoTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Neko.Contract.contract.Transact(opts, method, params...) +} + +// MAXNEKO is a free data retrieval call binding the contract method 0x8219c09e. +// +// Solidity: function MAX_NEKO() view returns(uint256) +func (_Neko *NekoCaller) MAXNEKO(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Neko.contract.Call(opts, &out, "MAX_NEKO") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// MAXNEKO is a free data retrieval call binding the contract method 0x8219c09e. +// +// Solidity: function MAX_NEKO() view returns(uint256) +func (_Neko *NekoSession) MAXNEKO() (*big.Int, error) { + return _Neko.Contract.MAXNEKO(&_Neko.CallOpts) +} + +// MAXNEKO is a free data retrieval call binding the contract method 0x8219c09e. +// +// Solidity: function MAX_NEKO() view returns(uint256) +func (_Neko *NekoCallerSession) MAXNEKO() (*big.Int, error) { + return _Neko.Contract.MAXNEKO(&_Neko.CallOpts) +} + +// NROFSUPPORTEDTOKEN is a free data retrieval call binding the contract method 0xa8b76e51. +// +// Solidity: function NR_OF_SUPPORTED_TOKEN() view returns(uint16) +func (_Neko *NekoCaller) NROFSUPPORTEDTOKEN(opts *bind.CallOpts) (uint16, error) { + var out []interface{} + err := _Neko.contract.Call(opts, &out, "NR_OF_SUPPORTED_TOKEN") + + if err != nil { + return *new(uint16), err + } + + out0 := *abi.ConvertType(out[0], new(uint16)).(*uint16) + + return out0, err + +} + +// NROFSUPPORTEDTOKEN is a free data retrieval call binding the contract method 0xa8b76e51. +// +// Solidity: function NR_OF_SUPPORTED_TOKEN() view returns(uint16) +func (_Neko *NekoSession) NROFSUPPORTEDTOKEN() (uint16, error) { + return _Neko.Contract.NROFSUPPORTEDTOKEN(&_Neko.CallOpts) +} + +// NROFSUPPORTEDTOKEN is a free data retrieval call binding the contract method 0xa8b76e51. +// +// Solidity: function NR_OF_SUPPORTED_TOKEN() view returns(uint16) +func (_Neko *NekoCallerSession) NROFSUPPORTEDTOKEN() (uint16, error) { + return _Neko.Contract.NROFSUPPORTEDTOKEN(&_Neko.CallOpts) +} + +// WHITELISTPRICE is a free data retrieval call binding the contract method 0x17e7f295. +// +// Solidity: function WHITELIST_PRICE() view returns(uint256) +func (_Neko *NekoCaller) WHITELISTPRICE(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Neko.contract.Call(opts, &out, "WHITELIST_PRICE") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// WHITELISTPRICE is a free data retrieval call binding the contract method 0x17e7f295. +// +// Solidity: function WHITELIST_PRICE() view returns(uint256) +func (_Neko *NekoSession) WHITELISTPRICE() (*big.Int, error) { + return _Neko.Contract.WHITELISTPRICE(&_Neko.CallOpts) +} + +// WHITELISTPRICE is a free data retrieval call binding the contract method 0x17e7f295. +// +// Solidity: function WHITELIST_PRICE() view returns(uint256) +func (_Neko *NekoCallerSession) WHITELISTPRICE() (*big.Int, error) { + return _Neko.Contract.WHITELISTPRICE(&_Neko.CallOpts) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address owner) view returns(uint256) +func (_Neko *NekoCaller) BalanceOf(opts *bind.CallOpts, owner common.Address) (*big.Int, error) { + var out []interface{} + err := _Neko.contract.Call(opts, &out, "balanceOf", owner) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address owner) view returns(uint256) +func (_Neko *NekoSession) BalanceOf(owner common.Address) (*big.Int, error) { + return _Neko.Contract.BalanceOf(&_Neko.CallOpts, owner) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address owner) view returns(uint256) +func (_Neko *NekoCallerSession) BalanceOf(owner common.Address) (*big.Int, error) { + return _Neko.Contract.BalanceOf(&_Neko.CallOpts, owner) +} + +// Base is a free data retrieval call binding the contract method 0x5001f3b5. +// +// Solidity: function base() view returns(uint256) +func (_Neko *NekoCaller) Base(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Neko.contract.Call(opts, &out, "base") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// Base is a free data retrieval call binding the contract method 0x5001f3b5. +// +// Solidity: function base() view returns(uint256) +func (_Neko *NekoSession) Base() (*big.Int, error) { + return _Neko.Contract.Base(&_Neko.CallOpts) +} + +// Base is a free data retrieval call binding the contract method 0x5001f3b5. +// +// Solidity: function base() view returns(uint256) +func (_Neko *NekoCallerSession) Base() (*big.Int, error) { + return _Neko.Contract.Base(&_Neko.CallOpts) +} + +// CalculatePrice is a free data retrieval call binding the contract method 0xae104265. +// +// Solidity: function calculatePrice(uint256 numNeko) view returns(uint256) +func (_Neko *NekoCaller) CalculatePrice(opts *bind.CallOpts, numNeko *big.Int) (*big.Int, error) { + var out []interface{} + err := _Neko.contract.Call(opts, &out, "calculatePrice", numNeko) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// CalculatePrice is a free data retrieval call binding the contract method 0xae104265. +// +// Solidity: function calculatePrice(uint256 numNeko) view returns(uint256) +func (_Neko *NekoSession) CalculatePrice(numNeko *big.Int) (*big.Int, error) { + return _Neko.Contract.CalculatePrice(&_Neko.CallOpts, numNeko) +} + +// CalculatePrice is a free data retrieval call binding the contract method 0xae104265. +// +// Solidity: function calculatePrice(uint256 numNeko) view returns(uint256) +func (_Neko *NekoCallerSession) CalculatePrice(numNeko *big.Int) (*big.Int, error) { + return _Neko.Contract.CalculatePrice(&_Neko.CallOpts, numNeko) +} + +// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// +// Solidity: function getApproved(uint256 tokenId) view returns(address) +func (_Neko *NekoCaller) GetApproved(opts *bind.CallOpts, tokenId *big.Int) (common.Address, error) { + var out []interface{} + err := _Neko.contract.Call(opts, &out, "getApproved", tokenId) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// +// Solidity: function getApproved(uint256 tokenId) view returns(address) +func (_Neko *NekoSession) GetApproved(tokenId *big.Int) (common.Address, error) { + return _Neko.Contract.GetApproved(&_Neko.CallOpts, tokenId) +} + +// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// +// Solidity: function getApproved(uint256 tokenId) view returns(address) +func (_Neko *NekoCallerSession) GetApproved(tokenId *big.Int) (common.Address, error) { + return _Neko.Contract.GetApproved(&_Neko.CallOpts, tokenId) +} + +// HasSaleStarted is a free data retrieval call binding the contract method 0x1c8b232d. +// +// Solidity: function hasSaleStarted() view returns(bool) +func (_Neko *NekoCaller) HasSaleStarted(opts *bind.CallOpts) (bool, error) { + var out []interface{} + err := _Neko.contract.Call(opts, &out, "hasSaleStarted") + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// HasSaleStarted is a free data retrieval call binding the contract method 0x1c8b232d. +// +// Solidity: function hasSaleStarted() view returns(bool) +func (_Neko *NekoSession) HasSaleStarted() (bool, error) { + return _Neko.Contract.HasSaleStarted(&_Neko.CallOpts) +} + +// HasSaleStarted is a free data retrieval call binding the contract method 0x1c8b232d. +// +// Solidity: function hasSaleStarted() view returns(bool) +func (_Neko *NekoCallerSession) HasSaleStarted() (bool, error) { + return _Neko.Contract.HasSaleStarted(&_Neko.CallOpts) +} + +// HasWhitelistStarted is a free data retrieval call binding the contract method 0xb4f519f1. +// +// Solidity: function hasWhitelistStarted() view returns(bool) +func (_Neko *NekoCaller) HasWhitelistStarted(opts *bind.CallOpts) (bool, error) { + var out []interface{} + err := _Neko.contract.Call(opts, &out, "hasWhitelistStarted") + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// HasWhitelistStarted is a free data retrieval call binding the contract method 0xb4f519f1. +// +// Solidity: function hasWhitelistStarted() view returns(bool) +func (_Neko *NekoSession) HasWhitelistStarted() (bool, error) { + return _Neko.Contract.HasWhitelistStarted(&_Neko.CallOpts) +} + +// HasWhitelistStarted is a free data retrieval call binding the contract method 0xb4f519f1. +// +// Solidity: function hasWhitelistStarted() view returns(bool) +func (_Neko *NekoCallerSession) HasWhitelistStarted() (bool, error) { + return _Neko.Contract.HasWhitelistStarted(&_Neko.CallOpts) +} + +// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// +// Solidity: function isApprovedForAll(address owner, address operator) view returns(bool) +func (_Neko *NekoCaller) IsApprovedForAll(opts *bind.CallOpts, owner common.Address, operator common.Address) (bool, error) { + var out []interface{} + err := _Neko.contract.Call(opts, &out, "isApprovedForAll", owner, operator) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// +// Solidity: function isApprovedForAll(address owner, address operator) view returns(bool) +func (_Neko *NekoSession) IsApprovedForAll(owner common.Address, operator common.Address) (bool, error) { + return _Neko.Contract.IsApprovedForAll(&_Neko.CallOpts, owner, operator) +} + +// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// +// Solidity: function isApprovedForAll(address owner, address operator) view returns(bool) +func (_Neko *NekoCallerSession) IsApprovedForAll(owner common.Address, operator common.Address) (bool, error) { + return _Neko.Contract.IsApprovedForAll(&_Neko.CallOpts, owner, operator) +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_Neko *NekoCaller) Name(opts *bind.CallOpts) (string, error) { + var out []interface{} + err := _Neko.contract.Call(opts, &out, "name") + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_Neko *NekoSession) Name() (string, error) { + return _Neko.Contract.Name(&_Neko.CallOpts) +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_Neko *NekoCallerSession) Name() (string, error) { + return _Neko.Contract.Name(&_Neko.CallOpts) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_Neko *NekoCaller) Owner(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _Neko.contract.Call(opts, &out, "owner") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_Neko *NekoSession) Owner() (common.Address, error) { + return _Neko.Contract.Owner(&_Neko.CallOpts) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_Neko *NekoCallerSession) Owner() (common.Address, error) { + return _Neko.Contract.Owner(&_Neko.CallOpts) +} + +// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// +// Solidity: function ownerOf(uint256 tokenId) view returns(address) +func (_Neko *NekoCaller) OwnerOf(opts *bind.CallOpts, tokenId *big.Int) (common.Address, error) { + var out []interface{} + err := _Neko.contract.Call(opts, &out, "ownerOf", tokenId) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// +// Solidity: function ownerOf(uint256 tokenId) view returns(address) +func (_Neko *NekoSession) OwnerOf(tokenId *big.Int) (common.Address, error) { + return _Neko.Contract.OwnerOf(&_Neko.CallOpts, tokenId) +} + +// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// +// Solidity: function ownerOf(uint256 tokenId) view returns(address) +func (_Neko *NekoCallerSession) OwnerOf(tokenId *big.Int) (common.Address, error) { + return _Neko.Contract.OwnerOf(&_Neko.CallOpts, tokenId) +} + +// SupportedToken is a free data retrieval call binding the contract method 0x35bc5db3. +// +// Solidity: function supportedToken(uint8 ) view returns(address tokenAddress, uint256 conversionRate, uint8 tokenId, string symbol, bool initialized, bool supported) +func (_Neko *NekoCaller) SupportedToken(opts *bind.CallOpts, arg0 uint8) (struct { + TokenAddress common.Address + ConversionRate *big.Int + TokenId uint8 + Symbol string + Initialized bool + Supported bool +}, error) { + var out []interface{} + err := _Neko.contract.Call(opts, &out, "supportedToken", arg0) + + outstruct := new(struct { + TokenAddress common.Address + ConversionRate *big.Int + TokenId uint8 + Symbol string + Initialized bool + Supported bool + }) + if err != nil { + return *outstruct, err + } + + outstruct.TokenAddress = *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + outstruct.ConversionRate = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + outstruct.TokenId = *abi.ConvertType(out[2], new(uint8)).(*uint8) + outstruct.Symbol = *abi.ConvertType(out[3], new(string)).(*string) + outstruct.Initialized = *abi.ConvertType(out[4], new(bool)).(*bool) + outstruct.Supported = *abi.ConvertType(out[5], new(bool)).(*bool) + + return *outstruct, err + +} + +// SupportedToken is a free data retrieval call binding the contract method 0x35bc5db3. +// +// Solidity: function supportedToken(uint8 ) view returns(address tokenAddress, uint256 conversionRate, uint8 tokenId, string symbol, bool initialized, bool supported) +func (_Neko *NekoSession) SupportedToken(arg0 uint8) (struct { + TokenAddress common.Address + ConversionRate *big.Int + TokenId uint8 + Symbol string + Initialized bool + Supported bool +}, error) { + return _Neko.Contract.SupportedToken(&_Neko.CallOpts, arg0) +} + +// SupportedToken is a free data retrieval call binding the contract method 0x35bc5db3. +// +// Solidity: function supportedToken(uint8 ) view returns(address tokenAddress, uint256 conversionRate, uint8 tokenId, string symbol, bool initialized, bool supported) +func (_Neko *NekoCallerSession) SupportedToken(arg0 uint8) (struct { + TokenAddress common.Address + ConversionRate *big.Int + TokenId uint8 + Symbol string + Initialized bool + Supported bool +}, error) { + return _Neko.Contract.SupportedToken(&_Neko.CallOpts, arg0) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_Neko *NekoCaller) SupportsInterface(opts *bind.CallOpts, interfaceId [4]byte) (bool, error) { + var out []interface{} + err := _Neko.contract.Call(opts, &out, "supportsInterface", interfaceId) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_Neko *NekoSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _Neko.Contract.SupportsInterface(&_Neko.CallOpts, interfaceId) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_Neko *NekoCallerSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _Neko.Contract.SupportsInterface(&_Neko.CallOpts, interfaceId) +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_Neko *NekoCaller) Symbol(opts *bind.CallOpts) (string, error) { + var out []interface{} + err := _Neko.contract.Call(opts, &out, "symbol") + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_Neko *NekoSession) Symbol() (string, error) { + return _Neko.Contract.Symbol(&_Neko.CallOpts) +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_Neko *NekoCallerSession) Symbol() (string, error) { + return _Neko.Contract.Symbol(&_Neko.CallOpts) +} + +// TokenByIndex is a free data retrieval call binding the contract method 0x4f6ccce7. +// +// Solidity: function tokenByIndex(uint256 index) view returns(uint256) +func (_Neko *NekoCaller) TokenByIndex(opts *bind.CallOpts, index *big.Int) (*big.Int, error) { + var out []interface{} + err := _Neko.contract.Call(opts, &out, "tokenByIndex", index) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// TokenByIndex is a free data retrieval call binding the contract method 0x4f6ccce7. +// +// Solidity: function tokenByIndex(uint256 index) view returns(uint256) +func (_Neko *NekoSession) TokenByIndex(index *big.Int) (*big.Int, error) { + return _Neko.Contract.TokenByIndex(&_Neko.CallOpts, index) +} + +// TokenByIndex is a free data retrieval call binding the contract method 0x4f6ccce7. +// +// Solidity: function tokenByIndex(uint256 index) view returns(uint256) +func (_Neko *NekoCallerSession) TokenByIndex(index *big.Int) (*big.Int, error) { + return _Neko.Contract.TokenByIndex(&_Neko.CallOpts, index) +} + +// TokenOfOwnerByIndex is a free data retrieval call binding the contract method 0x2f745c59. +// +// Solidity: function tokenOfOwnerByIndex(address owner, uint256 index) view returns(uint256) +func (_Neko *NekoCaller) TokenOfOwnerByIndex(opts *bind.CallOpts, owner common.Address, index *big.Int) (*big.Int, error) { + var out []interface{} + err := _Neko.contract.Call(opts, &out, "tokenOfOwnerByIndex", owner, index) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// TokenOfOwnerByIndex is a free data retrieval call binding the contract method 0x2f745c59. +// +// Solidity: function tokenOfOwnerByIndex(address owner, uint256 index) view returns(uint256) +func (_Neko *NekoSession) TokenOfOwnerByIndex(owner common.Address, index *big.Int) (*big.Int, error) { + return _Neko.Contract.TokenOfOwnerByIndex(&_Neko.CallOpts, owner, index) +} + +// TokenOfOwnerByIndex is a free data retrieval call binding the contract method 0x2f745c59. +// +// Solidity: function tokenOfOwnerByIndex(address owner, uint256 index) view returns(uint256) +func (_Neko *NekoCallerSession) TokenOfOwnerByIndex(owner common.Address, index *big.Int) (*big.Int, error) { + return _Neko.Contract.TokenOfOwnerByIndex(&_Neko.CallOpts, owner, index) +} + +// TokenURI is a free data retrieval call binding the contract method 0xc87b56dd. +// +// Solidity: function tokenURI(uint256 _tokenId) view returns(string) +func (_Neko *NekoCaller) TokenURI(opts *bind.CallOpts, _tokenId *big.Int) (string, error) { + var out []interface{} + err := _Neko.contract.Call(opts, &out, "tokenURI", _tokenId) + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// TokenURI is a free data retrieval call binding the contract method 0xc87b56dd. +// +// Solidity: function tokenURI(uint256 _tokenId) view returns(string) +func (_Neko *NekoSession) TokenURI(_tokenId *big.Int) (string, error) { + return _Neko.Contract.TokenURI(&_Neko.CallOpts, _tokenId) +} + +// TokenURI is a free data retrieval call binding the contract method 0xc87b56dd. +// +// Solidity: function tokenURI(uint256 _tokenId) view returns(string) +func (_Neko *NekoCallerSession) TokenURI(_tokenId *big.Int) (string, error) { + return _Neko.Contract.TokenURI(&_Neko.CallOpts, _tokenId) +} + +// TokensOfOwner is a free data retrieval call binding the contract method 0x8462151c. +// +// Solidity: function tokensOfOwner(address _owner) view returns(uint256[]) +func (_Neko *NekoCaller) TokensOfOwner(opts *bind.CallOpts, _owner common.Address) ([]*big.Int, error) { + var out []interface{} + err := _Neko.contract.Call(opts, &out, "tokensOfOwner", _owner) + + if err != nil { + return *new([]*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new([]*big.Int)).(*[]*big.Int) + + return out0, err + +} + +// TokensOfOwner is a free data retrieval call binding the contract method 0x8462151c. +// +// Solidity: function tokensOfOwner(address _owner) view returns(uint256[]) +func (_Neko *NekoSession) TokensOfOwner(_owner common.Address) ([]*big.Int, error) { + return _Neko.Contract.TokensOfOwner(&_Neko.CallOpts, _owner) +} + +// TokensOfOwner is a free data retrieval call binding the contract method 0x8462151c. +// +// Solidity: function tokensOfOwner(address _owner) view returns(uint256[]) +func (_Neko *NekoCallerSession) TokensOfOwner(_owner common.Address) ([]*big.Int, error) { + return _Neko.Contract.TokensOfOwner(&_Neko.CallOpts, _owner) +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_Neko *NekoCaller) TotalSupply(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Neko.contract.Call(opts, &out, "totalSupply") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_Neko *NekoSession) TotalSupply() (*big.Int, error) { + return _Neko.Contract.TotalSupply(&_Neko.CallOpts) +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_Neko *NekoCallerSession) TotalSupply() (*big.Int, error) { + return _Neko.Contract.TotalSupply(&_Neko.CallOpts) +} + +// Whitelister is a free data retrieval call binding the contract method 0x0c7253cf. +// +// Solidity: function whitelister(address ) view returns(bool) +func (_Neko *NekoCaller) Whitelister(opts *bind.CallOpts, arg0 common.Address) (bool, error) { + var out []interface{} + err := _Neko.contract.Call(opts, &out, "whitelister", arg0) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// Whitelister is a free data retrieval call binding the contract method 0x0c7253cf. +// +// Solidity: function whitelister(address ) view returns(bool) +func (_Neko *NekoSession) Whitelister(arg0 common.Address) (bool, error) { + return _Neko.Contract.Whitelister(&_Neko.CallOpts, arg0) +} + +// Whitelister is a free data retrieval call binding the contract method 0x0c7253cf. +// +// Solidity: function whitelister(address ) view returns(bool) +func (_Neko *NekoCallerSession) Whitelister(arg0 common.Address) (bool, error) { + return _Neko.Contract.Whitelister(&_Neko.CallOpts, arg0) +} + +// AddWhitelists is a paid mutator transaction binding the contract method 0xc8eaf28f. +// +// Solidity: function addWhitelists(address[] addresses) returns() +func (_Neko *NekoTransactor) AddWhitelists(opts *bind.TransactOpts, addresses []common.Address) (*types.Transaction, error) { + return _Neko.contract.Transact(opts, "addWhitelists", addresses) +} + +// AddWhitelists is a paid mutator transaction binding the contract method 0xc8eaf28f. +// +// Solidity: function addWhitelists(address[] addresses) returns() +func (_Neko *NekoSession) AddWhitelists(addresses []common.Address) (*types.Transaction, error) { + return _Neko.Contract.AddWhitelists(&_Neko.TransactOpts, addresses) +} + +// AddWhitelists is a paid mutator transaction binding the contract method 0xc8eaf28f. +// +// Solidity: function addWhitelists(address[] addresses) returns() +func (_Neko *NekoTransactorSession) AddWhitelists(addresses []common.Address) (*types.Transaction, error) { + return _Neko.Contract.AddWhitelists(&_Neko.TransactOpts, addresses) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address to, uint256 tokenId) returns() +func (_Neko *NekoTransactor) Approve(opts *bind.TransactOpts, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _Neko.contract.Transact(opts, "approve", to, tokenId) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address to, uint256 tokenId) returns() +func (_Neko *NekoSession) Approve(to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _Neko.Contract.Approve(&_Neko.TransactOpts, to, tokenId) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address to, uint256 tokenId) returns() +func (_Neko *NekoTransactorSession) Approve(to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _Neko.Contract.Approve(&_Neko.TransactOpts, to, tokenId) +} + +// MintNeko is a paid mutator transaction binding the contract method 0x19d9d446. +// +// Solidity: function mintNeko(uint256 numNeko) payable returns() +func (_Neko *NekoTransactor) MintNeko(opts *bind.TransactOpts, numNeko *big.Int) (*types.Transaction, error) { + return _Neko.contract.Transact(opts, "mintNeko", numNeko) +} + +// MintNeko is a paid mutator transaction binding the contract method 0x19d9d446. +// +// Solidity: function mintNeko(uint256 numNeko) payable returns() +func (_Neko *NekoSession) MintNeko(numNeko *big.Int) (*types.Transaction, error) { + return _Neko.Contract.MintNeko(&_Neko.TransactOpts, numNeko) +} + +// MintNeko is a paid mutator transaction binding the contract method 0x19d9d446. +// +// Solidity: function mintNeko(uint256 numNeko) payable returns() +func (_Neko *NekoTransactorSession) MintNeko(numNeko *big.Int) (*types.Transaction, error) { + return _Neko.Contract.MintNeko(&_Neko.TransactOpts, numNeko) +} + +// MintNekoByCustomToken is a paid mutator transaction binding the contract method 0x5cedb52f. +// +// Solidity: function mintNekoByCustomToken(uint256 numNeko, uint256 amount, uint8 tokenId) returns() +func (_Neko *NekoTransactor) MintNekoByCustomToken(opts *bind.TransactOpts, numNeko *big.Int, amount *big.Int, tokenId uint8) (*types.Transaction, error) { + return _Neko.contract.Transact(opts, "mintNekoByCustomToken", numNeko, amount, tokenId) +} + +// MintNekoByCustomToken is a paid mutator transaction binding the contract method 0x5cedb52f. +// +// Solidity: function mintNekoByCustomToken(uint256 numNeko, uint256 amount, uint8 tokenId) returns() +func (_Neko *NekoSession) MintNekoByCustomToken(numNeko *big.Int, amount *big.Int, tokenId uint8) (*types.Transaction, error) { + return _Neko.Contract.MintNekoByCustomToken(&_Neko.TransactOpts, numNeko, amount, tokenId) +} + +// MintNekoByCustomToken is a paid mutator transaction binding the contract method 0x5cedb52f. +// +// Solidity: function mintNekoByCustomToken(uint256 numNeko, uint256 amount, uint8 tokenId) returns() +func (_Neko *NekoTransactorSession) MintNekoByCustomToken(numNeko *big.Int, amount *big.Int, tokenId uint8) (*types.Transaction, error) { + return _Neko.Contract.MintNekoByCustomToken(&_Neko.TransactOpts, numNeko, amount, tokenId) +} + +// MintWhitelist is a paid mutator transaction binding the contract method 0x2d3df31f. +// +// Solidity: function mintWhitelist() payable returns() +func (_Neko *NekoTransactor) MintWhitelist(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Neko.contract.Transact(opts, "mintWhitelist") +} + +// MintWhitelist is a paid mutator transaction binding the contract method 0x2d3df31f. +// +// Solidity: function mintWhitelist() payable returns() +func (_Neko *NekoSession) MintWhitelist() (*types.Transaction, error) { + return _Neko.Contract.MintWhitelist(&_Neko.TransactOpts) +} + +// MintWhitelist is a paid mutator transaction binding the contract method 0x2d3df31f. +// +// Solidity: function mintWhitelist() payable returns() +func (_Neko *NekoTransactorSession) MintWhitelist() (*types.Transaction, error) { + return _Neko.Contract.MintWhitelist(&_Neko.TransactOpts) +} + +// MintWhitelistByCustomToken is a paid mutator transaction binding the contract method 0x4ac5f9b2. +// +// Solidity: function mintWhitelistByCustomToken(uint256 amount, uint8 tokenId) returns() +func (_Neko *NekoTransactor) MintWhitelistByCustomToken(opts *bind.TransactOpts, amount *big.Int, tokenId uint8) (*types.Transaction, error) { + return _Neko.contract.Transact(opts, "mintWhitelistByCustomToken", amount, tokenId) +} + +// MintWhitelistByCustomToken is a paid mutator transaction binding the contract method 0x4ac5f9b2. +// +// Solidity: function mintWhitelistByCustomToken(uint256 amount, uint8 tokenId) returns() +func (_Neko *NekoSession) MintWhitelistByCustomToken(amount *big.Int, tokenId uint8) (*types.Transaction, error) { + return _Neko.Contract.MintWhitelistByCustomToken(&_Neko.TransactOpts, amount, tokenId) +} + +// MintWhitelistByCustomToken is a paid mutator transaction binding the contract method 0x4ac5f9b2. +// +// Solidity: function mintWhitelistByCustomToken(uint256 amount, uint8 tokenId) returns() +func (_Neko *NekoTransactorSession) MintWhitelistByCustomToken(amount *big.Int, tokenId uint8) (*types.Transaction, error) { + return _Neko.Contract.MintWhitelistByCustomToken(&_Neko.TransactOpts, amount, tokenId) +} + +// PauseSale is a paid mutator transaction binding the contract method 0x55367ba9. +// +// Solidity: function pauseSale() returns() +func (_Neko *NekoTransactor) PauseSale(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Neko.contract.Transact(opts, "pauseSale") +} + +// PauseSale is a paid mutator transaction binding the contract method 0x55367ba9. +// +// Solidity: function pauseSale() returns() +func (_Neko *NekoSession) PauseSale() (*types.Transaction, error) { + return _Neko.Contract.PauseSale(&_Neko.TransactOpts) +} + +// PauseSale is a paid mutator transaction binding the contract method 0x55367ba9. +// +// Solidity: function pauseSale() returns() +func (_Neko *NekoTransactorSession) PauseSale() (*types.Transaction, error) { + return _Neko.Contract.PauseSale(&_Neko.TransactOpts) +} + +// PauseWhitelistSale is a paid mutator transaction binding the contract method 0x0d0dcda5. +// +// Solidity: function pauseWhitelistSale() returns() +func (_Neko *NekoTransactor) PauseWhitelistSale(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Neko.contract.Transact(opts, "pauseWhitelistSale") +} + +// PauseWhitelistSale is a paid mutator transaction binding the contract method 0x0d0dcda5. +// +// Solidity: function pauseWhitelistSale() returns() +func (_Neko *NekoSession) PauseWhitelistSale() (*types.Transaction, error) { + return _Neko.Contract.PauseWhitelistSale(&_Neko.TransactOpts) +} + +// PauseWhitelistSale is a paid mutator transaction binding the contract method 0x0d0dcda5. +// +// Solidity: function pauseWhitelistSale() returns() +func (_Neko *NekoTransactorSession) PauseWhitelistSale() (*types.Transaction, error) { + return _Neko.Contract.PauseWhitelistSale(&_Neko.TransactOpts) +} + +// RemoveWhitelist is a paid mutator transaction binding the contract method 0x23245216. +// +// Solidity: function removeWhitelist(address[] addresses) returns() +func (_Neko *NekoTransactor) RemoveWhitelist(opts *bind.TransactOpts, addresses []common.Address) (*types.Transaction, error) { + return _Neko.contract.Transact(opts, "removeWhitelist", addresses) +} + +// RemoveWhitelist is a paid mutator transaction binding the contract method 0x23245216. +// +// Solidity: function removeWhitelist(address[] addresses) returns() +func (_Neko *NekoSession) RemoveWhitelist(addresses []common.Address) (*types.Transaction, error) { + return _Neko.Contract.RemoveWhitelist(&_Neko.TransactOpts, addresses) +} + +// RemoveWhitelist is a paid mutator transaction binding the contract method 0x23245216. +// +// Solidity: function removeWhitelist(address[] addresses) returns() +func (_Neko *NekoTransactorSession) RemoveWhitelist(addresses []common.Address) (*types.Transaction, error) { + return _Neko.Contract.RemoveWhitelist(&_Neko.TransactOpts, addresses) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_Neko *NekoTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Neko.contract.Transact(opts, "renounceOwnership") +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_Neko *NekoSession) RenounceOwnership() (*types.Transaction, error) { + return _Neko.Contract.RenounceOwnership(&_Neko.TransactOpts) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_Neko *NekoTransactorSession) RenounceOwnership() (*types.Transaction, error) { + return _Neko.Contract.RenounceOwnership(&_Neko.TransactOpts) +} + +// ReserveGiveaway is a paid mutator transaction binding the contract method 0xa40f1aa5. +// +// Solidity: function reserveGiveaway(uint256 numNeko) returns() +func (_Neko *NekoTransactor) ReserveGiveaway(opts *bind.TransactOpts, numNeko *big.Int) (*types.Transaction, error) { + return _Neko.contract.Transact(opts, "reserveGiveaway", numNeko) +} + +// ReserveGiveaway is a paid mutator transaction binding the contract method 0xa40f1aa5. +// +// Solidity: function reserveGiveaway(uint256 numNeko) returns() +func (_Neko *NekoSession) ReserveGiveaway(numNeko *big.Int) (*types.Transaction, error) { + return _Neko.Contract.ReserveGiveaway(&_Neko.TransactOpts, numNeko) +} + +// ReserveGiveaway is a paid mutator transaction binding the contract method 0xa40f1aa5. +// +// Solidity: function reserveGiveaway(uint256 numNeko) returns() +func (_Neko *NekoTransactorSession) ReserveGiveaway(numNeko *big.Int) (*types.Transaction, error) { + return _Neko.Contract.ReserveGiveaway(&_Neko.TransactOpts, numNeko) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() +func (_Neko *NekoTransactor) SafeTransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _Neko.contract.Transact(opts, "safeTransferFrom", from, to, tokenId) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() +func (_Neko *NekoSession) SafeTransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _Neko.Contract.SafeTransferFrom(&_Neko.TransactOpts, from, to, tokenId) +} + +// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() +func (_Neko *NekoTransactorSession) SafeTransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _Neko.Contract.SafeTransferFrom(&_Neko.TransactOpts, from, to, tokenId) +} + +// SafeTransferFrom0 is a paid mutator transaction binding the contract method 0xb88d4fde. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId, bytes _data) returns() +func (_Neko *NekoTransactor) SafeTransferFrom0(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int, _data []byte) (*types.Transaction, error) { + return _Neko.contract.Transact(opts, "safeTransferFrom0", from, to, tokenId, _data) +} + +// SafeTransferFrom0 is a paid mutator transaction binding the contract method 0xb88d4fde. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId, bytes _data) returns() +func (_Neko *NekoSession) SafeTransferFrom0(from common.Address, to common.Address, tokenId *big.Int, _data []byte) (*types.Transaction, error) { + return _Neko.Contract.SafeTransferFrom0(&_Neko.TransactOpts, from, to, tokenId, _data) +} + +// SafeTransferFrom0 is a paid mutator transaction binding the contract method 0xb88d4fde. +// +// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId, bytes _data) returns() +func (_Neko *NekoTransactorSession) SafeTransferFrom0(from common.Address, to common.Address, tokenId *big.Int, _data []byte) (*types.Transaction, error) { + return _Neko.Contract.SafeTransferFrom0(&_Neko.TransactOpts, from, to, tokenId, _data) +} + +// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// +// Solidity: function setApprovalForAll(address operator, bool approved) returns() +func (_Neko *NekoTransactor) SetApprovalForAll(opts *bind.TransactOpts, operator common.Address, approved bool) (*types.Transaction, error) { + return _Neko.contract.Transact(opts, "setApprovalForAll", operator, approved) +} + +// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// +// Solidity: function setApprovalForAll(address operator, bool approved) returns() +func (_Neko *NekoSession) SetApprovalForAll(operator common.Address, approved bool) (*types.Transaction, error) { + return _Neko.Contract.SetApprovalForAll(&_Neko.TransactOpts, operator, approved) +} + +// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// +// Solidity: function setApprovalForAll(address operator, bool approved) returns() +func (_Neko *NekoTransactorSession) SetApprovalForAll(operator common.Address, approved bool) (*types.Transaction, error) { + return _Neko.Contract.SetApprovalForAll(&_Neko.TransactOpts, operator, approved) +} + +// SetBaseURI is a paid mutator transaction binding the contract method 0x55f804b3. +// +// Solidity: function setBaseURI(string _baseURI) returns() +func (_Neko *NekoTransactor) SetBaseURI(opts *bind.TransactOpts, _baseURI string) (*types.Transaction, error) { + return _Neko.contract.Transact(opts, "setBaseURI", _baseURI) +} + +// SetBaseURI is a paid mutator transaction binding the contract method 0x55f804b3. +// +// Solidity: function setBaseURI(string _baseURI) returns() +func (_Neko *NekoSession) SetBaseURI(_baseURI string) (*types.Transaction, error) { + return _Neko.Contract.SetBaseURI(&_Neko.TransactOpts, _baseURI) +} + +// SetBaseURI is a paid mutator transaction binding the contract method 0x55f804b3. +// +// Solidity: function setBaseURI(string _baseURI) returns() +func (_Neko *NekoTransactorSession) SetBaseURI(_baseURI string) (*types.Transaction, error) { + return _Neko.Contract.SetBaseURI(&_Neko.TransactOpts, _baseURI) +} + +// SetRevealer is a paid mutator transaction binding the contract method 0xc17c3fe3. +// +// Solidity: function setRevealer(address _revealer) returns() +func (_Neko *NekoTransactor) SetRevealer(opts *bind.TransactOpts, _revealer common.Address) (*types.Transaction, error) { + return _Neko.contract.Transact(opts, "setRevealer", _revealer) +} + +// SetRevealer is a paid mutator transaction binding the contract method 0xc17c3fe3. +// +// Solidity: function setRevealer(address _revealer) returns() +func (_Neko *NekoSession) SetRevealer(_revealer common.Address) (*types.Transaction, error) { + return _Neko.Contract.SetRevealer(&_Neko.TransactOpts, _revealer) +} + +// SetRevealer is a paid mutator transaction binding the contract method 0xc17c3fe3. +// +// Solidity: function setRevealer(address _revealer) returns() +func (_Neko *NekoTransactorSession) SetRevealer(_revealer common.Address) (*types.Transaction, error) { + return _Neko.Contract.SetRevealer(&_Neko.TransactOpts, _revealer) +} + +// SetSupportedToken is a paid mutator transaction binding the contract method 0x91bfc1e2. +// +// Solidity: function setSupportedToken(uint8 tokenId, address tokenAddress, uint256 conversionRate, string symbol) returns() +func (_Neko *NekoTransactor) SetSupportedToken(opts *bind.TransactOpts, tokenId uint8, tokenAddress common.Address, conversionRate *big.Int, symbol string) (*types.Transaction, error) { + return _Neko.contract.Transact(opts, "setSupportedToken", tokenId, tokenAddress, conversionRate, symbol) +} + +// SetSupportedToken is a paid mutator transaction binding the contract method 0x91bfc1e2. +// +// Solidity: function setSupportedToken(uint8 tokenId, address tokenAddress, uint256 conversionRate, string symbol) returns() +func (_Neko *NekoSession) SetSupportedToken(tokenId uint8, tokenAddress common.Address, conversionRate *big.Int, symbol string) (*types.Transaction, error) { + return _Neko.Contract.SetSupportedToken(&_Neko.TransactOpts, tokenId, tokenAddress, conversionRate, symbol) +} + +// SetSupportedToken is a paid mutator transaction binding the contract method 0x91bfc1e2. +// +// Solidity: function setSupportedToken(uint8 tokenId, address tokenAddress, uint256 conversionRate, string symbol) returns() +func (_Neko *NekoTransactorSession) SetSupportedToken(tokenId uint8, tokenAddress common.Address, conversionRate *big.Int, symbol string) (*types.Transaction, error) { + return _Neko.Contract.SetSupportedToken(&_Neko.TransactOpts, tokenId, tokenAddress, conversionRate, symbol) +} + +// StartSale is a paid mutator transaction binding the contract method 0xb66a0e5d. +// +// Solidity: function startSale() returns() +func (_Neko *NekoTransactor) StartSale(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Neko.contract.Transact(opts, "startSale") +} + +// StartSale is a paid mutator transaction binding the contract method 0xb66a0e5d. +// +// Solidity: function startSale() returns() +func (_Neko *NekoSession) StartSale() (*types.Transaction, error) { + return _Neko.Contract.StartSale(&_Neko.TransactOpts) +} + +// StartSale is a paid mutator transaction binding the contract method 0xb66a0e5d. +// +// Solidity: function startSale() returns() +func (_Neko *NekoTransactorSession) StartSale() (*types.Transaction, error) { + return _Neko.Contract.StartSale(&_Neko.TransactOpts) +} + +// StartWhitelistSale is a paid mutator transaction binding the contract method 0xff44e915. +// +// Solidity: function startWhitelistSale() returns() +func (_Neko *NekoTransactor) StartWhitelistSale(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Neko.contract.Transact(opts, "startWhitelistSale") +} + +// StartWhitelistSale is a paid mutator transaction binding the contract method 0xff44e915. +// +// Solidity: function startWhitelistSale() returns() +func (_Neko *NekoSession) StartWhitelistSale() (*types.Transaction, error) { + return _Neko.Contract.StartWhitelistSale(&_Neko.TransactOpts) +} + +// StartWhitelistSale is a paid mutator transaction binding the contract method 0xff44e915. +// +// Solidity: function startWhitelistSale() returns() +func (_Neko *NekoTransactorSession) StartWhitelistSale() (*types.Transaction, error) { + return _Neko.Contract.StartWhitelistSale(&_Neko.TransactOpts) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 tokenId) returns() +func (_Neko *NekoTransactor) TransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _Neko.contract.Transact(opts, "transferFrom", from, to, tokenId) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 tokenId) returns() +func (_Neko *NekoSession) TransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _Neko.Contract.TransferFrom(&_Neko.TransactOpts, from, to, tokenId) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 tokenId) returns() +func (_Neko *NekoTransactorSession) TransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { + return _Neko.Contract.TransferFrom(&_Neko.TransactOpts, from, to, tokenId) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_Neko *NekoTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { + return _Neko.contract.Transact(opts, "transferOwnership", newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_Neko *NekoSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _Neko.Contract.TransferOwnership(&_Neko.TransactOpts, newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_Neko *NekoTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _Neko.Contract.TransferOwnership(&_Neko.TransactOpts, newOwner) +} + +// TurnOffSupportedToken is a paid mutator transaction binding the contract method 0x4a219da1. +// +// Solidity: function turnOffSupportedToken(uint8 tokenId) returns() +func (_Neko *NekoTransactor) TurnOffSupportedToken(opts *bind.TransactOpts, tokenId uint8) (*types.Transaction, error) { + return _Neko.contract.Transact(opts, "turnOffSupportedToken", tokenId) +} + +// TurnOffSupportedToken is a paid mutator transaction binding the contract method 0x4a219da1. +// +// Solidity: function turnOffSupportedToken(uint8 tokenId) returns() +func (_Neko *NekoSession) TurnOffSupportedToken(tokenId uint8) (*types.Transaction, error) { + return _Neko.Contract.TurnOffSupportedToken(&_Neko.TransactOpts, tokenId) +} + +// TurnOffSupportedToken is a paid mutator transaction binding the contract method 0x4a219da1. +// +// Solidity: function turnOffSupportedToken(uint8 tokenId) returns() +func (_Neko *NekoTransactorSession) TurnOffSupportedToken(tokenId uint8) (*types.Transaction, error) { + return _Neko.Contract.TurnOffSupportedToken(&_Neko.TransactOpts, tokenId) +} + +// TurnOnSupportedToken is a paid mutator transaction binding the contract method 0xb79d7ca8. +// +// Solidity: function turnOnSupportedToken(uint8 tokenId) returns() +func (_Neko *NekoTransactor) TurnOnSupportedToken(opts *bind.TransactOpts, tokenId uint8) (*types.Transaction, error) { + return _Neko.contract.Transact(opts, "turnOnSupportedToken", tokenId) +} + +// TurnOnSupportedToken is a paid mutator transaction binding the contract method 0xb79d7ca8. +// +// Solidity: function turnOnSupportedToken(uint8 tokenId) returns() +func (_Neko *NekoSession) TurnOnSupportedToken(tokenId uint8) (*types.Transaction, error) { + return _Neko.Contract.TurnOnSupportedToken(&_Neko.TransactOpts, tokenId) +} + +// TurnOnSupportedToken is a paid mutator transaction binding the contract method 0xb79d7ca8. +// +// Solidity: function turnOnSupportedToken(uint8 tokenId) returns() +func (_Neko *NekoTransactorSession) TurnOnSupportedToken(tokenId uint8) (*types.Transaction, error) { + return _Neko.Contract.TurnOnSupportedToken(&_Neko.TransactOpts, tokenId) +} + +// WithdrawAll is a paid mutator transaction binding the contract method 0x853828b6. +// +// Solidity: function withdrawAll() payable returns() +func (_Neko *NekoTransactor) WithdrawAll(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Neko.contract.Transact(opts, "withdrawAll") +} + +// WithdrawAll is a paid mutator transaction binding the contract method 0x853828b6. +// +// Solidity: function withdrawAll() payable returns() +func (_Neko *NekoSession) WithdrawAll() (*types.Transaction, error) { + return _Neko.Contract.WithdrawAll(&_Neko.TransactOpts) +} + +// WithdrawAll is a paid mutator transaction binding the contract method 0x853828b6. +// +// Solidity: function withdrawAll() payable returns() +func (_Neko *NekoTransactorSession) WithdrawAll() (*types.Transaction, error) { + return _Neko.Contract.WithdrawAll(&_Neko.TransactOpts) +} + +// NekoApprovalIterator is returned from FilterApproval and is used to iterate over the raw logs and unpacked data for Approval events raised by the Neko contract. +type NekoApprovalIterator struct { + Event *NekoApproval // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *NekoApprovalIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(NekoApproval) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(NekoApproval) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *NekoApprovalIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *NekoApprovalIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// NekoApproval represents a Approval event raised by the Neko contract. +type NekoApproval struct { + Owner common.Address + Approved common.Address + TokenId *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterApproval is a free log retrieval operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId) +func (_Neko *NekoFilterer) FilterApproval(opts *bind.FilterOpts, owner []common.Address, approved []common.Address, tokenId []*big.Int) (*NekoApprovalIterator, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var approvedRule []interface{} + for _, approvedItem := range approved { + approvedRule = append(approvedRule, approvedItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _Neko.contract.FilterLogs(opts, "Approval", ownerRule, approvedRule, tokenIdRule) + if err != nil { + return nil, err + } + return &NekoApprovalIterator{contract: _Neko.contract, event: "Approval", logs: logs, sub: sub}, nil +} + +// WatchApproval is a free log subscription operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId) +func (_Neko *NekoFilterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *NekoApproval, owner []common.Address, approved []common.Address, tokenId []*big.Int) (event.Subscription, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var approvedRule []interface{} + for _, approvedItem := range approved { + approvedRule = append(approvedRule, approvedItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _Neko.contract.WatchLogs(opts, "Approval", ownerRule, approvedRule, tokenIdRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(NekoApproval) + if err := _Neko.contract.UnpackLog(event, "Approval", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseApproval is a log parse operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId) +func (_Neko *NekoFilterer) ParseApproval(log types.Log) (*NekoApproval, error) { + event := new(NekoApproval) + if err := _Neko.contract.UnpackLog(event, "Approval", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// NekoApprovalForAllIterator is returned from FilterApprovalForAll and is used to iterate over the raw logs and unpacked data for ApprovalForAll events raised by the Neko contract. +type NekoApprovalForAllIterator struct { + Event *NekoApprovalForAll // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *NekoApprovalForAllIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(NekoApprovalForAll) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(NekoApprovalForAll) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *NekoApprovalForAllIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *NekoApprovalForAllIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// NekoApprovalForAll represents a ApprovalForAll event raised by the Neko contract. +type NekoApprovalForAll struct { + Owner common.Address + Operator common.Address + Approved bool + Raw types.Log // Blockchain specific contextual infos +} + +// FilterApprovalForAll is a free log retrieval operation binding the contract event 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31. +// +// Solidity: event ApprovalForAll(address indexed owner, address indexed operator, bool approved) +func (_Neko *NekoFilterer) FilterApprovalForAll(opts *bind.FilterOpts, owner []common.Address, operator []common.Address) (*NekoApprovalForAllIterator, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var operatorRule []interface{} + for _, operatorItem := range operator { + operatorRule = append(operatorRule, operatorItem) + } + + logs, sub, err := _Neko.contract.FilterLogs(opts, "ApprovalForAll", ownerRule, operatorRule) + if err != nil { + return nil, err + } + return &NekoApprovalForAllIterator{contract: _Neko.contract, event: "ApprovalForAll", logs: logs, sub: sub}, nil +} + +// WatchApprovalForAll is a free log subscription operation binding the contract event 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31. +// +// Solidity: event ApprovalForAll(address indexed owner, address indexed operator, bool approved) +func (_Neko *NekoFilterer) WatchApprovalForAll(opts *bind.WatchOpts, sink chan<- *NekoApprovalForAll, owner []common.Address, operator []common.Address) (event.Subscription, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var operatorRule []interface{} + for _, operatorItem := range operator { + operatorRule = append(operatorRule, operatorItem) + } + + logs, sub, err := _Neko.contract.WatchLogs(opts, "ApprovalForAll", ownerRule, operatorRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(NekoApprovalForAll) + if err := _Neko.contract.UnpackLog(event, "ApprovalForAll", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseApprovalForAll is a log parse operation binding the contract event 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31. +// +// Solidity: event ApprovalForAll(address indexed owner, address indexed operator, bool approved) +func (_Neko *NekoFilterer) ParseApprovalForAll(log types.Log) (*NekoApprovalForAll, error) { + event := new(NekoApprovalForAll) + if err := _Neko.contract.UnpackLog(event, "ApprovalForAll", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// NekoOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the Neko contract. +type NekoOwnershipTransferredIterator struct { + Event *NekoOwnershipTransferred // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *NekoOwnershipTransferredIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(NekoOwnershipTransferred) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(NekoOwnershipTransferred) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *NekoOwnershipTransferredIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *NekoOwnershipTransferredIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// NekoOwnershipTransferred represents a OwnershipTransferred event raised by the Neko contract. +type NekoOwnershipTransferred struct { + PreviousOwner common.Address + NewOwner common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_Neko *NekoFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*NekoOwnershipTransferredIterator, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _Neko.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return &NekoOwnershipTransferredIterator{contract: _Neko.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil +} + +// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_Neko *NekoFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *NekoOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _Neko.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(NekoOwnershipTransferred) + if err := _Neko.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_Neko *NekoFilterer) ParseOwnershipTransferred(log types.Log) (*NekoOwnershipTransferred, error) { + event := new(NekoOwnershipTransferred) + if err := _Neko.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// NekoTransferIterator is returned from FilterTransfer and is used to iterate over the raw logs and unpacked data for Transfer events raised by the Neko contract. +type NekoTransferIterator struct { + Event *NekoTransfer // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *NekoTransferIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(NekoTransfer) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(NekoTransfer) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *NekoTransferIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *NekoTransferIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// NekoTransfer represents a Transfer event raised by the Neko contract. +type NekoTransfer struct { + From common.Address + To common.Address + TokenId *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterTransfer is a free log retrieval operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) +func (_Neko *NekoFilterer) FilterTransfer(opts *bind.FilterOpts, from []common.Address, to []common.Address, tokenId []*big.Int) (*NekoTransferIterator, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _Neko.contract.FilterLogs(opts, "Transfer", fromRule, toRule, tokenIdRule) + if err != nil { + return nil, err + } + return &NekoTransferIterator{contract: _Neko.contract, event: "Transfer", logs: logs, sub: sub}, nil +} + +// WatchTransfer is a free log subscription operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) +func (_Neko *NekoFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *NekoTransfer, from []common.Address, to []common.Address, tokenId []*big.Int) (event.Subscription, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + var tokenIdRule []interface{} + for _, tokenIdItem := range tokenId { + tokenIdRule = append(tokenIdRule, tokenIdItem) + } + + logs, sub, err := _Neko.contract.WatchLogs(opts, "Transfer", fromRule, toRule, tokenIdRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(NekoTransfer) + if err := _Neko.contract.UnpackLog(event, "Transfer", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseTransfer is a log parse operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) +func (_Neko *NekoFilterer) ParseTransfer(log types.Log) (*NekoTransfer, error) { + event := new(NekoTransfer) + if err := _Neko.contract.UnpackLog(event, "Transfer", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/pkg/contract/nekostaking/nekostaking.go b/pkg/contract/nekostaking/nekostaking.go new file mode 100644 index 000000000..bad5518b8 --- /dev/null +++ b/pkg/contract/nekostaking/nekostaking.go @@ -0,0 +1,1380 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package nekostaking + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription +) + +// NekostakingMetaData contains all meta data concerning the Nekostaking contract. +var NekostakingMetaData = &bind.MetaData{ + ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"staker\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"}],\"name\":\"Staked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"staker\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"}],\"name\":\"Unstaked\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"NekoContract\",\"outputs\":[{\"internalType\":\"contractIERC721\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_duration\",\"type\":\"uint256\"}],\"name\":\"addRewardToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"balances\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"disableStaking\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"disableUnstaking\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"earned\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getReward\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"}],\"name\":\"getReward\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"getReward\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contractIERC721\",\"name\":\"_neko\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isPrizeToken\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"lastTimeRewardApplicable\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"reward\",\"type\":\"uint256\"}],\"name\":\"notifyRewardAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"onERC721Received\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"owners\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"rewardInfo\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"periodFinish\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"rewardRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"lastUpdateTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"rewardPerTokenStored\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"rewardBalance\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"rewardPerToken\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rewardTokenLength\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"rewards\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"stake\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"unstake\",\"type\":\"bool\"}],\"name\":\"setDisable\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"rewardDuration\",\"type\":\"uint256\"}],\"name\":\"setRewardDuration\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"tokenIds\",\"type\":\"uint256[]\"},{\"internalType\":\"address\",\"name\":\"staker\",\"type\":\"address\"}],\"name\":\"stakeNekosFor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"tokenIds\",\"type\":\"uint256[]\"}],\"name\":\"unstakeNekos\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"userRewardPerTokenPaid\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", +} + +// NekostakingABI is the input ABI used to generate the binding from. +// Deprecated: Use NekostakingMetaData.ABI instead. +var NekostakingABI = NekostakingMetaData.ABI + +// Nekostaking is an auto generated Go binding around an Ethereum contract. +type Nekostaking struct { + NekostakingCaller // Read-only binding to the contract + NekostakingTransactor // Write-only binding to the contract + NekostakingFilterer // Log filterer for contract events +} + +// NekostakingCaller is an auto generated read-only Go binding around an Ethereum contract. +type NekostakingCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// NekostakingTransactor is an auto generated write-only Go binding around an Ethereum contract. +type NekostakingTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// NekostakingFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type NekostakingFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// NekostakingSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type NekostakingSession struct { + Contract *Nekostaking // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// NekostakingCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type NekostakingCallerSession struct { + Contract *NekostakingCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// NekostakingTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type NekostakingTransactorSession struct { + Contract *NekostakingTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// NekostakingRaw is an auto generated low-level Go binding around an Ethereum contract. +type NekostakingRaw struct { + Contract *Nekostaking // Generic contract binding to access the raw methods on +} + +// NekostakingCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type NekostakingCallerRaw struct { + Contract *NekostakingCaller // Generic read-only contract binding to access the raw methods on +} + +// NekostakingTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type NekostakingTransactorRaw struct { + Contract *NekostakingTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewNekostaking creates a new instance of Nekostaking, bound to a specific deployed contract. +func NewNekostaking(address common.Address, backend bind.ContractBackend) (*Nekostaking, error) { + contract, err := bindNekostaking(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &Nekostaking{NekostakingCaller: NekostakingCaller{contract: contract}, NekostakingTransactor: NekostakingTransactor{contract: contract}, NekostakingFilterer: NekostakingFilterer{contract: contract}}, nil +} + +// NewNekostakingCaller creates a new read-only instance of Nekostaking, bound to a specific deployed contract. +func NewNekostakingCaller(address common.Address, caller bind.ContractCaller) (*NekostakingCaller, error) { + contract, err := bindNekostaking(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &NekostakingCaller{contract: contract}, nil +} + +// NewNekostakingTransactor creates a new write-only instance of Nekostaking, bound to a specific deployed contract. +func NewNekostakingTransactor(address common.Address, transactor bind.ContractTransactor) (*NekostakingTransactor, error) { + contract, err := bindNekostaking(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &NekostakingTransactor{contract: contract}, nil +} + +// NewNekostakingFilterer creates a new log filterer instance of Nekostaking, bound to a specific deployed contract. +func NewNekostakingFilterer(address common.Address, filterer bind.ContractFilterer) (*NekostakingFilterer, error) { + contract, err := bindNekostaking(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &NekostakingFilterer{contract: contract}, nil +} + +// bindNekostaking binds a generic wrapper to an already deployed contract. +func bindNekostaking(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(NekostakingABI)) + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Nekostaking *NekostakingRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Nekostaking.Contract.NekostakingCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Nekostaking *NekostakingRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Nekostaking.Contract.NekostakingTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Nekostaking *NekostakingRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Nekostaking.Contract.NekostakingTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Nekostaking *NekostakingCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Nekostaking.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Nekostaking *NekostakingTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Nekostaking.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Nekostaking *NekostakingTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Nekostaking.Contract.contract.Transact(opts, method, params...) +} + +// NekoContract is a free data retrieval call binding the contract method 0x31046c1d. +// +// Solidity: function NekoContract() view returns(address) +func (_Nekostaking *NekostakingCaller) NekoContract(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _Nekostaking.contract.Call(opts, &out, "NekoContract") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// NekoContract is a free data retrieval call binding the contract method 0x31046c1d. +// +// Solidity: function NekoContract() view returns(address) +func (_Nekostaking *NekostakingSession) NekoContract() (common.Address, error) { + return _Nekostaking.Contract.NekoContract(&_Nekostaking.CallOpts) +} + +// NekoContract is a free data retrieval call binding the contract method 0x31046c1d. +// +// Solidity: function NekoContract() view returns(address) +func (_Nekostaking *NekostakingCallerSession) NekoContract() (common.Address, error) { + return _Nekostaking.Contract.NekoContract(&_Nekostaking.CallOpts) +} + +// Balances is a free data retrieval call binding the contract method 0x27e235e3. +// +// Solidity: function balances(address ) view returns(uint256) +func (_Nekostaking *NekostakingCaller) Balances(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error) { + var out []interface{} + err := _Nekostaking.contract.Call(opts, &out, "balances", arg0) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// Balances is a free data retrieval call binding the contract method 0x27e235e3. +// +// Solidity: function balances(address ) view returns(uint256) +func (_Nekostaking *NekostakingSession) Balances(arg0 common.Address) (*big.Int, error) { + return _Nekostaking.Contract.Balances(&_Nekostaking.CallOpts, arg0) +} + +// Balances is a free data retrieval call binding the contract method 0x27e235e3. +// +// Solidity: function balances(address ) view returns(uint256) +func (_Nekostaking *NekostakingCallerSession) Balances(arg0 common.Address) (*big.Int, error) { + return _Nekostaking.Contract.Balances(&_Nekostaking.CallOpts, arg0) +} + +// DisableStaking is a free data retrieval call binding the contract method 0x28696de2. +// +// Solidity: function disableStaking() view returns(bool) +func (_Nekostaking *NekostakingCaller) DisableStaking(opts *bind.CallOpts) (bool, error) { + var out []interface{} + err := _Nekostaking.contract.Call(opts, &out, "disableStaking") + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// DisableStaking is a free data retrieval call binding the contract method 0x28696de2. +// +// Solidity: function disableStaking() view returns(bool) +func (_Nekostaking *NekostakingSession) DisableStaking() (bool, error) { + return _Nekostaking.Contract.DisableStaking(&_Nekostaking.CallOpts) +} + +// DisableStaking is a free data retrieval call binding the contract method 0x28696de2. +// +// Solidity: function disableStaking() view returns(bool) +func (_Nekostaking *NekostakingCallerSession) DisableStaking() (bool, error) { + return _Nekostaking.Contract.DisableStaking(&_Nekostaking.CallOpts) +} + +// DisableUnstaking is a free data retrieval call binding the contract method 0xb46bbf0e. +// +// Solidity: function disableUnstaking() view returns(bool) +func (_Nekostaking *NekostakingCaller) DisableUnstaking(opts *bind.CallOpts) (bool, error) { + var out []interface{} + err := _Nekostaking.contract.Call(opts, &out, "disableUnstaking") + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// DisableUnstaking is a free data retrieval call binding the contract method 0xb46bbf0e. +// +// Solidity: function disableUnstaking() view returns(bool) +func (_Nekostaking *NekostakingSession) DisableUnstaking() (bool, error) { + return _Nekostaking.Contract.DisableUnstaking(&_Nekostaking.CallOpts) +} + +// DisableUnstaking is a free data retrieval call binding the contract method 0xb46bbf0e. +// +// Solidity: function disableUnstaking() view returns(bool) +func (_Nekostaking *NekostakingCallerSession) DisableUnstaking() (bool, error) { + return _Nekostaking.Contract.DisableUnstaking(&_Nekostaking.CallOpts) +} + +// Earned is a free data retrieval call binding the contract method 0x3e491d47. +// +// Solidity: function earned(address account, uint256 id) view returns(uint256) +func (_Nekostaking *NekostakingCaller) Earned(opts *bind.CallOpts, account common.Address, id *big.Int) (*big.Int, error) { + var out []interface{} + err := _Nekostaking.contract.Call(opts, &out, "earned", account, id) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// Earned is a free data retrieval call binding the contract method 0x3e491d47. +// +// Solidity: function earned(address account, uint256 id) view returns(uint256) +func (_Nekostaking *NekostakingSession) Earned(account common.Address, id *big.Int) (*big.Int, error) { + return _Nekostaking.Contract.Earned(&_Nekostaking.CallOpts, account, id) +} + +// Earned is a free data retrieval call binding the contract method 0x3e491d47. +// +// Solidity: function earned(address account, uint256 id) view returns(uint256) +func (_Nekostaking *NekostakingCallerSession) Earned(account common.Address, id *big.Int) (*big.Int, error) { + return _Nekostaking.Contract.Earned(&_Nekostaking.CallOpts, account, id) +} + +// IsPrizeToken is a free data retrieval call binding the contract method 0xa1100fed. +// +// Solidity: function isPrizeToken(address ) view returns(bool) +func (_Nekostaking *NekostakingCaller) IsPrizeToken(opts *bind.CallOpts, arg0 common.Address) (bool, error) { + var out []interface{} + err := _Nekostaking.contract.Call(opts, &out, "isPrizeToken", arg0) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsPrizeToken is a free data retrieval call binding the contract method 0xa1100fed. +// +// Solidity: function isPrizeToken(address ) view returns(bool) +func (_Nekostaking *NekostakingSession) IsPrizeToken(arg0 common.Address) (bool, error) { + return _Nekostaking.Contract.IsPrizeToken(&_Nekostaking.CallOpts, arg0) +} + +// IsPrizeToken is a free data retrieval call binding the contract method 0xa1100fed. +// +// Solidity: function isPrizeToken(address ) view returns(bool) +func (_Nekostaking *NekostakingCallerSession) IsPrizeToken(arg0 common.Address) (bool, error) { + return _Nekostaking.Contract.IsPrizeToken(&_Nekostaking.CallOpts, arg0) +} + +// LastTimeRewardApplicable is a free data retrieval call binding the contract method 0xeeca1562. +// +// Solidity: function lastTimeRewardApplicable(uint256 id) view returns(uint256) +func (_Nekostaking *NekostakingCaller) LastTimeRewardApplicable(opts *bind.CallOpts, id *big.Int) (*big.Int, error) { + var out []interface{} + err := _Nekostaking.contract.Call(opts, &out, "lastTimeRewardApplicable", id) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// LastTimeRewardApplicable is a free data retrieval call binding the contract method 0xeeca1562. +// +// Solidity: function lastTimeRewardApplicable(uint256 id) view returns(uint256) +func (_Nekostaking *NekostakingSession) LastTimeRewardApplicable(id *big.Int) (*big.Int, error) { + return _Nekostaking.Contract.LastTimeRewardApplicable(&_Nekostaking.CallOpts, id) +} + +// LastTimeRewardApplicable is a free data retrieval call binding the contract method 0xeeca1562. +// +// Solidity: function lastTimeRewardApplicable(uint256 id) view returns(uint256) +func (_Nekostaking *NekostakingCallerSession) LastTimeRewardApplicable(id *big.Int) (*big.Int, error) { + return _Nekostaking.Contract.LastTimeRewardApplicable(&_Nekostaking.CallOpts, id) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_Nekostaking *NekostakingCaller) Owner(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _Nekostaking.contract.Call(opts, &out, "owner") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_Nekostaking *NekostakingSession) Owner() (common.Address, error) { + return _Nekostaking.Contract.Owner(&_Nekostaking.CallOpts) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_Nekostaking *NekostakingCallerSession) Owner() (common.Address, error) { + return _Nekostaking.Contract.Owner(&_Nekostaking.CallOpts) +} + +// Owners is a free data retrieval call binding the contract method 0x025e7c27. +// +// Solidity: function owners(uint256 ) view returns(address) +func (_Nekostaking *NekostakingCaller) Owners(opts *bind.CallOpts, arg0 *big.Int) (common.Address, error) { + var out []interface{} + err := _Nekostaking.contract.Call(opts, &out, "owners", arg0) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Owners is a free data retrieval call binding the contract method 0x025e7c27. +// +// Solidity: function owners(uint256 ) view returns(address) +func (_Nekostaking *NekostakingSession) Owners(arg0 *big.Int) (common.Address, error) { + return _Nekostaking.Contract.Owners(&_Nekostaking.CallOpts, arg0) +} + +// Owners is a free data retrieval call binding the contract method 0x025e7c27. +// +// Solidity: function owners(uint256 ) view returns(address) +func (_Nekostaking *NekostakingCallerSession) Owners(arg0 *big.Int) (common.Address, error) { + return _Nekostaking.Contract.Owners(&_Nekostaking.CallOpts, arg0) +} + +// RewardInfo is a free data retrieval call binding the contract method 0x81a00f83. +// +// Solidity: function rewardInfo(uint256 ) view returns(address rewardToken, uint256 duration, uint256 periodFinish, uint256 rewardRate, uint256 lastUpdateTime, uint256 rewardPerTokenStored, uint256 rewardBalance) +func (_Nekostaking *NekostakingCaller) RewardInfo(opts *bind.CallOpts, arg0 *big.Int) (struct { + RewardToken common.Address + Duration *big.Int + PeriodFinish *big.Int + RewardRate *big.Int + LastUpdateTime *big.Int + RewardPerTokenStored *big.Int + RewardBalance *big.Int +}, error) { + var out []interface{} + err := _Nekostaking.contract.Call(opts, &out, "rewardInfo", arg0) + + outstruct := new(struct { + RewardToken common.Address + Duration *big.Int + PeriodFinish *big.Int + RewardRate *big.Int + LastUpdateTime *big.Int + RewardPerTokenStored *big.Int + RewardBalance *big.Int + }) + if err != nil { + return *outstruct, err + } + + outstruct.RewardToken = *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + outstruct.Duration = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + outstruct.PeriodFinish = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) + outstruct.RewardRate = *abi.ConvertType(out[3], new(*big.Int)).(**big.Int) + outstruct.LastUpdateTime = *abi.ConvertType(out[4], new(*big.Int)).(**big.Int) + outstruct.RewardPerTokenStored = *abi.ConvertType(out[5], new(*big.Int)).(**big.Int) + outstruct.RewardBalance = *abi.ConvertType(out[6], new(*big.Int)).(**big.Int) + + return *outstruct, err + +} + +// RewardInfo is a free data retrieval call binding the contract method 0x81a00f83. +// +// Solidity: function rewardInfo(uint256 ) view returns(address rewardToken, uint256 duration, uint256 periodFinish, uint256 rewardRate, uint256 lastUpdateTime, uint256 rewardPerTokenStored, uint256 rewardBalance) +func (_Nekostaking *NekostakingSession) RewardInfo(arg0 *big.Int) (struct { + RewardToken common.Address + Duration *big.Int + PeriodFinish *big.Int + RewardRate *big.Int + LastUpdateTime *big.Int + RewardPerTokenStored *big.Int + RewardBalance *big.Int +}, error) { + return _Nekostaking.Contract.RewardInfo(&_Nekostaking.CallOpts, arg0) +} + +// RewardInfo is a free data retrieval call binding the contract method 0x81a00f83. +// +// Solidity: function rewardInfo(uint256 ) view returns(address rewardToken, uint256 duration, uint256 periodFinish, uint256 rewardRate, uint256 lastUpdateTime, uint256 rewardPerTokenStored, uint256 rewardBalance) +func (_Nekostaking *NekostakingCallerSession) RewardInfo(arg0 *big.Int) (struct { + RewardToken common.Address + Duration *big.Int + PeriodFinish *big.Int + RewardRate *big.Int + LastUpdateTime *big.Int + RewardPerTokenStored *big.Int + RewardBalance *big.Int +}, error) { + return _Nekostaking.Contract.RewardInfo(&_Nekostaking.CallOpts, arg0) +} + +// RewardPerToken is a free data retrieval call binding the contract method 0x874c120b. +// +// Solidity: function rewardPerToken(uint256 id) view returns(uint256) +func (_Nekostaking *NekostakingCaller) RewardPerToken(opts *bind.CallOpts, id *big.Int) (*big.Int, error) { + var out []interface{} + err := _Nekostaking.contract.Call(opts, &out, "rewardPerToken", id) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// RewardPerToken is a free data retrieval call binding the contract method 0x874c120b. +// +// Solidity: function rewardPerToken(uint256 id) view returns(uint256) +func (_Nekostaking *NekostakingSession) RewardPerToken(id *big.Int) (*big.Int, error) { + return _Nekostaking.Contract.RewardPerToken(&_Nekostaking.CallOpts, id) +} + +// RewardPerToken is a free data retrieval call binding the contract method 0x874c120b. +// +// Solidity: function rewardPerToken(uint256 id) view returns(uint256) +func (_Nekostaking *NekostakingCallerSession) RewardPerToken(id *big.Int) (*big.Int, error) { + return _Nekostaking.Contract.RewardPerToken(&_Nekostaking.CallOpts, id) +} + +// RewardTokenLength is a free data retrieval call binding the contract method 0x857cb94a. +// +// Solidity: function rewardTokenLength() view returns(uint256) +func (_Nekostaking *NekostakingCaller) RewardTokenLength(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Nekostaking.contract.Call(opts, &out, "rewardTokenLength") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// RewardTokenLength is a free data retrieval call binding the contract method 0x857cb94a. +// +// Solidity: function rewardTokenLength() view returns(uint256) +func (_Nekostaking *NekostakingSession) RewardTokenLength() (*big.Int, error) { + return _Nekostaking.Contract.RewardTokenLength(&_Nekostaking.CallOpts) +} + +// RewardTokenLength is a free data retrieval call binding the contract method 0x857cb94a. +// +// Solidity: function rewardTokenLength() view returns(uint256) +func (_Nekostaking *NekostakingCallerSession) RewardTokenLength() (*big.Int, error) { + return _Nekostaking.Contract.RewardTokenLength(&_Nekostaking.CallOpts) +} + +// Rewards is a free data retrieval call binding the contract method 0xe70b9e27. +// +// Solidity: function rewards(address , address ) view returns(uint256) +func (_Nekostaking *NekostakingCaller) Rewards(opts *bind.CallOpts, arg0 common.Address, arg1 common.Address) (*big.Int, error) { + var out []interface{} + err := _Nekostaking.contract.Call(opts, &out, "rewards", arg0, arg1) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// Rewards is a free data retrieval call binding the contract method 0xe70b9e27. +// +// Solidity: function rewards(address , address ) view returns(uint256) +func (_Nekostaking *NekostakingSession) Rewards(arg0 common.Address, arg1 common.Address) (*big.Int, error) { + return _Nekostaking.Contract.Rewards(&_Nekostaking.CallOpts, arg0, arg1) +} + +// Rewards is a free data retrieval call binding the contract method 0xe70b9e27. +// +// Solidity: function rewards(address , address ) view returns(uint256) +func (_Nekostaking *NekostakingCallerSession) Rewards(arg0 common.Address, arg1 common.Address) (*big.Int, error) { + return _Nekostaking.Contract.Rewards(&_Nekostaking.CallOpts, arg0, arg1) +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_Nekostaking *NekostakingCaller) TotalSupply(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Nekostaking.contract.Call(opts, &out, "totalSupply") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_Nekostaking *NekostakingSession) TotalSupply() (*big.Int, error) { + return _Nekostaking.Contract.TotalSupply(&_Nekostaking.CallOpts) +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_Nekostaking *NekostakingCallerSession) TotalSupply() (*big.Int, error) { + return _Nekostaking.Contract.TotalSupply(&_Nekostaking.CallOpts) +} + +// UserRewardPerTokenPaid is a free data retrieval call binding the contract method 0x7035ab98. +// +// Solidity: function userRewardPerTokenPaid(address , address ) view returns(uint256) +func (_Nekostaking *NekostakingCaller) UserRewardPerTokenPaid(opts *bind.CallOpts, arg0 common.Address, arg1 common.Address) (*big.Int, error) { + var out []interface{} + err := _Nekostaking.contract.Call(opts, &out, "userRewardPerTokenPaid", arg0, arg1) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// UserRewardPerTokenPaid is a free data retrieval call binding the contract method 0x7035ab98. +// +// Solidity: function userRewardPerTokenPaid(address , address ) view returns(uint256) +func (_Nekostaking *NekostakingSession) UserRewardPerTokenPaid(arg0 common.Address, arg1 common.Address) (*big.Int, error) { + return _Nekostaking.Contract.UserRewardPerTokenPaid(&_Nekostaking.CallOpts, arg0, arg1) +} + +// UserRewardPerTokenPaid is a free data retrieval call binding the contract method 0x7035ab98. +// +// Solidity: function userRewardPerTokenPaid(address , address ) view returns(uint256) +func (_Nekostaking *NekostakingCallerSession) UserRewardPerTokenPaid(arg0 common.Address, arg1 common.Address) (*big.Int, error) { + return _Nekostaking.Contract.UserRewardPerTokenPaid(&_Nekostaking.CallOpts, arg0, arg1) +} + +// AddRewardToken is a paid mutator transaction binding the contract method 0x0e3802e9. +// +// Solidity: function addRewardToken(address _rewardToken, uint256 _duration) returns() +func (_Nekostaking *NekostakingTransactor) AddRewardToken(opts *bind.TransactOpts, _rewardToken common.Address, _duration *big.Int) (*types.Transaction, error) { + return _Nekostaking.contract.Transact(opts, "addRewardToken", _rewardToken, _duration) +} + +// AddRewardToken is a paid mutator transaction binding the contract method 0x0e3802e9. +// +// Solidity: function addRewardToken(address _rewardToken, uint256 _duration) returns() +func (_Nekostaking *NekostakingSession) AddRewardToken(_rewardToken common.Address, _duration *big.Int) (*types.Transaction, error) { + return _Nekostaking.Contract.AddRewardToken(&_Nekostaking.TransactOpts, _rewardToken, _duration) +} + +// AddRewardToken is a paid mutator transaction binding the contract method 0x0e3802e9. +// +// Solidity: function addRewardToken(address _rewardToken, uint256 _duration) returns() +func (_Nekostaking *NekostakingTransactorSession) AddRewardToken(_rewardToken common.Address, _duration *big.Int) (*types.Transaction, error) { + return _Nekostaking.Contract.AddRewardToken(&_Nekostaking.TransactOpts, _rewardToken, _duration) +} + +// GetReward is a paid mutator transaction binding the contract method 0x3d18b912. +// +// Solidity: function getReward() returns() +func (_Nekostaking *NekostakingTransactor) GetReward(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Nekostaking.contract.Transact(opts, "getReward") +} + +// GetReward is a paid mutator transaction binding the contract method 0x3d18b912. +// +// Solidity: function getReward() returns() +func (_Nekostaking *NekostakingSession) GetReward() (*types.Transaction, error) { + return _Nekostaking.Contract.GetReward(&_Nekostaking.TransactOpts) +} + +// GetReward is a paid mutator transaction binding the contract method 0x3d18b912. +// +// Solidity: function getReward() returns() +func (_Nekostaking *NekostakingTransactorSession) GetReward() (*types.Transaction, error) { + return _Nekostaking.Contract.GetReward(&_Nekostaking.TransactOpts) +} + +// GetReward0 is a paid mutator transaction binding the contract method 0xc00007b0. +// +// Solidity: function getReward(address user) returns() +func (_Nekostaking *NekostakingTransactor) GetReward0(opts *bind.TransactOpts, user common.Address) (*types.Transaction, error) { + return _Nekostaking.contract.Transact(opts, "getReward0", user) +} + +// GetReward0 is a paid mutator transaction binding the contract method 0xc00007b0. +// +// Solidity: function getReward(address user) returns() +func (_Nekostaking *NekostakingSession) GetReward0(user common.Address) (*types.Transaction, error) { + return _Nekostaking.Contract.GetReward0(&_Nekostaking.TransactOpts, user) +} + +// GetReward0 is a paid mutator transaction binding the contract method 0xc00007b0. +// +// Solidity: function getReward(address user) returns() +func (_Nekostaking *NekostakingTransactorSession) GetReward0(user common.Address) (*types.Transaction, error) { + return _Nekostaking.Contract.GetReward0(&_Nekostaking.TransactOpts, user) +} + +// GetReward1 is a paid mutator transaction binding the contract method 0xf474c8ce. +// +// Solidity: function getReward(address user, uint256 id) returns() +func (_Nekostaking *NekostakingTransactor) GetReward1(opts *bind.TransactOpts, user common.Address, id *big.Int) (*types.Transaction, error) { + return _Nekostaking.contract.Transact(opts, "getReward1", user, id) +} + +// GetReward1 is a paid mutator transaction binding the contract method 0xf474c8ce. +// +// Solidity: function getReward(address user, uint256 id) returns() +func (_Nekostaking *NekostakingSession) GetReward1(user common.Address, id *big.Int) (*types.Transaction, error) { + return _Nekostaking.Contract.GetReward1(&_Nekostaking.TransactOpts, user, id) +} + +// GetReward1 is a paid mutator transaction binding the contract method 0xf474c8ce. +// +// Solidity: function getReward(address user, uint256 id) returns() +func (_Nekostaking *NekostakingTransactorSession) GetReward1(user common.Address, id *big.Int) (*types.Transaction, error) { + return _Nekostaking.Contract.GetReward1(&_Nekostaking.TransactOpts, user, id) +} + +// Initialize is a paid mutator transaction binding the contract method 0xc4d66de8. +// +// Solidity: function initialize(address _neko) returns() +func (_Nekostaking *NekostakingTransactor) Initialize(opts *bind.TransactOpts, _neko common.Address) (*types.Transaction, error) { + return _Nekostaking.contract.Transact(opts, "initialize", _neko) +} + +// Initialize is a paid mutator transaction binding the contract method 0xc4d66de8. +// +// Solidity: function initialize(address _neko) returns() +func (_Nekostaking *NekostakingSession) Initialize(_neko common.Address) (*types.Transaction, error) { + return _Nekostaking.Contract.Initialize(&_Nekostaking.TransactOpts, _neko) +} + +// Initialize is a paid mutator transaction binding the contract method 0xc4d66de8. +// +// Solidity: function initialize(address _neko) returns() +func (_Nekostaking *NekostakingTransactorSession) Initialize(_neko common.Address) (*types.Transaction, error) { + return _Nekostaking.Contract.Initialize(&_Nekostaking.TransactOpts, _neko) +} + +// NotifyRewardAmount is a paid mutator transaction binding the contract method 0x246132f9. +// +// Solidity: function notifyRewardAmount(uint256 id, uint256 reward) returns() +func (_Nekostaking *NekostakingTransactor) NotifyRewardAmount(opts *bind.TransactOpts, id *big.Int, reward *big.Int) (*types.Transaction, error) { + return _Nekostaking.contract.Transact(opts, "notifyRewardAmount", id, reward) +} + +// NotifyRewardAmount is a paid mutator transaction binding the contract method 0x246132f9. +// +// Solidity: function notifyRewardAmount(uint256 id, uint256 reward) returns() +func (_Nekostaking *NekostakingSession) NotifyRewardAmount(id *big.Int, reward *big.Int) (*types.Transaction, error) { + return _Nekostaking.Contract.NotifyRewardAmount(&_Nekostaking.TransactOpts, id, reward) +} + +// NotifyRewardAmount is a paid mutator transaction binding the contract method 0x246132f9. +// +// Solidity: function notifyRewardAmount(uint256 id, uint256 reward) returns() +func (_Nekostaking *NekostakingTransactorSession) NotifyRewardAmount(id *big.Int, reward *big.Int) (*types.Transaction, error) { + return _Nekostaking.Contract.NotifyRewardAmount(&_Nekostaking.TransactOpts, id, reward) +} + +// OnERC721Received is a paid mutator transaction binding the contract method 0x150b7a02. +// +// Solidity: function onERC721Received(address , address , uint256 , bytes ) returns(bytes4) +func (_Nekostaking *NekostakingTransactor) OnERC721Received(opts *bind.TransactOpts, arg0 common.Address, arg1 common.Address, arg2 *big.Int, arg3 []byte) (*types.Transaction, error) { + return _Nekostaking.contract.Transact(opts, "onERC721Received", arg0, arg1, arg2, arg3) +} + +// OnERC721Received is a paid mutator transaction binding the contract method 0x150b7a02. +// +// Solidity: function onERC721Received(address , address , uint256 , bytes ) returns(bytes4) +func (_Nekostaking *NekostakingSession) OnERC721Received(arg0 common.Address, arg1 common.Address, arg2 *big.Int, arg3 []byte) (*types.Transaction, error) { + return _Nekostaking.Contract.OnERC721Received(&_Nekostaking.TransactOpts, arg0, arg1, arg2, arg3) +} + +// OnERC721Received is a paid mutator transaction binding the contract method 0x150b7a02. +// +// Solidity: function onERC721Received(address , address , uint256 , bytes ) returns(bytes4) +func (_Nekostaking *NekostakingTransactorSession) OnERC721Received(arg0 common.Address, arg1 common.Address, arg2 *big.Int, arg3 []byte) (*types.Transaction, error) { + return _Nekostaking.Contract.OnERC721Received(&_Nekostaking.TransactOpts, arg0, arg1, arg2, arg3) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_Nekostaking *NekostakingTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Nekostaking.contract.Transact(opts, "renounceOwnership") +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_Nekostaking *NekostakingSession) RenounceOwnership() (*types.Transaction, error) { + return _Nekostaking.Contract.RenounceOwnership(&_Nekostaking.TransactOpts) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_Nekostaking *NekostakingTransactorSession) RenounceOwnership() (*types.Transaction, error) { + return _Nekostaking.Contract.RenounceOwnership(&_Nekostaking.TransactOpts) +} + +// SetDisable is a paid mutator transaction binding the contract method 0x070a7e5b. +// +// Solidity: function setDisable(bool stake, bool unstake) returns() +func (_Nekostaking *NekostakingTransactor) SetDisable(opts *bind.TransactOpts, stake bool, unstake bool) (*types.Transaction, error) { + return _Nekostaking.contract.Transact(opts, "setDisable", stake, unstake) +} + +// SetDisable is a paid mutator transaction binding the contract method 0x070a7e5b. +// +// Solidity: function setDisable(bool stake, bool unstake) returns() +func (_Nekostaking *NekostakingSession) SetDisable(stake bool, unstake bool) (*types.Transaction, error) { + return _Nekostaking.Contract.SetDisable(&_Nekostaking.TransactOpts, stake, unstake) +} + +// SetDisable is a paid mutator transaction binding the contract method 0x070a7e5b. +// +// Solidity: function setDisable(bool stake, bool unstake) returns() +func (_Nekostaking *NekostakingTransactorSession) SetDisable(stake bool, unstake bool) (*types.Transaction, error) { + return _Nekostaking.Contract.SetDisable(&_Nekostaking.TransactOpts, stake, unstake) +} + +// SetRewardDuration is a paid mutator transaction binding the contract method 0x5d835ae7. +// +// Solidity: function setRewardDuration(uint256 id, uint256 rewardDuration) returns() +func (_Nekostaking *NekostakingTransactor) SetRewardDuration(opts *bind.TransactOpts, id *big.Int, rewardDuration *big.Int) (*types.Transaction, error) { + return _Nekostaking.contract.Transact(opts, "setRewardDuration", id, rewardDuration) +} + +// SetRewardDuration is a paid mutator transaction binding the contract method 0x5d835ae7. +// +// Solidity: function setRewardDuration(uint256 id, uint256 rewardDuration) returns() +func (_Nekostaking *NekostakingSession) SetRewardDuration(id *big.Int, rewardDuration *big.Int) (*types.Transaction, error) { + return _Nekostaking.Contract.SetRewardDuration(&_Nekostaking.TransactOpts, id, rewardDuration) +} + +// SetRewardDuration is a paid mutator transaction binding the contract method 0x5d835ae7. +// +// Solidity: function setRewardDuration(uint256 id, uint256 rewardDuration) returns() +func (_Nekostaking *NekostakingTransactorSession) SetRewardDuration(id *big.Int, rewardDuration *big.Int) (*types.Transaction, error) { + return _Nekostaking.Contract.SetRewardDuration(&_Nekostaking.TransactOpts, id, rewardDuration) +} + +// StakeNekosFor is a paid mutator transaction binding the contract method 0x3aaed54e. +// +// Solidity: function stakeNekosFor(uint256[] tokenIds, address staker) returns() +func (_Nekostaking *NekostakingTransactor) StakeNekosFor(opts *bind.TransactOpts, tokenIds []*big.Int, staker common.Address) (*types.Transaction, error) { + return _Nekostaking.contract.Transact(opts, "stakeNekosFor", tokenIds, staker) +} + +// StakeNekosFor is a paid mutator transaction binding the contract method 0x3aaed54e. +// +// Solidity: function stakeNekosFor(uint256[] tokenIds, address staker) returns() +func (_Nekostaking *NekostakingSession) StakeNekosFor(tokenIds []*big.Int, staker common.Address) (*types.Transaction, error) { + return _Nekostaking.Contract.StakeNekosFor(&_Nekostaking.TransactOpts, tokenIds, staker) +} + +// StakeNekosFor is a paid mutator transaction binding the contract method 0x3aaed54e. +// +// Solidity: function stakeNekosFor(uint256[] tokenIds, address staker) returns() +func (_Nekostaking *NekostakingTransactorSession) StakeNekosFor(tokenIds []*big.Int, staker common.Address) (*types.Transaction, error) { + return _Nekostaking.Contract.StakeNekosFor(&_Nekostaking.TransactOpts, tokenIds, staker) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_Nekostaking *NekostakingTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { + return _Nekostaking.contract.Transact(opts, "transferOwnership", newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_Nekostaking *NekostakingSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _Nekostaking.Contract.TransferOwnership(&_Nekostaking.TransactOpts, newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_Nekostaking *NekostakingTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _Nekostaking.Contract.TransferOwnership(&_Nekostaking.TransactOpts, newOwner) +} + +// UnstakeNekos is a paid mutator transaction binding the contract method 0x0adef4e1. +// +// Solidity: function unstakeNekos(uint256[] tokenIds) returns() +func (_Nekostaking *NekostakingTransactor) UnstakeNekos(opts *bind.TransactOpts, tokenIds []*big.Int) (*types.Transaction, error) { + return _Nekostaking.contract.Transact(opts, "unstakeNekos", tokenIds) +} + +// UnstakeNekos is a paid mutator transaction binding the contract method 0x0adef4e1. +// +// Solidity: function unstakeNekos(uint256[] tokenIds) returns() +func (_Nekostaking *NekostakingSession) UnstakeNekos(tokenIds []*big.Int) (*types.Transaction, error) { + return _Nekostaking.Contract.UnstakeNekos(&_Nekostaking.TransactOpts, tokenIds) +} + +// UnstakeNekos is a paid mutator transaction binding the contract method 0x0adef4e1. +// +// Solidity: function unstakeNekos(uint256[] tokenIds) returns() +func (_Nekostaking *NekostakingTransactorSession) UnstakeNekos(tokenIds []*big.Int) (*types.Transaction, error) { + return _Nekostaking.Contract.UnstakeNekos(&_Nekostaking.TransactOpts, tokenIds) +} + +// NekostakingOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the Nekostaking contract. +type NekostakingOwnershipTransferredIterator struct { + Event *NekostakingOwnershipTransferred // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *NekostakingOwnershipTransferredIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(NekostakingOwnershipTransferred) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(NekostakingOwnershipTransferred) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *NekostakingOwnershipTransferredIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *NekostakingOwnershipTransferredIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// NekostakingOwnershipTransferred represents a OwnershipTransferred event raised by the Nekostaking contract. +type NekostakingOwnershipTransferred struct { + PreviousOwner common.Address + NewOwner common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_Nekostaking *NekostakingFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*NekostakingOwnershipTransferredIterator, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _Nekostaking.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return &NekostakingOwnershipTransferredIterator{contract: _Nekostaking.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil +} + +// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_Nekostaking *NekostakingFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *NekostakingOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _Nekostaking.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(NekostakingOwnershipTransferred) + if err := _Nekostaking.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_Nekostaking *NekostakingFilterer) ParseOwnershipTransferred(log types.Log) (*NekostakingOwnershipTransferred, error) { + event := new(NekostakingOwnershipTransferred) + if err := _Nekostaking.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// NekostakingStakedIterator is returned from FilterStaked and is used to iterate over the raw logs and unpacked data for Staked events raised by the Nekostaking contract. +type NekostakingStakedIterator struct { + Event *NekostakingStaked // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *NekostakingStakedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(NekostakingStaked) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(NekostakingStaked) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *NekostakingStakedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *NekostakingStakedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// NekostakingStaked represents a Staked event raised by the Nekostaking contract. +type NekostakingStaked struct { + Staker common.Address + Ids []*big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterStaked is a free log retrieval operation binding the contract event 0x134b166c6094cc1ccbf1e3353ce5c3cd9fd29869051bdb999895854d77cc5ef6. +// +// Solidity: event Staked(address staker, uint256[] ids) +func (_Nekostaking *NekostakingFilterer) FilterStaked(opts *bind.FilterOpts) (*NekostakingStakedIterator, error) { + + logs, sub, err := _Nekostaking.contract.FilterLogs(opts, "Staked") + if err != nil { + return nil, err + } + return &NekostakingStakedIterator{contract: _Nekostaking.contract, event: "Staked", logs: logs, sub: sub}, nil +} + +// WatchStaked is a free log subscription operation binding the contract event 0x134b166c6094cc1ccbf1e3353ce5c3cd9fd29869051bdb999895854d77cc5ef6. +// +// Solidity: event Staked(address staker, uint256[] ids) +func (_Nekostaking *NekostakingFilterer) WatchStaked(opts *bind.WatchOpts, sink chan<- *NekostakingStaked) (event.Subscription, error) { + + logs, sub, err := _Nekostaking.contract.WatchLogs(opts, "Staked") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(NekostakingStaked) + if err := _Nekostaking.contract.UnpackLog(event, "Staked", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseStaked is a log parse operation binding the contract event 0x134b166c6094cc1ccbf1e3353ce5c3cd9fd29869051bdb999895854d77cc5ef6. +// +// Solidity: event Staked(address staker, uint256[] ids) +func (_Nekostaking *NekostakingFilterer) ParseStaked(log types.Log) (*NekostakingStaked, error) { + event := new(NekostakingStaked) + if err := _Nekostaking.contract.UnpackLog(event, "Staked", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// NekostakingUnstakedIterator is returned from FilterUnstaked and is used to iterate over the raw logs and unpacked data for Unstaked events raised by the Nekostaking contract. +type NekostakingUnstakedIterator struct { + Event *NekostakingUnstaked // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *NekostakingUnstakedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(NekostakingUnstaked) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(NekostakingUnstaked) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *NekostakingUnstakedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *NekostakingUnstakedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// NekostakingUnstaked represents a Unstaked event raised by the Nekostaking contract. +type NekostakingUnstaked struct { + Staker common.Address + Ids []*big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterUnstaked is a free log retrieval operation binding the contract event 0x20748b935fd9f21155c2e98cb2bd5df6fe86f21b193cebaae8d9ad7db0ba5416. +// +// Solidity: event Unstaked(address staker, uint256[] ids) +func (_Nekostaking *NekostakingFilterer) FilterUnstaked(opts *bind.FilterOpts) (*NekostakingUnstakedIterator, error) { + + logs, sub, err := _Nekostaking.contract.FilterLogs(opts, "Unstaked") + if err != nil { + return nil, err + } + return &NekostakingUnstakedIterator{contract: _Nekostaking.contract, event: "Unstaked", logs: logs, sub: sub}, nil +} + +// WatchUnstaked is a free log subscription operation binding the contract event 0x20748b935fd9f21155c2e98cb2bd5df6fe86f21b193cebaae8d9ad7db0ba5416. +// +// Solidity: event Unstaked(address staker, uint256[] ids) +func (_Nekostaking *NekostakingFilterer) WatchUnstaked(opts *bind.WatchOpts, sink chan<- *NekostakingUnstaked) (event.Subscription, error) { + + logs, sub, err := _Nekostaking.contract.WatchLogs(opts, "Unstaked") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(NekostakingUnstaked) + if err := _Nekostaking.contract.UnpackLog(event, "Unstaked", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseUnstaked is a log parse operation binding the contract event 0x20748b935fd9f21155c2e98cb2bd5df6fe86f21b193cebaae8d9ad7db0ba5416. +// +// Solidity: event Unstaked(address staker, uint256[] ids) +func (_Nekostaking *NekostakingFilterer) ParseUnstaked(log types.Log) (*NekostakingUnstaked, error) { + event := new(NekostakingUnstaked) + if err := _Nekostaking.contract.UnpackLog(event, "Unstaked", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/pkg/contracts/nekostaking/neko_staking.json b/pkg/contracts/nekostaking/neko_staking.json new file mode 100644 index 000000000..a961ce604 --- /dev/null +++ b/pkg/contracts/nekostaking/neko_staking.json @@ -0,0 +1,561 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + } + ], + "name": "Staked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + } + ], + "name": "Unstaked", + "type": "event" + }, + { + "inputs": [], + "name": "NekoContract", + "outputs": [ + { + "internalType": "contract IERC721", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_duration", + "type": "uint256" + } + ], + "name": "addRewardToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "balances", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "disableStaking", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "disableUnstaking", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "earned", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC721", + "name": "_neko", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isPrizeToken", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "lastTimeRewardApplicable", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + } + ], + "name": "notifyRewardAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "onERC721Received", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "owners", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "rewardInfo", + "outputs": [ + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "periodFinish", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardPerTokenStored", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardBalance", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "rewardPerToken", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardTokenLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "rewards", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "stake", + "type": "bool" + }, + { + "internalType": "bool", + "name": "unstake", + "type": "bool" + } + ], + "name": "setDisable", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardDuration", + "type": "uint256" + } + ], + "name": "setRewardDuration", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "tokenIds", + "type": "uint256[]" + }, + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "stakeNekosFor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "tokenIds", + "type": "uint256[]" + } + ], + "name": "unstakeNekos", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "userRewardPerTokenPaid", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } +] diff --git a/pkg/entities/nfts.go b/pkg/entities/nfts.go index 5f3f46b5b..c9635dd43 100644 --- a/pkg/entities/nfts.go +++ b/pkg/entities/nfts.go @@ -2,6 +2,7 @@ package entities import ( "bytes" + "database/sql" "encoding/json" "errors" "fmt" @@ -9,24 +10,32 @@ import ( "net/http" "strconv" "strings" + "sync" "time" "github.com/consolelabs/mochi-typeset/common/contract/abi/typeset" + "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/ethclient" "gorm.io/gorm" "github.com/defipod/mochi/pkg/config" "github.com/defipod/mochi/pkg/consts" + "github.com/defipod/mochi/pkg/contract/neko" + "github.com/defipod/mochi/pkg/contract/nekostaking" "github.com/defipod/mochi/pkg/contracts/erc721" "github.com/defipod/mochi/pkg/logger" "github.com/defipod/mochi/pkg/model" baseerrs "github.com/defipod/mochi/pkg/model/errors" + "github.com/defipod/mochi/pkg/repo/user_nft_balance" usernftwatchlistitem "github.com/defipod/mochi/pkg/repo/user_nft_watchlist_items" "github.com/defipod/mochi/pkg/request" "github.com/defipod/mochi/pkg/response" "github.com/defipod/mochi/pkg/service/indexer" + "github.com/defipod/mochi/pkg/service/mochiprofile" "github.com/defipod/mochi/pkg/util" + maputils "github.com/defipod/mochi/pkg/util/map" + sliceutils "github.com/defipod/mochi/pkg/util/slice" ) var ( @@ -795,7 +804,7 @@ func (e *Entity) GetNFTCollections(p string, s string) (*response.NFTCollections return nil, err } - for i, _ := range data { + for i := range data { data[i].Image = util.StandardizeUri(data[i].Image) } @@ -1304,3 +1313,307 @@ func (e *Entity) GetNFTTokenTickers(req request.GetNFTTokenTickersRequest, rawQu func (e *Entity) TotalNftCollection() (int64, error) { return e.repo.NFTCollection.TotalNftCollection() } + +func (e *Entity) GetProfileNftBalance(req request.GetProfileNFTsRequest) (*response.ProfileNftBalancesData, error) { + collection, err := e.repo.NFTCollection.GetByAddress(req.CollectionAddress) + if err != nil { + e.log.Error(err, "[entity.GetProfileNftBalance] repo.NFTCollection.GetByAddress() failed") + return nil, err + } + + collectionID := collection.ID.UUID.String() + total, err := e.repo.UserNFTBalance.TotalBalance(collectionID) + if err != nil { + e.log.Error(err, "[entity.GetProfileNftBalance] repo.UserNFTBalance.TotalBalance() failed") + return nil, err + } + + bals, err := e.repo.UserNFTBalance.List(user_nft_balance.ListQuery{ProfileID: req.ProfileID, CollectionID: collectionID}) + if err != nil { + e.log.Error(err, "[entity.GetProfileNftBalance] repo.UserNFTBalance.List() failed") + return nil, err + } + + data := response.ProfileNftBalancesData{ + ProfileID: req.ProfileID, + Total: total, + Items: bals, + } + if !sliceutils.IsEmpty(bals) { + data.Balance = sliceutils.Reduce(bals, func(acc int, curr model.UserNFTBalance) int { + return acc + curr.Balance + curr.StakingNekos + }, 0) + if total != 0 { + data.Share = float64(data.Balance) / float64(total) + } + + } + + go e.fetchNftBalance(req.ProfileID, collection) + + return &data, nil +} + +func (e *Entity) fetchNftBalance(profileID string, collection *model.NFTCollection) { + fmt.Println(profileID == "", !strings.EqualFold(collection.ERCFormat, model.ErcFormat721) || !collection.IsVerified) + if profileID == "" { + return + } + if !strings.EqualFold(collection.ERCFormat, model.ErcFormat721) || !collection.IsVerified { + return + } + + // only support EVM + // TODO: why collection.chainID is string? + chainID, err := strconv.Atoi(collection.ChainID) + if err != nil { + return + } + chain, err := e.repo.Chain.GetByID(chainID) + if err != nil { + e.log.Errorf(err, "[entity.fetchNftBalance] GetNFTBalanceFunc() failed") + return + } + if !strings.EqualFold(chain.Type, model.ChainTypeEvm.String()) { + return + } + + balanceOf, err := e.GetNFTBalanceFunc(model.NFTCollectionConfig{ + ID: collection.ID, + ERCFormat: collection.ERCFormat, + Address: collection.Address, + Name: collection.Name, + ChainID: collection.ChainID, + }) + if err != nil { + e.log.Errorf(err, "[entity.fetchNftBalance] GetNFTBalanceFunc() failed") + return + } + + profile, err := e.svc.MochiProfile.GetByID(profileID) + if err != nil { + e.log.Errorf(err, "[entity.fetchNftBalance] svc.MochiProfile.GetByID() failed") + return + } + + if profile == nil || profile.AssociatedAccounts == nil { + return + } + + evmAccs := sliceutils.Filter(profile.AssociatedAccounts, func(aa mochiprofile.AssociatedAccount) bool { + return aa.Platform == mochiprofile.PlatformEVM + }) + + now := time.Now().UTC() + for _, acc := range evmAccs { + // fetch nft balance + bal, err := balanceOf(acc.PlatformIdentifier) + if err != nil { + e.log.Errorf(err, "[entity.fetchNftBalance] balanceOf() failed") + continue + } + + // update db record + err = e.repo.UserNFTBalance.Upsert(model.UserNFTBalance{ + NFTCollectionID: collection.ID, + UserAddress: strings.ToLower(acc.PlatformIdentifier), + ChainType: model.JSONNullString{NullString: sql.NullString{String: chain.Type, Valid: true}}, + Balance: int(bal.Int64()), + ProfileID: profileID, + UpdatedAt: now, + }) + if err != nil { + e.log.Errorf(err, "[entity.fetchNftBalance] repo.UserNFTBalance.Upsert() failed") + continue + } + } +} + +func (e *Entity) GetNekoBalanceFunc(config model.NFTCollectionConfig) (func(address string) (*big.Int, *big.Int, error), error) { + chainID, err := strconv.Atoi(config.ChainID) + if err != nil { + e.log.Errorf(err, "[strconv.Atoi] failed to convert chain id %s to int", config.ChainID) + return nil, fmt.Errorf("failed to convert chain id %s to int: %v", config.ChainID, err) + } + + chain, err := e.repo.Chain.GetByID(chainID) + if err != nil { + e.log.Errorf(err, "[repo.Chain.GetByID] failed to get chain by id %s", config.ChainID) + return nil, fmt.Errorf("failed to get chain by id %s: %v", config.ChainID, err) + } + + client, err := ethclient.Dial(chain.RPC) + if err != nil { + return nil, fmt.Errorf("failed to connect to chain client: %v", err.Error()) + } + + var balanceOf func(string) (*big.Int, *big.Int, error) + contract721, err := erc721.NewErc721(common.HexToAddress(config.Address), client) + if err != nil { + e.log.Errorf(err, "[erc721.NewErc721] failed to init erc721 contract") + return nil, err + } + + nekoStakingAddr := "0xD28Cf82b9B8ee25E3C82923aDF6aA6CC2f220932" + stakingInstance, err := nekostaking.NewNekostaking(common.HexToAddress(nekoStakingAddr), client) + if err != nil { + e.log.Errorf(err, "[erc721.NewErc721] nekostaking.NewNekoStaking() failed") + return nil, err + } + + balanceOf = func(address string) (holding *big.Int, staking *big.Int, err error) { + exist, err := e.repo.UserNFTBalance.IsExists(config.ID.UUID.String(), address) + if exist { + return nil, nil, errors.New("existed") + } + + var wg sync.WaitGroup + wg.Add(2) + + go func(addr string) { + defer wg.Done() + holding, err = contract721.BalanceOf(nil, common.HexToAddress(address)) + if err != nil { + e.log.Errorf(err, "[contract721.BalanceOf] failed to get balance of %s in chain %s", address, config.ChainID) + // return nil, nil, fmt.Errorf("failed to get balance of %s in chain %s: %v", address, config.ChainID, err.Error()) + } + }(address) + + go func(addr string) { + defer wg.Done() + staking, err = stakingInstance.Balances(nil, common.HexToAddress(address)) + if err != nil { + e.log.Errorf(err, "[contract721.BalanceOf] failed to get balance of %s in chain %s", address, config.ChainID) + // return nil, nil, fmt.Errorf("failed to get balance of %s in chain %s: %v", address, config.ChainID, err.Error()) + } + }(address) + + wg.Wait() + + return holding, staking, nil + } + + return balanceOf, nil +} + +// TODO: remove after airdrop +func (e *Entity) GetNekoHolders(col model.NFTCollection) ([]model.UserNFTBalance, error) { + chainID, err := strconv.Atoi(col.ChainID) + if err != nil { + e.log.Errorf(err, "[GetNekoHolders] strconv.Atoi() failed") + return nil, err + } + + chain, err := e.repo.Chain.GetByID(chainID) + if err != nil { + e.log.Errorf(err, "[GetNekoHolders] repo.Chain.GetByID() failed") + return nil, err + } + + client, err := ethclient.Dial(chain.RPC) + if err != nil { + e.log.Errorf(err, "[GetNekoHolders] ethclient.Dial() failed") + return nil, err + } + + nekoInstance, err := neko.NewNeko(common.HexToAddress(col.Address), client) + if err != nil { + e.log.Errorf(err, "[GetNekoHolders] neko.NewNeko() failed") + return nil, err + } + + stakingAddr := consts.NekoStakingContractAddress + stakingInstance, err := nekostaking.NewNekostaking(common.HexToAddress(stakingAddr), client) + if err != nil { + e.log.Errorf(err, "[GetNekoHolders] nekostaking.NewNekoStaking() failed") + return nil, err + } + + stakings, err := nekoInstance.TokensOfOwner(nil, common.HexToAddress(stakingAddr)) + if err != nil { + e.log.Errorf(err, "[GetNekoHolders] nekoInstance.TokensOfOwner() failed") + return nil, err + } + stakingIds := sliceutils.Map(stakings, func(t *big.Int) int64 { + return t.Int64() + }) + + var unstakings []*big.Int + for tokenId := 0; tokenId < col.TotalSupply; tokenId++ { + if sliceutils.Contains(stakingIds, int64(tokenId)) { + continue + } + unstakings = append(unstakings, big.NewInt(int64(tokenId))) + } + + var wg sync.WaitGroup + wg.Add(2) + + holders := make(map[string]int) + tokensByHolder := make(map[string][]int64) + go func(tokenIds []*big.Int) { + for _, tokenId := range tokenIds { + owner, err := nekoInstance.OwnerOf(&bind.CallOpts{}, tokenId) + if err != nil { + e.log.Errorf(err, "[GetNekoHolders] failed to get balance of %d in chain %s", tokenId.Int64(), col.ChainID) + continue + } + + k := strings.ToLower(owner.Hex()) + holders[k]++ + tokensByHolder[k] = append(tokensByHolder[k], tokenId.Int64()) + } + wg.Done() + }(unstakings) + + stakers := make(map[string]int) + tokensByStaker := make(map[string][]int64) + go func(tokenIds []*big.Int) { + for _, tokenId := range tokenIds { + staker, err := stakingInstance.Owners(&bind.CallOpts{}, tokenId) + if err != nil { + e.log.Errorf(err, "[GetNekoHolders] stakingInstance.Owners() failed") + continue + } + + k := strings.ToLower(staker.Hex()) + stakers[k]++ + tokensByStaker[k] = append(tokensByStaker[k], tokenId.Int64()) + } + wg.Done() + }(stakings) + + wg.Wait() + + evmAccs, err := e.ListAllWalletAddresses() + if err != nil { + e.log.Error(err, "[GetNekoHolders] ListAllWalletAddresses() failed") + return nil, err + } + + evms := map[string]string{} + for _, acc := range evmAccs { + k := strings.ToLower(acc.Address) + evms[k] = acc.ProfileId + } + + wallets := append(maputils.Keys(holders), maputils.Keys(stakers)...) + data := sliceutils.Map(wallets, func(w string) model.UserNFTBalance { + return model.UserNFTBalance{ + UserAddress: w, + ChainType: model.JSONNullString{NullString: sql.NullString{String: "evm", Valid: true}}, + NFTCollectionID: col.ID, + Balance: holders[w], + ProfileID: evms[w], + StakingNekos: stakers[w], + Metadata: map[string]interface{}{"holding": tokensByHolder[w], "staking": tokensByStaker[w]}, + } + }) + + return data, nil +} + +func (e *Entity) ExistedNekoHolder(colId, addr string) bool { + existed, _ := e.repo.UserNFTBalance.IsExists(colId, addr) + return existed +} diff --git a/pkg/entities/setting.go b/pkg/entities/setting.go index b2e8f8982..090039b96 100644 --- a/pkg/entities/setting.go +++ b/pkg/entities/setting.go @@ -178,7 +178,7 @@ func (e *Entity) ValidateMoneySourceSetting(profileId string, s request.MoneySou return nil } - profile, err := e.svc.MochiProfile.GetByID(profileId, e.cfg.MochiBotSecret) + profile, err := e.svc.MochiProfile.GetByID(profileId) if err != nil { logger.Error(err, "svc.MochiProfile.GetByID() failed") return errors.New("failed to validate profile accounts") diff --git a/pkg/entities/user.go b/pkg/entities/user.go index 369c25bc6..85915d2d9 100644 --- a/pkg/entities/user.go +++ b/pkg/entities/user.go @@ -237,7 +237,7 @@ func (e *Entity) GetTopUsers(req request.GetTopUsersRequest) (*response.TopUser, item := &leaderboard[i] if item.User == nil { - profile, err := e.svc.MochiProfile.GetByID(item.ProfileID, e.cfg.MochiBotSecret) + profile, err := e.svc.MochiProfile.GetByID(item.ProfileID) if err != nil { return } @@ -578,7 +578,7 @@ func (e *Entity) GetUserBalance(profileId string) (*response.UserBalanceResponse lastestSnapshotSum += lastestSnapshotOffchainBalanceFloat // get all onchain account - profile, err := e.svc.MochiProfile.GetByID(profileId, e.cfg.MochiBotSecret) + profile, err := e.svc.MochiProfile.GetByID(profileId) if err != nil { e.log.Fields(logger.Fields{"profileId": profileId}).Error(err, "[entity.GetUserBalance] - e.svc.MochiProfile.GetByID failed") return nil, err diff --git a/pkg/entities/vault.go b/pkg/entities/vault.go index a906635f6..a134b2bf5 100644 --- a/pkg/entities/vault.go +++ b/pkg/entities/vault.go @@ -71,7 +71,7 @@ func (e *Entity) CreateVault(req *request.CreateVaultRequest) (*model.Vault, err } userDiscordID := "" - profile, err := e.svc.MochiProfile.GetByID(req.VaultCreator, e.cfg.MochiBotSecret) + profile, err := e.svc.MochiProfile.GetByID(req.VaultCreator) if err != nil { e.log.Fields(logger.Fields{"req": req}).Errorf(err, "[entity.GetVaults] svc.MochiProfile.GetByID() failed") return nil, err @@ -233,7 +233,7 @@ func (e *Entity) CreateConfigThreshold(req *request.CreateConfigThresholdRequest func (e *Entity) AddTreasurerToVault(req *request.AddTreasurerToVaultRequest) (*model.VaultTreasurer, error) { userDiscordID := "" - profile, err := e.svc.MochiProfile.GetByID(req.UserProfileID, "") + profile, err := e.svc.MochiProfile.GetByID(req.UserProfileID) if err != nil { e.log.Fields(logger.Fields{"req": req}).Errorf(err, "[entity.GetVaults] svc.MochiProfile.GetByID() failed") return nil, err diff --git a/pkg/entities/wallet.go b/pkg/entities/wallet.go index 1a208653d..e94e120b6 100644 --- a/pkg/entities/wallet.go +++ b/pkg/entities/wallet.go @@ -92,6 +92,7 @@ func (e *Entity) ListAllWalletAddresses() ([]model.EvmAddress, error) { listWalletAddress = append(listWalletAddress, model.EvmAddress{ Address: account.PlatformIdentifier, ChainType: chainType, + ProfileId: account.ProfileID, }) } @@ -1044,7 +1045,7 @@ func (e *Entity) GetBinanceAverageCost(profileId string) ([]model.BinanceAssetAv } func (e *Entity) GetBinanceAssets(req request.GetBinanceAssetsRequest) (*response.GetBinanceAsset, string, string, error) { - profile, err := e.svc.MochiProfile.GetByID(req.Id, e.cfg.MochiBotSecret) + profile, err := e.svc.MochiProfile.GetByID(req.Id) if err != nil { e.log.Fields(logger.Fields{"req": req}).Error(err, "[entities.GetBinanceAssets] Failed to get profile") return nil, "", "", err @@ -1503,7 +1504,7 @@ func (e *Entity) parseSkymavisInternalTxnsData(data *response.WalletTransactionD } func (e *Entity) GetBinanceFuturePosition(req request.GetBinanceFutureRequest) ([]response.BinanceFuturePositionInformation, error) { - profile, err := e.svc.MochiProfile.GetByID(req.Id, e.cfg.MochiBotSecret) + profile, err := e.svc.MochiProfile.GetByID(req.Id) if err != nil { e.log.Fields(logger.Fields{"req": req}).Error(err, "[entities.GetBinanceFuturePosition] Failed to get profile") return nil, err diff --git a/pkg/handler/nft/interface.go b/pkg/handler/nft/interface.go index f2ab5b53d..df7d18931 100644 --- a/pkg/handler/nft/interface.go +++ b/pkg/handler/nft/interface.go @@ -30,4 +30,5 @@ type IHandler interface { GetSuggestionNFTCollections(c *gin.Context) GetNftTokenTickers(c *gin.Context) GetNftSalesHandler(c *gin.Context) + GetProfileNFTBalances(c *gin.Context) } diff --git a/pkg/handler/nft/nft.go b/pkg/handler/nft/nft.go index 55211ffd3..d2584d55d 100644 --- a/pkg/handler/nft/nft.go +++ b/pkg/handler/nft/nft.go @@ -620,3 +620,27 @@ func (h *Handler) GetNftSalesHandler(c *gin.Context) { } c.JSON(http.StatusOK, data) } + +func (h *Handler) GetProfileNFTBalances(c *gin.Context) { + var req request.GetProfileNFTsRequest + if err := c.BindUri(&req); err != nil { + h.log.Info("[handler.GetProfileNFTBalances] BindQuery() failed") + c.JSON(http.StatusBadRequest, response.CreateResponse[any](nil, nil, err, nil)) + return + } + + if err := c.BindQuery(&req); err != nil { + h.log.Info("[handler.GetProfileNFTBalances] BindQuery() failed") + c.JSON(http.StatusBadRequest, response.CreateResponse[any](nil, nil, err, nil)) + return + } + + data, err := h.entities.GetProfileNftBalance(req) + if err != nil { + h.log.Fields(logger.Fields{"req": req}).Error(err, "[handler.GetProfileNFTBalances] entity.GetProfileNftBalance() failed") + c.JSON(http.StatusInternalServerError, response.CreateResponse[any](nil, nil, err, nil)) + return + } + + c.JSON(http.StatusOK, response.CreateResponse(data, nil, nil, nil)) +} diff --git a/pkg/job/update_user_nft_balance.go b/pkg/job/update_user_nft_balance.go index 30e95c3a5..83d38b918 100644 --- a/pkg/job/update_user_nft_balance.go +++ b/pkg/job/update_user_nft_balance.go @@ -1,9 +1,12 @@ package job import ( + "strings" + "github.com/defipod/mochi/pkg/entities" "github.com/defipod/mochi/pkg/logger" "github.com/defipod/mochi/pkg/model" + sliceutils "github.com/defipod/mochi/pkg/util/slice" ) type updateUserNFTBalances struct { @@ -18,54 +21,91 @@ func NewUpdateUserNFTBalancesJob(e *entities.Entity) Job { } } +// func (c *updateUserNFTBalances) Run() error { +// c.log.Info("start updating user nft balances") +// nftConfigs, err := c.entity.ListAllNFTCollectionConfigs() +// if err != nil { +// c.log.Error(err, "entity.ListAllNFTCollectionConfigs failed") +// return err +// } + +// if len(nftConfigs) == 0 { +// c.log.Info("entity.ListAllNFTCollectionConfigs - no data found") +// return nil +// } + +// was, err := c.entity.ListAllWalletAddresses() +// if err != nil { +// c.log.Error(err, "entity.ListAllWalletAddresses failed") +// return err +// } + +// // // TODO: get from mochi profile +// for _, nftConfig := range nftConfigs { +// c.log.Infof("start nft config %s", nftConfig.Address) +// balanceOf, err := c.entity.GetNekoBalanceFunc(nftConfig) +// if err != nil { +// c.log.Errorf(err, "failed to get nft balance function of collection %s", nftConfig.Name) +// continue +// } + +// for _, wa := range was { +// holding, staking, err := balanceOf(wa.Address) +// if err != nil { +// c.log.Errorf(err, "failed to get nft %s balance of address %s", nftConfig.Name, wa.Address) +// continue +// } + +// balance := model.UserNFTBalance{ +// UserAddress: wa.Address, +// ChainType: wa.ChainType, +// NFTCollectionID: nftConfig.ID, +// Balance: int(holding.Int64()), +// ProfileID: wa.ProfileId, +// StakingNekos: int(staking.Int64()), +// } + +// err = c.entity.NewUserNFTBalance(balance) +// if err != nil { +// c.log.Errorf(err, "failed to create user nft balance of address %s", wa.Address) +// continue +// } +// } +// } + +// return nil +// } + func (c *updateUserNFTBalances) Run() error { c.log.Info("start updating user nft balances") - nftConfigs, err := c.entity.ListAllNFTCollectionConfigs() + collections, err := c.entity.ListAllNFTCollections() if err != nil { - c.log.Error(err, "entity.ListAllNFTCollectionConfigs failed") + c.log.Error(err, "entity.ListAllNFTCollections failed") return err } - if len(nftConfigs) == 0 { - c.log.Info("entity.ListAllNFTCollectionConfigs - no data found") + nekoAddr := "0x7aCeE5D0acC520faB33b3Ea25D4FEEF1FfebDE73" + nekoCol := sliceutils.Find(collections, func(c model.NFTCollection) bool { + return strings.EqualFold(nekoAddr, c.Address) + }) + + if nekoCol == nil { + c.log.Info("Neko Collection not found") return nil } - was, err := c.entity.ListAllWalletAddresses() + data, err := c.entity.GetNekoHolders(*nekoCol) if err != nil { - c.log.Error(err, "entity.ListAllWalletAddresses failed") + c.log.Errorf(err, "entity.GetNekoHolders() failed") return err } - // // TODO: get from mochi profile - for _, nftConfig := range nftConfigs { - c.log.Infof("start nft config %s", nftConfig.Address) - balanceOf, err := c.entity.GetNFTBalanceFunc(nftConfig) + for _, bal := range data { + err = c.entity.NewUserNFTBalance(bal) if err != nil { - c.log.Errorf(err, "failed to get nft balance function of collection %s", nftConfig.Name) + c.log.Errorf(err, "NewUserNFTBalance() failed") continue } - - for _, wa := range was { - n, err := balanceOf(wa.Address) - if err != nil { - c.log.Errorf(err, "failed to get nft %s balance of address %s", nftConfig.Name, wa.Address) - continue - } - - balance := model.UserNFTBalance{ - UserAddress: wa.Address, - ChainType: wa.ChainType, - NFTCollectionID: nftConfig.ID, - Balance: int(n.Int64()), - } - - err = c.entity.NewUserNFTBalance(balance) - if err != nil { - c.log.Errorf(err, "failed to create user nft balance of address %s", wa.Address) - continue - } - } } return nil diff --git a/pkg/model/nft_collection.go b/pkg/model/nft_collection.go index e1674f844..3a92401d8 100644 --- a/pkg/model/nft_collection.go +++ b/pkg/model/nft_collection.go @@ -6,18 +6,27 @@ import ( "github.com/google/uuid" ) +type ErcFormat string + +const ( + ErcFormat721 = "ERC721" + ErcFormat1155 = "ERC721" +) + type NFTCollection struct { - ID uuid.NullUUID `json:"id" gorm:"default:uuid_generate_v4()" swaggertype:"string"` - Address string `json:"address"` - Name string `json:"name"` - Symbol string `json:"symbol"` - ChainID string `json:"chain_id"` - ERCFormat string `json:"erc_format"` - IsVerified bool `json:"is_verified"` - CreatedAt time.Time `json:"created_at"` - Image string `json:"image"` - Author string `json:"author"` + ID uuid.NullUUID `json:"id" gorm:"default:uuid_generate_v4()" swaggertype:"string"` + Address string `json:"address"` + Name string `json:"name"` + Symbol string `json:"symbol"` + ChainID string `json:"chain_id"` + ERCFormat string `json:"erc_format"` + IsVerified bool `json:"is_verified"` + CreatedAt time.Time `json:"created_at"` + Image string `json:"image"` + Author string `json:"author"` + TotalSupply int `json:"total_supply"` } + type NewListedNFTCollection struct { ID uuid.NullUUID `json:"id" gorm:"default:uuid_generate_v4()" swaggertype:"string"` Address string `json:"address"` diff --git a/pkg/model/user_nft_balance.go b/pkg/model/user_nft_balance.go index d3f0b0800..1b253da07 100644 --- a/pkg/model/user_nft_balance.go +++ b/pkg/model/user_nft_balance.go @@ -1,13 +1,44 @@ package model -import "github.com/google/uuid" +import ( + "database/sql/driver" + "encoding/json" + "fmt" + "time" + + "github.com/google/uuid" +) + +type metadata map[string]interface{} type UserNFTBalance struct { UserAddress string `json:"user_address"` ChainType JSONNullString `json:"chain_type"` NFTCollectionID uuid.NullUUID `json:"nft_collection_id" swaggertype:"string"` - TokenID string `json:"token_id,omitempty"` Balance int `json:"balance"` + StakingNekos int `json:"staking_nekos"` + ProfileID string `json:"profile_id"` + UpdatedAt time.Time `json:"updated_at"` + Metadata metadata `json:"metadata" gorm:"type:jsonb"` +} + +func (m *metadata) Scan(value interface{}) error { + var bytes []byte + switch v := value.(type) { + case []byte: + bytes = v + case string: + bytes = []byte(v) + default: + return fmt.Errorf("user_nft_balance.metadata has unsupported type: %v", v) + } + + return json.Unmarshal(bytes, m) +} + +func (m metadata) Value() (driver.Value, error) { + bytes, err := json.Marshal(m) + return string(bytes), err } type UserNFTBalancesByGuild struct { diff --git a/pkg/model/wallet_snapshot.go b/pkg/model/wallet_snapshot.go index a0162a89d..c063ada58 100644 --- a/pkg/model/wallet_snapshot.go +++ b/pkg/model/wallet_snapshot.go @@ -15,4 +15,5 @@ type WalletSnapshot struct { type EvmAddress struct { Address string `json:"address"` ChainType JSONNullString `json:"chain_type"` + ProfileId string `json:"profile_id"` } diff --git a/pkg/repo/nft_collection/pg.go b/pkg/repo/nft_collection/pg.go index 543d8cec0..aec1d295a 100644 --- a/pkg/repo/nft_collection/pg.go +++ b/pkg/repo/nft_collection/pg.go @@ -158,3 +158,13 @@ func (pg *pg) UpdateImage(address string, image string) error { func (pg *pg) TotalNftCollection() (count int64, err error) { return count, pg.db.Table("nft_collections").Count(&count).Error } + +func (pg *pg) ListAllNFTCollections() ([]model.NFTCollection, error) { + var collections []model.NFTCollection + return collections, pg.db.Table("nft_collections"). + Select("nft_collections.*"). + Joins("JOIN guild_config_nft_roles ON nft_collections.id = guild_config_nft_roles.nft_collection_id"). + Where("nft_collections.erc_format != '1155'"). + Group("nft_collections.id"). + Find(&collections).Error +} diff --git a/pkg/repo/nft_collection/store.go b/pkg/repo/nft_collection/store.go index 1fff48934..99fda7936 100644 --- a/pkg/repo/nft_collection/store.go +++ b/pkg/repo/nft_collection/store.go @@ -20,4 +20,6 @@ type Store interface { ListByGuildID(guildID string) ([]model.NFTCollection, error) UpdateImage(address string, image string) error TotalNftCollection() (count int64, err error) + + ListAllNFTCollections() ([]model.NFTCollection, error) } diff --git a/pkg/repo/user_nft_balance/pg.go b/pkg/repo/user_nft_balance/pg.go index 767939ce3..b829c2c4b 100644 --- a/pkg/repo/user_nft_balance/pg.go +++ b/pkg/repo/user_nft_balance/pg.go @@ -17,18 +17,18 @@ func NewPG(db *gorm.DB) Store { } } -func (pg *pg) Upsert(balance model.UserNFTBalance) error { +func (pg *pg) Upsert(b model.UserNFTBalance) error { tx := pg.db.Begin() + updates := []string{"balance", "updated_at", "profile_id"} + if b.StakingNekos != 0 { + updates = append(updates, "staking_nekos") + } + if err := tx.Clauses(clause.OnConflict{ - Columns: []clause.Column{ - {Name: "user_address"}, - {Name: "chain_type"}, - {Name: "nft_collection_id"}, - {Name: "token_id"}, - }, - UpdateAll: true, - }).Create(&balance).Error; err != nil { + OnConstraint: "user_nft_balances_collection_id_address", + DoUpdates: clause.AssignmentColumns(updates), + }).Create(&b).Error; err != nil { tx.Rollback() return err } @@ -92,3 +92,30 @@ func (pg *pg) GetUserNFTBalancesByUserInGuild(guildID string) ([]model.UserAddre return res, nil } + +func (pg *pg) List(q ListQuery) ([]model.UserNFTBalance, error) { + var res []model.UserNFTBalance + db := pg.db + if q.ProfileID != "" { + db = db.Where("profile_id = ?", q.ProfileID) + } + if q.CollectionID != "" { + db = db.Where("nft_collection_id = ?", q.CollectionID) + } + return res, db.Find(&res).Error +} + +func (pg *pg) TotalBalance(collectionID string) (total int, err error) { + return total, pg.db.Table("user_nft_balances"). + Select("COALESCE(SUM(balance + staking_nekos),0)"). + Where("nft_collection_id = ?", collectionID). + Scan(&total).Error +} + +func (pg *pg) IsExists(collectionID, userAddress string) (bool, error) { + var count int64 + err := pg.db.Table("user_nft_balances"). + Where("nft_collection_id = ? AND user_address ILIKE ?", collectionID, userAddress). + Count(&count).Error + return count > 0, err +} diff --git a/pkg/repo/user_nft_balance/query.go b/pkg/repo/user_nft_balance/query.go new file mode 100644 index 000000000..8981ae97c --- /dev/null +++ b/pkg/repo/user_nft_balance/query.go @@ -0,0 +1,6 @@ +package user_nft_balance + +type ListQuery struct { + ProfileID string + CollectionID string +} diff --git a/pkg/repo/user_nft_balance/store.go b/pkg/repo/user_nft_balance/store.go index 96107bec0..99643055b 100644 --- a/pkg/repo/user_nft_balance/store.go +++ b/pkg/repo/user_nft_balance/store.go @@ -5,4 +5,7 @@ import "github.com/defipod/mochi/pkg/model" type Store interface { Upsert(balance model.UserNFTBalance) error GetUserNFTBalancesByUserInGuild(guildID string) ([]model.UserAddressNFTBalancesByGuild, error) + List(ListQuery) ([]model.UserNFTBalance, error) + TotalBalance(collectionID string) (int, error) + IsExists(collectionID, userAddress string) (bool, error) } diff --git a/pkg/request/nft.go b/pkg/request/nft.go index 4d6419f9b..d0ef0bcb4 100644 --- a/pkg/request/nft.go +++ b/pkg/request/nft.go @@ -27,3 +27,8 @@ type GetNFTTokenTickersRequest struct { CollectionAddress string `json:"collection_address" form:"collection_address" binding:"required"` TokenID string `json:"token_id" form:"token_id" binding:"required"` } + +type GetProfileNFTsRequest struct { + ProfileID string `json:"profile_id" form:"profile_id"` + CollectionAddress string `json:"address" uri:"address" binding:"required"` +} diff --git a/pkg/response/nft.go b/pkg/response/nft.go index a4f3e32cc..ac562f94f 100644 --- a/pkg/response/nft.go +++ b/pkg/response/nft.go @@ -386,3 +386,15 @@ type IndexerErrorResponse struct { Data interface{} `json:"data"` Error string `json:"error"` } + +type ProfileNftBalancesData struct { + ProfileID string `json:"profile_id"` + Total int `json:"total"` + Balance int `json:"total_balance"` + Share float64 `json:"share"` + Items []model.UserNFTBalance `json:"items"` +} + +type ProfileNftBalancesResponse struct { + Data *ProfileNftBalancesData `json:"data"` +} diff --git a/pkg/routes/v1.go b/pkg/routes/v1.go index ce3026b43..47f6df92c 100644 --- a/pkg/routes/v1.go +++ b/pkg/routes/v1.go @@ -346,6 +346,9 @@ func NewRoutes(r *gin.Engine, h *handler.Handler, cfg config.Config) { collectionsGroup.GET("/:symbol", h.Nft.GetNFTTokens) collectionsGroup.GET("/tickers", h.Nft.GetNFTCollectionTickers) collectionsGroup.GET("/address/:address", h.Nft.GetNFTCollectionByAddressChain) + + // nft balances + collectionsGroup.GET("/address/:address/balances", h.Nft.GetProfileNFTBalances) } defaultNftTickerGroup := nftsGroup.Group("/default-nft-ticker") @@ -353,6 +356,7 @@ func NewRoutes(r *gin.Engine, h *handler.Handler, cfg config.Config) { defaultNftTickerGroup.GET("", h.Nft.GetGuildDefaultNftTicker) defaultNftTickerGroup.POST("", h.Nft.SetGuildDefaultNftTicker) } + } // TODO diff --git a/pkg/service/mochiprofile/mochiprofile.go b/pkg/service/mochiprofile/mochiprofile.go index a48607abe..40be65614 100644 --- a/pkg/service/mochiprofile/mochiprofile.go +++ b/pkg/service/mochiprofile/mochiprofile.go @@ -168,14 +168,14 @@ func (m *MochiProfile) CreateProfileApiKey(profileAccessToken string) (*ProfileA return &res.Data, nil } -func (m *MochiProfile) GetByID(profileID, authorization string) (*GetProfileResponse, error) { +func (m *MochiProfile) GetByID(profileID string) (*GetProfileResponse, error) { url := fmt.Sprintf("%s/api/v1/profiles/%s", m.config.MochiProfileServerHost, profileID) res := GetProfileResponse{} req := util.SendRequestQuery{ URL: url, Response: &res, - Headers: map[string]string{"Content-Type": "application/json", "Authorization": "Bearer " + authorization}, + Headers: map[string]string{"Content-Type": "application/json", "Authorization": "Bearer " + m.config.MochiBotSecret}, } statusCode, err := util.SendRequest(req) if err != nil || statusCode != http.StatusOK { @@ -194,7 +194,7 @@ func (m *MochiProfile) GetAllEvmAccount() (res []*EvmAssociatedAccount, err erro } statusCode, err := util.SendRequest(req) if err != nil || statusCode != http.StatusOK { - return nil, fmt.Errorf("[mochiprofile.GetByID] util.SendRequest() failed: %v", err) + return nil, fmt.Errorf("[mochiprofile.GetAllEvmAccount] util.SendRequest() failed: %v", err) } return res, nil } @@ -420,7 +420,7 @@ func (m *MochiProfile) GetAllBinanceAccount() (*GetAllBinanceAssociatedAccountDa } statusCode, err := util.SendRequest(req) if err != nil || statusCode != http.StatusOK { - return nil, fmt.Errorf("[mochiprofile.GetByID] util.SendRequest() failed: %v", err) + return nil, fmt.Errorf("[mochiprofile.GetAllBinanceAccount] util.SendRequest() failed: %v", err) } return &res, nil } diff --git a/pkg/service/mochiprofile/service.go b/pkg/service/mochiprofile/service.go index a8f35d03a..492b87a7f 100644 --- a/pkg/service/mochiprofile/service.go +++ b/pkg/service/mochiprofile/service.go @@ -4,7 +4,7 @@ type Service interface { GetByDiscordID(discordID string, noFetchAmount bool) (*GetProfileResponse, error) GetApiKeyByProfileID(profileID string) (*ProfileApiKeyResponse, error) CreateProfileApiKey(profileAccessToken string) (*ProfileApiKeyResponse, error) - GetByID(profileID, authorization string) (*GetProfileResponse, error) + GetByID(profileID string) (*GetProfileResponse, error) GetByIds(profileIds []string) ([]GetProfileResponse, error) GetByDiscordIds(discordIds []string) ([]GetProfileResponse, error) GetAllEvmAccount() ([]*EvmAssociatedAccount, error) diff --git a/pkg/util/map/map.go b/pkg/util/map/map.go new file mode 100644 index 000000000..e49f8024a --- /dev/null +++ b/pkg/util/map/map.go @@ -0,0 +1,26 @@ +package maputils + +func Keys[K comparable, V any](m map[K]V) (keys []K) { + for k := range m { + keys = append(keys, k) + } + + return keys +} + +func Values[K comparable, V any](m map[K]V) (values []V) { + for _, v := range m { + values = append(values, v) + } + + return values +} + +func HasKey[K comparable, V any](m map[K]V, key K) bool { + if m == nil { + return false + } + + _, ok := m[key] + return ok +} diff --git a/pkg/util/slice/slice.go b/pkg/util/slice/slice.go index 7e2aba0ef..0564ce697 100644 --- a/pkg/util/slice/slice.go +++ b/pkg/util/slice/slice.go @@ -1,6 +1,7 @@ package sliceutils import ( + "math" "reflect" "sort" @@ -94,3 +95,49 @@ func Find[T any](s []T, callbackFn func(elem T) bool) *T { return nil } + +func IsEmpty[T any](s []T) bool { + return s == nil || len(s) == 0 +} + +func Reduce[A, B any](input []A, callbackFn func(accVal B, currentVal A) B, initVal B) B { + accumulation := initVal + for _, a := range input { + current := a + accumulation = callbackFn(accumulation, current) + } + + return accumulation +} + +// return a new slice of unique elements based on the given slice +func Uniquify[T comparable](s []T) (result []T) { + m := make(map[T]reflect.Value) + for _, k := range s { + v := reflect.ValueOf(k) + m[k] = v + } + + for k, v := range m { + if v.String() == "" { + continue + } + result = append(result, k) + } + + return +} + +// divide the given slice into equal parts whose max length is the given 'maxSize' +func DivideIntoChunks[T any](s []T, maxSize int64) (result [][]T) { + parts := int64(math.Ceil(float64(len(s)) / float64(maxSize))) + + for i := int64(0); i < parts; i++ { + start := i * maxSize + end := math.Min(float64((i+1)*maxSize), float64(len(s))) + + result = append(result, s[start:int(end)]) + } + + return +}