From 91debe9277d1519fa4d9f3a1ee3f15a665d59905 Mon Sep 17 00:00:00 2001 From: KallyDev Date: Fri, 19 Jan 2024 19:55:37 +0800 Subject: [PATCH] feat: support stake transactions (#29) --- contract/l2/abi/Chips.abi | 1742 ++++++- contract/l2/abi/Staking.abi | 143 +- contract/l2/contract.go | 2 +- contract/l2/contract_chips.go | 4163 +++++++++++++++-- contract/l2/contract_staking.go | 231 +- deploy/config.yaml | 2 +- go.mod | 2 +- internal/database/client.go | 8 + .../dialer/cockroachdb/client_bridge.go | 8 +- .../dialer/cockroachdb/client_stake.go | 148 + ...240119093020_create_stake_transactions.sql | 36 + .../dialer/cockroachdb/table/stake_event.go | 58 + .../cockroachdb/table/stake_transaction.go | 58 + internal/hub/handler_bridge.go | 36 +- internal/hub/handler_stake.go | 156 + internal/hub/model/stake_transaction.go | 123 + internal/hub/server.go | 6 + internal/service/indexer/l2/indexer_stake.go | 207 +- schema/stake_event.go | 46 + schema/stake_transaction.go | 38 + 20 files changed, 6212 insertions(+), 1001 deletions(-) create mode 100644 internal/database/dialer/cockroachdb/migration/20240119093020_create_stake_transactions.sql create mode 100644 internal/database/dialer/cockroachdb/table/stake_event.go create mode 100644 internal/database/dialer/cockroachdb/table/stake_transaction.go create mode 100644 internal/hub/handler_stake.go create mode 100644 internal/hub/model/stake_transaction.go create mode 100644 schema/stake_event.go create mode 100644 schema/stake_transaction.go diff --git a/contract/l2/abi/Chips.abi b/contract/l2/abi/Chips.abi index c5394d11..eaa1d85a 100644 --- a/contract/l2/abi/Chips.abi +++ b/contract/l2/abi/Chips.abi @@ -1,4 +1,93 @@ [ + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "treasury", + "type": "address" + }, + { + "internalType": "uint256", + "name": "stakeRatio", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "stakeUnbondingPeriod", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "depositUnbondingPeriod", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nodeSlashRateBasisPoints", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "userSlashRateBasisPoints", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minDeposit", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AccessControlBadConfirmation", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "neededRole", + "type": "bytes32" + } + ], + "name": "AccessControlUnauthorizedAccount", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "target", + "type": "address" + } + ], + "name": "AddressEmptyCode", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "AddressInsufficientBalance", + "type": "error" + }, { "inputs": [], "name": "AlreadyClaimed", @@ -30,6 +119,11 @@ "name": "CallerNotStaking", "type": "error" }, + { + "inputs": [], + "name": "CheckpointUnorderedInsertion", + "type": "error" + }, { "inputs": [ { @@ -91,115 +185,32 @@ }, { "inputs": [], - "name": "DepositedTokensSlashedAll", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "ERC721IncorrectOwner", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "ERC721InsufficientApproval", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "approver", - "type": "address" - } - ], - "name": "ERC721InvalidApprover", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "operator", - "type": "address" - } - ], - "name": "ERC721InvalidOperator", + "name": "CreateNodeToZeroAddress", "type": "error" }, { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "ERC721InvalidOwner", + "inputs": [], + "name": "DepositedTokensSlashedAll", "type": "error" }, { - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - } - ], - "name": "ERC721InvalidReceiver", + "inputs": [], + "name": "EmptyNodeList", "type": "error" }, { - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "ERC721InvalidSender", + "inputs": [], + "name": "EnforcedPause", "type": "error" }, { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "ERC721NonexistentToken", + "inputs": [], + "name": "ExpectedPause", "type": "error" }, { "inputs": [], - "name": "EmptyNodeList", + "name": "FailedInnerCall", "type": "error" }, { @@ -277,32 +288,71 @@ }, { "inputs": [], - "name": "TaxFractionTooLarge", + "name": "RewardDistributionFailed", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "bits", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "SafeCastOverflowedUintDowncast", "type": "error" }, { - "anonymous": false, "inputs": [ { - "indexed": true, "internalType": "address", - "name": "owner", + "name": "token", "type": "address" - }, + } + ], + "name": "SafeERC20FailedOperation", + "type": "error" + }, + { + "inputs": [], + "name": "TaxRateBasisPointsTooLarge", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ { "indexed": true, "internalType": "address", - "name": "approved", + "name": "nodeAddr", "type": "address" }, { "indexed": true, "internalType": "uint256", - "name": "tokenId", + "name": "amount", "type": "uint256" } ], - "name": "Approval", + "name": "Deposited", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint64", + "name": "version", + "type": "uint64" + } + ], + "name": "Initialized", "type": "event" }, { @@ -311,36 +361,48 @@ { "indexed": true, "internalType": "address", - "name": "owner", + "name": "nodeAddr", "type": "address" }, { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "description", + "type": "string" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "taxRateBasisPoints", + "type": "uint64" }, { "indexed": false, "internalType": "bool", - "name": "approved", + "name": "publicGood", "type": "bool" } ], - "name": "ApprovalForAll", + "name": "NodeCreated", "type": "event" }, { "anonymous": false, "inputs": [ { - "indexed": false, - "internalType": "uint64", - "name": "version", - "type": "uint64" + "indexed": true, + "internalType": "address", + "name": "nodeAddr", + "type": "address" } ], - "name": "Initialized", + "name": "NodeDeleted", "type": "event" }, { @@ -349,84 +411,1171 @@ { "indexed": true, "internalType": "address", - "name": "from", + "name": "nodeAddr", "type": "address" }, { "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" + "internalType": "uint256", + "name": "slashedOperationPool", + "type": "uint256" }, { "indexed": true, "internalType": "uint256", - "name": "tokenId", + "name": "slashedStakingPool", "type": "uint256" } ], - "name": "Transfer", + "name": "NodeSlashed", "type": "event" }, { + "anonymous": false, "inputs": [ { + "indexed": true, "internalType": "address", - "name": "to", + "name": "nodeAddr", "type": "address" }, { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" + "indexed": true, + "internalType": "uint64", + "name": "taxRateBasisPoints", + "type": "uint64" } ], - "name": "approve", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "name": "NodeTaxRateBasisPointsSet", + "type": "event" }, { + "anonymous": false, "inputs": [ { + "indexed": false, "internalType": "address", - "name": "owner", + "name": "account", "type": "address" } ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "epoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "startTimestamp", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "endTimestamp", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "publicPoolReward", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "publicPoolTax", + "type": "uint256" + } + ], + "name": "PublicGoodRewardDistributed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint64", + "name": "taxRateBasisPoints", + "type": "uint64" + } + ], + "name": "PublicPoolTaxRateBasisPointsSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "epoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "startTimestamp", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "endTimestamp", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address[]", + "name": "nodeAddrs", + "type": "address[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "requestFees", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "operationRewards", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "stakingRewards", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "taxAmounts", + "type": "uint256[]" + } + ], + "name": "RewardDistributed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "nodeAddr", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "startTokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "endTokenId", + "type": "uint256" + } + ], + "name": "Staked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "requestId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "nodeAddr", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "unstakeAmount", + "type": "uint256" + } + ], + "name": "UnstakeClaimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "nodeAddr", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "requestId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "chipsIds", + "type": "uint256[]" + } + ], + "name": "UnstakeRequested", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "nodeAddr", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "requestId", + "type": "uint256" + } + ], + "name": "WithdrawRequested", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "requestId", + "type": "uint256" + } + ], + "name": "WithdrawalClaimed", + "type": "event" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DEPOSIT_UNBONDING_PERIOD", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MIN_DEPOSIT", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "NODE_SLASH_RATE_BASIS_POINTS", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ORACLE_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PAUSE_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SHARES_PER_CHIP", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "STAKE_RATIO", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "STAKE_UNBONDING_PERIOD", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TOKEN", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TREASURY", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "USER_SLASH_RATE_BASIS_POINTS", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "chipsContract", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "requestIds", + "type": "uint256[]" + } + ], + "name": "claimUnstake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "requestIds", + "type": "uint256[]" + } + ], + "name": "claimWithdrawal", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "description", + "type": "string" + }, + { + "internalType": "uint64", + "name": "taxRateBasisPoints", + "type": "uint64" + }, + { + "internalType": "bool", + "name": "publicGood", + "type": "bool" + } + ], + "name": "createNode", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "description", + "type": "string" + }, + { + "internalType": "uint64", + "name": "taxRateBasisPoints", + "type": "uint64" + }, + { + "internalType": "bool", + "name": "publicGood", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "createNodeAndDeposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "currentEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "nodeAddr", + "type": "address" + } + ], + "name": "deleteNode", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[3]", + "name": "epochInfo", + "type": "uint256[3]" + }, + { + "internalType": "address[]", + "name": "nodeAddrs", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "requestFees", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "operationRewards", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "stakingRewards", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "publicPoolReward", + "type": "uint256" + } + ], + "name": "distributeRewards", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getChipsInfo", + "outputs": [ + { + "internalType": "address", + "name": "nodeAddr", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMinDeposit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "nodeAddr", + "type": "address" + } + ], + "name": "getNode", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint64", + "name": "taxRateBasisPoints", + "type": "uint64" + }, + { + "internalType": "bool", + "name": "publicGood", + "type": "bool" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "description", + "type": "string" + }, + { + "internalType": "uint256", + "name": "operationPoolTokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "stakingPoolTokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalShares", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "slashedTokens", + "type": "uint256" + } + ], + "internalType": "struct DataTypes.Node", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getNodeCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "nodeAddrs", + "type": "address[]" + } + ], + "name": "getNodes", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint64", + "name": "taxRateBasisPoints", + "type": "uint64" + }, + { + "internalType": "bool", + "name": "publicGood", + "type": "bool" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "description", + "type": "string" + }, + { + "internalType": "uint256", + "name": "operationPoolTokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "stakingPoolTokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalShares", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "slashedTokens", + "type": "uint256" + } + ], + "internalType": "struct DataTypes.Node[]", + "name": "nodes", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "offset", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "limit", + "type": "uint256" + } + ], + "name": "getNodesWithPagination", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint64", + "name": "taxRateBasisPoints", + "type": "uint64" + }, + { + "internalType": "bool", + "name": "publicGood", + "type": "bool" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "description", + "type": "string" + }, + { + "internalType": "uint256", + "name": "operationPoolTokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "stakingPoolTokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalShares", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "slashedTokens", + "type": "uint256" + } + ], + "internalType": "struct DataTypes.Node[]", + "name": "nodes", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "requestId", + "type": "uint256" + } + ], + "name": "getPendingUnstake", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "nodeAddr", + "type": "address" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "unstakeAmount", + "type": "uint256" + } + ], + "internalType": "struct DataTypes.UnstakeRequest", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "requestId", + "type": "uint256" + } + ], + "name": "getPendingWithdrawal", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint40", + "name": "timestamp", + "type": "uint40" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct DataTypes.WithdrawalRequest", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPoolInfo", + "outputs": [ + { + "internalType": "uint256", + "name": "totalOperationPoolTokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalStakingPoolTokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "treasuryAmount", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "getPublicPool", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint64", + "name": "taxRateBasisPoints", + "type": "uint64" + }, + { + "internalType": "bool", + "name": "publicGood", + "type": "bool" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "description", + "type": "string" + }, + { + "internalType": "uint256", + "name": "operationPoolTokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "stakingPoolTokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalShares", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "slashedTokens", + "type": "uint256" + } + ], + "internalType": "struct DataTypes.Node", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" + "internalType": "bytes32", + "name": "role", + "type": "bytes32" } ], - "name": "burn", - "outputs": [], - "stateMutability": "nonpayable", + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", "type": "function" }, { "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, { "internalType": "uint256", - "name": "tokenId", + "name": "index", "type": "uint256" } ], - "name": "getApproved", + "name": "getRoleMember", "outputs": [ { "internalType": "address", @@ -440,22 +1589,36 @@ { "inputs": [ { - "internalType": "string", - "name": "name_", - "type": "string" - }, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleMemberCount", + "outputs": [ { - "internalType": "string", - "name": "symbol_", - "type": "string" + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" }, { "internalType": "address", - "name": "staking_", + "name": "account", "type": "address" } ], - "name": "initialize", + "name": "grantRole", "outputs": [], "stateMutability": "nonpayable", "type": "function" @@ -463,17 +1626,17 @@ { "inputs": [ { - "internalType": "address", - "name": "owner", - "type": "address" + "internalType": "bytes32", + "name": "role", + "type": "bytes32" }, { "internalType": "address", - "name": "operator", + "name": "account", "type": "address" } ], - "name": "isApprovedForAll", + "name": "hasRole", "outputs": [ { "internalType": "bool", @@ -488,18 +1651,22 @@ "inputs": [ { "internalType": "address", - "name": "account", + "name": "chips", "type": "address" - } - ], - "name": "mint", - "outputs": [ + }, { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" + "internalType": "address", + "name": "pauseAccount", + "type": "address" + }, + { + "internalType": "address", + "name": "oracleAccount", + "type": "address" } ], + "name": "initialize", + "outputs": [], "stateMutability": "nonpayable", "type": "function" }, @@ -507,39 +1674,36 @@ "inputs": [ { "internalType": "address", - "name": "to", + "name": "nodeAddr", "type": "address" - }, - { - "internalType": "uint256", - "name": "batchSize", - "type": "uint256" } ], - "name": "mintBatch", + "name": "minTokensToStake", "outputs": [ { "internalType": "uint256", - "name": "startTokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "endTokenId", + "name": "", "type": "uint256" } ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pause", + "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], - "name": "name", + "name": "paused", "outputs": [ { - "internalType": "string", + "internalType": "bool", "name": "", - "type": "string" + "type": "bool" } ], "stateMutability": "view", @@ -548,163 +1712,211 @@ { "inputs": [ { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "ownerOf", - "outputs": [ + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, { "internalType": "address", - "name": "", + "name": "callerConfirmation", "type": "address" } ], - "stateMutability": "view", + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", - "name": "from", + "name": "nodeAddr", "type": "address" }, { - "internalType": "address", - "name": "to", - "type": "address" - }, + "internalType": "uint256[]", + "name": "chipsIds", + "type": "uint256[]" + } + ], + "name": "requestUnstake", + "outputs": [ { "internalType": "uint256", - "name": "tokenId", + "name": "requestId", "type": "uint256" } ], - "name": "safeTransferFrom", - "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { - "internalType": "address", - "name": "from", - "type": "address" - }, + "internalType": "uint256[]", + "name": "chipsIds", + "type": "uint256[]" + } + ], + "name": "requestUnstakeFromPublicPool", + "outputs": [ { - "internalType": "address", - "name": "to", - "type": "address" - }, + "internalType": "uint256", + "name": "requestId", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ { "internalType": "uint256", - "name": "tokenId", + "name": "amount", "type": "uint256" - }, + } + ], + "name": "requestWithdrawal", + "outputs": [ { - "internalType": "bytes", - "name": "data", - "type": "bytes" + "internalType": "uint256", + "name": "requestId", + "type": "uint256" } ], - "name": "safeTransferFrom", - "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { - "internalType": "address", - "name": "operator", - "type": "address" + "internalType": "bytes32", + "name": "role", + "type": "bytes32" }, { - "internalType": "bool", - "name": "approved", - "type": "bool" + "internalType": "address", + "name": "account", + "type": "address" } ], - "name": "setApprovalForAll", + "name": "revokeRole", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { - "inputs": [], - "name": "stakingContract", - "outputs": [ + "inputs": [ { "internalType": "address", - "name": "", + "name": "nodeAddr", "type": "address" + }, + { + "internalType": "uint64", + "name": "taxRateBasisPoints", + "type": "uint64" } ], - "stateMutability": "view", + "name": "setTaxRateBasisPoints4Node", + "outputs": [], + "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" + "internalType": "uint64", + "name": "taxRateBasisPoints", + "type": "uint64" } ], - "name": "supportsInterface", - "outputs": [ + "name": "setTaxRateBasisPoints4PublicPool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ { - "internalType": "bool", - "name": "", - "type": "bool" + "internalType": "address[]", + "name": "nodeAddrs", + "type": "address[]" } ], - "stateMutability": "view", + "name": "slashNodes", + "outputs": [], + "stateMutability": "nonpayable", "type": "function" }, { - "inputs": [], - "name": "symbol", + "inputs": [ + { + "internalType": "address", + "name": "nodeAddr", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "stake", "outputs": [ { - "internalType": "string", - "name": "", - "type": "string" + "internalType": "uint256", + "name": "startTokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "endTokenId", + "type": "uint256" } ], - "stateMutability": "view", + "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ + { + "internalType": "address", + "name": "nodeAddr", + "type": "address" + }, { "internalType": "uint256", - "name": "tokenId", + "name": "amount", "type": "uint256" } ], - "name": "tokenURI", + "name": "stakeToPublicPool", "outputs": [ { - "internalType": "string", - "name": "", - "type": "string" + "internalType": "uint256", + "name": "startTokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "endTokenId", + "type": "uint256" } ], - "stateMutability": "view", + "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], - "name": "totalSupply", + "name": "stakingToken", "outputs": [ { - "internalType": "uint256", + "internalType": "address", "name": "", - "type": "uint256" + "type": "address" } ], "stateMutability": "view", @@ -713,22 +1925,32 @@ { "inputs": [ { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" + "internalType": "bool", + "name": "", + "type": "bool" } ], - "name": "transferFrom", + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "unpause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw2Treasury", "outputs": [], "stateMutability": "nonpayable", "type": "function" diff --git a/contract/l2/abi/Staking.abi b/contract/l2/abi/Staking.abi index eaa1d85a..256554d8 100644 --- a/contract/l2/abi/Staking.abi +++ b/contract/l2/abi/Staking.abi @@ -1,11 +1,6 @@ [ { "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, { "internalType": "address", "name": "treasury", @@ -66,28 +61,6 @@ "name": "AccessControlUnauthorizedAccount", "type": "error" }, - { - "inputs": [ - { - "internalType": "address", - "name": "target", - "type": "address" - } - ], - "name": "AddressEmptyCode", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "AddressInsufficientBalance", - "type": "error" - }, { "inputs": [], "name": "AlreadyClaimed", @@ -210,7 +183,7 @@ }, { "inputs": [], - "name": "FailedInnerCall", + "name": "InsufficientValue", "type": "error" }, { @@ -308,19 +281,13 @@ "type": "error" }, { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "SafeERC20FailedOperation", + "inputs": [], + "name": "TaxRateBasisPointsTooLarge", "type": "error" }, { "inputs": [], - "name": "TaxRateBasisPointsTooLarge", + "name": "TransferFailed", "type": "error" }, { @@ -744,6 +711,12 @@ "name": "requestId", "type": "uint256" }, + { + "indexed": false, + "internalType": "uint256", + "name": "unstakeAmount", + "type": "uint256" + }, { "indexed": false, "internalType": "uint256[]", @@ -909,19 +882,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [], - "name": "TOKEN", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [], "name": "TREASURY", @@ -989,11 +949,6 @@ }, { "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, { "internalType": "string", "name": "name", @@ -1017,40 +972,7 @@ ], "name": "createNode", "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "name", - "type": "string" - }, - { - "internalType": "string", - "name": "description", - "type": "string" - }, - { - "internalType": "uint64", - "name": "taxRateBasisPoints", - "type": "uint64" - }, - { - "internalType": "bool", - "name": "publicGood", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "createNodeAndDeposit", - "outputs": [], - "stateMutability": "nonpayable", + "stateMutability": "payable", "type": "function" }, { @@ -1080,16 +1002,10 @@ "type": "function" }, { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], + "inputs": [], "name": "deposit", "outputs": [], - "stateMutability": "nonpayable", + "stateMutability": "payable", "type": "function" }, { @@ -1127,7 +1043,7 @@ ], "name": "distributeRewards", "outputs": [], - "stateMutability": "nonpayable", + "stateMutability": "payable", "type": "function" }, { @@ -1857,11 +1773,6 @@ "internalType": "address", "name": "nodeAddr", "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" } ], "name": "stake", @@ -1877,7 +1788,7 @@ "type": "uint256" } ], - "stateMutability": "nonpayable", + "stateMutability": "payable", "type": "function" }, { @@ -1886,11 +1797,6 @@ "internalType": "address", "name": "nodeAddr", "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" } ], "name": "stakeToPublicPool", @@ -1906,20 +1812,7 @@ "type": "uint256" } ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "stakingToken", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", + "stateMutability": "payable", "type": "function" }, { @@ -1954,5 +1847,9 @@ "outputs": [], "stateMutability": "nonpayable", "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" } ] diff --git a/contract/l2/contract.go b/contract/l2/contract.go index 7efd8158..696325dd 100644 --- a/contract/l2/contract.go +++ b/contract/l2/contract.go @@ -29,7 +29,7 @@ var ( EventHashStakingDeposited = crypto.Keccak256Hash([]byte("Deposited(address,uint256)")) EventHashStakingStaked = crypto.Keccak256Hash([]byte("Staked(address,address,uint256,uint256,uint256)")) - EventHashStakingUnstakeRequested = crypto.Keccak256Hash([]byte("UnstakeRequested(address,address,uint256,uint256[])")) + EventHashStakingUnstakeRequested = crypto.Keccak256Hash([]byte("UnstakeRequested(address,address,uint256,uint256,uint256[])")) EventHashStakingUnstakeClaimed = crypto.Keccak256Hash([]byte("UnstakeClaimed(uint256,address,address,uint256)")) EventHashStakingWithdrawRequested = crypto.Keccak256Hash([]byte("WithdrawRequested(address,uint256,uint256)")) EventHashStakingWithdrawalClaimed = crypto.Keccak256Hash([]byte("WithdrawalClaimed(uint256 indexed requestId)")) diff --git a/contract/l2/contract_chips.go b/contract/l2/contract_chips.go index fe070dbc..093a68e9 100644 --- a/contract/l2/contract_chips.go +++ b/contract/l2/contract_chips.go @@ -31,7 +31,7 @@ var ( // ChipsMetaData contains all meta data concerning the Chips contract. var ChipsMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"name\":\"AlreadyClaimed\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"AmountTooSmall\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"BatchSizeZero\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotNodeOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotStaking\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ChipNotAuthorized\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ChipNotPublicGood\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"}],\"name\":\"ChipNotValid\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ChipsIdOverflow\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"claimId\",\"type\":\"uint256\"}],\"name\":\"ClaimIdNotExists\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ClaimTimeNotReady\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DepositedTokensSlashedAll\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"ERC721IncorrectOwner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ERC721InsufficientApproval\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"approver\",\"type\":\"address\"}],\"name\":\"ERC721InvalidApprover\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"ERC721InvalidOperator\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"ERC721InvalidOwner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"ERC721InvalidReceiver\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"ERC721InvalidSender\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ERC721NonexistentToken\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"EmptyNodeList\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidArrayLength\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"expected\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"actual\",\"type\":\"uint256\"}],\"name\":\"InvalidEpoch\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidInitialization\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NodeExists\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NodeNotExists\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"}],\"name\":\"NodeNotPublicGood\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NodeStakedOrDeposited\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotInitializing\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"PublicGoodNodeNotDeposited\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"}],\"name\":\"PublicGoodNodeNotStaked\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TaxFractionTooLarge\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"approved\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"version\",\"type\":\"uint64\"}],\"name\":\"Initialized\",\"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\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name_\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"symbol_\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"staking_\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"mint\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"batchSize\",\"type\":\"uint256\"}],\"name\":\"mintBatch\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"startTokenId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"endTokenId\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"stakingContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"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\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"tokenURI\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"treasury\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"stakeRatio\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stakeUnbondingPeriod\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"depositUnbondingPeriod\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nodeSlashRateBasisPoints\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"userSlashRateBasisPoints\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minDeposit\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AccessControlBadConfirmation\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"neededRole\",\"type\":\"bytes32\"}],\"name\":\"AccessControlUnauthorizedAccount\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"}],\"name\":\"AddressEmptyCode\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"AddressInsufficientBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"AlreadyClaimed\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"AmountTooSmall\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"BatchSizeZero\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotNodeOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotStaking\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CheckpointUnorderedInsertion\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ChipNotAuthorized\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ChipNotPublicGood\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"}],\"name\":\"ChipNotValid\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ChipsIdOverflow\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"claimId\",\"type\":\"uint256\"}],\"name\":\"ClaimIdNotExists\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ClaimTimeNotReady\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CreateNodeToZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DepositedTokensSlashedAll\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"EmptyNodeList\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"EnforcedPause\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ExpectedPause\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"FailedInnerCall\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidArrayLength\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"expected\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"actual\",\"type\":\"uint256\"}],\"name\":\"InvalidEpoch\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidInitialization\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NodeExists\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NodeNotExists\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"}],\"name\":\"NodeNotPublicGood\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NodeStakedOrDeposited\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotInitializing\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"PublicGoodNodeNotDeposited\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"}],\"name\":\"PublicGoodNodeNotStaked\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RewardDistributionFailed\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"bits\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"SafeCastOverflowedUintDowncast\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"SafeERC20FailedOperation\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TaxRateBasisPointsTooLarge\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Deposited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"version\",\"type\":\"uint64\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"description\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"taxRateBasisPoints\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"publicGood\",\"type\":\"bool\"}],\"name\":\"NodeCreated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"}],\"name\":\"NodeDeleted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"slashedOperationPool\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"slashedStakingPool\",\"type\":\"uint256\"}],\"name\":\"NodeSlashed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint64\",\"name\":\"taxRateBasisPoints\",\"type\":\"uint64\"}],\"name\":\"NodeTaxRateBasisPointsSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"startTimestamp\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"endTimestamp\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"publicPoolReward\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"publicPoolTax\",\"type\":\"uint256\"}],\"name\":\"PublicGoodRewardDistributed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint64\",\"name\":\"taxRateBasisPoints\",\"type\":\"uint64\"}],\"name\":\"PublicPoolTaxRateBasisPointsSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"startTimestamp\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"endTimestamp\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"nodeAddrs\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"requestFees\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"operationRewards\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"stakingRewards\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"taxAmounts\",\"type\":\"uint256[]\"}],\"name\":\"RewardDistributed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"startTokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"endTokenId\",\"type\":\"uint256\"}],\"name\":\"Staked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"unstakeAmount\",\"type\":\"uint256\"}],\"name\":\"UnstakeClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"chipsIds\",\"type\":\"uint256[]\"}],\"name\":\"UnstakeRequested\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"name\":\"WithdrawRequested\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"name\":\"WithdrawalClaimed\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DEPOSIT_UNBONDING_PERIOD\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MIN_DEPOSIT\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"NODE_SLASH_RATE_BASIS_POINTS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ORACLE_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PAUSE_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"SHARES_PER_CHIP\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"STAKE_RATIO\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"STAKE_UNBONDING_PERIOD\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TOKEN\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TREASURY\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"USER_SLASH_RATE_BASIS_POINTS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"chipsContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"requestIds\",\"type\":\"uint256[]\"}],\"name\":\"claimUnstake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"requestIds\",\"type\":\"uint256[]\"}],\"name\":\"claimWithdrawal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"description\",\"type\":\"string\"},{\"internalType\":\"uint64\",\"name\":\"taxRateBasisPoints\",\"type\":\"uint64\"},{\"internalType\":\"bool\",\"name\":\"publicGood\",\"type\":\"bool\"}],\"name\":\"createNode\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"description\",\"type\":\"string\"},{\"internalType\":\"uint64\",\"name\":\"taxRateBasisPoints\",\"type\":\"uint64\"},{\"internalType\":\"bool\",\"name\":\"publicGood\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"createNodeAndDeposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentEpoch\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"}],\"name\":\"deleteNode\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[3]\",\"name\":\"epochInfo\",\"type\":\"uint256[3]\"},{\"internalType\":\"address[]\",\"name\":\"nodeAddrs\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"requestFees\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"operationRewards\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"stakingRewards\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"publicPoolReward\",\"type\":\"uint256\"}],\"name\":\"distributeRewards\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getChipsInfo\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokens\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getMinDeposit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"}],\"name\":\"getNode\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"taxRateBasisPoints\",\"type\":\"uint64\"},{\"internalType\":\"bool\",\"name\":\"publicGood\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"description\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"operationPoolTokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stakingPoolTokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalShares\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"slashedTokens\",\"type\":\"uint256\"}],\"internalType\":\"structDataTypes.Node\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getNodeCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"nodeAddrs\",\"type\":\"address[]\"}],\"name\":\"getNodes\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"taxRateBasisPoints\",\"type\":\"uint64\"},{\"internalType\":\"bool\",\"name\":\"publicGood\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"description\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"operationPoolTokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stakingPoolTokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalShares\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"slashedTokens\",\"type\":\"uint256\"}],\"internalType\":\"structDataTypes.Node[]\",\"name\":\"nodes\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"offset\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"limit\",\"type\":\"uint256\"}],\"name\":\"getNodesWithPagination\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"taxRateBasisPoints\",\"type\":\"uint64\"},{\"internalType\":\"bool\",\"name\":\"publicGood\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"description\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"operationPoolTokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stakingPoolTokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalShares\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"slashedTokens\",\"type\":\"uint256\"}],\"internalType\":\"structDataTypes.Node[]\",\"name\":\"nodes\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"name\":\"getPendingUnstake\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"unstakeAmount\",\"type\":\"uint256\"}],\"internalType\":\"structDataTypes.UnstakeRequest\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"name\":\"getPendingWithdrawal\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint40\",\"name\":\"timestamp\",\"type\":\"uint40\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structDataTypes.WithdrawalRequest\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPoolInfo\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"totalOperationPoolTokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalStakingPoolTokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"treasuryAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPublicPool\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"taxRateBasisPoints\",\"type\":\"uint64\"},{\"internalType\":\"bool\",\"name\":\"publicGood\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"description\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"operationPoolTokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stakingPoolTokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalShares\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"slashedTokens\",\"type\":\"uint256\"}],\"internalType\":\"structDataTypes.Node\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getRoleMember\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleMemberCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"chips\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"pauseAccount\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"oracleAccount\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"}],\"name\":\"minTokensToStake\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"callerConfirmation\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"chipsIds\",\"type\":\"uint256[]\"}],\"name\":\"requestUnstake\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"chipsIds\",\"type\":\"uint256[]\"}],\"name\":\"requestUnstakeFromPublicPool\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"requestWithdrawal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"taxRateBasisPoints\",\"type\":\"uint64\"}],\"name\":\"setTaxRateBasisPoints4Node\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"taxRateBasisPoints\",\"type\":\"uint64\"}],\"name\":\"setTaxRateBasisPoints4PublicPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"nodeAddrs\",\"type\":\"address[]\"}],\"name\":\"slashNodes\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"stake\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"startTokenId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"endTokenId\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"stakeToPublicPool\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"startTokenId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"endTokenId\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"stakingToken\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"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\":\"unpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"withdraw2Treasury\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // ChipsABI is the input ABI used to generate the binding from. @@ -180,12 +180,43 @@ func (_Chips *ChipsTransactorRaw) Transact(opts *bind.TransactOpts, method strin return _Chips.Contract.contract.Transact(opts, method, params...) } -// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// DEFAULTADMINROLE is a free data retrieval call binding the contract method 0xa217fddf. // -// Solidity: function balanceOf(address owner) view returns(uint256) -func (_Chips *ChipsCaller) BalanceOf(opts *bind.CallOpts, owner common.Address) (*big.Int, error) { +// Solidity: function DEFAULT_ADMIN_ROLE() view returns(bytes32) +func (_Chips *ChipsCaller) DEFAULTADMINROLE(opts *bind.CallOpts) ([32]byte, error) { var out []interface{} - err := _Chips.contract.Call(opts, &out, "balanceOf", owner) + err := _Chips.contract.Call(opts, &out, "DEFAULT_ADMIN_ROLE") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// DEFAULTADMINROLE is a free data retrieval call binding the contract method 0xa217fddf. +// +// Solidity: function DEFAULT_ADMIN_ROLE() view returns(bytes32) +func (_Chips *ChipsSession) DEFAULTADMINROLE() ([32]byte, error) { + return _Chips.Contract.DEFAULTADMINROLE(&_Chips.CallOpts) +} + +// DEFAULTADMINROLE is a free data retrieval call binding the contract method 0xa217fddf. +// +// Solidity: function DEFAULT_ADMIN_ROLE() view returns(bytes32) +func (_Chips *ChipsCallerSession) DEFAULTADMINROLE() ([32]byte, error) { + return _Chips.Contract.DEFAULTADMINROLE(&_Chips.CallOpts) +} + +// DEPOSITUNBONDINGPERIOD is a free data retrieval call binding the contract method 0x6bdc11d5. +// +// Solidity: function DEPOSIT_UNBONDING_PERIOD() view returns(uint256) +func (_Chips *ChipsCaller) DEPOSITUNBONDINGPERIOD(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Chips.contract.Call(opts, &out, "DEPOSIT_UNBONDING_PERIOD") if err != nil { return *new(*big.Int), err @@ -197,119 +228,243 @@ func (_Chips *ChipsCaller) BalanceOf(opts *bind.CallOpts, owner common.Address) } -// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// DEPOSITUNBONDINGPERIOD is a free data retrieval call binding the contract method 0x6bdc11d5. // -// Solidity: function balanceOf(address owner) view returns(uint256) -func (_Chips *ChipsSession) BalanceOf(owner common.Address) (*big.Int, error) { - return _Chips.Contract.BalanceOf(&_Chips.CallOpts, owner) +// Solidity: function DEPOSIT_UNBONDING_PERIOD() view returns(uint256) +func (_Chips *ChipsSession) DEPOSITUNBONDINGPERIOD() (*big.Int, error) { + return _Chips.Contract.DEPOSITUNBONDINGPERIOD(&_Chips.CallOpts) } -// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// DEPOSITUNBONDINGPERIOD is a free data retrieval call binding the contract method 0x6bdc11d5. // -// Solidity: function balanceOf(address owner) view returns(uint256) -func (_Chips *ChipsCallerSession) BalanceOf(owner common.Address) (*big.Int, error) { - return _Chips.Contract.BalanceOf(&_Chips.CallOpts, owner) +// Solidity: function DEPOSIT_UNBONDING_PERIOD() view returns(uint256) +func (_Chips *ChipsCallerSession) DEPOSITUNBONDINGPERIOD() (*big.Int, error) { + return _Chips.Contract.DEPOSITUNBONDINGPERIOD(&_Chips.CallOpts) } -// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// MINDEPOSIT is a free data retrieval call binding the contract method 0xe1e158a5. // -// Solidity: function getApproved(uint256 tokenId) view returns(address) -func (_Chips *ChipsCaller) GetApproved(opts *bind.CallOpts, tokenId *big.Int) (common.Address, error) { +// Solidity: function MIN_DEPOSIT() view returns(uint256) +func (_Chips *ChipsCaller) MINDEPOSIT(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _Chips.contract.Call(opts, &out, "getApproved", tokenId) + err := _Chips.contract.Call(opts, &out, "MIN_DEPOSIT") if err != nil { - return *new(common.Address), err + return *new(*big.Int), err } - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) return out0, err } -// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// MINDEPOSIT is a free data retrieval call binding the contract method 0xe1e158a5. // -// Solidity: function getApproved(uint256 tokenId) view returns(address) -func (_Chips *ChipsSession) GetApproved(tokenId *big.Int) (common.Address, error) { - return _Chips.Contract.GetApproved(&_Chips.CallOpts, tokenId) +// Solidity: function MIN_DEPOSIT() view returns(uint256) +func (_Chips *ChipsSession) MINDEPOSIT() (*big.Int, error) { + return _Chips.Contract.MINDEPOSIT(&_Chips.CallOpts) } -// GetApproved is a free data retrieval call binding the contract method 0x081812fc. +// MINDEPOSIT is a free data retrieval call binding the contract method 0xe1e158a5. // -// Solidity: function getApproved(uint256 tokenId) view returns(address) -func (_Chips *ChipsCallerSession) GetApproved(tokenId *big.Int) (common.Address, error) { - return _Chips.Contract.GetApproved(&_Chips.CallOpts, tokenId) +// Solidity: function MIN_DEPOSIT() view returns(uint256) +func (_Chips *ChipsCallerSession) MINDEPOSIT() (*big.Int, error) { + return _Chips.Contract.MINDEPOSIT(&_Chips.CallOpts) } -// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// NODESLASHRATEBASISPOINTS is a free data retrieval call binding the contract method 0x3daf051f. // -// Solidity: function isApprovedForAll(address owner, address operator) view returns(bool) -func (_Chips *ChipsCaller) IsApprovedForAll(opts *bind.CallOpts, owner common.Address, operator common.Address) (bool, error) { +// Solidity: function NODE_SLASH_RATE_BASIS_POINTS() view returns(uint256) +func (_Chips *ChipsCaller) NODESLASHRATEBASISPOINTS(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _Chips.contract.Call(opts, &out, "isApprovedForAll", owner, operator) + err := _Chips.contract.Call(opts, &out, "NODE_SLASH_RATE_BASIS_POINTS") if err != nil { - return *new(bool), err + return *new(*big.Int), err } - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// NODESLASHRATEBASISPOINTS is a free data retrieval call binding the contract method 0x3daf051f. +// +// Solidity: function NODE_SLASH_RATE_BASIS_POINTS() view returns(uint256) +func (_Chips *ChipsSession) NODESLASHRATEBASISPOINTS() (*big.Int, error) { + return _Chips.Contract.NODESLASHRATEBASISPOINTS(&_Chips.CallOpts) +} + +// NODESLASHRATEBASISPOINTS is a free data retrieval call binding the contract method 0x3daf051f. +// +// Solidity: function NODE_SLASH_RATE_BASIS_POINTS() view returns(uint256) +func (_Chips *ChipsCallerSession) NODESLASHRATEBASISPOINTS() (*big.Int, error) { + return _Chips.Contract.NODESLASHRATEBASISPOINTS(&_Chips.CallOpts) +} + +// ORACLEROLE is a free data retrieval call binding the contract method 0x07e2cea5. +// +// Solidity: function ORACLE_ROLE() view returns(bytes32) +func (_Chips *ChipsCaller) ORACLEROLE(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _Chips.contract.Call(opts, &out, "ORACLE_ROLE") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// ORACLEROLE is a free data retrieval call binding the contract method 0x07e2cea5. +// +// Solidity: function ORACLE_ROLE() view returns(bytes32) +func (_Chips *ChipsSession) ORACLEROLE() ([32]byte, error) { + return _Chips.Contract.ORACLEROLE(&_Chips.CallOpts) +} + +// ORACLEROLE is a free data retrieval call binding the contract method 0x07e2cea5. +// +// Solidity: function ORACLE_ROLE() view returns(bytes32) +func (_Chips *ChipsCallerSession) ORACLEROLE() ([32]byte, error) { + return _Chips.Contract.ORACLEROLE(&_Chips.CallOpts) +} + +// PAUSEROLE is a free data retrieval call binding the contract method 0x389ed267. +// +// Solidity: function PAUSE_ROLE() view returns(bytes32) +func (_Chips *ChipsCaller) PAUSEROLE(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _Chips.contract.Call(opts, &out, "PAUSE_ROLE") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// PAUSEROLE is a free data retrieval call binding the contract method 0x389ed267. +// +// Solidity: function PAUSE_ROLE() view returns(bytes32) +func (_Chips *ChipsSession) PAUSEROLE() ([32]byte, error) { + return _Chips.Contract.PAUSEROLE(&_Chips.CallOpts) +} + +// PAUSEROLE is a free data retrieval call binding the contract method 0x389ed267. +// +// Solidity: function PAUSE_ROLE() view returns(bytes32) +func (_Chips *ChipsCallerSession) PAUSEROLE() ([32]byte, error) { + return _Chips.Contract.PAUSEROLE(&_Chips.CallOpts) +} + +// SHARESPERCHIP is a free data retrieval call binding the contract method 0x6b05f6dc. +// +// Solidity: function SHARES_PER_CHIP() view returns(uint256) +func (_Chips *ChipsCaller) SHARESPERCHIP(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Chips.contract.Call(opts, &out, "SHARES_PER_CHIP") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// SHARESPERCHIP is a free data retrieval call binding the contract method 0x6b05f6dc. +// +// Solidity: function SHARES_PER_CHIP() view returns(uint256) +func (_Chips *ChipsSession) SHARESPERCHIP() (*big.Int, error) { + return _Chips.Contract.SHARESPERCHIP(&_Chips.CallOpts) +} + +// SHARESPERCHIP is a free data retrieval call binding the contract method 0x6b05f6dc. +// +// Solidity: function SHARES_PER_CHIP() view returns(uint256) +func (_Chips *ChipsCallerSession) SHARESPERCHIP() (*big.Int, error) { + return _Chips.Contract.SHARESPERCHIP(&_Chips.CallOpts) +} + +// STAKERATIO is a free data retrieval call binding the contract method 0x736fcdf6. +// +// Solidity: function STAKE_RATIO() view returns(uint256) +func (_Chips *ChipsCaller) STAKERATIO(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Chips.contract.Call(opts, &out, "STAKE_RATIO") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) return out0, err } -// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// STAKERATIO is a free data retrieval call binding the contract method 0x736fcdf6. // -// Solidity: function isApprovedForAll(address owner, address operator) view returns(bool) -func (_Chips *ChipsSession) IsApprovedForAll(owner common.Address, operator common.Address) (bool, error) { - return _Chips.Contract.IsApprovedForAll(&_Chips.CallOpts, owner, operator) +// Solidity: function STAKE_RATIO() view returns(uint256) +func (_Chips *ChipsSession) STAKERATIO() (*big.Int, error) { + return _Chips.Contract.STAKERATIO(&_Chips.CallOpts) } -// IsApprovedForAll is a free data retrieval call binding the contract method 0xe985e9c5. +// STAKERATIO is a free data retrieval call binding the contract method 0x736fcdf6. // -// Solidity: function isApprovedForAll(address owner, address operator) view returns(bool) -func (_Chips *ChipsCallerSession) IsApprovedForAll(owner common.Address, operator common.Address) (bool, error) { - return _Chips.Contract.IsApprovedForAll(&_Chips.CallOpts, owner, operator) +// Solidity: function STAKE_RATIO() view returns(uint256) +func (_Chips *ChipsCallerSession) STAKERATIO() (*big.Int, error) { + return _Chips.Contract.STAKERATIO(&_Chips.CallOpts) } -// Name is a free data retrieval call binding the contract method 0x06fdde03. +// STAKEUNBONDINGPERIOD is a free data retrieval call binding the contract method 0x2606a44a. // -// Solidity: function name() view returns(string) -func (_Chips *ChipsCaller) Name(opts *bind.CallOpts) (string, error) { +// Solidity: function STAKE_UNBONDING_PERIOD() view returns(uint256) +func (_Chips *ChipsCaller) STAKEUNBONDINGPERIOD(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _Chips.contract.Call(opts, &out, "name") + err := _Chips.contract.Call(opts, &out, "STAKE_UNBONDING_PERIOD") if err != nil { - return *new(string), err + return *new(*big.Int), err } - out0 := *abi.ConvertType(out[0], new(string)).(*string) + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) return out0, err } -// Name is a free data retrieval call binding the contract method 0x06fdde03. +// STAKEUNBONDINGPERIOD is a free data retrieval call binding the contract method 0x2606a44a. // -// Solidity: function name() view returns(string) -func (_Chips *ChipsSession) Name() (string, error) { - return _Chips.Contract.Name(&_Chips.CallOpts) +// Solidity: function STAKE_UNBONDING_PERIOD() view returns(uint256) +func (_Chips *ChipsSession) STAKEUNBONDINGPERIOD() (*big.Int, error) { + return _Chips.Contract.STAKEUNBONDINGPERIOD(&_Chips.CallOpts) } -// Name is a free data retrieval call binding the contract method 0x06fdde03. +// STAKEUNBONDINGPERIOD is a free data retrieval call binding the contract method 0x2606a44a. // -// Solidity: function name() view returns(string) -func (_Chips *ChipsCallerSession) Name() (string, error) { - return _Chips.Contract.Name(&_Chips.CallOpts) +// Solidity: function STAKE_UNBONDING_PERIOD() view returns(uint256) +func (_Chips *ChipsCallerSession) STAKEUNBONDINGPERIOD() (*big.Int, error) { + return _Chips.Contract.STAKEUNBONDINGPERIOD(&_Chips.CallOpts) } -// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// TOKEN is a free data retrieval call binding the contract method 0x82bfefc8. // -// Solidity: function ownerOf(uint256 tokenId) view returns(address) -func (_Chips *ChipsCaller) OwnerOf(opts *bind.CallOpts, tokenId *big.Int) (common.Address, error) { +// Solidity: function TOKEN() view returns(address) +func (_Chips *ChipsCaller) TOKEN(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _Chips.contract.Call(opts, &out, "ownerOf", tokenId) + err := _Chips.contract.Call(opts, &out, "TOKEN") if err != nil { return *new(common.Address), err @@ -321,26 +476,26 @@ func (_Chips *ChipsCaller) OwnerOf(opts *bind.CallOpts, tokenId *big.Int) (commo } -// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// TOKEN is a free data retrieval call binding the contract method 0x82bfefc8. // -// Solidity: function ownerOf(uint256 tokenId) view returns(address) -func (_Chips *ChipsSession) OwnerOf(tokenId *big.Int) (common.Address, error) { - return _Chips.Contract.OwnerOf(&_Chips.CallOpts, tokenId) +// Solidity: function TOKEN() view returns(address) +func (_Chips *ChipsSession) TOKEN() (common.Address, error) { + return _Chips.Contract.TOKEN(&_Chips.CallOpts) } -// OwnerOf is a free data retrieval call binding the contract method 0x6352211e. +// TOKEN is a free data retrieval call binding the contract method 0x82bfefc8. // -// Solidity: function ownerOf(uint256 tokenId) view returns(address) -func (_Chips *ChipsCallerSession) OwnerOf(tokenId *big.Int) (common.Address, error) { - return _Chips.Contract.OwnerOf(&_Chips.CallOpts, tokenId) +// Solidity: function TOKEN() view returns(address) +func (_Chips *ChipsCallerSession) TOKEN() (common.Address, error) { + return _Chips.Contract.TOKEN(&_Chips.CallOpts) } -// StakingContract is a free data retrieval call binding the contract method 0xee99205c. +// TREASURY is a free data retrieval call binding the contract method 0x2d2c5565. // -// Solidity: function stakingContract() view returns(address) -func (_Chips *ChipsCaller) StakingContract(opts *bind.CallOpts) (common.Address, error) { +// Solidity: function TREASURY() view returns(address) +func (_Chips *ChipsCaller) TREASURY(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _Chips.contract.Call(opts, &out, "stakingContract") + err := _Chips.contract.Call(opts, &out, "TREASURY") if err != nil { return *new(common.Address), err @@ -352,336 +507,3424 @@ func (_Chips *ChipsCaller) StakingContract(opts *bind.CallOpts) (common.Address, } -// StakingContract is a free data retrieval call binding the contract method 0xee99205c. +// TREASURY is a free data retrieval call binding the contract method 0x2d2c5565. // -// Solidity: function stakingContract() view returns(address) -func (_Chips *ChipsSession) StakingContract() (common.Address, error) { - return _Chips.Contract.StakingContract(&_Chips.CallOpts) +// Solidity: function TREASURY() view returns(address) +func (_Chips *ChipsSession) TREASURY() (common.Address, error) { + return _Chips.Contract.TREASURY(&_Chips.CallOpts) } -// StakingContract is a free data retrieval call binding the contract method 0xee99205c. +// TREASURY is a free data retrieval call binding the contract method 0x2d2c5565. // -// Solidity: function stakingContract() view returns(address) -func (_Chips *ChipsCallerSession) StakingContract() (common.Address, error) { - return _Chips.Contract.StakingContract(&_Chips.CallOpts) +// Solidity: function TREASURY() view returns(address) +func (_Chips *ChipsCallerSession) TREASURY() (common.Address, error) { + return _Chips.Contract.TREASURY(&_Chips.CallOpts) } -// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// USERSLASHRATEBASISPOINTS is a free data retrieval call binding the contract method 0xb47d343c. // -// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) -func (_Chips *ChipsCaller) SupportsInterface(opts *bind.CallOpts, interfaceId [4]byte) (bool, error) { +// Solidity: function USER_SLASH_RATE_BASIS_POINTS() view returns(uint256) +func (_Chips *ChipsCaller) USERSLASHRATEBASISPOINTS(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _Chips.contract.Call(opts, &out, "supportsInterface", interfaceId) + err := _Chips.contract.Call(opts, &out, "USER_SLASH_RATE_BASIS_POINTS") if err != nil { - return *new(bool), err + return *new(*big.Int), err } - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) return out0, err } -// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// USERSLASHRATEBASISPOINTS is a free data retrieval call binding the contract method 0xb47d343c. // -// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) -func (_Chips *ChipsSession) SupportsInterface(interfaceId [4]byte) (bool, error) { - return _Chips.Contract.SupportsInterface(&_Chips.CallOpts, interfaceId) +// Solidity: function USER_SLASH_RATE_BASIS_POINTS() view returns(uint256) +func (_Chips *ChipsSession) USERSLASHRATEBASISPOINTS() (*big.Int, error) { + return _Chips.Contract.USERSLASHRATEBASISPOINTS(&_Chips.CallOpts) } -// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// USERSLASHRATEBASISPOINTS is a free data retrieval call binding the contract method 0xb47d343c. // -// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) -func (_Chips *ChipsCallerSession) SupportsInterface(interfaceId [4]byte) (bool, error) { - return _Chips.Contract.SupportsInterface(&_Chips.CallOpts, interfaceId) +// Solidity: function USER_SLASH_RATE_BASIS_POINTS() view returns(uint256) +func (_Chips *ChipsCallerSession) USERSLASHRATEBASISPOINTS() (*big.Int, error) { + return _Chips.Contract.USERSLASHRATEBASISPOINTS(&_Chips.CallOpts) +} + +// ChipsContract is a free data retrieval call binding the contract method 0xd13b19a3. +// +// Solidity: function chipsContract() view returns(address) +func (_Chips *ChipsCaller) ChipsContract(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _Chips.contract.Call(opts, &out, "chipsContract") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + } -// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// ChipsContract is a free data retrieval call binding the contract method 0xd13b19a3. // -// Solidity: function symbol() view returns(string) -func (_Chips *ChipsCaller) Symbol(opts *bind.CallOpts) (string, error) { +// Solidity: function chipsContract() view returns(address) +func (_Chips *ChipsSession) ChipsContract() (common.Address, error) { + return _Chips.Contract.ChipsContract(&_Chips.CallOpts) +} + +// ChipsContract is a free data retrieval call binding the contract method 0xd13b19a3. +// +// Solidity: function chipsContract() view returns(address) +func (_Chips *ChipsCallerSession) ChipsContract() (common.Address, error) { + return _Chips.Contract.ChipsContract(&_Chips.CallOpts) +} + +// CurrentEpoch is a free data retrieval call binding the contract method 0x76671808. +// +// Solidity: function currentEpoch() view returns(uint256) +func (_Chips *ChipsCaller) CurrentEpoch(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Chips.contract.Call(opts, &out, "currentEpoch") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// CurrentEpoch is a free data retrieval call binding the contract method 0x76671808. +// +// Solidity: function currentEpoch() view returns(uint256) +func (_Chips *ChipsSession) CurrentEpoch() (*big.Int, error) { + return _Chips.Contract.CurrentEpoch(&_Chips.CallOpts) +} + +// CurrentEpoch is a free data retrieval call binding the contract method 0x76671808. +// +// Solidity: function currentEpoch() view returns(uint256) +func (_Chips *ChipsCallerSession) CurrentEpoch() (*big.Int, error) { + return _Chips.Contract.CurrentEpoch(&_Chips.CallOpts) +} + +// GetChipsInfo is a free data retrieval call binding the contract method 0x90d3f47c. +// +// Solidity: function getChipsInfo(uint256 tokenId) view returns(address nodeAddr, uint256 tokens) +func (_Chips *ChipsCaller) GetChipsInfo(opts *bind.CallOpts, tokenId *big.Int) (struct { + NodeAddr common.Address + Tokens *big.Int +}, error) { + var out []interface{} + err := _Chips.contract.Call(opts, &out, "getChipsInfo", tokenId) + + outstruct := new(struct { + NodeAddr common.Address + Tokens *big.Int + }) + if err != nil { + return *outstruct, err + } + + outstruct.NodeAddr = *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + outstruct.Tokens = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + + return *outstruct, err + +} + +// GetChipsInfo is a free data retrieval call binding the contract method 0x90d3f47c. +// +// Solidity: function getChipsInfo(uint256 tokenId) view returns(address nodeAddr, uint256 tokens) +func (_Chips *ChipsSession) GetChipsInfo(tokenId *big.Int) (struct { + NodeAddr common.Address + Tokens *big.Int +}, error) { + return _Chips.Contract.GetChipsInfo(&_Chips.CallOpts, tokenId) +} + +// GetChipsInfo is a free data retrieval call binding the contract method 0x90d3f47c. +// +// Solidity: function getChipsInfo(uint256 tokenId) view returns(address nodeAddr, uint256 tokens) +func (_Chips *ChipsCallerSession) GetChipsInfo(tokenId *big.Int) (struct { + NodeAddr common.Address + Tokens *big.Int +}, error) { + return _Chips.Contract.GetChipsInfo(&_Chips.CallOpts, tokenId) +} + +// GetMinDeposit is a free data retrieval call binding the contract method 0x0eaad3f1. +// +// Solidity: function getMinDeposit() view returns(uint256) +func (_Chips *ChipsCaller) GetMinDeposit(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _Chips.contract.Call(opts, &out, "symbol") + err := _Chips.contract.Call(opts, &out, "getMinDeposit") if err != nil { - return *new(string), err + return *new(*big.Int), err } - out0 := *abi.ConvertType(out[0], new(string)).(*string) + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) return out0, err } -// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// GetMinDeposit is a free data retrieval call binding the contract method 0x0eaad3f1. // -// Solidity: function symbol() view returns(string) -func (_Chips *ChipsSession) Symbol() (string, error) { - return _Chips.Contract.Symbol(&_Chips.CallOpts) +// Solidity: function getMinDeposit() view returns(uint256) +func (_Chips *ChipsSession) GetMinDeposit() (*big.Int, error) { + return _Chips.Contract.GetMinDeposit(&_Chips.CallOpts) } -// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// GetMinDeposit is a free data retrieval call binding the contract method 0x0eaad3f1. // -// Solidity: function symbol() view returns(string) -func (_Chips *ChipsCallerSession) Symbol() (string, error) { - return _Chips.Contract.Symbol(&_Chips.CallOpts) +// Solidity: function getMinDeposit() view returns(uint256) +func (_Chips *ChipsCallerSession) GetMinDeposit() (*big.Int, error) { + return _Chips.Contract.GetMinDeposit(&_Chips.CallOpts) } -// TokenURI is a free data retrieval call binding the contract method 0xc87b56dd. +// GetNode is a free data retrieval call binding the contract method 0x9d209048. // -// Solidity: function tokenURI(uint256 tokenId) view returns(string) -func (_Chips *ChipsCaller) TokenURI(opts *bind.CallOpts, tokenId *big.Int) (string, error) { +// Solidity: function getNode(address nodeAddr) view returns((address,uint64,bool,string,string,uint256,uint256,uint256,uint256)) +func (_Chips *ChipsCaller) GetNode(opts *bind.CallOpts, nodeAddr common.Address) (DataTypesNode, error) { var out []interface{} - err := _Chips.contract.Call(opts, &out, "tokenURI", tokenId) + err := _Chips.contract.Call(opts, &out, "getNode", nodeAddr) if err != nil { - return *new(string), err + return *new(DataTypesNode), err } - out0 := *abi.ConvertType(out[0], new(string)).(*string) + out0 := *abi.ConvertType(out[0], new(DataTypesNode)).(*DataTypesNode) return out0, err } -// TokenURI is a free data retrieval call binding the contract method 0xc87b56dd. +// GetNode is a free data retrieval call binding the contract method 0x9d209048. // -// Solidity: function tokenURI(uint256 tokenId) view returns(string) -func (_Chips *ChipsSession) TokenURI(tokenId *big.Int) (string, error) { - return _Chips.Contract.TokenURI(&_Chips.CallOpts, tokenId) +// Solidity: function getNode(address nodeAddr) view returns((address,uint64,bool,string,string,uint256,uint256,uint256,uint256)) +func (_Chips *ChipsSession) GetNode(nodeAddr common.Address) (DataTypesNode, error) { + return _Chips.Contract.GetNode(&_Chips.CallOpts, nodeAddr) } -// TokenURI is a free data retrieval call binding the contract method 0xc87b56dd. +// GetNode is a free data retrieval call binding the contract method 0x9d209048. // -// Solidity: function tokenURI(uint256 tokenId) view returns(string) -func (_Chips *ChipsCallerSession) TokenURI(tokenId *big.Int) (string, error) { - return _Chips.Contract.TokenURI(&_Chips.CallOpts, tokenId) +// Solidity: function getNode(address nodeAddr) view returns((address,uint64,bool,string,string,uint256,uint256,uint256,uint256)) +func (_Chips *ChipsCallerSession) GetNode(nodeAddr common.Address) (DataTypesNode, error) { + return _Chips.Contract.GetNode(&_Chips.CallOpts, nodeAddr) } -// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// GetNodeCount is a free data retrieval call binding the contract method 0x39bf397e. // -// Solidity: function totalSupply() view returns(uint256) -func (_Chips *ChipsCaller) TotalSupply(opts *bind.CallOpts) (*big.Int, error) { +// Solidity: function getNodeCount() view returns(uint256) +func (_Chips *ChipsCaller) GetNodeCount(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _Chips.contract.Call(opts, &out, "totalSupply") + err := _Chips.contract.Call(opts, &out, "getNodeCount") if err != nil { return *new(*big.Int), err } - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetNodeCount is a free data retrieval call binding the contract method 0x39bf397e. +// +// Solidity: function getNodeCount() view returns(uint256) +func (_Chips *ChipsSession) GetNodeCount() (*big.Int, error) { + return _Chips.Contract.GetNodeCount(&_Chips.CallOpts) +} + +// GetNodeCount is a free data retrieval call binding the contract method 0x39bf397e. +// +// Solidity: function getNodeCount() view returns(uint256) +func (_Chips *ChipsCallerSession) GetNodeCount() (*big.Int, error) { + return _Chips.Contract.GetNodeCount(&_Chips.CallOpts) +} + +// GetNodes is a free data retrieval call binding the contract method 0x38c96b14. +// +// Solidity: function getNodes(address[] nodeAddrs) view returns((address,uint64,bool,string,string,uint256,uint256,uint256,uint256)[] nodes) +func (_Chips *ChipsCaller) GetNodes(opts *bind.CallOpts, nodeAddrs []common.Address) ([]DataTypesNode, error) { + var out []interface{} + err := _Chips.contract.Call(opts, &out, "getNodes", nodeAddrs) + + if err != nil { + return *new([]DataTypesNode), err + } + + out0 := *abi.ConvertType(out[0], new([]DataTypesNode)).(*[]DataTypesNode) + + return out0, err + +} + +// GetNodes is a free data retrieval call binding the contract method 0x38c96b14. +// +// Solidity: function getNodes(address[] nodeAddrs) view returns((address,uint64,bool,string,string,uint256,uint256,uint256,uint256)[] nodes) +func (_Chips *ChipsSession) GetNodes(nodeAddrs []common.Address) ([]DataTypesNode, error) { + return _Chips.Contract.GetNodes(&_Chips.CallOpts, nodeAddrs) +} + +// GetNodes is a free data retrieval call binding the contract method 0x38c96b14. +// +// Solidity: function getNodes(address[] nodeAddrs) view returns((address,uint64,bool,string,string,uint256,uint256,uint256,uint256)[] nodes) +func (_Chips *ChipsCallerSession) GetNodes(nodeAddrs []common.Address) ([]DataTypesNode, error) { + return _Chips.Contract.GetNodes(&_Chips.CallOpts, nodeAddrs) +} + +// GetNodesWithPagination is a free data retrieval call binding the contract method 0xd995415b. +// +// Solidity: function getNodesWithPagination(uint256 offset, uint256 limit) view returns((address,uint64,bool,string,string,uint256,uint256,uint256,uint256)[] nodes) +func (_Chips *ChipsCaller) GetNodesWithPagination(opts *bind.CallOpts, offset *big.Int, limit *big.Int) ([]DataTypesNode, error) { + var out []interface{} + err := _Chips.contract.Call(opts, &out, "getNodesWithPagination", offset, limit) + + if err != nil { + return *new([]DataTypesNode), err + } + + out0 := *abi.ConvertType(out[0], new([]DataTypesNode)).(*[]DataTypesNode) + + return out0, err + +} + +// GetNodesWithPagination is a free data retrieval call binding the contract method 0xd995415b. +// +// Solidity: function getNodesWithPagination(uint256 offset, uint256 limit) view returns((address,uint64,bool,string,string,uint256,uint256,uint256,uint256)[] nodes) +func (_Chips *ChipsSession) GetNodesWithPagination(offset *big.Int, limit *big.Int) ([]DataTypesNode, error) { + return _Chips.Contract.GetNodesWithPagination(&_Chips.CallOpts, offset, limit) +} + +// GetNodesWithPagination is a free data retrieval call binding the contract method 0xd995415b. +// +// Solidity: function getNodesWithPagination(uint256 offset, uint256 limit) view returns((address,uint64,bool,string,string,uint256,uint256,uint256,uint256)[] nodes) +func (_Chips *ChipsCallerSession) GetNodesWithPagination(offset *big.Int, limit *big.Int) ([]DataTypesNode, error) { + return _Chips.Contract.GetNodesWithPagination(&_Chips.CallOpts, offset, limit) +} + +// GetPendingUnstake is a free data retrieval call binding the contract method 0xadfd065f. +// +// Solidity: function getPendingUnstake(uint256 requestId) view returns((address,address,uint256,uint256)) +func (_Chips *ChipsCaller) GetPendingUnstake(opts *bind.CallOpts, requestId *big.Int) (DataTypesUnstakeRequest, error) { + var out []interface{} + err := _Chips.contract.Call(opts, &out, "getPendingUnstake", requestId) + + if err != nil { + return *new(DataTypesUnstakeRequest), err + } + + out0 := *abi.ConvertType(out[0], new(DataTypesUnstakeRequest)).(*DataTypesUnstakeRequest) + + return out0, err + +} + +// GetPendingUnstake is a free data retrieval call binding the contract method 0xadfd065f. +// +// Solidity: function getPendingUnstake(uint256 requestId) view returns((address,address,uint256,uint256)) +func (_Chips *ChipsSession) GetPendingUnstake(requestId *big.Int) (DataTypesUnstakeRequest, error) { + return _Chips.Contract.GetPendingUnstake(&_Chips.CallOpts, requestId) +} + +// GetPendingUnstake is a free data retrieval call binding the contract method 0xadfd065f. +// +// Solidity: function getPendingUnstake(uint256 requestId) view returns((address,address,uint256,uint256)) +func (_Chips *ChipsCallerSession) GetPendingUnstake(requestId *big.Int) (DataTypesUnstakeRequest, error) { + return _Chips.Contract.GetPendingUnstake(&_Chips.CallOpts, requestId) +} + +// GetPendingWithdrawal is a free data retrieval call binding the contract method 0x38a3c878. +// +// Solidity: function getPendingWithdrawal(uint256 requestId) view returns((address,uint40,uint256)) +func (_Chips *ChipsCaller) GetPendingWithdrawal(opts *bind.CallOpts, requestId *big.Int) (DataTypesWithdrawalRequest, error) { + var out []interface{} + err := _Chips.contract.Call(opts, &out, "getPendingWithdrawal", requestId) + + if err != nil { + return *new(DataTypesWithdrawalRequest), err + } + + out0 := *abi.ConvertType(out[0], new(DataTypesWithdrawalRequest)).(*DataTypesWithdrawalRequest) + + return out0, err + +} + +// GetPendingWithdrawal is a free data retrieval call binding the contract method 0x38a3c878. +// +// Solidity: function getPendingWithdrawal(uint256 requestId) view returns((address,uint40,uint256)) +func (_Chips *ChipsSession) GetPendingWithdrawal(requestId *big.Int) (DataTypesWithdrawalRequest, error) { + return _Chips.Contract.GetPendingWithdrawal(&_Chips.CallOpts, requestId) +} + +// GetPendingWithdrawal is a free data retrieval call binding the contract method 0x38a3c878. +// +// Solidity: function getPendingWithdrawal(uint256 requestId) view returns((address,uint40,uint256)) +func (_Chips *ChipsCallerSession) GetPendingWithdrawal(requestId *big.Int) (DataTypesWithdrawalRequest, error) { + return _Chips.Contract.GetPendingWithdrawal(&_Chips.CallOpts, requestId) +} + +// GetPoolInfo is a free data retrieval call binding the contract method 0x60246c88. +// +// Solidity: function getPoolInfo() view returns(uint256 totalOperationPoolTokens, uint256 totalStakingPoolTokens, uint256 treasuryAmount) +func (_Chips *ChipsCaller) GetPoolInfo(opts *bind.CallOpts) (struct { + TotalOperationPoolTokens *big.Int + TotalStakingPoolTokens *big.Int + TreasuryAmount *big.Int +}, error) { + var out []interface{} + err := _Chips.contract.Call(opts, &out, "getPoolInfo") + + outstruct := new(struct { + TotalOperationPoolTokens *big.Int + TotalStakingPoolTokens *big.Int + TreasuryAmount *big.Int + }) + if err != nil { + return *outstruct, err + } + + outstruct.TotalOperationPoolTokens = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + outstruct.TotalStakingPoolTokens = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + outstruct.TreasuryAmount = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) + + return *outstruct, err + +} + +// GetPoolInfo is a free data retrieval call binding the contract method 0x60246c88. +// +// Solidity: function getPoolInfo() view returns(uint256 totalOperationPoolTokens, uint256 totalStakingPoolTokens, uint256 treasuryAmount) +func (_Chips *ChipsSession) GetPoolInfo() (struct { + TotalOperationPoolTokens *big.Int + TotalStakingPoolTokens *big.Int + TreasuryAmount *big.Int +}, error) { + return _Chips.Contract.GetPoolInfo(&_Chips.CallOpts) +} + +// GetPoolInfo is a free data retrieval call binding the contract method 0x60246c88. +// +// Solidity: function getPoolInfo() view returns(uint256 totalOperationPoolTokens, uint256 totalStakingPoolTokens, uint256 treasuryAmount) +func (_Chips *ChipsCallerSession) GetPoolInfo() (struct { + TotalOperationPoolTokens *big.Int + TotalStakingPoolTokens *big.Int + TreasuryAmount *big.Int +}, error) { + return _Chips.Contract.GetPoolInfo(&_Chips.CallOpts) +} + +// GetPublicPool is a free data retrieval call binding the contract method 0xc84c42a3. +// +// Solidity: function getPublicPool() view returns((address,uint64,bool,string,string,uint256,uint256,uint256,uint256)) +func (_Chips *ChipsCaller) GetPublicPool(opts *bind.CallOpts) (DataTypesNode, error) { + var out []interface{} + err := _Chips.contract.Call(opts, &out, "getPublicPool") + + if err != nil { + return *new(DataTypesNode), err + } + + out0 := *abi.ConvertType(out[0], new(DataTypesNode)).(*DataTypesNode) + + return out0, err + +} + +// GetPublicPool is a free data retrieval call binding the contract method 0xc84c42a3. +// +// Solidity: function getPublicPool() view returns((address,uint64,bool,string,string,uint256,uint256,uint256,uint256)) +func (_Chips *ChipsSession) GetPublicPool() (DataTypesNode, error) { + return _Chips.Contract.GetPublicPool(&_Chips.CallOpts) +} + +// GetPublicPool is a free data retrieval call binding the contract method 0xc84c42a3. +// +// Solidity: function getPublicPool() view returns((address,uint64,bool,string,string,uint256,uint256,uint256,uint256)) +func (_Chips *ChipsCallerSession) GetPublicPool() (DataTypesNode, error) { + return _Chips.Contract.GetPublicPool(&_Chips.CallOpts) +} + +// GetRoleAdmin is a free data retrieval call binding the contract method 0x248a9ca3. +// +// Solidity: function getRoleAdmin(bytes32 role) view returns(bytes32) +func (_Chips *ChipsCaller) GetRoleAdmin(opts *bind.CallOpts, role [32]byte) ([32]byte, error) { + var out []interface{} + err := _Chips.contract.Call(opts, &out, "getRoleAdmin", role) + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// GetRoleAdmin is a free data retrieval call binding the contract method 0x248a9ca3. +// +// Solidity: function getRoleAdmin(bytes32 role) view returns(bytes32) +func (_Chips *ChipsSession) GetRoleAdmin(role [32]byte) ([32]byte, error) { + return _Chips.Contract.GetRoleAdmin(&_Chips.CallOpts, role) +} + +// GetRoleAdmin is a free data retrieval call binding the contract method 0x248a9ca3. +// +// Solidity: function getRoleAdmin(bytes32 role) view returns(bytes32) +func (_Chips *ChipsCallerSession) GetRoleAdmin(role [32]byte) ([32]byte, error) { + return _Chips.Contract.GetRoleAdmin(&_Chips.CallOpts, role) +} + +// GetRoleMember is a free data retrieval call binding the contract method 0x9010d07c. +// +// Solidity: function getRoleMember(bytes32 role, uint256 index) view returns(address) +func (_Chips *ChipsCaller) GetRoleMember(opts *bind.CallOpts, role [32]byte, index *big.Int) (common.Address, error) { + var out []interface{} + err := _Chips.contract.Call(opts, &out, "getRoleMember", role, index) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// GetRoleMember is a free data retrieval call binding the contract method 0x9010d07c. +// +// Solidity: function getRoleMember(bytes32 role, uint256 index) view returns(address) +func (_Chips *ChipsSession) GetRoleMember(role [32]byte, index *big.Int) (common.Address, error) { + return _Chips.Contract.GetRoleMember(&_Chips.CallOpts, role, index) +} + +// GetRoleMember is a free data retrieval call binding the contract method 0x9010d07c. +// +// Solidity: function getRoleMember(bytes32 role, uint256 index) view returns(address) +func (_Chips *ChipsCallerSession) GetRoleMember(role [32]byte, index *big.Int) (common.Address, error) { + return _Chips.Contract.GetRoleMember(&_Chips.CallOpts, role, index) +} + +// GetRoleMemberCount is a free data retrieval call binding the contract method 0xca15c873. +// +// Solidity: function getRoleMemberCount(bytes32 role) view returns(uint256) +func (_Chips *ChipsCaller) GetRoleMemberCount(opts *bind.CallOpts, role [32]byte) (*big.Int, error) { + var out []interface{} + err := _Chips.contract.Call(opts, &out, "getRoleMemberCount", role) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetRoleMemberCount is a free data retrieval call binding the contract method 0xca15c873. +// +// Solidity: function getRoleMemberCount(bytes32 role) view returns(uint256) +func (_Chips *ChipsSession) GetRoleMemberCount(role [32]byte) (*big.Int, error) { + return _Chips.Contract.GetRoleMemberCount(&_Chips.CallOpts, role) +} + +// GetRoleMemberCount is a free data retrieval call binding the contract method 0xca15c873. +// +// Solidity: function getRoleMemberCount(bytes32 role) view returns(uint256) +func (_Chips *ChipsCallerSession) GetRoleMemberCount(role [32]byte) (*big.Int, error) { + return _Chips.Contract.GetRoleMemberCount(&_Chips.CallOpts, role) +} + +// HasRole is a free data retrieval call binding the contract method 0x91d14854. +// +// Solidity: function hasRole(bytes32 role, address account) view returns(bool) +func (_Chips *ChipsCaller) HasRole(opts *bind.CallOpts, role [32]byte, account common.Address) (bool, error) { + var out []interface{} + err := _Chips.contract.Call(opts, &out, "hasRole", role, account) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// HasRole is a free data retrieval call binding the contract method 0x91d14854. +// +// Solidity: function hasRole(bytes32 role, address account) view returns(bool) +func (_Chips *ChipsSession) HasRole(role [32]byte, account common.Address) (bool, error) { + return _Chips.Contract.HasRole(&_Chips.CallOpts, role, account) +} + +// HasRole is a free data retrieval call binding the contract method 0x91d14854. +// +// Solidity: function hasRole(bytes32 role, address account) view returns(bool) +func (_Chips *ChipsCallerSession) HasRole(role [32]byte, account common.Address) (bool, error) { + return _Chips.Contract.HasRole(&_Chips.CallOpts, role, account) +} + +// MinTokensToStake is a free data retrieval call binding the contract method 0x14936b13. +// +// Solidity: function minTokensToStake(address nodeAddr) view returns(uint256) +func (_Chips *ChipsCaller) MinTokensToStake(opts *bind.CallOpts, nodeAddr common.Address) (*big.Int, error) { + var out []interface{} + err := _Chips.contract.Call(opts, &out, "minTokensToStake", nodeAddr) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// MinTokensToStake is a free data retrieval call binding the contract method 0x14936b13. +// +// Solidity: function minTokensToStake(address nodeAddr) view returns(uint256) +func (_Chips *ChipsSession) MinTokensToStake(nodeAddr common.Address) (*big.Int, error) { + return _Chips.Contract.MinTokensToStake(&_Chips.CallOpts, nodeAddr) +} + +// MinTokensToStake is a free data retrieval call binding the contract method 0x14936b13. +// +// Solidity: function minTokensToStake(address nodeAddr) view returns(uint256) +func (_Chips *ChipsCallerSession) MinTokensToStake(nodeAddr common.Address) (*big.Int, error) { + return _Chips.Contract.MinTokensToStake(&_Chips.CallOpts, nodeAddr) +} + +// Paused is a free data retrieval call binding the contract method 0x5c975abb. +// +// Solidity: function paused() view returns(bool) +func (_Chips *ChipsCaller) Paused(opts *bind.CallOpts) (bool, error) { + var out []interface{} + err := _Chips.contract.Call(opts, &out, "paused") + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// Paused is a free data retrieval call binding the contract method 0x5c975abb. +// +// Solidity: function paused() view returns(bool) +func (_Chips *ChipsSession) Paused() (bool, error) { + return _Chips.Contract.Paused(&_Chips.CallOpts) +} + +// Paused is a free data retrieval call binding the contract method 0x5c975abb. +// +// Solidity: function paused() view returns(bool) +func (_Chips *ChipsCallerSession) Paused() (bool, error) { + return _Chips.Contract.Paused(&_Chips.CallOpts) +} + +// StakingToken is a free data retrieval call binding the contract method 0x72f702f3. +// +// Solidity: function stakingToken() view returns(address) +func (_Chips *ChipsCaller) StakingToken(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _Chips.contract.Call(opts, &out, "stakingToken") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// StakingToken is a free data retrieval call binding the contract method 0x72f702f3. +// +// Solidity: function stakingToken() view returns(address) +func (_Chips *ChipsSession) StakingToken() (common.Address, error) { + return _Chips.Contract.StakingToken(&_Chips.CallOpts) +} + +// StakingToken is a free data retrieval call binding the contract method 0x72f702f3. +// +// Solidity: function stakingToken() view returns(address) +func (_Chips *ChipsCallerSession) StakingToken() (common.Address, error) { + return _Chips.Contract.StakingToken(&_Chips.CallOpts) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_Chips *ChipsCaller) SupportsInterface(opts *bind.CallOpts, interfaceId [4]byte) (bool, error) { + var out []interface{} + err := _Chips.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 (_Chips *ChipsSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _Chips.Contract.SupportsInterface(&_Chips.CallOpts, interfaceId) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_Chips *ChipsCallerSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _Chips.Contract.SupportsInterface(&_Chips.CallOpts, interfaceId) +} + +// ClaimUnstake is a paid mutator transaction binding the contract method 0x04a4fb10. +// +// Solidity: function claimUnstake(uint256[] requestIds) returns() +func (_Chips *ChipsTransactor) ClaimUnstake(opts *bind.TransactOpts, requestIds []*big.Int) (*types.Transaction, error) { + return _Chips.contract.Transact(opts, "claimUnstake", requestIds) +} + +// ClaimUnstake is a paid mutator transaction binding the contract method 0x04a4fb10. +// +// Solidity: function claimUnstake(uint256[] requestIds) returns() +func (_Chips *ChipsSession) ClaimUnstake(requestIds []*big.Int) (*types.Transaction, error) { + return _Chips.Contract.ClaimUnstake(&_Chips.TransactOpts, requestIds) +} + +// ClaimUnstake is a paid mutator transaction binding the contract method 0x04a4fb10. +// +// Solidity: function claimUnstake(uint256[] requestIds) returns() +func (_Chips *ChipsTransactorSession) ClaimUnstake(requestIds []*big.Int) (*types.Transaction, error) { + return _Chips.Contract.ClaimUnstake(&_Chips.TransactOpts, requestIds) +} + +// ClaimWithdrawal is a paid mutator transaction binding the contract method 0x3c256b98. +// +// Solidity: function claimWithdrawal(uint256[] requestIds) returns() +func (_Chips *ChipsTransactor) ClaimWithdrawal(opts *bind.TransactOpts, requestIds []*big.Int) (*types.Transaction, error) { + return _Chips.contract.Transact(opts, "claimWithdrawal", requestIds) +} + +// ClaimWithdrawal is a paid mutator transaction binding the contract method 0x3c256b98. +// +// Solidity: function claimWithdrawal(uint256[] requestIds) returns() +func (_Chips *ChipsSession) ClaimWithdrawal(requestIds []*big.Int) (*types.Transaction, error) { + return _Chips.Contract.ClaimWithdrawal(&_Chips.TransactOpts, requestIds) +} + +// ClaimWithdrawal is a paid mutator transaction binding the contract method 0x3c256b98. +// +// Solidity: function claimWithdrawal(uint256[] requestIds) returns() +func (_Chips *ChipsTransactorSession) ClaimWithdrawal(requestIds []*big.Int) (*types.Transaction, error) { + return _Chips.Contract.ClaimWithdrawal(&_Chips.TransactOpts, requestIds) +} + +// CreateNode is a paid mutator transaction binding the contract method 0xec3f4783. +// +// Solidity: function createNode(address to, string name, string description, uint64 taxRateBasisPoints, bool publicGood) returns() +func (_Chips *ChipsTransactor) CreateNode(opts *bind.TransactOpts, to common.Address, name string, description string, taxRateBasisPoints uint64, publicGood bool) (*types.Transaction, error) { + return _Chips.contract.Transact(opts, "createNode", to, name, description, taxRateBasisPoints, publicGood) +} + +// CreateNode is a paid mutator transaction binding the contract method 0xec3f4783. +// +// Solidity: function createNode(address to, string name, string description, uint64 taxRateBasisPoints, bool publicGood) returns() +func (_Chips *ChipsSession) CreateNode(to common.Address, name string, description string, taxRateBasisPoints uint64, publicGood bool) (*types.Transaction, error) { + return _Chips.Contract.CreateNode(&_Chips.TransactOpts, to, name, description, taxRateBasisPoints, publicGood) +} + +// CreateNode is a paid mutator transaction binding the contract method 0xec3f4783. +// +// Solidity: function createNode(address to, string name, string description, uint64 taxRateBasisPoints, bool publicGood) returns() +func (_Chips *ChipsTransactorSession) CreateNode(to common.Address, name string, description string, taxRateBasisPoints uint64, publicGood bool) (*types.Transaction, error) { + return _Chips.Contract.CreateNode(&_Chips.TransactOpts, to, name, description, taxRateBasisPoints, publicGood) +} + +// CreateNodeAndDeposit is a paid mutator transaction binding the contract method 0x52ada782. +// +// Solidity: function createNodeAndDeposit(string name, string description, uint64 taxRateBasisPoints, bool publicGood, uint256 amount) returns() +func (_Chips *ChipsTransactor) CreateNodeAndDeposit(opts *bind.TransactOpts, name string, description string, taxRateBasisPoints uint64, publicGood bool, amount *big.Int) (*types.Transaction, error) { + return _Chips.contract.Transact(opts, "createNodeAndDeposit", name, description, taxRateBasisPoints, publicGood, amount) +} + +// CreateNodeAndDeposit is a paid mutator transaction binding the contract method 0x52ada782. +// +// Solidity: function createNodeAndDeposit(string name, string description, uint64 taxRateBasisPoints, bool publicGood, uint256 amount) returns() +func (_Chips *ChipsSession) CreateNodeAndDeposit(name string, description string, taxRateBasisPoints uint64, publicGood bool, amount *big.Int) (*types.Transaction, error) { + return _Chips.Contract.CreateNodeAndDeposit(&_Chips.TransactOpts, name, description, taxRateBasisPoints, publicGood, amount) +} + +// CreateNodeAndDeposit is a paid mutator transaction binding the contract method 0x52ada782. +// +// Solidity: function createNodeAndDeposit(string name, string description, uint64 taxRateBasisPoints, bool publicGood, uint256 amount) returns() +func (_Chips *ChipsTransactorSession) CreateNodeAndDeposit(name string, description string, taxRateBasisPoints uint64, publicGood bool, amount *big.Int) (*types.Transaction, error) { + return _Chips.Contract.CreateNodeAndDeposit(&_Chips.TransactOpts, name, description, taxRateBasisPoints, publicGood, amount) +} + +// DeleteNode is a paid mutator transaction binding the contract method 0x2d4ede93. +// +// Solidity: function deleteNode(address nodeAddr) returns() +func (_Chips *ChipsTransactor) DeleteNode(opts *bind.TransactOpts, nodeAddr common.Address) (*types.Transaction, error) { + return _Chips.contract.Transact(opts, "deleteNode", nodeAddr) +} + +// DeleteNode is a paid mutator transaction binding the contract method 0x2d4ede93. +// +// Solidity: function deleteNode(address nodeAddr) returns() +func (_Chips *ChipsSession) DeleteNode(nodeAddr common.Address) (*types.Transaction, error) { + return _Chips.Contract.DeleteNode(&_Chips.TransactOpts, nodeAddr) +} + +// DeleteNode is a paid mutator transaction binding the contract method 0x2d4ede93. +// +// Solidity: function deleteNode(address nodeAddr) returns() +func (_Chips *ChipsTransactorSession) DeleteNode(nodeAddr common.Address) (*types.Transaction, error) { + return _Chips.Contract.DeleteNode(&_Chips.TransactOpts, nodeAddr) +} + +// Deposit is a paid mutator transaction binding the contract method 0xb6b55f25. +// +// Solidity: function deposit(uint256 amount) returns() +func (_Chips *ChipsTransactor) Deposit(opts *bind.TransactOpts, amount *big.Int) (*types.Transaction, error) { + return _Chips.contract.Transact(opts, "deposit", amount) +} + +// Deposit is a paid mutator transaction binding the contract method 0xb6b55f25. +// +// Solidity: function deposit(uint256 amount) returns() +func (_Chips *ChipsSession) Deposit(amount *big.Int) (*types.Transaction, error) { + return _Chips.Contract.Deposit(&_Chips.TransactOpts, amount) +} + +// Deposit is a paid mutator transaction binding the contract method 0xb6b55f25. +// +// Solidity: function deposit(uint256 amount) returns() +func (_Chips *ChipsTransactorSession) Deposit(amount *big.Int) (*types.Transaction, error) { + return _Chips.Contract.Deposit(&_Chips.TransactOpts, amount) +} + +// DistributeRewards is a paid mutator transaction binding the contract method 0x8e3e6174. +// +// Solidity: function distributeRewards(uint256[3] epochInfo, address[] nodeAddrs, uint256[] requestFees, uint256[] operationRewards, uint256[] stakingRewards, uint256 publicPoolReward) returns() +func (_Chips *ChipsTransactor) DistributeRewards(opts *bind.TransactOpts, epochInfo [3]*big.Int, nodeAddrs []common.Address, requestFees []*big.Int, operationRewards []*big.Int, stakingRewards []*big.Int, publicPoolReward *big.Int) (*types.Transaction, error) { + return _Chips.contract.Transact(opts, "distributeRewards", epochInfo, nodeAddrs, requestFees, operationRewards, stakingRewards, publicPoolReward) +} + +// DistributeRewards is a paid mutator transaction binding the contract method 0x8e3e6174. +// +// Solidity: function distributeRewards(uint256[3] epochInfo, address[] nodeAddrs, uint256[] requestFees, uint256[] operationRewards, uint256[] stakingRewards, uint256 publicPoolReward) returns() +func (_Chips *ChipsSession) DistributeRewards(epochInfo [3]*big.Int, nodeAddrs []common.Address, requestFees []*big.Int, operationRewards []*big.Int, stakingRewards []*big.Int, publicPoolReward *big.Int) (*types.Transaction, error) { + return _Chips.Contract.DistributeRewards(&_Chips.TransactOpts, epochInfo, nodeAddrs, requestFees, operationRewards, stakingRewards, publicPoolReward) +} + +// DistributeRewards is a paid mutator transaction binding the contract method 0x8e3e6174. +// +// Solidity: function distributeRewards(uint256[3] epochInfo, address[] nodeAddrs, uint256[] requestFees, uint256[] operationRewards, uint256[] stakingRewards, uint256 publicPoolReward) returns() +func (_Chips *ChipsTransactorSession) DistributeRewards(epochInfo [3]*big.Int, nodeAddrs []common.Address, requestFees []*big.Int, operationRewards []*big.Int, stakingRewards []*big.Int, publicPoolReward *big.Int) (*types.Transaction, error) { + return _Chips.Contract.DistributeRewards(&_Chips.TransactOpts, epochInfo, nodeAddrs, requestFees, operationRewards, stakingRewards, publicPoolReward) +} + +// GrantRole is a paid mutator transaction binding the contract method 0x2f2ff15d. +// +// Solidity: function grantRole(bytes32 role, address account) returns() +func (_Chips *ChipsTransactor) GrantRole(opts *bind.TransactOpts, role [32]byte, account common.Address) (*types.Transaction, error) { + return _Chips.contract.Transact(opts, "grantRole", role, account) +} + +// GrantRole is a paid mutator transaction binding the contract method 0x2f2ff15d. +// +// Solidity: function grantRole(bytes32 role, address account) returns() +func (_Chips *ChipsSession) GrantRole(role [32]byte, account common.Address) (*types.Transaction, error) { + return _Chips.Contract.GrantRole(&_Chips.TransactOpts, role, account) +} + +// GrantRole is a paid mutator transaction binding the contract method 0x2f2ff15d. +// +// Solidity: function grantRole(bytes32 role, address account) returns() +func (_Chips *ChipsTransactorSession) GrantRole(role [32]byte, account common.Address) (*types.Transaction, error) { + return _Chips.Contract.GrantRole(&_Chips.TransactOpts, role, account) +} + +// Initialize is a paid mutator transaction binding the contract method 0xc0c53b8b. +// +// Solidity: function initialize(address chips, address pauseAccount, address oracleAccount) returns() +func (_Chips *ChipsTransactor) Initialize(opts *bind.TransactOpts, chips common.Address, pauseAccount common.Address, oracleAccount common.Address) (*types.Transaction, error) { + return _Chips.contract.Transact(opts, "initialize", chips, pauseAccount, oracleAccount) +} + +// Initialize is a paid mutator transaction binding the contract method 0xc0c53b8b. +// +// Solidity: function initialize(address chips, address pauseAccount, address oracleAccount) returns() +func (_Chips *ChipsSession) Initialize(chips common.Address, pauseAccount common.Address, oracleAccount common.Address) (*types.Transaction, error) { + return _Chips.Contract.Initialize(&_Chips.TransactOpts, chips, pauseAccount, oracleAccount) +} + +// Initialize is a paid mutator transaction binding the contract method 0xc0c53b8b. +// +// Solidity: function initialize(address chips, address pauseAccount, address oracleAccount) returns() +func (_Chips *ChipsTransactorSession) Initialize(chips common.Address, pauseAccount common.Address, oracleAccount common.Address) (*types.Transaction, error) { + return _Chips.Contract.Initialize(&_Chips.TransactOpts, chips, pauseAccount, oracleAccount) +} + +// Pause is a paid mutator transaction binding the contract method 0x8456cb59. +// +// Solidity: function pause() returns() +func (_Chips *ChipsTransactor) Pause(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Chips.contract.Transact(opts, "pause") +} + +// Pause is a paid mutator transaction binding the contract method 0x8456cb59. +// +// Solidity: function pause() returns() +func (_Chips *ChipsSession) Pause() (*types.Transaction, error) { + return _Chips.Contract.Pause(&_Chips.TransactOpts) +} + +// Pause is a paid mutator transaction binding the contract method 0x8456cb59. +// +// Solidity: function pause() returns() +func (_Chips *ChipsTransactorSession) Pause() (*types.Transaction, error) { + return _Chips.Contract.Pause(&_Chips.TransactOpts) +} + +// RenounceRole is a paid mutator transaction binding the contract method 0x36568abe. +// +// Solidity: function renounceRole(bytes32 role, address callerConfirmation) returns() +func (_Chips *ChipsTransactor) RenounceRole(opts *bind.TransactOpts, role [32]byte, callerConfirmation common.Address) (*types.Transaction, error) { + return _Chips.contract.Transact(opts, "renounceRole", role, callerConfirmation) +} + +// RenounceRole is a paid mutator transaction binding the contract method 0x36568abe. +// +// Solidity: function renounceRole(bytes32 role, address callerConfirmation) returns() +func (_Chips *ChipsSession) RenounceRole(role [32]byte, callerConfirmation common.Address) (*types.Transaction, error) { + return _Chips.Contract.RenounceRole(&_Chips.TransactOpts, role, callerConfirmation) +} + +// RenounceRole is a paid mutator transaction binding the contract method 0x36568abe. +// +// Solidity: function renounceRole(bytes32 role, address callerConfirmation) returns() +func (_Chips *ChipsTransactorSession) RenounceRole(role [32]byte, callerConfirmation common.Address) (*types.Transaction, error) { + return _Chips.Contract.RenounceRole(&_Chips.TransactOpts, role, callerConfirmation) +} + +// RequestUnstake is a paid mutator transaction binding the contract method 0xbcdd4190. +// +// Solidity: function requestUnstake(address nodeAddr, uint256[] chipsIds) returns(uint256 requestId) +func (_Chips *ChipsTransactor) RequestUnstake(opts *bind.TransactOpts, nodeAddr common.Address, chipsIds []*big.Int) (*types.Transaction, error) { + return _Chips.contract.Transact(opts, "requestUnstake", nodeAddr, chipsIds) +} + +// RequestUnstake is a paid mutator transaction binding the contract method 0xbcdd4190. +// +// Solidity: function requestUnstake(address nodeAddr, uint256[] chipsIds) returns(uint256 requestId) +func (_Chips *ChipsSession) RequestUnstake(nodeAddr common.Address, chipsIds []*big.Int) (*types.Transaction, error) { + return _Chips.Contract.RequestUnstake(&_Chips.TransactOpts, nodeAddr, chipsIds) +} + +// RequestUnstake is a paid mutator transaction binding the contract method 0xbcdd4190. +// +// Solidity: function requestUnstake(address nodeAddr, uint256[] chipsIds) returns(uint256 requestId) +func (_Chips *ChipsTransactorSession) RequestUnstake(nodeAddr common.Address, chipsIds []*big.Int) (*types.Transaction, error) { + return _Chips.Contract.RequestUnstake(&_Chips.TransactOpts, nodeAddr, chipsIds) +} + +// RequestUnstakeFromPublicPool is a paid mutator transaction binding the contract method 0x22ce5370. +// +// Solidity: function requestUnstakeFromPublicPool(uint256[] chipsIds) returns(uint256 requestId) +func (_Chips *ChipsTransactor) RequestUnstakeFromPublicPool(opts *bind.TransactOpts, chipsIds []*big.Int) (*types.Transaction, error) { + return _Chips.contract.Transact(opts, "requestUnstakeFromPublicPool", chipsIds) +} + +// RequestUnstakeFromPublicPool is a paid mutator transaction binding the contract method 0x22ce5370. +// +// Solidity: function requestUnstakeFromPublicPool(uint256[] chipsIds) returns(uint256 requestId) +func (_Chips *ChipsSession) RequestUnstakeFromPublicPool(chipsIds []*big.Int) (*types.Transaction, error) { + return _Chips.Contract.RequestUnstakeFromPublicPool(&_Chips.TransactOpts, chipsIds) +} + +// RequestUnstakeFromPublicPool is a paid mutator transaction binding the contract method 0x22ce5370. +// +// Solidity: function requestUnstakeFromPublicPool(uint256[] chipsIds) returns(uint256 requestId) +func (_Chips *ChipsTransactorSession) RequestUnstakeFromPublicPool(chipsIds []*big.Int) (*types.Transaction, error) { + return _Chips.Contract.RequestUnstakeFromPublicPool(&_Chips.TransactOpts, chipsIds) +} + +// RequestWithdrawal is a paid mutator transaction binding the contract method 0x9ee679e8. +// +// Solidity: function requestWithdrawal(uint256 amount) returns(uint256 requestId) +func (_Chips *ChipsTransactor) RequestWithdrawal(opts *bind.TransactOpts, amount *big.Int) (*types.Transaction, error) { + return _Chips.contract.Transact(opts, "requestWithdrawal", amount) +} + +// RequestWithdrawal is a paid mutator transaction binding the contract method 0x9ee679e8. +// +// Solidity: function requestWithdrawal(uint256 amount) returns(uint256 requestId) +func (_Chips *ChipsSession) RequestWithdrawal(amount *big.Int) (*types.Transaction, error) { + return _Chips.Contract.RequestWithdrawal(&_Chips.TransactOpts, amount) +} + +// RequestWithdrawal is a paid mutator transaction binding the contract method 0x9ee679e8. +// +// Solidity: function requestWithdrawal(uint256 amount) returns(uint256 requestId) +func (_Chips *ChipsTransactorSession) RequestWithdrawal(amount *big.Int) (*types.Transaction, error) { + return _Chips.Contract.RequestWithdrawal(&_Chips.TransactOpts, amount) +} + +// RevokeRole is a paid mutator transaction binding the contract method 0xd547741f. +// +// Solidity: function revokeRole(bytes32 role, address account) returns() +func (_Chips *ChipsTransactor) RevokeRole(opts *bind.TransactOpts, role [32]byte, account common.Address) (*types.Transaction, error) { + return _Chips.contract.Transact(opts, "revokeRole", role, account) +} + +// RevokeRole is a paid mutator transaction binding the contract method 0xd547741f. +// +// Solidity: function revokeRole(bytes32 role, address account) returns() +func (_Chips *ChipsSession) RevokeRole(role [32]byte, account common.Address) (*types.Transaction, error) { + return _Chips.Contract.RevokeRole(&_Chips.TransactOpts, role, account) +} + +// RevokeRole is a paid mutator transaction binding the contract method 0xd547741f. +// +// Solidity: function revokeRole(bytes32 role, address account) returns() +func (_Chips *ChipsTransactorSession) RevokeRole(role [32]byte, account common.Address) (*types.Transaction, error) { + return _Chips.Contract.RevokeRole(&_Chips.TransactOpts, role, account) +} + +// SetTaxRateBasisPoints4Node is a paid mutator transaction binding the contract method 0xb65d660c. +// +// Solidity: function setTaxRateBasisPoints4Node(address nodeAddr, uint64 taxRateBasisPoints) returns() +func (_Chips *ChipsTransactor) SetTaxRateBasisPoints4Node(opts *bind.TransactOpts, nodeAddr common.Address, taxRateBasisPoints uint64) (*types.Transaction, error) { + return _Chips.contract.Transact(opts, "setTaxRateBasisPoints4Node", nodeAddr, taxRateBasisPoints) +} + +// SetTaxRateBasisPoints4Node is a paid mutator transaction binding the contract method 0xb65d660c. +// +// Solidity: function setTaxRateBasisPoints4Node(address nodeAddr, uint64 taxRateBasisPoints) returns() +func (_Chips *ChipsSession) SetTaxRateBasisPoints4Node(nodeAddr common.Address, taxRateBasisPoints uint64) (*types.Transaction, error) { + return _Chips.Contract.SetTaxRateBasisPoints4Node(&_Chips.TransactOpts, nodeAddr, taxRateBasisPoints) +} + +// SetTaxRateBasisPoints4Node is a paid mutator transaction binding the contract method 0xb65d660c. +// +// Solidity: function setTaxRateBasisPoints4Node(address nodeAddr, uint64 taxRateBasisPoints) returns() +func (_Chips *ChipsTransactorSession) SetTaxRateBasisPoints4Node(nodeAddr common.Address, taxRateBasisPoints uint64) (*types.Transaction, error) { + return _Chips.Contract.SetTaxRateBasisPoints4Node(&_Chips.TransactOpts, nodeAddr, taxRateBasisPoints) +} + +// SetTaxRateBasisPoints4PublicPool is a paid mutator transaction binding the contract method 0xe3fb8dca. +// +// Solidity: function setTaxRateBasisPoints4PublicPool(uint64 taxRateBasisPoints) returns() +func (_Chips *ChipsTransactor) SetTaxRateBasisPoints4PublicPool(opts *bind.TransactOpts, taxRateBasisPoints uint64) (*types.Transaction, error) { + return _Chips.contract.Transact(opts, "setTaxRateBasisPoints4PublicPool", taxRateBasisPoints) +} + +// SetTaxRateBasisPoints4PublicPool is a paid mutator transaction binding the contract method 0xe3fb8dca. +// +// Solidity: function setTaxRateBasisPoints4PublicPool(uint64 taxRateBasisPoints) returns() +func (_Chips *ChipsSession) SetTaxRateBasisPoints4PublicPool(taxRateBasisPoints uint64) (*types.Transaction, error) { + return _Chips.Contract.SetTaxRateBasisPoints4PublicPool(&_Chips.TransactOpts, taxRateBasisPoints) +} + +// SetTaxRateBasisPoints4PublicPool is a paid mutator transaction binding the contract method 0xe3fb8dca. +// +// Solidity: function setTaxRateBasisPoints4PublicPool(uint64 taxRateBasisPoints) returns() +func (_Chips *ChipsTransactorSession) SetTaxRateBasisPoints4PublicPool(taxRateBasisPoints uint64) (*types.Transaction, error) { + return _Chips.Contract.SetTaxRateBasisPoints4PublicPool(&_Chips.TransactOpts, taxRateBasisPoints) +} + +// SlashNodes is a paid mutator transaction binding the contract method 0xa2f641c3. +// +// Solidity: function slashNodes(address[] nodeAddrs) returns() +func (_Chips *ChipsTransactor) SlashNodes(opts *bind.TransactOpts, nodeAddrs []common.Address) (*types.Transaction, error) { + return _Chips.contract.Transact(opts, "slashNodes", nodeAddrs) +} + +// SlashNodes is a paid mutator transaction binding the contract method 0xa2f641c3. +// +// Solidity: function slashNodes(address[] nodeAddrs) returns() +func (_Chips *ChipsSession) SlashNodes(nodeAddrs []common.Address) (*types.Transaction, error) { + return _Chips.Contract.SlashNodes(&_Chips.TransactOpts, nodeAddrs) +} + +// SlashNodes is a paid mutator transaction binding the contract method 0xa2f641c3. +// +// Solidity: function slashNodes(address[] nodeAddrs) returns() +func (_Chips *ChipsTransactorSession) SlashNodes(nodeAddrs []common.Address) (*types.Transaction, error) { + return _Chips.Contract.SlashNodes(&_Chips.TransactOpts, nodeAddrs) +} + +// Stake is a paid mutator transaction binding the contract method 0xadc9772e. +// +// Solidity: function stake(address nodeAddr, uint256 amount) returns(uint256 startTokenId, uint256 endTokenId) +func (_Chips *ChipsTransactor) Stake(opts *bind.TransactOpts, nodeAddr common.Address, amount *big.Int) (*types.Transaction, error) { + return _Chips.contract.Transact(opts, "stake", nodeAddr, amount) +} + +// Stake is a paid mutator transaction binding the contract method 0xadc9772e. +// +// Solidity: function stake(address nodeAddr, uint256 amount) returns(uint256 startTokenId, uint256 endTokenId) +func (_Chips *ChipsSession) Stake(nodeAddr common.Address, amount *big.Int) (*types.Transaction, error) { + return _Chips.Contract.Stake(&_Chips.TransactOpts, nodeAddr, amount) +} + +// Stake is a paid mutator transaction binding the contract method 0xadc9772e. +// +// Solidity: function stake(address nodeAddr, uint256 amount) returns(uint256 startTokenId, uint256 endTokenId) +func (_Chips *ChipsTransactorSession) Stake(nodeAddr common.Address, amount *big.Int) (*types.Transaction, error) { + return _Chips.Contract.Stake(&_Chips.TransactOpts, nodeAddr, amount) +} + +// StakeToPublicPool is a paid mutator transaction binding the contract method 0x53db41ac. +// +// Solidity: function stakeToPublicPool(address nodeAddr, uint256 amount) returns(uint256 startTokenId, uint256 endTokenId) +func (_Chips *ChipsTransactor) StakeToPublicPool(opts *bind.TransactOpts, nodeAddr common.Address, amount *big.Int) (*types.Transaction, error) { + return _Chips.contract.Transact(opts, "stakeToPublicPool", nodeAddr, amount) +} + +// StakeToPublicPool is a paid mutator transaction binding the contract method 0x53db41ac. +// +// Solidity: function stakeToPublicPool(address nodeAddr, uint256 amount) returns(uint256 startTokenId, uint256 endTokenId) +func (_Chips *ChipsSession) StakeToPublicPool(nodeAddr common.Address, amount *big.Int) (*types.Transaction, error) { + return _Chips.Contract.StakeToPublicPool(&_Chips.TransactOpts, nodeAddr, amount) +} + +// StakeToPublicPool is a paid mutator transaction binding the contract method 0x53db41ac. +// +// Solidity: function stakeToPublicPool(address nodeAddr, uint256 amount) returns(uint256 startTokenId, uint256 endTokenId) +func (_Chips *ChipsTransactorSession) StakeToPublicPool(nodeAddr common.Address, amount *big.Int) (*types.Transaction, error) { + return _Chips.Contract.StakeToPublicPool(&_Chips.TransactOpts, nodeAddr, amount) +} + +// Unpause is a paid mutator transaction binding the contract method 0x3f4ba83a. +// +// Solidity: function unpause() returns() +func (_Chips *ChipsTransactor) Unpause(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Chips.contract.Transact(opts, "unpause") +} + +// Unpause is a paid mutator transaction binding the contract method 0x3f4ba83a. +// +// Solidity: function unpause() returns() +func (_Chips *ChipsSession) Unpause() (*types.Transaction, error) { + return _Chips.Contract.Unpause(&_Chips.TransactOpts) +} + +// Unpause is a paid mutator transaction binding the contract method 0x3f4ba83a. +// +// Solidity: function unpause() returns() +func (_Chips *ChipsTransactorSession) Unpause() (*types.Transaction, error) { + return _Chips.Contract.Unpause(&_Chips.TransactOpts) +} + +// Withdraw2Treasury is a paid mutator transaction binding the contract method 0x4a7dfc90. +// +// Solidity: function withdraw2Treasury() returns() +func (_Chips *ChipsTransactor) Withdraw2Treasury(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Chips.contract.Transact(opts, "withdraw2Treasury") +} + +// Withdraw2Treasury is a paid mutator transaction binding the contract method 0x4a7dfc90. +// +// Solidity: function withdraw2Treasury() returns() +func (_Chips *ChipsSession) Withdraw2Treasury() (*types.Transaction, error) { + return _Chips.Contract.Withdraw2Treasury(&_Chips.TransactOpts) +} + +// Withdraw2Treasury is a paid mutator transaction binding the contract method 0x4a7dfc90. +// +// Solidity: function withdraw2Treasury() returns() +func (_Chips *ChipsTransactorSession) Withdraw2Treasury() (*types.Transaction, error) { + return _Chips.Contract.Withdraw2Treasury(&_Chips.TransactOpts) +} + +// ChipsDepositedIterator is returned from FilterDeposited and is used to iterate over the raw logs and unpacked data for Deposited events raised by the Chips contract. +type ChipsDepositedIterator struct { + Event *ChipsDeposited // 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 *ChipsDepositedIterator) 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(ChipsDeposited) + 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(ChipsDeposited) + 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 *ChipsDepositedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ChipsDepositedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ChipsDeposited represents a Deposited event raised by the Chips contract. +type ChipsDeposited struct { + NodeAddr common.Address + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterDeposited is a free log retrieval operation binding the contract event 0x2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c4. +// +// Solidity: event Deposited(address indexed nodeAddr, uint256 indexed amount) +func (_Chips *ChipsFilterer) FilterDeposited(opts *bind.FilterOpts, nodeAddr []common.Address, amount []*big.Int) (*ChipsDepositedIterator, error) { + + var nodeAddrRule []interface{} + for _, nodeAddrItem := range nodeAddr { + nodeAddrRule = append(nodeAddrRule, nodeAddrItem) + } + var amountRule []interface{} + for _, amountItem := range amount { + amountRule = append(amountRule, amountItem) + } + + logs, sub, err := _Chips.contract.FilterLogs(opts, "Deposited", nodeAddrRule, amountRule) + if err != nil { + return nil, err + } + return &ChipsDepositedIterator{contract: _Chips.contract, event: "Deposited", logs: logs, sub: sub}, nil +} + +// WatchDeposited is a free log subscription operation binding the contract event 0x2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c4. +// +// Solidity: event Deposited(address indexed nodeAddr, uint256 indexed amount) +func (_Chips *ChipsFilterer) WatchDeposited(opts *bind.WatchOpts, sink chan<- *ChipsDeposited, nodeAddr []common.Address, amount []*big.Int) (event.Subscription, error) { + + var nodeAddrRule []interface{} + for _, nodeAddrItem := range nodeAddr { + nodeAddrRule = append(nodeAddrRule, nodeAddrItem) + } + var amountRule []interface{} + for _, amountItem := range amount { + amountRule = append(amountRule, amountItem) + } + + logs, sub, err := _Chips.contract.WatchLogs(opts, "Deposited", nodeAddrRule, amountRule) + 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(ChipsDeposited) + if err := _Chips.contract.UnpackLog(event, "Deposited", 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 +} + +// ParseDeposited is a log parse operation binding the contract event 0x2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c4. +// +// Solidity: event Deposited(address indexed nodeAddr, uint256 indexed amount) +func (_Chips *ChipsFilterer) ParseDeposited(log types.Log) (*ChipsDeposited, error) { + event := new(ChipsDeposited) + if err := _Chips.contract.UnpackLog(event, "Deposited", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ChipsInitializedIterator is returned from FilterInitialized and is used to iterate over the raw logs and unpacked data for Initialized events raised by the Chips contract. +type ChipsInitializedIterator struct { + Event *ChipsInitialized // 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 *ChipsInitializedIterator) 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(ChipsInitialized) + 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(ChipsInitialized) + 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 *ChipsInitializedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ChipsInitializedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ChipsInitialized represents a Initialized event raised by the Chips contract. +type ChipsInitialized struct { + Version uint64 + Raw types.Log // Blockchain specific contextual infos +} + +// FilterInitialized is a free log retrieval operation binding the contract event 0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2. +// +// Solidity: event Initialized(uint64 version) +func (_Chips *ChipsFilterer) FilterInitialized(opts *bind.FilterOpts) (*ChipsInitializedIterator, error) { + + logs, sub, err := _Chips.contract.FilterLogs(opts, "Initialized") + if err != nil { + return nil, err + } + return &ChipsInitializedIterator{contract: _Chips.contract, event: "Initialized", logs: logs, sub: sub}, nil +} + +// WatchInitialized is a free log subscription operation binding the contract event 0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2. +// +// Solidity: event Initialized(uint64 version) +func (_Chips *ChipsFilterer) WatchInitialized(opts *bind.WatchOpts, sink chan<- *ChipsInitialized) (event.Subscription, error) { + + logs, sub, err := _Chips.contract.WatchLogs(opts, "Initialized") + 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(ChipsInitialized) + if err := _Chips.contract.UnpackLog(event, "Initialized", 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 +} + +// ParseInitialized is a log parse operation binding the contract event 0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2. +// +// Solidity: event Initialized(uint64 version) +func (_Chips *ChipsFilterer) ParseInitialized(log types.Log) (*ChipsInitialized, error) { + event := new(ChipsInitialized) + if err := _Chips.contract.UnpackLog(event, "Initialized", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ChipsNodeCreatedIterator is returned from FilterNodeCreated and is used to iterate over the raw logs and unpacked data for NodeCreated events raised by the Chips contract. +type ChipsNodeCreatedIterator struct { + Event *ChipsNodeCreated // 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 *ChipsNodeCreatedIterator) 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(ChipsNodeCreated) + 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(ChipsNodeCreated) + 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 *ChipsNodeCreatedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ChipsNodeCreatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ChipsNodeCreated represents a NodeCreated event raised by the Chips contract. +type ChipsNodeCreated struct { + NodeAddr common.Address + Name string + Description string + TaxRateBasisPoints uint64 + PublicGood bool + Raw types.Log // Blockchain specific contextual infos +} + +// FilterNodeCreated is a free log retrieval operation binding the contract event 0x6ae2420fc4e19a67c13bace8d75372b34c462f70f67dc8c54cb587d4f493c044. +// +// Solidity: event NodeCreated(address indexed nodeAddr, string name, string description, uint64 taxRateBasisPoints, bool publicGood) +func (_Chips *ChipsFilterer) FilterNodeCreated(opts *bind.FilterOpts, nodeAddr []common.Address) (*ChipsNodeCreatedIterator, error) { + + var nodeAddrRule []interface{} + for _, nodeAddrItem := range nodeAddr { + nodeAddrRule = append(nodeAddrRule, nodeAddrItem) + } + + logs, sub, err := _Chips.contract.FilterLogs(opts, "NodeCreated", nodeAddrRule) + if err != nil { + return nil, err + } + return &ChipsNodeCreatedIterator{contract: _Chips.contract, event: "NodeCreated", logs: logs, sub: sub}, nil +} + +// WatchNodeCreated is a free log subscription operation binding the contract event 0x6ae2420fc4e19a67c13bace8d75372b34c462f70f67dc8c54cb587d4f493c044. +// +// Solidity: event NodeCreated(address indexed nodeAddr, string name, string description, uint64 taxRateBasisPoints, bool publicGood) +func (_Chips *ChipsFilterer) WatchNodeCreated(opts *bind.WatchOpts, sink chan<- *ChipsNodeCreated, nodeAddr []common.Address) (event.Subscription, error) { + + var nodeAddrRule []interface{} + for _, nodeAddrItem := range nodeAddr { + nodeAddrRule = append(nodeAddrRule, nodeAddrItem) + } + + logs, sub, err := _Chips.contract.WatchLogs(opts, "NodeCreated", nodeAddrRule) + 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(ChipsNodeCreated) + if err := _Chips.contract.UnpackLog(event, "NodeCreated", 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 +} + +// ParseNodeCreated is a log parse operation binding the contract event 0x6ae2420fc4e19a67c13bace8d75372b34c462f70f67dc8c54cb587d4f493c044. +// +// Solidity: event NodeCreated(address indexed nodeAddr, string name, string description, uint64 taxRateBasisPoints, bool publicGood) +func (_Chips *ChipsFilterer) ParseNodeCreated(log types.Log) (*ChipsNodeCreated, error) { + event := new(ChipsNodeCreated) + if err := _Chips.contract.UnpackLog(event, "NodeCreated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ChipsNodeDeletedIterator is returned from FilterNodeDeleted and is used to iterate over the raw logs and unpacked data for NodeDeleted events raised by the Chips contract. +type ChipsNodeDeletedIterator struct { + Event *ChipsNodeDeleted // 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 *ChipsNodeDeletedIterator) 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(ChipsNodeDeleted) + 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(ChipsNodeDeleted) + 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 *ChipsNodeDeletedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ChipsNodeDeletedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ChipsNodeDeleted represents a NodeDeleted event raised by the Chips contract. +type ChipsNodeDeleted struct { + NodeAddr common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterNodeDeleted is a free log retrieval operation binding the contract event 0x1629bfc36423a1b4749d3fe1d6970b9d32d42bbee47dd5540670696ab6b9a4ad. +// +// Solidity: event NodeDeleted(address indexed nodeAddr) +func (_Chips *ChipsFilterer) FilterNodeDeleted(opts *bind.FilterOpts, nodeAddr []common.Address) (*ChipsNodeDeletedIterator, error) { + + var nodeAddrRule []interface{} + for _, nodeAddrItem := range nodeAddr { + nodeAddrRule = append(nodeAddrRule, nodeAddrItem) + } + + logs, sub, err := _Chips.contract.FilterLogs(opts, "NodeDeleted", nodeAddrRule) + if err != nil { + return nil, err + } + return &ChipsNodeDeletedIterator{contract: _Chips.contract, event: "NodeDeleted", logs: logs, sub: sub}, nil +} + +// WatchNodeDeleted is a free log subscription operation binding the contract event 0x1629bfc36423a1b4749d3fe1d6970b9d32d42bbee47dd5540670696ab6b9a4ad. +// +// Solidity: event NodeDeleted(address indexed nodeAddr) +func (_Chips *ChipsFilterer) WatchNodeDeleted(opts *bind.WatchOpts, sink chan<- *ChipsNodeDeleted, nodeAddr []common.Address) (event.Subscription, error) { + + var nodeAddrRule []interface{} + for _, nodeAddrItem := range nodeAddr { + nodeAddrRule = append(nodeAddrRule, nodeAddrItem) + } + + logs, sub, err := _Chips.contract.WatchLogs(opts, "NodeDeleted", nodeAddrRule) + 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(ChipsNodeDeleted) + if err := _Chips.contract.UnpackLog(event, "NodeDeleted", 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 +} + +// ParseNodeDeleted is a log parse operation binding the contract event 0x1629bfc36423a1b4749d3fe1d6970b9d32d42bbee47dd5540670696ab6b9a4ad. +// +// Solidity: event NodeDeleted(address indexed nodeAddr) +func (_Chips *ChipsFilterer) ParseNodeDeleted(log types.Log) (*ChipsNodeDeleted, error) { + event := new(ChipsNodeDeleted) + if err := _Chips.contract.UnpackLog(event, "NodeDeleted", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ChipsNodeSlashedIterator is returned from FilterNodeSlashed and is used to iterate over the raw logs and unpacked data for NodeSlashed events raised by the Chips contract. +type ChipsNodeSlashedIterator struct { + Event *ChipsNodeSlashed // 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 *ChipsNodeSlashedIterator) 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(ChipsNodeSlashed) + 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(ChipsNodeSlashed) + 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 *ChipsNodeSlashedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ChipsNodeSlashedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ChipsNodeSlashed represents a NodeSlashed event raised by the Chips contract. +type ChipsNodeSlashed struct { + NodeAddr common.Address + SlashedOperationPool *big.Int + SlashedStakingPool *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterNodeSlashed is a free log retrieval operation binding the contract event 0xa8d720d0a0a2e7c96bf9eb87433901ebb6331356c8f3283b2568de34478703cc. +// +// Solidity: event NodeSlashed(address indexed nodeAddr, uint256 indexed slashedOperationPool, uint256 indexed slashedStakingPool) +func (_Chips *ChipsFilterer) FilterNodeSlashed(opts *bind.FilterOpts, nodeAddr []common.Address, slashedOperationPool []*big.Int, slashedStakingPool []*big.Int) (*ChipsNodeSlashedIterator, error) { + + var nodeAddrRule []interface{} + for _, nodeAddrItem := range nodeAddr { + nodeAddrRule = append(nodeAddrRule, nodeAddrItem) + } + var slashedOperationPoolRule []interface{} + for _, slashedOperationPoolItem := range slashedOperationPool { + slashedOperationPoolRule = append(slashedOperationPoolRule, slashedOperationPoolItem) + } + var slashedStakingPoolRule []interface{} + for _, slashedStakingPoolItem := range slashedStakingPool { + slashedStakingPoolRule = append(slashedStakingPoolRule, slashedStakingPoolItem) + } + + logs, sub, err := _Chips.contract.FilterLogs(opts, "NodeSlashed", nodeAddrRule, slashedOperationPoolRule, slashedStakingPoolRule) + if err != nil { + return nil, err + } + return &ChipsNodeSlashedIterator{contract: _Chips.contract, event: "NodeSlashed", logs: logs, sub: sub}, nil +} + +// WatchNodeSlashed is a free log subscription operation binding the contract event 0xa8d720d0a0a2e7c96bf9eb87433901ebb6331356c8f3283b2568de34478703cc. +// +// Solidity: event NodeSlashed(address indexed nodeAddr, uint256 indexed slashedOperationPool, uint256 indexed slashedStakingPool) +func (_Chips *ChipsFilterer) WatchNodeSlashed(opts *bind.WatchOpts, sink chan<- *ChipsNodeSlashed, nodeAddr []common.Address, slashedOperationPool []*big.Int, slashedStakingPool []*big.Int) (event.Subscription, error) { + + var nodeAddrRule []interface{} + for _, nodeAddrItem := range nodeAddr { + nodeAddrRule = append(nodeAddrRule, nodeAddrItem) + } + var slashedOperationPoolRule []interface{} + for _, slashedOperationPoolItem := range slashedOperationPool { + slashedOperationPoolRule = append(slashedOperationPoolRule, slashedOperationPoolItem) + } + var slashedStakingPoolRule []interface{} + for _, slashedStakingPoolItem := range slashedStakingPool { + slashedStakingPoolRule = append(slashedStakingPoolRule, slashedStakingPoolItem) + } + + logs, sub, err := _Chips.contract.WatchLogs(opts, "NodeSlashed", nodeAddrRule, slashedOperationPoolRule, slashedStakingPoolRule) + 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(ChipsNodeSlashed) + if err := _Chips.contract.UnpackLog(event, "NodeSlashed", 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 +} + +// ParseNodeSlashed is a log parse operation binding the contract event 0xa8d720d0a0a2e7c96bf9eb87433901ebb6331356c8f3283b2568de34478703cc. +// +// Solidity: event NodeSlashed(address indexed nodeAddr, uint256 indexed slashedOperationPool, uint256 indexed slashedStakingPool) +func (_Chips *ChipsFilterer) ParseNodeSlashed(log types.Log) (*ChipsNodeSlashed, error) { + event := new(ChipsNodeSlashed) + if err := _Chips.contract.UnpackLog(event, "NodeSlashed", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ChipsNodeTaxRateBasisPointsSetIterator is returned from FilterNodeTaxRateBasisPointsSet and is used to iterate over the raw logs and unpacked data for NodeTaxRateBasisPointsSet events raised by the Chips contract. +type ChipsNodeTaxRateBasisPointsSetIterator struct { + Event *ChipsNodeTaxRateBasisPointsSet // 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 *ChipsNodeTaxRateBasisPointsSetIterator) 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(ChipsNodeTaxRateBasisPointsSet) + 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(ChipsNodeTaxRateBasisPointsSet) + 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 *ChipsNodeTaxRateBasisPointsSetIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ChipsNodeTaxRateBasisPointsSetIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ChipsNodeTaxRateBasisPointsSet represents a NodeTaxRateBasisPointsSet event raised by the Chips contract. +type ChipsNodeTaxRateBasisPointsSet struct { + NodeAddr common.Address + TaxRateBasisPoints uint64 + Raw types.Log // Blockchain specific contextual infos +} + +// FilterNodeTaxRateBasisPointsSet is a free log retrieval operation binding the contract event 0xb8e5551053b871a40f7c7382e5bd3af5a62dd737d059d3838cf3aa7c325bd479. +// +// Solidity: event NodeTaxRateBasisPointsSet(address indexed nodeAddr, uint64 indexed taxRateBasisPoints) +func (_Chips *ChipsFilterer) FilterNodeTaxRateBasisPointsSet(opts *bind.FilterOpts, nodeAddr []common.Address, taxRateBasisPoints []uint64) (*ChipsNodeTaxRateBasisPointsSetIterator, error) { + + var nodeAddrRule []interface{} + for _, nodeAddrItem := range nodeAddr { + nodeAddrRule = append(nodeAddrRule, nodeAddrItem) + } + var taxRateBasisPointsRule []interface{} + for _, taxRateBasisPointsItem := range taxRateBasisPoints { + taxRateBasisPointsRule = append(taxRateBasisPointsRule, taxRateBasisPointsItem) + } + + logs, sub, err := _Chips.contract.FilterLogs(opts, "NodeTaxRateBasisPointsSet", nodeAddrRule, taxRateBasisPointsRule) + if err != nil { + return nil, err + } + return &ChipsNodeTaxRateBasisPointsSetIterator{contract: _Chips.contract, event: "NodeTaxRateBasisPointsSet", logs: logs, sub: sub}, nil +} + +// WatchNodeTaxRateBasisPointsSet is a free log subscription operation binding the contract event 0xb8e5551053b871a40f7c7382e5bd3af5a62dd737d059d3838cf3aa7c325bd479. +// +// Solidity: event NodeTaxRateBasisPointsSet(address indexed nodeAddr, uint64 indexed taxRateBasisPoints) +func (_Chips *ChipsFilterer) WatchNodeTaxRateBasisPointsSet(opts *bind.WatchOpts, sink chan<- *ChipsNodeTaxRateBasisPointsSet, nodeAddr []common.Address, taxRateBasisPoints []uint64) (event.Subscription, error) { + + var nodeAddrRule []interface{} + for _, nodeAddrItem := range nodeAddr { + nodeAddrRule = append(nodeAddrRule, nodeAddrItem) + } + var taxRateBasisPointsRule []interface{} + for _, taxRateBasisPointsItem := range taxRateBasisPoints { + taxRateBasisPointsRule = append(taxRateBasisPointsRule, taxRateBasisPointsItem) + } + + logs, sub, err := _Chips.contract.WatchLogs(opts, "NodeTaxRateBasisPointsSet", nodeAddrRule, taxRateBasisPointsRule) + 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(ChipsNodeTaxRateBasisPointsSet) + if err := _Chips.contract.UnpackLog(event, "NodeTaxRateBasisPointsSet", 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 +} + +// ParseNodeTaxRateBasisPointsSet is a log parse operation binding the contract event 0xb8e5551053b871a40f7c7382e5bd3af5a62dd737d059d3838cf3aa7c325bd479. +// +// Solidity: event NodeTaxRateBasisPointsSet(address indexed nodeAddr, uint64 indexed taxRateBasisPoints) +func (_Chips *ChipsFilterer) ParseNodeTaxRateBasisPointsSet(log types.Log) (*ChipsNodeTaxRateBasisPointsSet, error) { + event := new(ChipsNodeTaxRateBasisPointsSet) + if err := _Chips.contract.UnpackLog(event, "NodeTaxRateBasisPointsSet", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ChipsPausedIterator is returned from FilterPaused and is used to iterate over the raw logs and unpacked data for Paused events raised by the Chips contract. +type ChipsPausedIterator struct { + Event *ChipsPaused // 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 *ChipsPausedIterator) 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(ChipsPaused) + 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(ChipsPaused) + 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 *ChipsPausedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ChipsPausedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ChipsPaused represents a Paused event raised by the Chips contract. +type ChipsPaused struct { + Account common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterPaused is a free log retrieval operation binding the contract event 0x62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258. +// +// Solidity: event Paused(address account) +func (_Chips *ChipsFilterer) FilterPaused(opts *bind.FilterOpts) (*ChipsPausedIterator, error) { + + logs, sub, err := _Chips.contract.FilterLogs(opts, "Paused") + if err != nil { + return nil, err + } + return &ChipsPausedIterator{contract: _Chips.contract, event: "Paused", logs: logs, sub: sub}, nil +} + +// WatchPaused is a free log subscription operation binding the contract event 0x62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258. +// +// Solidity: event Paused(address account) +func (_Chips *ChipsFilterer) WatchPaused(opts *bind.WatchOpts, sink chan<- *ChipsPaused) (event.Subscription, error) { + + logs, sub, err := _Chips.contract.WatchLogs(opts, "Paused") + 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(ChipsPaused) + if err := _Chips.contract.UnpackLog(event, "Paused", 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 +} + +// ParsePaused is a log parse operation binding the contract event 0x62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258. +// +// Solidity: event Paused(address account) +func (_Chips *ChipsFilterer) ParsePaused(log types.Log) (*ChipsPaused, error) { + event := new(ChipsPaused) + if err := _Chips.contract.UnpackLog(event, "Paused", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ChipsPublicGoodRewardDistributedIterator is returned from FilterPublicGoodRewardDistributed and is used to iterate over the raw logs and unpacked data for PublicGoodRewardDistributed events raised by the Chips contract. +type ChipsPublicGoodRewardDistributedIterator struct { + Event *ChipsPublicGoodRewardDistributed // 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 *ChipsPublicGoodRewardDistributedIterator) 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(ChipsPublicGoodRewardDistributed) + 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(ChipsPublicGoodRewardDistributed) + 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 *ChipsPublicGoodRewardDistributedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ChipsPublicGoodRewardDistributedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ChipsPublicGoodRewardDistributed represents a PublicGoodRewardDistributed event raised by the Chips contract. +type ChipsPublicGoodRewardDistributed struct { + Epoch *big.Int + StartTimestamp *big.Int + EndTimestamp *big.Int + PublicPoolReward *big.Int + PublicPoolTax *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterPublicGoodRewardDistributed is a free log retrieval operation binding the contract event 0xab7d25a2f6206ef56c88807f2474ddcd97e1a6323cb25149cde3a607fed6f2d7. +// +// Solidity: event PublicGoodRewardDistributed(uint256 indexed epoch, uint256 startTimestamp, uint256 endTimestamp, uint256 publicPoolReward, uint256 publicPoolTax) +func (_Chips *ChipsFilterer) FilterPublicGoodRewardDistributed(opts *bind.FilterOpts, epoch []*big.Int) (*ChipsPublicGoodRewardDistributedIterator, error) { + + var epochRule []interface{} + for _, epochItem := range epoch { + epochRule = append(epochRule, epochItem) + } + + logs, sub, err := _Chips.contract.FilterLogs(opts, "PublicGoodRewardDistributed", epochRule) + if err != nil { + return nil, err + } + return &ChipsPublicGoodRewardDistributedIterator{contract: _Chips.contract, event: "PublicGoodRewardDistributed", logs: logs, sub: sub}, nil +} + +// WatchPublicGoodRewardDistributed is a free log subscription operation binding the contract event 0xab7d25a2f6206ef56c88807f2474ddcd97e1a6323cb25149cde3a607fed6f2d7. +// +// Solidity: event PublicGoodRewardDistributed(uint256 indexed epoch, uint256 startTimestamp, uint256 endTimestamp, uint256 publicPoolReward, uint256 publicPoolTax) +func (_Chips *ChipsFilterer) WatchPublicGoodRewardDistributed(opts *bind.WatchOpts, sink chan<- *ChipsPublicGoodRewardDistributed, epoch []*big.Int) (event.Subscription, error) { + + var epochRule []interface{} + for _, epochItem := range epoch { + epochRule = append(epochRule, epochItem) + } + + logs, sub, err := _Chips.contract.WatchLogs(opts, "PublicGoodRewardDistributed", epochRule) + 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(ChipsPublicGoodRewardDistributed) + if err := _Chips.contract.UnpackLog(event, "PublicGoodRewardDistributed", 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 +} + +// ParsePublicGoodRewardDistributed is a log parse operation binding the contract event 0xab7d25a2f6206ef56c88807f2474ddcd97e1a6323cb25149cde3a607fed6f2d7. +// +// Solidity: event PublicGoodRewardDistributed(uint256 indexed epoch, uint256 startTimestamp, uint256 endTimestamp, uint256 publicPoolReward, uint256 publicPoolTax) +func (_Chips *ChipsFilterer) ParsePublicGoodRewardDistributed(log types.Log) (*ChipsPublicGoodRewardDistributed, error) { + event := new(ChipsPublicGoodRewardDistributed) + if err := _Chips.contract.UnpackLog(event, "PublicGoodRewardDistributed", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ChipsPublicPoolTaxRateBasisPointsSetIterator is returned from FilterPublicPoolTaxRateBasisPointsSet and is used to iterate over the raw logs and unpacked data for PublicPoolTaxRateBasisPointsSet events raised by the Chips contract. +type ChipsPublicPoolTaxRateBasisPointsSetIterator struct { + Event *ChipsPublicPoolTaxRateBasisPointsSet // 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 *ChipsPublicPoolTaxRateBasisPointsSetIterator) 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(ChipsPublicPoolTaxRateBasisPointsSet) + 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(ChipsPublicPoolTaxRateBasisPointsSet) + 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 *ChipsPublicPoolTaxRateBasisPointsSetIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ChipsPublicPoolTaxRateBasisPointsSetIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ChipsPublicPoolTaxRateBasisPointsSet represents a PublicPoolTaxRateBasisPointsSet event raised by the Chips contract. +type ChipsPublicPoolTaxRateBasisPointsSet struct { + TaxRateBasisPoints uint64 + Raw types.Log // Blockchain specific contextual infos +} + +// FilterPublicPoolTaxRateBasisPointsSet is a free log retrieval operation binding the contract event 0x948cf2302b029d76db2ac06e4ef2625e6c687335de349317468f47942a44e8b0. +// +// Solidity: event PublicPoolTaxRateBasisPointsSet(uint64 indexed taxRateBasisPoints) +func (_Chips *ChipsFilterer) FilterPublicPoolTaxRateBasisPointsSet(opts *bind.FilterOpts, taxRateBasisPoints []uint64) (*ChipsPublicPoolTaxRateBasisPointsSetIterator, error) { + + var taxRateBasisPointsRule []interface{} + for _, taxRateBasisPointsItem := range taxRateBasisPoints { + taxRateBasisPointsRule = append(taxRateBasisPointsRule, taxRateBasisPointsItem) + } + + logs, sub, err := _Chips.contract.FilterLogs(opts, "PublicPoolTaxRateBasisPointsSet", taxRateBasisPointsRule) + if err != nil { + return nil, err + } + return &ChipsPublicPoolTaxRateBasisPointsSetIterator{contract: _Chips.contract, event: "PublicPoolTaxRateBasisPointsSet", logs: logs, sub: sub}, nil +} + +// WatchPublicPoolTaxRateBasisPointsSet is a free log subscription operation binding the contract event 0x948cf2302b029d76db2ac06e4ef2625e6c687335de349317468f47942a44e8b0. +// +// Solidity: event PublicPoolTaxRateBasisPointsSet(uint64 indexed taxRateBasisPoints) +func (_Chips *ChipsFilterer) WatchPublicPoolTaxRateBasisPointsSet(opts *bind.WatchOpts, sink chan<- *ChipsPublicPoolTaxRateBasisPointsSet, taxRateBasisPoints []uint64) (event.Subscription, error) { + + var taxRateBasisPointsRule []interface{} + for _, taxRateBasisPointsItem := range taxRateBasisPoints { + taxRateBasisPointsRule = append(taxRateBasisPointsRule, taxRateBasisPointsItem) + } + + logs, sub, err := _Chips.contract.WatchLogs(opts, "PublicPoolTaxRateBasisPointsSet", taxRateBasisPointsRule) + 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(ChipsPublicPoolTaxRateBasisPointsSet) + if err := _Chips.contract.UnpackLog(event, "PublicPoolTaxRateBasisPointsSet", 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 +} + +// ParsePublicPoolTaxRateBasisPointsSet is a log parse operation binding the contract event 0x948cf2302b029d76db2ac06e4ef2625e6c687335de349317468f47942a44e8b0. +// +// Solidity: event PublicPoolTaxRateBasisPointsSet(uint64 indexed taxRateBasisPoints) +func (_Chips *ChipsFilterer) ParsePublicPoolTaxRateBasisPointsSet(log types.Log) (*ChipsPublicPoolTaxRateBasisPointsSet, error) { + event := new(ChipsPublicPoolTaxRateBasisPointsSet) + if err := _Chips.contract.UnpackLog(event, "PublicPoolTaxRateBasisPointsSet", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ChipsRewardDistributedIterator is returned from FilterRewardDistributed and is used to iterate over the raw logs and unpacked data for RewardDistributed events raised by the Chips contract. +type ChipsRewardDistributedIterator struct { + Event *ChipsRewardDistributed // 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 *ChipsRewardDistributedIterator) 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(ChipsRewardDistributed) + 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(ChipsRewardDistributed) + 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 *ChipsRewardDistributedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ChipsRewardDistributedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ChipsRewardDistributed represents a RewardDistributed event raised by the Chips contract. +type ChipsRewardDistributed struct { + Epoch *big.Int + StartTimestamp *big.Int + EndTimestamp *big.Int + NodeAddrs []common.Address + RequestFees []*big.Int + OperationRewards []*big.Int + StakingRewards []*big.Int + TaxAmounts []*big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterRewardDistributed is a free log retrieval operation binding the contract event 0x8ea79f19e90b084c2009d3490a097547d8bbb315a883b9efec0996502c1dd7ae. +// +// Solidity: event RewardDistributed(uint256 indexed epoch, uint256 startTimestamp, uint256 endTimestamp, address[] nodeAddrs, uint256[] requestFees, uint256[] operationRewards, uint256[] stakingRewards, uint256[] taxAmounts) +func (_Chips *ChipsFilterer) FilterRewardDistributed(opts *bind.FilterOpts, epoch []*big.Int) (*ChipsRewardDistributedIterator, error) { + + var epochRule []interface{} + for _, epochItem := range epoch { + epochRule = append(epochRule, epochItem) + } + + logs, sub, err := _Chips.contract.FilterLogs(opts, "RewardDistributed", epochRule) + if err != nil { + return nil, err + } + return &ChipsRewardDistributedIterator{contract: _Chips.contract, event: "RewardDistributed", logs: logs, sub: sub}, nil +} + +// WatchRewardDistributed is a free log subscription operation binding the contract event 0x8ea79f19e90b084c2009d3490a097547d8bbb315a883b9efec0996502c1dd7ae. +// +// Solidity: event RewardDistributed(uint256 indexed epoch, uint256 startTimestamp, uint256 endTimestamp, address[] nodeAddrs, uint256[] requestFees, uint256[] operationRewards, uint256[] stakingRewards, uint256[] taxAmounts) +func (_Chips *ChipsFilterer) WatchRewardDistributed(opts *bind.WatchOpts, sink chan<- *ChipsRewardDistributed, epoch []*big.Int) (event.Subscription, error) { + + var epochRule []interface{} + for _, epochItem := range epoch { + epochRule = append(epochRule, epochItem) + } + + logs, sub, err := _Chips.contract.WatchLogs(opts, "RewardDistributed", epochRule) + 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(ChipsRewardDistributed) + if err := _Chips.contract.UnpackLog(event, "RewardDistributed", 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 +} + +// ParseRewardDistributed is a log parse operation binding the contract event 0x8ea79f19e90b084c2009d3490a097547d8bbb315a883b9efec0996502c1dd7ae. +// +// Solidity: event RewardDistributed(uint256 indexed epoch, uint256 startTimestamp, uint256 endTimestamp, address[] nodeAddrs, uint256[] requestFees, uint256[] operationRewards, uint256[] stakingRewards, uint256[] taxAmounts) +func (_Chips *ChipsFilterer) ParseRewardDistributed(log types.Log) (*ChipsRewardDistributed, error) { + event := new(ChipsRewardDistributed) + if err := _Chips.contract.UnpackLog(event, "RewardDistributed", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ChipsRoleAdminChangedIterator is returned from FilterRoleAdminChanged and is used to iterate over the raw logs and unpacked data for RoleAdminChanged events raised by the Chips contract. +type ChipsRoleAdminChangedIterator struct { + Event *ChipsRoleAdminChanged // 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 *ChipsRoleAdminChangedIterator) 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(ChipsRoleAdminChanged) + 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(ChipsRoleAdminChanged) + 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 *ChipsRoleAdminChangedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ChipsRoleAdminChangedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ChipsRoleAdminChanged represents a RoleAdminChanged event raised by the Chips contract. +type ChipsRoleAdminChanged struct { + Role [32]byte + PreviousAdminRole [32]byte + NewAdminRole [32]byte + Raw types.Log // Blockchain specific contextual infos +} + +// FilterRoleAdminChanged is a free log retrieval operation binding the contract event 0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff. +// +// Solidity: event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole) +func (_Chips *ChipsFilterer) FilterRoleAdminChanged(opts *bind.FilterOpts, role [][32]byte, previousAdminRole [][32]byte, newAdminRole [][32]byte) (*ChipsRoleAdminChangedIterator, error) { + + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var previousAdminRoleRule []interface{} + for _, previousAdminRoleItem := range previousAdminRole { + previousAdminRoleRule = append(previousAdminRoleRule, previousAdminRoleItem) + } + var newAdminRoleRule []interface{} + for _, newAdminRoleItem := range newAdminRole { + newAdminRoleRule = append(newAdminRoleRule, newAdminRoleItem) + } + + logs, sub, err := _Chips.contract.FilterLogs(opts, "RoleAdminChanged", roleRule, previousAdminRoleRule, newAdminRoleRule) + if err != nil { + return nil, err + } + return &ChipsRoleAdminChangedIterator{contract: _Chips.contract, event: "RoleAdminChanged", logs: logs, sub: sub}, nil +} + +// WatchRoleAdminChanged is a free log subscription operation binding the contract event 0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff. +// +// Solidity: event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole) +func (_Chips *ChipsFilterer) WatchRoleAdminChanged(opts *bind.WatchOpts, sink chan<- *ChipsRoleAdminChanged, role [][32]byte, previousAdminRole [][32]byte, newAdminRole [][32]byte) (event.Subscription, error) { + + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var previousAdminRoleRule []interface{} + for _, previousAdminRoleItem := range previousAdminRole { + previousAdminRoleRule = append(previousAdminRoleRule, previousAdminRoleItem) + } + var newAdminRoleRule []interface{} + for _, newAdminRoleItem := range newAdminRole { + newAdminRoleRule = append(newAdminRoleRule, newAdminRoleItem) + } + + logs, sub, err := _Chips.contract.WatchLogs(opts, "RoleAdminChanged", roleRule, previousAdminRoleRule, newAdminRoleRule) + 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(ChipsRoleAdminChanged) + if err := _Chips.contract.UnpackLog(event, "RoleAdminChanged", 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 +} + +// ParseRoleAdminChanged is a log parse operation binding the contract event 0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff. +// +// Solidity: event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole) +func (_Chips *ChipsFilterer) ParseRoleAdminChanged(log types.Log) (*ChipsRoleAdminChanged, error) { + event := new(ChipsRoleAdminChanged) + if err := _Chips.contract.UnpackLog(event, "RoleAdminChanged", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ChipsRoleGrantedIterator is returned from FilterRoleGranted and is used to iterate over the raw logs and unpacked data for RoleGranted events raised by the Chips contract. +type ChipsRoleGrantedIterator struct { + Event *ChipsRoleGranted // 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 *ChipsRoleGrantedIterator) 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(ChipsRoleGranted) + 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(ChipsRoleGranted) + 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 *ChipsRoleGrantedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ChipsRoleGrantedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ChipsRoleGranted represents a RoleGranted event raised by the Chips contract. +type ChipsRoleGranted struct { + Role [32]byte + Account common.Address + Sender common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterRoleGranted is a free log retrieval operation binding the contract event 0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d. +// +// Solidity: event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender) +func (_Chips *ChipsFilterer) FilterRoleGranted(opts *bind.FilterOpts, role [][32]byte, account []common.Address, sender []common.Address) (*ChipsRoleGrantedIterator, error) { + + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _Chips.contract.FilterLogs(opts, "RoleGranted", roleRule, accountRule, senderRule) + if err != nil { + return nil, err + } + return &ChipsRoleGrantedIterator{contract: _Chips.contract, event: "RoleGranted", logs: logs, sub: sub}, nil +} + +// WatchRoleGranted is a free log subscription operation binding the contract event 0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d. +// +// Solidity: event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender) +func (_Chips *ChipsFilterer) WatchRoleGranted(opts *bind.WatchOpts, sink chan<- *ChipsRoleGranted, role [][32]byte, account []common.Address, sender []common.Address) (event.Subscription, error) { + + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _Chips.contract.WatchLogs(opts, "RoleGranted", roleRule, accountRule, senderRule) + 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(ChipsRoleGranted) + if err := _Chips.contract.UnpackLog(event, "RoleGranted", 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 +} + +// ParseRoleGranted is a log parse operation binding the contract event 0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d. +// +// Solidity: event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender) +func (_Chips *ChipsFilterer) ParseRoleGranted(log types.Log) (*ChipsRoleGranted, error) { + event := new(ChipsRoleGranted) + if err := _Chips.contract.UnpackLog(event, "RoleGranted", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ChipsRoleRevokedIterator is returned from FilterRoleRevoked and is used to iterate over the raw logs and unpacked data for RoleRevoked events raised by the Chips contract. +type ChipsRoleRevokedIterator struct { + Event *ChipsRoleRevoked // 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 *ChipsRoleRevokedIterator) 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(ChipsRoleRevoked) + 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(ChipsRoleRevoked) + 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 *ChipsRoleRevokedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ChipsRoleRevokedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ChipsRoleRevoked represents a RoleRevoked event raised by the Chips contract. +type ChipsRoleRevoked struct { + Role [32]byte + Account common.Address + Sender common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterRoleRevoked is a free log retrieval operation binding the contract event 0xf6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b. +// +// Solidity: event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender) +func (_Chips *ChipsFilterer) FilterRoleRevoked(opts *bind.FilterOpts, role [][32]byte, account []common.Address, sender []common.Address) (*ChipsRoleRevokedIterator, error) { + + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _Chips.contract.FilterLogs(opts, "RoleRevoked", roleRule, accountRule, senderRule) + if err != nil { + return nil, err + } + return &ChipsRoleRevokedIterator{contract: _Chips.contract, event: "RoleRevoked", logs: logs, sub: sub}, nil +} + +// WatchRoleRevoked is a free log subscription operation binding the contract event 0xf6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b. +// +// Solidity: event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender) +func (_Chips *ChipsFilterer) WatchRoleRevoked(opts *bind.WatchOpts, sink chan<- *ChipsRoleRevoked, role [][32]byte, account []common.Address, sender []common.Address) (event.Subscription, error) { + + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _Chips.contract.WatchLogs(opts, "RoleRevoked", roleRule, accountRule, senderRule) + 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(ChipsRoleRevoked) + if err := _Chips.contract.UnpackLog(event, "RoleRevoked", 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 +} + +// ParseRoleRevoked is a log parse operation binding the contract event 0xf6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b. +// +// Solidity: event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender) +func (_Chips *ChipsFilterer) ParseRoleRevoked(log types.Log) (*ChipsRoleRevoked, error) { + event := new(ChipsRoleRevoked) + if err := _Chips.contract.UnpackLog(event, "RoleRevoked", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ChipsStakedIterator is returned from FilterStaked and is used to iterate over the raw logs and unpacked data for Staked events raised by the Chips contract. +type ChipsStakedIterator struct { + Event *ChipsStaked // Event containing the contract specifics and raw log - return out0, err + 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 } -// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. -// -// Solidity: function totalSupply() view returns(uint256) -func (_Chips *ChipsSession) TotalSupply() (*big.Int, error) { - return _Chips.Contract.TotalSupply(&_Chips.CallOpts) -} +// 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 *ChipsStakedIterator) 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(ChipsStaked) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true -// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. -// -// Solidity: function totalSupply() view returns(uint256) -func (_Chips *ChipsCallerSession) TotalSupply() (*big.Int, error) { - return _Chips.Contract.TotalSupply(&_Chips.CallOpts) -} + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ChipsStaked) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true -// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. -// -// Solidity: function approve(address to, uint256 tokenId) returns() -func (_Chips *ChipsTransactor) Approve(opts *bind.TransactOpts, to common.Address, tokenId *big.Int) (*types.Transaction, error) { - return _Chips.contract.Transact(opts, "approve", to, tokenId) + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } } -// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. -// -// Solidity: function approve(address to, uint256 tokenId) returns() -func (_Chips *ChipsSession) Approve(to common.Address, tokenId *big.Int) (*types.Transaction, error) { - return _Chips.Contract.Approve(&_Chips.TransactOpts, to, tokenId) +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ChipsStakedIterator) Error() error { + return it.fail } -// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. -// -// Solidity: function approve(address to, uint256 tokenId) returns() -func (_Chips *ChipsTransactorSession) Approve(to common.Address, tokenId *big.Int) (*types.Transaction, error) { - return _Chips.Contract.Approve(&_Chips.TransactOpts, to, tokenId) +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ChipsStakedIterator) Close() error { + it.sub.Unsubscribe() + return nil } -// Burn is a paid mutator transaction binding the contract method 0x42966c68. -// -// Solidity: function burn(uint256 tokenId) returns() -func (_Chips *ChipsTransactor) Burn(opts *bind.TransactOpts, tokenId *big.Int) (*types.Transaction, error) { - return _Chips.contract.Transact(opts, "burn", tokenId) +// ChipsStaked represents a Staked event raised by the Chips contract. +type ChipsStaked struct { + User common.Address + NodeAddr common.Address + Amount *big.Int + StartTokenId *big.Int + EndTokenId *big.Int + Raw types.Log // Blockchain specific contextual infos } -// Burn is a paid mutator transaction binding the contract method 0x42966c68. +// FilterStaked is a free log retrieval operation binding the contract event 0xad3fa07f4195b47e64892eb944ecbfc253384053c119852bb2bcae484c2fcb69. // -// Solidity: function burn(uint256 tokenId) returns() -func (_Chips *ChipsSession) Burn(tokenId *big.Int) (*types.Transaction, error) { - return _Chips.Contract.Burn(&_Chips.TransactOpts, tokenId) -} +// Solidity: event Staked(address indexed user, address indexed nodeAddr, uint256 indexed amount, uint256 startTokenId, uint256 endTokenId) +func (_Chips *ChipsFilterer) FilterStaked(opts *bind.FilterOpts, user []common.Address, nodeAddr []common.Address, amount []*big.Int) (*ChipsStakedIterator, error) { -// Burn is a paid mutator transaction binding the contract method 0x42966c68. -// -// Solidity: function burn(uint256 tokenId) returns() -func (_Chips *ChipsTransactorSession) Burn(tokenId *big.Int) (*types.Transaction, error) { - return _Chips.Contract.Burn(&_Chips.TransactOpts, tokenId) -} + var userRule []interface{} + for _, userItem := range user { + userRule = append(userRule, userItem) + } + var nodeAddrRule []interface{} + for _, nodeAddrItem := range nodeAddr { + nodeAddrRule = append(nodeAddrRule, nodeAddrItem) + } + var amountRule []interface{} + for _, amountItem := range amount { + amountRule = append(amountRule, amountItem) + } -// Initialize is a paid mutator transaction binding the contract method 0x077f224a. -// -// Solidity: function initialize(string name_, string symbol_, address staking_) returns() -func (_Chips *ChipsTransactor) Initialize(opts *bind.TransactOpts, name_ string, symbol_ string, staking_ common.Address) (*types.Transaction, error) { - return _Chips.contract.Transact(opts, "initialize", name_, symbol_, staking_) + logs, sub, err := _Chips.contract.FilterLogs(opts, "Staked", userRule, nodeAddrRule, amountRule) + if err != nil { + return nil, err + } + return &ChipsStakedIterator{contract: _Chips.contract, event: "Staked", logs: logs, sub: sub}, nil } -// Initialize is a paid mutator transaction binding the contract method 0x077f224a. +// WatchStaked is a free log subscription operation binding the contract event 0xad3fa07f4195b47e64892eb944ecbfc253384053c119852bb2bcae484c2fcb69. // -// Solidity: function initialize(string name_, string symbol_, address staking_) returns() -func (_Chips *ChipsSession) Initialize(name_ string, symbol_ string, staking_ common.Address) (*types.Transaction, error) { - return _Chips.Contract.Initialize(&_Chips.TransactOpts, name_, symbol_, staking_) -} +// Solidity: event Staked(address indexed user, address indexed nodeAddr, uint256 indexed amount, uint256 startTokenId, uint256 endTokenId) +func (_Chips *ChipsFilterer) WatchStaked(opts *bind.WatchOpts, sink chan<- *ChipsStaked, user []common.Address, nodeAddr []common.Address, amount []*big.Int) (event.Subscription, error) { -// Initialize is a paid mutator transaction binding the contract method 0x077f224a. -// -// Solidity: function initialize(string name_, string symbol_, address staking_) returns() -func (_Chips *ChipsTransactorSession) Initialize(name_ string, symbol_ string, staking_ common.Address) (*types.Transaction, error) { - return _Chips.Contract.Initialize(&_Chips.TransactOpts, name_, symbol_, staking_) -} + var userRule []interface{} + for _, userItem := range user { + userRule = append(userRule, userItem) + } + var nodeAddrRule []interface{} + for _, nodeAddrItem := range nodeAddr { + nodeAddrRule = append(nodeAddrRule, nodeAddrItem) + } + var amountRule []interface{} + for _, amountItem := range amount { + amountRule = append(amountRule, amountItem) + } -// Mint is a paid mutator transaction binding the contract method 0x6a627842. -// -// Solidity: function mint(address account) returns(uint256 tokenId) -func (_Chips *ChipsTransactor) Mint(opts *bind.TransactOpts, account common.Address) (*types.Transaction, error) { - return _Chips.contract.Transact(opts, "mint", account) -} + logs, sub, err := _Chips.contract.WatchLogs(opts, "Staked", userRule, nodeAddrRule, amountRule) + 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(ChipsStaked) + if err := _Chips.contract.UnpackLog(event, "Staked", log); err != nil { + return err + } + event.Raw = log -// Mint is a paid mutator transaction binding the contract method 0x6a627842. -// -// Solidity: function mint(address account) returns(uint256 tokenId) -func (_Chips *ChipsSession) Mint(account common.Address) (*types.Transaction, error) { - return _Chips.Contract.Mint(&_Chips.TransactOpts, account) + 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 } -// Mint is a paid mutator transaction binding the contract method 0x6a627842. +// ParseStaked is a log parse operation binding the contract event 0xad3fa07f4195b47e64892eb944ecbfc253384053c119852bb2bcae484c2fcb69. // -// Solidity: function mint(address account) returns(uint256 tokenId) -func (_Chips *ChipsTransactorSession) Mint(account common.Address) (*types.Transaction, error) { - return _Chips.Contract.Mint(&_Chips.TransactOpts, account) +// Solidity: event Staked(address indexed user, address indexed nodeAddr, uint256 indexed amount, uint256 startTokenId, uint256 endTokenId) +func (_Chips *ChipsFilterer) ParseStaked(log types.Log) (*ChipsStaked, error) { + event := new(ChipsStaked) + if err := _Chips.contract.UnpackLog(event, "Staked", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil } -// MintBatch is a paid mutator transaction binding the contract method 0x248b71fc. -// -// Solidity: function mintBatch(address to, uint256 batchSize) returns(uint256 startTokenId, uint256 endTokenId) -func (_Chips *ChipsTransactor) MintBatch(opts *bind.TransactOpts, to common.Address, batchSize *big.Int) (*types.Transaction, error) { - return _Chips.contract.Transact(opts, "mintBatch", to, batchSize) -} +// ChipsUnpausedIterator is returned from FilterUnpaused and is used to iterate over the raw logs and unpacked data for Unpaused events raised by the Chips contract. +type ChipsUnpausedIterator struct { + Event *ChipsUnpaused // Event containing the contract specifics and raw log -// MintBatch is a paid mutator transaction binding the contract method 0x248b71fc. -// -// Solidity: function mintBatch(address to, uint256 batchSize) returns(uint256 startTokenId, uint256 endTokenId) -func (_Chips *ChipsSession) MintBatch(to common.Address, batchSize *big.Int) (*types.Transaction, error) { - return _Chips.Contract.MintBatch(&_Chips.TransactOpts, to, batchSize) -} + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data -// MintBatch is a paid mutator transaction binding the contract method 0x248b71fc. -// -// Solidity: function mintBatch(address to, uint256 batchSize) returns(uint256 startTokenId, uint256 endTokenId) -func (_Chips *ChipsTransactorSession) MintBatch(to common.Address, batchSize *big.Int) (*types.Transaction, error) { - return _Chips.Contract.MintBatch(&_Chips.TransactOpts, to, batchSize) + 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 } -// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. -// -// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() -func (_Chips *ChipsTransactor) SafeTransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { - return _Chips.contract.Transact(opts, "safeTransferFrom", from, to, tokenId) -} +// 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 *ChipsUnpausedIterator) 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(ChipsUnpaused) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true -// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. -// -// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() -func (_Chips *ChipsSession) SafeTransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { - return _Chips.Contract.SafeTransferFrom(&_Chips.TransactOpts, from, to, tokenId) -} + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ChipsUnpaused) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true -// SafeTransferFrom is a paid mutator transaction binding the contract method 0x42842e0e. -// -// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId) returns() -func (_Chips *ChipsTransactorSession) SafeTransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { - return _Chips.Contract.SafeTransferFrom(&_Chips.TransactOpts, from, to, tokenId) + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } } -// SafeTransferFrom0 is a paid mutator transaction binding the contract method 0xb88d4fde. -// -// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId, bytes data) returns() -func (_Chips *ChipsTransactor) SafeTransferFrom0(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int, data []byte) (*types.Transaction, error) { - return _Chips.contract.Transact(opts, "safeTransferFrom0", from, to, tokenId, data) +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ChipsUnpausedIterator) Error() error { + return it.fail } -// SafeTransferFrom0 is a paid mutator transaction binding the contract method 0xb88d4fde. -// -// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId, bytes data) returns() -func (_Chips *ChipsSession) SafeTransferFrom0(from common.Address, to common.Address, tokenId *big.Int, data []byte) (*types.Transaction, error) { - return _Chips.Contract.SafeTransferFrom0(&_Chips.TransactOpts, from, to, tokenId, data) +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ChipsUnpausedIterator) Close() error { + it.sub.Unsubscribe() + return nil } -// SafeTransferFrom0 is a paid mutator transaction binding the contract method 0xb88d4fde. -// -// Solidity: function safeTransferFrom(address from, address to, uint256 tokenId, bytes data) returns() -func (_Chips *ChipsTransactorSession) SafeTransferFrom0(from common.Address, to common.Address, tokenId *big.Int, data []byte) (*types.Transaction, error) { - return _Chips.Contract.SafeTransferFrom0(&_Chips.TransactOpts, from, to, tokenId, data) +// ChipsUnpaused represents a Unpaused event raised by the Chips contract. +type ChipsUnpaused struct { + Account common.Address + Raw types.Log // Blockchain specific contextual infos } -// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// FilterUnpaused is a free log retrieval operation binding the contract event 0x5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa. // -// Solidity: function setApprovalForAll(address operator, bool approved) returns() -func (_Chips *ChipsTransactor) SetApprovalForAll(opts *bind.TransactOpts, operator common.Address, approved bool) (*types.Transaction, error) { - return _Chips.contract.Transact(opts, "setApprovalForAll", operator, approved) -} +// Solidity: event Unpaused(address account) +func (_Chips *ChipsFilterer) FilterUnpaused(opts *bind.FilterOpts) (*ChipsUnpausedIterator, error) { -// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. -// -// Solidity: function setApprovalForAll(address operator, bool approved) returns() -func (_Chips *ChipsSession) SetApprovalForAll(operator common.Address, approved bool) (*types.Transaction, error) { - return _Chips.Contract.SetApprovalForAll(&_Chips.TransactOpts, operator, approved) + logs, sub, err := _Chips.contract.FilterLogs(opts, "Unpaused") + if err != nil { + return nil, err + } + return &ChipsUnpausedIterator{contract: _Chips.contract, event: "Unpaused", logs: logs, sub: sub}, nil } -// SetApprovalForAll is a paid mutator transaction binding the contract method 0xa22cb465. +// WatchUnpaused is a free log subscription operation binding the contract event 0x5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa. // -// Solidity: function setApprovalForAll(address operator, bool approved) returns() -func (_Chips *ChipsTransactorSession) SetApprovalForAll(operator common.Address, approved bool) (*types.Transaction, error) { - return _Chips.Contract.SetApprovalForAll(&_Chips.TransactOpts, operator, approved) -} +// Solidity: event Unpaused(address account) +func (_Chips *ChipsFilterer) WatchUnpaused(opts *bind.WatchOpts, sink chan<- *ChipsUnpaused) (event.Subscription, error) { -// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. -// -// Solidity: function transferFrom(address from, address to, uint256 tokenId) returns() -func (_Chips *ChipsTransactor) TransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { - return _Chips.contract.Transact(opts, "transferFrom", from, to, tokenId) -} + logs, sub, err := _Chips.contract.WatchLogs(opts, "Unpaused") + 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(ChipsUnpaused) + if err := _Chips.contract.UnpackLog(event, "Unpaused", log); err != nil { + return err + } + event.Raw = log -// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. -// -// Solidity: function transferFrom(address from, address to, uint256 tokenId) returns() -func (_Chips *ChipsSession) TransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { - return _Chips.Contract.TransferFrom(&_Chips.TransactOpts, from, to, tokenId) + 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 } -// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// ParseUnpaused is a log parse operation binding the contract event 0x5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa. // -// Solidity: function transferFrom(address from, address to, uint256 tokenId) returns() -func (_Chips *ChipsTransactorSession) TransferFrom(from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error) { - return _Chips.Contract.TransferFrom(&_Chips.TransactOpts, from, to, tokenId) +// Solidity: event Unpaused(address account) +func (_Chips *ChipsFilterer) ParseUnpaused(log types.Log) (*ChipsUnpaused, error) { + event := new(ChipsUnpaused) + if err := _Chips.contract.UnpackLog(event, "Unpaused", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil } -// ChipsApprovalIterator is returned from FilterApproval and is used to iterate over the raw logs and unpacked data for Approval events raised by the Chips contract. -type ChipsApprovalIterator struct { - Event *ChipsApproval // Event containing the contract specifics and raw log +// ChipsUnstakeClaimedIterator is returned from FilterUnstakeClaimed and is used to iterate over the raw logs and unpacked data for UnstakeClaimed events raised by the Chips contract. +type ChipsUnstakeClaimedIterator struct { + Event *ChipsUnstakeClaimed // 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 @@ -695,7 +3938,7 @@ type ChipsApprovalIterator struct { // 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 *ChipsApprovalIterator) Next() bool { +func (it *ChipsUnstakeClaimedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -704,7 +3947,7 @@ func (it *ChipsApprovalIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(ChipsApproval) + it.Event = new(ChipsUnstakeClaimed) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -719,7 +3962,7 @@ func (it *ChipsApprovalIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(ChipsApproval) + it.Event = new(ChipsUnstakeClaimed) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -735,69 +3978,70 @@ func (it *ChipsApprovalIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *ChipsApprovalIterator) Error() error { +func (it *ChipsUnstakeClaimedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *ChipsApprovalIterator) Close() error { +func (it *ChipsUnstakeClaimedIterator) Close() error { it.sub.Unsubscribe() return nil } -// ChipsApproval represents a Approval event raised by the Chips contract. -type ChipsApproval struct { - Owner common.Address - Approved common.Address - TokenId *big.Int - Raw types.Log // Blockchain specific contextual infos +// ChipsUnstakeClaimed represents a UnstakeClaimed event raised by the Chips contract. +type ChipsUnstakeClaimed struct { + RequestId *big.Int + NodeAddr common.Address + User common.Address + UnstakeAmount *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterApproval is a free log retrieval operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// FilterUnstakeClaimed is a free log retrieval operation binding the contract event 0x2769ece66eadb650afd8c08c7a8772e39381dddd7230f9e039669e631044d47c. // -// Solidity: event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId) -func (_Chips *ChipsFilterer) FilterApproval(opts *bind.FilterOpts, owner []common.Address, approved []common.Address, tokenId []*big.Int) (*ChipsApprovalIterator, error) { +// Solidity: event UnstakeClaimed(uint256 indexed requestId, address indexed nodeAddr, address indexed user, uint256 unstakeAmount) +func (_Chips *ChipsFilterer) FilterUnstakeClaimed(opts *bind.FilterOpts, requestId []*big.Int, nodeAddr []common.Address, user []common.Address) (*ChipsUnstakeClaimedIterator, error) { - var ownerRule []interface{} - for _, ownerItem := range owner { - ownerRule = append(ownerRule, ownerItem) + var requestIdRule []interface{} + for _, requestIdItem := range requestId { + requestIdRule = append(requestIdRule, requestIdItem) } - var approvedRule []interface{} - for _, approvedItem := range approved { - approvedRule = append(approvedRule, approvedItem) + var nodeAddrRule []interface{} + for _, nodeAddrItem := range nodeAddr { + nodeAddrRule = append(nodeAddrRule, nodeAddrItem) } - var tokenIdRule []interface{} - for _, tokenIdItem := range tokenId { - tokenIdRule = append(tokenIdRule, tokenIdItem) + var userRule []interface{} + for _, userItem := range user { + userRule = append(userRule, userItem) } - logs, sub, err := _Chips.contract.FilterLogs(opts, "Approval", ownerRule, approvedRule, tokenIdRule) + logs, sub, err := _Chips.contract.FilterLogs(opts, "UnstakeClaimed", requestIdRule, nodeAddrRule, userRule) if err != nil { return nil, err } - return &ChipsApprovalIterator{contract: _Chips.contract, event: "Approval", logs: logs, sub: sub}, nil + return &ChipsUnstakeClaimedIterator{contract: _Chips.contract, event: "UnstakeClaimed", logs: logs, sub: sub}, nil } -// WatchApproval is a free log subscription operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// WatchUnstakeClaimed is a free log subscription operation binding the contract event 0x2769ece66eadb650afd8c08c7a8772e39381dddd7230f9e039669e631044d47c. // -// Solidity: event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId) -func (_Chips *ChipsFilterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *ChipsApproval, owner []common.Address, approved []common.Address, tokenId []*big.Int) (event.Subscription, error) { +// Solidity: event UnstakeClaimed(uint256 indexed requestId, address indexed nodeAddr, address indexed user, uint256 unstakeAmount) +func (_Chips *ChipsFilterer) WatchUnstakeClaimed(opts *bind.WatchOpts, sink chan<- *ChipsUnstakeClaimed, requestId []*big.Int, nodeAddr []common.Address, user []common.Address) (event.Subscription, error) { - var ownerRule []interface{} - for _, ownerItem := range owner { - ownerRule = append(ownerRule, ownerItem) + var requestIdRule []interface{} + for _, requestIdItem := range requestId { + requestIdRule = append(requestIdRule, requestIdItem) } - var approvedRule []interface{} - for _, approvedItem := range approved { - approvedRule = append(approvedRule, approvedItem) + var nodeAddrRule []interface{} + for _, nodeAddrItem := range nodeAddr { + nodeAddrRule = append(nodeAddrRule, nodeAddrItem) } - var tokenIdRule []interface{} - for _, tokenIdItem := range tokenId { - tokenIdRule = append(tokenIdRule, tokenIdItem) + var userRule []interface{} + for _, userItem := range user { + userRule = append(userRule, userItem) } - logs, sub, err := _Chips.contract.WatchLogs(opts, "Approval", ownerRule, approvedRule, tokenIdRule) + logs, sub, err := _Chips.contract.WatchLogs(opts, "UnstakeClaimed", requestIdRule, nodeAddrRule, userRule) if err != nil { return nil, err } @@ -807,8 +4051,8 @@ func (_Chips *ChipsFilterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *Ch select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(ChipsApproval) - if err := _Chips.contract.UnpackLog(event, "Approval", log); err != nil { + event := new(ChipsUnstakeClaimed) + if err := _Chips.contract.UnpackLog(event, "UnstakeClaimed", log); err != nil { return err } event.Raw = log @@ -829,21 +4073,21 @@ func (_Chips *ChipsFilterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *Ch }), nil } -// ParseApproval is a log parse operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// ParseUnstakeClaimed is a log parse operation binding the contract event 0x2769ece66eadb650afd8c08c7a8772e39381dddd7230f9e039669e631044d47c. // -// Solidity: event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId) -func (_Chips *ChipsFilterer) ParseApproval(log types.Log) (*ChipsApproval, error) { - event := new(ChipsApproval) - if err := _Chips.contract.UnpackLog(event, "Approval", log); err != nil { +// Solidity: event UnstakeClaimed(uint256 indexed requestId, address indexed nodeAddr, address indexed user, uint256 unstakeAmount) +func (_Chips *ChipsFilterer) ParseUnstakeClaimed(log types.Log) (*ChipsUnstakeClaimed, error) { + event := new(ChipsUnstakeClaimed) + if err := _Chips.contract.UnpackLog(event, "UnstakeClaimed", log); err != nil { return nil, err } event.Raw = log return event, nil } -// ChipsApprovalForAllIterator is returned from FilterApprovalForAll and is used to iterate over the raw logs and unpacked data for ApprovalForAll events raised by the Chips contract. -type ChipsApprovalForAllIterator struct { - Event *ChipsApprovalForAll // Event containing the contract specifics and raw log +// ChipsUnstakeRequestedIterator is returned from FilterUnstakeRequested and is used to iterate over the raw logs and unpacked data for UnstakeRequested events raised by the Chips contract. +type ChipsUnstakeRequestedIterator struct { + Event *ChipsUnstakeRequested // 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 @@ -857,7 +4101,7 @@ type ChipsApprovalForAllIterator struct { // 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 *ChipsApprovalForAllIterator) Next() bool { +func (it *ChipsUnstakeRequestedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -866,7 +4110,7 @@ func (it *ChipsApprovalForAllIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(ChipsApprovalForAll) + it.Event = new(ChipsUnstakeRequested) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -881,7 +4125,7 @@ func (it *ChipsApprovalForAllIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(ChipsApprovalForAll) + it.Event = new(ChipsUnstakeRequested) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -897,61 +4141,70 @@ func (it *ChipsApprovalForAllIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *ChipsApprovalForAllIterator) Error() error { +func (it *ChipsUnstakeRequestedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *ChipsApprovalForAllIterator) Close() error { +func (it *ChipsUnstakeRequestedIterator) Close() error { it.sub.Unsubscribe() return nil } -// ChipsApprovalForAll represents a ApprovalForAll event raised by the Chips contract. -type ChipsApprovalForAll struct { - Owner common.Address - Operator common.Address - Approved bool - Raw types.Log // Blockchain specific contextual infos +// ChipsUnstakeRequested represents a UnstakeRequested event raised by the Chips contract. +type ChipsUnstakeRequested struct { + User common.Address + NodeAddr common.Address + RequestId *big.Int + ChipsIds []*big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterApprovalForAll is a free log retrieval operation binding the contract event 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31. +// FilterUnstakeRequested is a free log retrieval operation binding the contract event 0xdb16a7c2edf86059b1faf94dd3d8c2144c14ff49e54690aaa6eb633c796b6b0c. // -// Solidity: event ApprovalForAll(address indexed owner, address indexed operator, bool approved) -func (_Chips *ChipsFilterer) FilterApprovalForAll(opts *bind.FilterOpts, owner []common.Address, operator []common.Address) (*ChipsApprovalForAllIterator, error) { +// Solidity: event UnstakeRequested(address indexed user, address indexed nodeAddr, uint256 indexed requestId, uint256[] chipsIds) +func (_Chips *ChipsFilterer) FilterUnstakeRequested(opts *bind.FilterOpts, user []common.Address, nodeAddr []common.Address, requestId []*big.Int) (*ChipsUnstakeRequestedIterator, error) { - var ownerRule []interface{} - for _, ownerItem := range owner { - ownerRule = append(ownerRule, ownerItem) + var userRule []interface{} + for _, userItem := range user { + userRule = append(userRule, userItem) + } + var nodeAddrRule []interface{} + for _, nodeAddrItem := range nodeAddr { + nodeAddrRule = append(nodeAddrRule, nodeAddrItem) } - var operatorRule []interface{} - for _, operatorItem := range operator { - operatorRule = append(operatorRule, operatorItem) + var requestIdRule []interface{} + for _, requestIdItem := range requestId { + requestIdRule = append(requestIdRule, requestIdItem) } - logs, sub, err := _Chips.contract.FilterLogs(opts, "ApprovalForAll", ownerRule, operatorRule) + logs, sub, err := _Chips.contract.FilterLogs(opts, "UnstakeRequested", userRule, nodeAddrRule, requestIdRule) if err != nil { return nil, err } - return &ChipsApprovalForAllIterator{contract: _Chips.contract, event: "ApprovalForAll", logs: logs, sub: sub}, nil + return &ChipsUnstakeRequestedIterator{contract: _Chips.contract, event: "UnstakeRequested", logs: logs, sub: sub}, nil } -// WatchApprovalForAll is a free log subscription operation binding the contract event 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31. +// WatchUnstakeRequested is a free log subscription operation binding the contract event 0xdb16a7c2edf86059b1faf94dd3d8c2144c14ff49e54690aaa6eb633c796b6b0c. // -// Solidity: event ApprovalForAll(address indexed owner, address indexed operator, bool approved) -func (_Chips *ChipsFilterer) WatchApprovalForAll(opts *bind.WatchOpts, sink chan<- *ChipsApprovalForAll, owner []common.Address, operator []common.Address) (event.Subscription, error) { +// Solidity: event UnstakeRequested(address indexed user, address indexed nodeAddr, uint256 indexed requestId, uint256[] chipsIds) +func (_Chips *ChipsFilterer) WatchUnstakeRequested(opts *bind.WatchOpts, sink chan<- *ChipsUnstakeRequested, user []common.Address, nodeAddr []common.Address, requestId []*big.Int) (event.Subscription, error) { - var ownerRule []interface{} - for _, ownerItem := range owner { - ownerRule = append(ownerRule, ownerItem) + var userRule []interface{} + for _, userItem := range user { + userRule = append(userRule, userItem) } - var operatorRule []interface{} - for _, operatorItem := range operator { - operatorRule = append(operatorRule, operatorItem) + var nodeAddrRule []interface{} + for _, nodeAddrItem := range nodeAddr { + nodeAddrRule = append(nodeAddrRule, nodeAddrItem) + } + var requestIdRule []interface{} + for _, requestIdItem := range requestId { + requestIdRule = append(requestIdRule, requestIdItem) } - logs, sub, err := _Chips.contract.WatchLogs(opts, "ApprovalForAll", ownerRule, operatorRule) + logs, sub, err := _Chips.contract.WatchLogs(opts, "UnstakeRequested", userRule, nodeAddrRule, requestIdRule) if err != nil { return nil, err } @@ -961,8 +4214,8 @@ func (_Chips *ChipsFilterer) WatchApprovalForAll(opts *bind.WatchOpts, sink chan select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(ChipsApprovalForAll) - if err := _Chips.contract.UnpackLog(event, "ApprovalForAll", log); err != nil { + event := new(ChipsUnstakeRequested) + if err := _Chips.contract.UnpackLog(event, "UnstakeRequested", log); err != nil { return err } event.Raw = log @@ -983,21 +4236,21 @@ func (_Chips *ChipsFilterer) WatchApprovalForAll(opts *bind.WatchOpts, sink chan }), nil } -// ParseApprovalForAll is a log parse operation binding the contract event 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31. +// ParseUnstakeRequested is a log parse operation binding the contract event 0xdb16a7c2edf86059b1faf94dd3d8c2144c14ff49e54690aaa6eb633c796b6b0c. // -// Solidity: event ApprovalForAll(address indexed owner, address indexed operator, bool approved) -func (_Chips *ChipsFilterer) ParseApprovalForAll(log types.Log) (*ChipsApprovalForAll, error) { - event := new(ChipsApprovalForAll) - if err := _Chips.contract.UnpackLog(event, "ApprovalForAll", log); err != nil { +// Solidity: event UnstakeRequested(address indexed user, address indexed nodeAddr, uint256 indexed requestId, uint256[] chipsIds) +func (_Chips *ChipsFilterer) ParseUnstakeRequested(log types.Log) (*ChipsUnstakeRequested, error) { + event := new(ChipsUnstakeRequested) + if err := _Chips.contract.UnpackLog(event, "UnstakeRequested", log); err != nil { return nil, err } event.Raw = log return event, nil } -// ChipsInitializedIterator is returned from FilterInitialized and is used to iterate over the raw logs and unpacked data for Initialized events raised by the Chips contract. -type ChipsInitializedIterator struct { - Event *ChipsInitialized // Event containing the contract specifics and raw log +// ChipsWithdrawRequestedIterator is returned from FilterWithdrawRequested and is used to iterate over the raw logs and unpacked data for WithdrawRequested events raised by the Chips contract. +type ChipsWithdrawRequestedIterator struct { + Event *ChipsWithdrawRequested // 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 @@ -1011,7 +4264,7 @@ type ChipsInitializedIterator struct { // 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 *ChipsInitializedIterator) Next() bool { +func (it *ChipsWithdrawRequestedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1020,7 +4273,7 @@ func (it *ChipsInitializedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(ChipsInitialized) + it.Event = new(ChipsWithdrawRequested) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1035,7 +4288,7 @@ func (it *ChipsInitializedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(ChipsInitialized) + it.Event = new(ChipsWithdrawRequested) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1051,41 +4304,69 @@ func (it *ChipsInitializedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *ChipsInitializedIterator) Error() error { +func (it *ChipsWithdrawRequestedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *ChipsInitializedIterator) Close() error { +func (it *ChipsWithdrawRequestedIterator) Close() error { it.sub.Unsubscribe() return nil } -// ChipsInitialized represents a Initialized event raised by the Chips contract. -type ChipsInitialized struct { - Version uint64 - Raw types.Log // Blockchain specific contextual infos +// ChipsWithdrawRequested represents a WithdrawRequested event raised by the Chips contract. +type ChipsWithdrawRequested struct { + NodeAddr common.Address + Amount *big.Int + RequestId *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterInitialized is a free log retrieval operation binding the contract event 0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2. +// FilterWithdrawRequested is a free log retrieval operation binding the contract event 0xd72eb5d043f24a0168ae744d5c44f9596fd673a26bf74d9646bff4b844882d14. // -// Solidity: event Initialized(uint64 version) -func (_Chips *ChipsFilterer) FilterInitialized(opts *bind.FilterOpts) (*ChipsInitializedIterator, error) { +// Solidity: event WithdrawRequested(address indexed nodeAddr, uint256 indexed amount, uint256 indexed requestId) +func (_Chips *ChipsFilterer) FilterWithdrawRequested(opts *bind.FilterOpts, nodeAddr []common.Address, amount []*big.Int, requestId []*big.Int) (*ChipsWithdrawRequestedIterator, error) { - logs, sub, err := _Chips.contract.FilterLogs(opts, "Initialized") + var nodeAddrRule []interface{} + for _, nodeAddrItem := range nodeAddr { + nodeAddrRule = append(nodeAddrRule, nodeAddrItem) + } + var amountRule []interface{} + for _, amountItem := range amount { + amountRule = append(amountRule, amountItem) + } + var requestIdRule []interface{} + for _, requestIdItem := range requestId { + requestIdRule = append(requestIdRule, requestIdItem) + } + + logs, sub, err := _Chips.contract.FilterLogs(opts, "WithdrawRequested", nodeAddrRule, amountRule, requestIdRule) if err != nil { return nil, err } - return &ChipsInitializedIterator{contract: _Chips.contract, event: "Initialized", logs: logs, sub: sub}, nil + return &ChipsWithdrawRequestedIterator{contract: _Chips.contract, event: "WithdrawRequested", logs: logs, sub: sub}, nil } -// WatchInitialized is a free log subscription operation binding the contract event 0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2. +// WatchWithdrawRequested is a free log subscription operation binding the contract event 0xd72eb5d043f24a0168ae744d5c44f9596fd673a26bf74d9646bff4b844882d14. // -// Solidity: event Initialized(uint64 version) -func (_Chips *ChipsFilterer) WatchInitialized(opts *bind.WatchOpts, sink chan<- *ChipsInitialized) (event.Subscription, error) { +// Solidity: event WithdrawRequested(address indexed nodeAddr, uint256 indexed amount, uint256 indexed requestId) +func (_Chips *ChipsFilterer) WatchWithdrawRequested(opts *bind.WatchOpts, sink chan<- *ChipsWithdrawRequested, nodeAddr []common.Address, amount []*big.Int, requestId []*big.Int) (event.Subscription, error) { - logs, sub, err := _Chips.contract.WatchLogs(opts, "Initialized") + var nodeAddrRule []interface{} + for _, nodeAddrItem := range nodeAddr { + nodeAddrRule = append(nodeAddrRule, nodeAddrItem) + } + var amountRule []interface{} + for _, amountItem := range amount { + amountRule = append(amountRule, amountItem) + } + var requestIdRule []interface{} + for _, requestIdItem := range requestId { + requestIdRule = append(requestIdRule, requestIdItem) + } + + logs, sub, err := _Chips.contract.WatchLogs(opts, "WithdrawRequested", nodeAddrRule, amountRule, requestIdRule) if err != nil { return nil, err } @@ -1095,8 +4376,8 @@ func (_Chips *ChipsFilterer) WatchInitialized(opts *bind.WatchOpts, sink chan<- select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(ChipsInitialized) - if err := _Chips.contract.UnpackLog(event, "Initialized", log); err != nil { + event := new(ChipsWithdrawRequested) + if err := _Chips.contract.UnpackLog(event, "WithdrawRequested", log); err != nil { return err } event.Raw = log @@ -1117,21 +4398,21 @@ func (_Chips *ChipsFilterer) WatchInitialized(opts *bind.WatchOpts, sink chan<- }), nil } -// ParseInitialized is a log parse operation binding the contract event 0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2. +// ParseWithdrawRequested is a log parse operation binding the contract event 0xd72eb5d043f24a0168ae744d5c44f9596fd673a26bf74d9646bff4b844882d14. // -// Solidity: event Initialized(uint64 version) -func (_Chips *ChipsFilterer) ParseInitialized(log types.Log) (*ChipsInitialized, error) { - event := new(ChipsInitialized) - if err := _Chips.contract.UnpackLog(event, "Initialized", log); err != nil { +// Solidity: event WithdrawRequested(address indexed nodeAddr, uint256 indexed amount, uint256 indexed requestId) +func (_Chips *ChipsFilterer) ParseWithdrawRequested(log types.Log) (*ChipsWithdrawRequested, error) { + event := new(ChipsWithdrawRequested) + if err := _Chips.contract.UnpackLog(event, "WithdrawRequested", log); err != nil { return nil, err } event.Raw = log return event, nil } -// ChipsTransferIterator is returned from FilterTransfer and is used to iterate over the raw logs and unpacked data for Transfer events raised by the Chips contract. -type ChipsTransferIterator struct { - Event *ChipsTransfer // Event containing the contract specifics and raw log +// ChipsWithdrawalClaimedIterator is returned from FilterWithdrawalClaimed and is used to iterate over the raw logs and unpacked data for WithdrawalClaimed events raised by the Chips contract. +type ChipsWithdrawalClaimedIterator struct { + Event *ChipsWithdrawalClaimed // 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 @@ -1145,7 +4426,7 @@ type ChipsTransferIterator struct { // 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 *ChipsTransferIterator) Next() bool { +func (it *ChipsWithdrawalClaimedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1154,7 +4435,7 @@ func (it *ChipsTransferIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(ChipsTransfer) + it.Event = new(ChipsWithdrawalClaimed) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1169,7 +4450,7 @@ func (it *ChipsTransferIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(ChipsTransfer) + it.Event = new(ChipsWithdrawalClaimed) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1185,69 +4466,51 @@ func (it *ChipsTransferIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *ChipsTransferIterator) Error() error { +func (it *ChipsWithdrawalClaimedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *ChipsTransferIterator) Close() error { +func (it *ChipsWithdrawalClaimedIterator) Close() error { it.sub.Unsubscribe() return nil } -// ChipsTransfer represents a Transfer event raised by the Chips contract. -type ChipsTransfer struct { - From common.Address - To common.Address - TokenId *big.Int - Raw types.Log // Blockchain specific contextual infos +// ChipsWithdrawalClaimed represents a WithdrawalClaimed event raised by the Chips contract. +type ChipsWithdrawalClaimed struct { + RequestId *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterTransfer is a free log retrieval operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// FilterWithdrawalClaimed is a free log retrieval operation binding the contract event 0x8772d6f79a1845a0c0e90ef18d99f91242bbc0ba98c9ca780feaad42b81f02ba. // -// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) -func (_Chips *ChipsFilterer) FilterTransfer(opts *bind.FilterOpts, from []common.Address, to []common.Address, tokenId []*big.Int) (*ChipsTransferIterator, error) { +// Solidity: event WithdrawalClaimed(uint256 indexed requestId) +func (_Chips *ChipsFilterer) FilterWithdrawalClaimed(opts *bind.FilterOpts, requestId []*big.Int) (*ChipsWithdrawalClaimedIterator, 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) + var requestIdRule []interface{} + for _, requestIdItem := range requestId { + requestIdRule = append(requestIdRule, requestIdItem) } - logs, sub, err := _Chips.contract.FilterLogs(opts, "Transfer", fromRule, toRule, tokenIdRule) + logs, sub, err := _Chips.contract.FilterLogs(opts, "WithdrawalClaimed", requestIdRule) if err != nil { return nil, err } - return &ChipsTransferIterator{contract: _Chips.contract, event: "Transfer", logs: logs, sub: sub}, nil + return &ChipsWithdrawalClaimedIterator{contract: _Chips.contract, event: "WithdrawalClaimed", logs: logs, sub: sub}, nil } -// WatchTransfer is a free log subscription operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// WatchWithdrawalClaimed is a free log subscription operation binding the contract event 0x8772d6f79a1845a0c0e90ef18d99f91242bbc0ba98c9ca780feaad42b81f02ba. // -// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) -func (_Chips *ChipsFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *ChipsTransfer, from []common.Address, to []common.Address, tokenId []*big.Int) (event.Subscription, error) { +// Solidity: event WithdrawalClaimed(uint256 indexed requestId) +func (_Chips *ChipsFilterer) WatchWithdrawalClaimed(opts *bind.WatchOpts, sink chan<- *ChipsWithdrawalClaimed, requestId []*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) + var requestIdRule []interface{} + for _, requestIdItem := range requestId { + requestIdRule = append(requestIdRule, requestIdItem) } - logs, sub, err := _Chips.contract.WatchLogs(opts, "Transfer", fromRule, toRule, tokenIdRule) + logs, sub, err := _Chips.contract.WatchLogs(opts, "WithdrawalClaimed", requestIdRule) if err != nil { return nil, err } @@ -1257,8 +4520,8 @@ func (_Chips *ChipsFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *Ch select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(ChipsTransfer) - if err := _Chips.contract.UnpackLog(event, "Transfer", log); err != nil { + event := new(ChipsWithdrawalClaimed) + if err := _Chips.contract.UnpackLog(event, "WithdrawalClaimed", log); err != nil { return err } event.Raw = log @@ -1279,12 +4542,12 @@ func (_Chips *ChipsFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *Ch }), nil } -// ParseTransfer is a log parse operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// ParseWithdrawalClaimed is a log parse operation binding the contract event 0x8772d6f79a1845a0c0e90ef18d99f91242bbc0ba98c9ca780feaad42b81f02ba. // -// Solidity: event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) -func (_Chips *ChipsFilterer) ParseTransfer(log types.Log) (*ChipsTransfer, error) { - event := new(ChipsTransfer) - if err := _Chips.contract.UnpackLog(event, "Transfer", log); err != nil { +// Solidity: event WithdrawalClaimed(uint256 indexed requestId) +func (_Chips *ChipsFilterer) ParseWithdrawalClaimed(log types.Log) (*ChipsWithdrawalClaimed, error) { + event := new(ChipsWithdrawalClaimed) + if err := _Chips.contract.UnpackLog(event, "WithdrawalClaimed", log); err != nil { return nil, err } event.Raw = log diff --git a/contract/l2/contract_staking.go b/contract/l2/contract_staking.go index 2c0296ce..89926f8e 100644 --- a/contract/l2/contract_staking.go +++ b/contract/l2/contract_staking.go @@ -59,7 +59,7 @@ type DataTypesWithdrawalRequest struct { // StakingMetaData contains all meta data concerning the Staking contract. var StakingMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"treasury\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"stakeRatio\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stakeUnbondingPeriod\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"depositUnbondingPeriod\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nodeSlashRateBasisPoints\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"userSlashRateBasisPoints\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minDeposit\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AccessControlBadConfirmation\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"neededRole\",\"type\":\"bytes32\"}],\"name\":\"AccessControlUnauthorizedAccount\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"}],\"name\":\"AddressEmptyCode\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"AddressInsufficientBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"AlreadyClaimed\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"AmountTooSmall\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"BatchSizeZero\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotNodeOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotStaking\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CheckpointUnorderedInsertion\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ChipNotAuthorized\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ChipNotPublicGood\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"}],\"name\":\"ChipNotValid\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ChipsIdOverflow\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"claimId\",\"type\":\"uint256\"}],\"name\":\"ClaimIdNotExists\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ClaimTimeNotReady\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CreateNodeToZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DepositedTokensSlashedAll\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"EmptyNodeList\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"EnforcedPause\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ExpectedPause\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"FailedInnerCall\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidArrayLength\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"expected\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"actual\",\"type\":\"uint256\"}],\"name\":\"InvalidEpoch\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidInitialization\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NodeExists\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NodeNotExists\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"}],\"name\":\"NodeNotPublicGood\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NodeStakedOrDeposited\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotInitializing\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"PublicGoodNodeNotDeposited\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"}],\"name\":\"PublicGoodNodeNotStaked\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RewardDistributionFailed\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"bits\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"SafeCastOverflowedUintDowncast\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"SafeERC20FailedOperation\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TaxRateBasisPointsTooLarge\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Deposited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"version\",\"type\":\"uint64\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"description\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"taxRateBasisPoints\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"publicGood\",\"type\":\"bool\"}],\"name\":\"NodeCreated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"}],\"name\":\"NodeDeleted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"slashedOperationPool\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"slashedStakingPool\",\"type\":\"uint256\"}],\"name\":\"NodeSlashed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint64\",\"name\":\"taxRateBasisPoints\",\"type\":\"uint64\"}],\"name\":\"NodeTaxRateBasisPointsSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"startTimestamp\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"endTimestamp\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"publicPoolReward\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"publicPoolTax\",\"type\":\"uint256\"}],\"name\":\"PublicGoodRewardDistributed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint64\",\"name\":\"taxRateBasisPoints\",\"type\":\"uint64\"}],\"name\":\"PublicPoolTaxRateBasisPointsSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"startTimestamp\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"endTimestamp\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"nodeAddrs\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"requestFees\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"operationRewards\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"stakingRewards\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"taxAmounts\",\"type\":\"uint256[]\"}],\"name\":\"RewardDistributed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"startTokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"endTokenId\",\"type\":\"uint256\"}],\"name\":\"Staked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"unstakeAmount\",\"type\":\"uint256\"}],\"name\":\"UnstakeClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"chipsIds\",\"type\":\"uint256[]\"}],\"name\":\"UnstakeRequested\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"name\":\"WithdrawRequested\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"name\":\"WithdrawalClaimed\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DEPOSIT_UNBONDING_PERIOD\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MIN_DEPOSIT\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"NODE_SLASH_RATE_BASIS_POINTS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ORACLE_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PAUSE_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"SHARES_PER_CHIP\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"STAKE_RATIO\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"STAKE_UNBONDING_PERIOD\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TOKEN\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TREASURY\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"USER_SLASH_RATE_BASIS_POINTS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"chipsContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"requestIds\",\"type\":\"uint256[]\"}],\"name\":\"claimUnstake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"requestIds\",\"type\":\"uint256[]\"}],\"name\":\"claimWithdrawal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"description\",\"type\":\"string\"},{\"internalType\":\"uint64\",\"name\":\"taxRateBasisPoints\",\"type\":\"uint64\"},{\"internalType\":\"bool\",\"name\":\"publicGood\",\"type\":\"bool\"}],\"name\":\"createNode\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"description\",\"type\":\"string\"},{\"internalType\":\"uint64\",\"name\":\"taxRateBasisPoints\",\"type\":\"uint64\"},{\"internalType\":\"bool\",\"name\":\"publicGood\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"createNodeAndDeposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentEpoch\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"}],\"name\":\"deleteNode\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[3]\",\"name\":\"epochInfo\",\"type\":\"uint256[3]\"},{\"internalType\":\"address[]\",\"name\":\"nodeAddrs\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"requestFees\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"operationRewards\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"stakingRewards\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"publicPoolReward\",\"type\":\"uint256\"}],\"name\":\"distributeRewards\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getChipsInfo\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokens\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getMinDeposit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"}],\"name\":\"getNode\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"taxRateBasisPoints\",\"type\":\"uint64\"},{\"internalType\":\"bool\",\"name\":\"publicGood\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"description\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"operationPoolTokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stakingPoolTokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalShares\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"slashedTokens\",\"type\":\"uint256\"}],\"internalType\":\"structDataTypes.Node\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getNodeCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"nodeAddrs\",\"type\":\"address[]\"}],\"name\":\"getNodes\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"taxRateBasisPoints\",\"type\":\"uint64\"},{\"internalType\":\"bool\",\"name\":\"publicGood\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"description\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"operationPoolTokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stakingPoolTokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalShares\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"slashedTokens\",\"type\":\"uint256\"}],\"internalType\":\"structDataTypes.Node[]\",\"name\":\"nodes\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"offset\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"limit\",\"type\":\"uint256\"}],\"name\":\"getNodesWithPagination\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"taxRateBasisPoints\",\"type\":\"uint64\"},{\"internalType\":\"bool\",\"name\":\"publicGood\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"description\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"operationPoolTokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stakingPoolTokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalShares\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"slashedTokens\",\"type\":\"uint256\"}],\"internalType\":\"structDataTypes.Node[]\",\"name\":\"nodes\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"name\":\"getPendingUnstake\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"unstakeAmount\",\"type\":\"uint256\"}],\"internalType\":\"structDataTypes.UnstakeRequest\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"name\":\"getPendingWithdrawal\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint40\",\"name\":\"timestamp\",\"type\":\"uint40\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structDataTypes.WithdrawalRequest\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPoolInfo\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"totalOperationPoolTokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalStakingPoolTokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"treasuryAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPublicPool\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"taxRateBasisPoints\",\"type\":\"uint64\"},{\"internalType\":\"bool\",\"name\":\"publicGood\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"description\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"operationPoolTokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stakingPoolTokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalShares\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"slashedTokens\",\"type\":\"uint256\"}],\"internalType\":\"structDataTypes.Node\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getRoleMember\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleMemberCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"chips\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"pauseAccount\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"oracleAccount\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"}],\"name\":\"minTokensToStake\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"callerConfirmation\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"chipsIds\",\"type\":\"uint256[]\"}],\"name\":\"requestUnstake\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"chipsIds\",\"type\":\"uint256[]\"}],\"name\":\"requestUnstakeFromPublicPool\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"requestWithdrawal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"taxRateBasisPoints\",\"type\":\"uint64\"}],\"name\":\"setTaxRateBasisPoints4Node\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"taxRateBasisPoints\",\"type\":\"uint64\"}],\"name\":\"setTaxRateBasisPoints4PublicPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"nodeAddrs\",\"type\":\"address[]\"}],\"name\":\"slashNodes\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"stake\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"startTokenId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"endTokenId\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"stakeToPublicPool\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"startTokenId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"endTokenId\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"stakingToken\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"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\":\"unpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"withdraw2Treasury\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"treasury\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"stakeRatio\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stakeUnbondingPeriod\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"depositUnbondingPeriod\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nodeSlashRateBasisPoints\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"userSlashRateBasisPoints\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minDeposit\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AccessControlBadConfirmation\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"neededRole\",\"type\":\"bytes32\"}],\"name\":\"AccessControlUnauthorizedAccount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"AlreadyClaimed\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"AmountTooSmall\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"BatchSizeZero\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotNodeOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallerNotStaking\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CheckpointUnorderedInsertion\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ChipNotAuthorized\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ChipNotPublicGood\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"}],\"name\":\"ChipNotValid\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ChipsIdOverflow\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"claimId\",\"type\":\"uint256\"}],\"name\":\"ClaimIdNotExists\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ClaimTimeNotReady\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CreateNodeToZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DepositedTokensSlashedAll\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"EmptyNodeList\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"EnforcedPause\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ExpectedPause\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidArrayLength\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"expected\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"actual\",\"type\":\"uint256\"}],\"name\":\"InvalidEpoch\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidInitialization\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NodeExists\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NodeNotExists\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"}],\"name\":\"NodeNotPublicGood\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NodeStakedOrDeposited\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotInitializing\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"PublicGoodNodeNotDeposited\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"}],\"name\":\"PublicGoodNodeNotStaked\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RewardDistributionFailed\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"bits\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"SafeCastOverflowedUintDowncast\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TaxRateBasisPointsTooLarge\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TransferFailed\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Deposited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"version\",\"type\":\"uint64\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"description\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"taxRateBasisPoints\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"publicGood\",\"type\":\"bool\"}],\"name\":\"NodeCreated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"}],\"name\":\"NodeDeleted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"slashedOperationPool\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"slashedStakingPool\",\"type\":\"uint256\"}],\"name\":\"NodeSlashed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint64\",\"name\":\"taxRateBasisPoints\",\"type\":\"uint64\"}],\"name\":\"NodeTaxRateBasisPointsSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"startTimestamp\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"endTimestamp\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"publicPoolReward\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"publicPoolTax\",\"type\":\"uint256\"}],\"name\":\"PublicGoodRewardDistributed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint64\",\"name\":\"taxRateBasisPoints\",\"type\":\"uint64\"}],\"name\":\"PublicPoolTaxRateBasisPointsSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"startTimestamp\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"endTimestamp\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"nodeAddrs\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"requestFees\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"operationRewards\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"stakingRewards\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"taxAmounts\",\"type\":\"uint256[]\"}],\"name\":\"RewardDistributed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"startTokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"endTokenId\",\"type\":\"uint256\"}],\"name\":\"Staked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"unstakeAmount\",\"type\":\"uint256\"}],\"name\":\"UnstakeClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"unstakeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"chipsIds\",\"type\":\"uint256[]\"}],\"name\":\"UnstakeRequested\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"name\":\"WithdrawRequested\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"name\":\"WithdrawalClaimed\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DEPOSIT_UNBONDING_PERIOD\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MIN_DEPOSIT\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"NODE_SLASH_RATE_BASIS_POINTS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ORACLE_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PAUSE_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"SHARES_PER_CHIP\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"STAKE_RATIO\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"STAKE_UNBONDING_PERIOD\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TREASURY\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"USER_SLASH_RATE_BASIS_POINTS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"chipsContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"requestIds\",\"type\":\"uint256[]\"}],\"name\":\"claimUnstake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"requestIds\",\"type\":\"uint256[]\"}],\"name\":\"claimWithdrawal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"description\",\"type\":\"string\"},{\"internalType\":\"uint64\",\"name\":\"taxRateBasisPoints\",\"type\":\"uint64\"},{\"internalType\":\"bool\",\"name\":\"publicGood\",\"type\":\"bool\"}],\"name\":\"createNode\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentEpoch\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"}],\"name\":\"deleteNode\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[3]\",\"name\":\"epochInfo\",\"type\":\"uint256[3]\"},{\"internalType\":\"address[]\",\"name\":\"nodeAddrs\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"requestFees\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"operationRewards\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"stakingRewards\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"publicPoolReward\",\"type\":\"uint256\"}],\"name\":\"distributeRewards\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getChipsInfo\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokens\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getMinDeposit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"}],\"name\":\"getNode\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"taxRateBasisPoints\",\"type\":\"uint64\"},{\"internalType\":\"bool\",\"name\":\"publicGood\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"description\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"operationPoolTokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stakingPoolTokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalShares\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"slashedTokens\",\"type\":\"uint256\"}],\"internalType\":\"structDataTypes.Node\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getNodeCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"nodeAddrs\",\"type\":\"address[]\"}],\"name\":\"getNodes\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"taxRateBasisPoints\",\"type\":\"uint64\"},{\"internalType\":\"bool\",\"name\":\"publicGood\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"description\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"operationPoolTokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stakingPoolTokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalShares\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"slashedTokens\",\"type\":\"uint256\"}],\"internalType\":\"structDataTypes.Node[]\",\"name\":\"nodes\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"offset\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"limit\",\"type\":\"uint256\"}],\"name\":\"getNodesWithPagination\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"taxRateBasisPoints\",\"type\":\"uint64\"},{\"internalType\":\"bool\",\"name\":\"publicGood\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"description\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"operationPoolTokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stakingPoolTokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalShares\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"slashedTokens\",\"type\":\"uint256\"}],\"internalType\":\"structDataTypes.Node[]\",\"name\":\"nodes\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"name\":\"getPendingUnstake\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"unstakeAmount\",\"type\":\"uint256\"}],\"internalType\":\"structDataTypes.UnstakeRequest\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"name\":\"getPendingWithdrawal\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint40\",\"name\":\"timestamp\",\"type\":\"uint40\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structDataTypes.WithdrawalRequest\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPoolInfo\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"totalOperationPoolTokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalStakingPoolTokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"treasuryAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPublicPool\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"taxRateBasisPoints\",\"type\":\"uint64\"},{\"internalType\":\"bool\",\"name\":\"publicGood\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"description\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"operationPoolTokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stakingPoolTokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalShares\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"slashedTokens\",\"type\":\"uint256\"}],\"internalType\":\"structDataTypes.Node\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getRoleMember\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleMemberCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"chips\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"pauseAccount\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"oracleAccount\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"}],\"name\":\"minTokensToStake\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"callerConfirmation\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"chipsIds\",\"type\":\"uint256[]\"}],\"name\":\"requestUnstake\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"chipsIds\",\"type\":\"uint256[]\"}],\"name\":\"requestUnstakeFromPublicPool\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"requestWithdrawal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"taxRateBasisPoints\",\"type\":\"uint64\"}],\"name\":\"setTaxRateBasisPoints4Node\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"taxRateBasisPoints\",\"type\":\"uint64\"}],\"name\":\"setTaxRateBasisPoints4PublicPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"nodeAddrs\",\"type\":\"address[]\"}],\"name\":\"slashNodes\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"}],\"name\":\"stake\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"startTokenId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"endTokenId\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nodeAddr\",\"type\":\"address\"}],\"name\":\"stakeToPublicPool\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"startTokenId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"endTokenId\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"withdraw2Treasury\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", } // StakingABI is the input ABI used to generate the binding from. @@ -487,37 +487,6 @@ func (_Staking *StakingCallerSession) STAKEUNBONDINGPERIOD() (*big.Int, error) { return _Staking.Contract.STAKEUNBONDINGPERIOD(&_Staking.CallOpts) } -// TOKEN is a free data retrieval call binding the contract method 0x82bfefc8. -// -// Solidity: function TOKEN() view returns(address) -func (_Staking *StakingCaller) TOKEN(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _Staking.contract.Call(opts, &out, "TOKEN") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// TOKEN is a free data retrieval call binding the contract method 0x82bfefc8. -// -// Solidity: function TOKEN() view returns(address) -func (_Staking *StakingSession) TOKEN() (common.Address, error) { - return _Staking.Contract.TOKEN(&_Staking.CallOpts) -} - -// TOKEN is a free data retrieval call binding the contract method 0x82bfefc8. -// -// Solidity: function TOKEN() view returns(address) -func (_Staking *StakingCallerSession) TOKEN() (common.Address, error) { - return _Staking.Contract.TOKEN(&_Staking.CallOpts) -} - // TREASURY is a free data retrieval call binding the contract method 0x2d2c5565. // // Solidity: function TREASURY() view returns(address) @@ -1171,37 +1140,6 @@ func (_Staking *StakingCallerSession) Paused() (bool, error) { return _Staking.Contract.Paused(&_Staking.CallOpts) } -// StakingToken is a free data retrieval call binding the contract method 0x72f702f3. -// -// Solidity: function stakingToken() view returns(address) -func (_Staking *StakingCaller) StakingToken(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _Staking.contract.Call(opts, &out, "stakingToken") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// StakingToken is a free data retrieval call binding the contract method 0x72f702f3. -// -// Solidity: function stakingToken() view returns(address) -func (_Staking *StakingSession) StakingToken() (common.Address, error) { - return _Staking.Contract.StakingToken(&_Staking.CallOpts) -} - -// StakingToken is a free data retrieval call binding the contract method 0x72f702f3. -// -// Solidity: function stakingToken() view returns(address) -func (_Staking *StakingCallerSession) StakingToken() (common.Address, error) { - return _Staking.Contract.StakingToken(&_Staking.CallOpts) -} - // SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. // // Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) @@ -1275,46 +1213,25 @@ func (_Staking *StakingTransactorSession) ClaimWithdrawal(requestIds []*big.Int) return _Staking.Contract.ClaimWithdrawal(&_Staking.TransactOpts, requestIds) } -// CreateNode is a paid mutator transaction binding the contract method 0xec3f4783. -// -// Solidity: function createNode(address to, string name, string description, uint64 taxRateBasisPoints, bool publicGood) returns() -func (_Staking *StakingTransactor) CreateNode(opts *bind.TransactOpts, to common.Address, name string, description string, taxRateBasisPoints uint64, publicGood bool) (*types.Transaction, error) { - return _Staking.contract.Transact(opts, "createNode", to, name, description, taxRateBasisPoints, publicGood) -} - -// CreateNode is a paid mutator transaction binding the contract method 0xec3f4783. -// -// Solidity: function createNode(address to, string name, string description, uint64 taxRateBasisPoints, bool publicGood) returns() -func (_Staking *StakingSession) CreateNode(to common.Address, name string, description string, taxRateBasisPoints uint64, publicGood bool) (*types.Transaction, error) { - return _Staking.Contract.CreateNode(&_Staking.TransactOpts, to, name, description, taxRateBasisPoints, publicGood) -} - -// CreateNode is a paid mutator transaction binding the contract method 0xec3f4783. +// CreateNode is a paid mutator transaction binding the contract method 0x96531623. // -// Solidity: function createNode(address to, string name, string description, uint64 taxRateBasisPoints, bool publicGood) returns() -func (_Staking *StakingTransactorSession) CreateNode(to common.Address, name string, description string, taxRateBasisPoints uint64, publicGood bool) (*types.Transaction, error) { - return _Staking.Contract.CreateNode(&_Staking.TransactOpts, to, name, description, taxRateBasisPoints, publicGood) +// Solidity: function createNode(string name, string description, uint64 taxRateBasisPoints, bool publicGood) payable returns() +func (_Staking *StakingTransactor) CreateNode(opts *bind.TransactOpts, name string, description string, taxRateBasisPoints uint64, publicGood bool) (*types.Transaction, error) { + return _Staking.contract.Transact(opts, "createNode", name, description, taxRateBasisPoints, publicGood) } -// CreateNodeAndDeposit is a paid mutator transaction binding the contract method 0x52ada782. +// CreateNode is a paid mutator transaction binding the contract method 0x96531623. // -// Solidity: function createNodeAndDeposit(string name, string description, uint64 taxRateBasisPoints, bool publicGood, uint256 amount) returns() -func (_Staking *StakingTransactor) CreateNodeAndDeposit(opts *bind.TransactOpts, name string, description string, taxRateBasisPoints uint64, publicGood bool, amount *big.Int) (*types.Transaction, error) { - return _Staking.contract.Transact(opts, "createNodeAndDeposit", name, description, taxRateBasisPoints, publicGood, amount) +// Solidity: function createNode(string name, string description, uint64 taxRateBasisPoints, bool publicGood) payable returns() +func (_Staking *StakingSession) CreateNode(name string, description string, taxRateBasisPoints uint64, publicGood bool) (*types.Transaction, error) { + return _Staking.Contract.CreateNode(&_Staking.TransactOpts, name, description, taxRateBasisPoints, publicGood) } -// CreateNodeAndDeposit is a paid mutator transaction binding the contract method 0x52ada782. +// CreateNode is a paid mutator transaction binding the contract method 0x96531623. // -// Solidity: function createNodeAndDeposit(string name, string description, uint64 taxRateBasisPoints, bool publicGood, uint256 amount) returns() -func (_Staking *StakingSession) CreateNodeAndDeposit(name string, description string, taxRateBasisPoints uint64, publicGood bool, amount *big.Int) (*types.Transaction, error) { - return _Staking.Contract.CreateNodeAndDeposit(&_Staking.TransactOpts, name, description, taxRateBasisPoints, publicGood, amount) -} - -// CreateNodeAndDeposit is a paid mutator transaction binding the contract method 0x52ada782. -// -// Solidity: function createNodeAndDeposit(string name, string description, uint64 taxRateBasisPoints, bool publicGood, uint256 amount) returns() -func (_Staking *StakingTransactorSession) CreateNodeAndDeposit(name string, description string, taxRateBasisPoints uint64, publicGood bool, amount *big.Int) (*types.Transaction, error) { - return _Staking.Contract.CreateNodeAndDeposit(&_Staking.TransactOpts, name, description, taxRateBasisPoints, publicGood, amount) +// Solidity: function createNode(string name, string description, uint64 taxRateBasisPoints, bool publicGood) payable returns() +func (_Staking *StakingTransactorSession) CreateNode(name string, description string, taxRateBasisPoints uint64, publicGood bool) (*types.Transaction, error) { + return _Staking.Contract.CreateNode(&_Staking.TransactOpts, name, description, taxRateBasisPoints, publicGood) } // DeleteNode is a paid mutator transaction binding the contract method 0x2d4ede93. @@ -1338,44 +1255,44 @@ func (_Staking *StakingTransactorSession) DeleteNode(nodeAddr common.Address) (* return _Staking.Contract.DeleteNode(&_Staking.TransactOpts, nodeAddr) } -// Deposit is a paid mutator transaction binding the contract method 0xb6b55f25. +// Deposit is a paid mutator transaction binding the contract method 0xd0e30db0. // -// Solidity: function deposit(uint256 amount) returns() -func (_Staking *StakingTransactor) Deposit(opts *bind.TransactOpts, amount *big.Int) (*types.Transaction, error) { - return _Staking.contract.Transact(opts, "deposit", amount) +// Solidity: function deposit() payable returns() +func (_Staking *StakingTransactor) Deposit(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Staking.contract.Transact(opts, "deposit") } -// Deposit is a paid mutator transaction binding the contract method 0xb6b55f25. +// Deposit is a paid mutator transaction binding the contract method 0xd0e30db0. // -// Solidity: function deposit(uint256 amount) returns() -func (_Staking *StakingSession) Deposit(amount *big.Int) (*types.Transaction, error) { - return _Staking.Contract.Deposit(&_Staking.TransactOpts, amount) +// Solidity: function deposit() payable returns() +func (_Staking *StakingSession) Deposit() (*types.Transaction, error) { + return _Staking.Contract.Deposit(&_Staking.TransactOpts) } -// Deposit is a paid mutator transaction binding the contract method 0xb6b55f25. +// Deposit is a paid mutator transaction binding the contract method 0xd0e30db0. // -// Solidity: function deposit(uint256 amount) returns() -func (_Staking *StakingTransactorSession) Deposit(amount *big.Int) (*types.Transaction, error) { - return _Staking.Contract.Deposit(&_Staking.TransactOpts, amount) +// Solidity: function deposit() payable returns() +func (_Staking *StakingTransactorSession) Deposit() (*types.Transaction, error) { + return _Staking.Contract.Deposit(&_Staking.TransactOpts) } // DistributeRewards is a paid mutator transaction binding the contract method 0x8e3e6174. // -// Solidity: function distributeRewards(uint256[3] epochInfo, address[] nodeAddrs, uint256[] requestFees, uint256[] operationRewards, uint256[] stakingRewards, uint256 publicPoolReward) returns() +// Solidity: function distributeRewards(uint256[3] epochInfo, address[] nodeAddrs, uint256[] requestFees, uint256[] operationRewards, uint256[] stakingRewards, uint256 publicPoolReward) payable returns() func (_Staking *StakingTransactor) DistributeRewards(opts *bind.TransactOpts, epochInfo [3]*big.Int, nodeAddrs []common.Address, requestFees []*big.Int, operationRewards []*big.Int, stakingRewards []*big.Int, publicPoolReward *big.Int) (*types.Transaction, error) { return _Staking.contract.Transact(opts, "distributeRewards", epochInfo, nodeAddrs, requestFees, operationRewards, stakingRewards, publicPoolReward) } // DistributeRewards is a paid mutator transaction binding the contract method 0x8e3e6174. // -// Solidity: function distributeRewards(uint256[3] epochInfo, address[] nodeAddrs, uint256[] requestFees, uint256[] operationRewards, uint256[] stakingRewards, uint256 publicPoolReward) returns() +// Solidity: function distributeRewards(uint256[3] epochInfo, address[] nodeAddrs, uint256[] requestFees, uint256[] operationRewards, uint256[] stakingRewards, uint256 publicPoolReward) payable returns() func (_Staking *StakingSession) DistributeRewards(epochInfo [3]*big.Int, nodeAddrs []common.Address, requestFees []*big.Int, operationRewards []*big.Int, stakingRewards []*big.Int, publicPoolReward *big.Int) (*types.Transaction, error) { return _Staking.Contract.DistributeRewards(&_Staking.TransactOpts, epochInfo, nodeAddrs, requestFees, operationRewards, stakingRewards, publicPoolReward) } // DistributeRewards is a paid mutator transaction binding the contract method 0x8e3e6174. // -// Solidity: function distributeRewards(uint256[3] epochInfo, address[] nodeAddrs, uint256[] requestFees, uint256[] operationRewards, uint256[] stakingRewards, uint256 publicPoolReward) returns() +// Solidity: function distributeRewards(uint256[3] epochInfo, address[] nodeAddrs, uint256[] requestFees, uint256[] operationRewards, uint256[] stakingRewards, uint256 publicPoolReward) payable returns() func (_Staking *StakingTransactorSession) DistributeRewards(epochInfo [3]*big.Int, nodeAddrs []common.Address, requestFees []*big.Int, operationRewards []*big.Int, stakingRewards []*big.Int, publicPoolReward *big.Int) (*types.Transaction, error) { return _Staking.Contract.DistributeRewards(&_Staking.TransactOpts, epochInfo, nodeAddrs, requestFees, operationRewards, stakingRewards, publicPoolReward) } @@ -1611,46 +1528,46 @@ func (_Staking *StakingTransactorSession) SlashNodes(nodeAddrs []common.Address) return _Staking.Contract.SlashNodes(&_Staking.TransactOpts, nodeAddrs) } -// Stake is a paid mutator transaction binding the contract method 0xadc9772e. +// Stake is a paid mutator transaction binding the contract method 0x26476204. // -// Solidity: function stake(address nodeAddr, uint256 amount) returns(uint256 startTokenId, uint256 endTokenId) -func (_Staking *StakingTransactor) Stake(opts *bind.TransactOpts, nodeAddr common.Address, amount *big.Int) (*types.Transaction, error) { - return _Staking.contract.Transact(opts, "stake", nodeAddr, amount) +// Solidity: function stake(address nodeAddr) payable returns(uint256 startTokenId, uint256 endTokenId) +func (_Staking *StakingTransactor) Stake(opts *bind.TransactOpts, nodeAddr common.Address) (*types.Transaction, error) { + return _Staking.contract.Transact(opts, "stake", nodeAddr) } -// Stake is a paid mutator transaction binding the contract method 0xadc9772e. +// Stake is a paid mutator transaction binding the contract method 0x26476204. // -// Solidity: function stake(address nodeAddr, uint256 amount) returns(uint256 startTokenId, uint256 endTokenId) -func (_Staking *StakingSession) Stake(nodeAddr common.Address, amount *big.Int) (*types.Transaction, error) { - return _Staking.Contract.Stake(&_Staking.TransactOpts, nodeAddr, amount) +// Solidity: function stake(address nodeAddr) payable returns(uint256 startTokenId, uint256 endTokenId) +func (_Staking *StakingSession) Stake(nodeAddr common.Address) (*types.Transaction, error) { + return _Staking.Contract.Stake(&_Staking.TransactOpts, nodeAddr) } -// Stake is a paid mutator transaction binding the contract method 0xadc9772e. +// Stake is a paid mutator transaction binding the contract method 0x26476204. // -// Solidity: function stake(address nodeAddr, uint256 amount) returns(uint256 startTokenId, uint256 endTokenId) -func (_Staking *StakingTransactorSession) Stake(nodeAddr common.Address, amount *big.Int) (*types.Transaction, error) { - return _Staking.Contract.Stake(&_Staking.TransactOpts, nodeAddr, amount) +// Solidity: function stake(address nodeAddr) payable returns(uint256 startTokenId, uint256 endTokenId) +func (_Staking *StakingTransactorSession) Stake(nodeAddr common.Address) (*types.Transaction, error) { + return _Staking.Contract.Stake(&_Staking.TransactOpts, nodeAddr) } -// StakeToPublicPool is a paid mutator transaction binding the contract method 0x53db41ac. +// StakeToPublicPool is a paid mutator transaction binding the contract method 0x379f8100. // -// Solidity: function stakeToPublicPool(address nodeAddr, uint256 amount) returns(uint256 startTokenId, uint256 endTokenId) -func (_Staking *StakingTransactor) StakeToPublicPool(opts *bind.TransactOpts, nodeAddr common.Address, amount *big.Int) (*types.Transaction, error) { - return _Staking.contract.Transact(opts, "stakeToPublicPool", nodeAddr, amount) +// Solidity: function stakeToPublicPool(address nodeAddr) payable returns(uint256 startTokenId, uint256 endTokenId) +func (_Staking *StakingTransactor) StakeToPublicPool(opts *bind.TransactOpts, nodeAddr common.Address) (*types.Transaction, error) { + return _Staking.contract.Transact(opts, "stakeToPublicPool", nodeAddr) } -// StakeToPublicPool is a paid mutator transaction binding the contract method 0x53db41ac. +// StakeToPublicPool is a paid mutator transaction binding the contract method 0x379f8100. // -// Solidity: function stakeToPublicPool(address nodeAddr, uint256 amount) returns(uint256 startTokenId, uint256 endTokenId) -func (_Staking *StakingSession) StakeToPublicPool(nodeAddr common.Address, amount *big.Int) (*types.Transaction, error) { - return _Staking.Contract.StakeToPublicPool(&_Staking.TransactOpts, nodeAddr, amount) +// Solidity: function stakeToPublicPool(address nodeAddr) payable returns(uint256 startTokenId, uint256 endTokenId) +func (_Staking *StakingSession) StakeToPublicPool(nodeAddr common.Address) (*types.Transaction, error) { + return _Staking.Contract.StakeToPublicPool(&_Staking.TransactOpts, nodeAddr) } -// StakeToPublicPool is a paid mutator transaction binding the contract method 0x53db41ac. +// StakeToPublicPool is a paid mutator transaction binding the contract method 0x379f8100. // -// Solidity: function stakeToPublicPool(address nodeAddr, uint256 amount) returns(uint256 startTokenId, uint256 endTokenId) -func (_Staking *StakingTransactorSession) StakeToPublicPool(nodeAddr common.Address, amount *big.Int) (*types.Transaction, error) { - return _Staking.Contract.StakeToPublicPool(&_Staking.TransactOpts, nodeAddr, amount) +// Solidity: function stakeToPublicPool(address nodeAddr) payable returns(uint256 startTokenId, uint256 endTokenId) +func (_Staking *StakingTransactorSession) StakeToPublicPool(nodeAddr common.Address) (*types.Transaction, error) { + return _Staking.Contract.StakeToPublicPool(&_Staking.TransactOpts, nodeAddr) } // Unpause is a paid mutator transaction binding the contract method 0x3f4ba83a. @@ -1695,6 +1612,27 @@ func (_Staking *StakingTransactorSession) Withdraw2Treasury() (*types.Transactio return _Staking.Contract.Withdraw2Treasury(&_Staking.TransactOpts) } +// Receive is a paid mutator transaction binding the contract receive function. +// +// Solidity: receive() payable returns() +func (_Staking *StakingTransactor) Receive(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Staking.contract.RawTransact(opts, nil) // calldata is disallowed for receive function +} + +// Receive is a paid mutator transaction binding the contract receive function. +// +// Solidity: receive() payable returns() +func (_Staking *StakingSession) Receive() (*types.Transaction, error) { + return _Staking.Contract.Receive(&_Staking.TransactOpts) +} + +// Receive is a paid mutator transaction binding the contract receive function. +// +// Solidity: receive() payable returns() +func (_Staking *StakingTransactorSession) Receive() (*types.Transaction, error) { + return _Staking.Contract.Receive(&_Staking.TransactOpts) +} + // StakingDepositedIterator is returned from FilterDeposited and is used to iterate over the raw logs and unpacked data for Deposited events raised by the Staking contract. type StakingDepositedIterator struct { Event *StakingDeposited // Event containing the contract specifics and raw log @@ -4182,16 +4120,17 @@ func (it *StakingUnstakeRequestedIterator) Close() error { // StakingUnstakeRequested represents a UnstakeRequested event raised by the Staking contract. type StakingUnstakeRequested struct { - User common.Address - NodeAddr common.Address - RequestId *big.Int - ChipsIds []*big.Int - Raw types.Log // Blockchain specific contextual infos + User common.Address + NodeAddr common.Address + RequestId *big.Int + UnstakeAmount *big.Int + ChipsIds []*big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterUnstakeRequested is a free log retrieval operation binding the contract event 0xdb16a7c2edf86059b1faf94dd3d8c2144c14ff49e54690aaa6eb633c796b6b0c. +// FilterUnstakeRequested is a free log retrieval operation binding the contract event 0x2808f92d5a0fada467cbe4e766f62f323e78271a7471058a87ef63a9e3e4c5c5. // -// Solidity: event UnstakeRequested(address indexed user, address indexed nodeAddr, uint256 indexed requestId, uint256[] chipsIds) +// Solidity: event UnstakeRequested(address indexed user, address indexed nodeAddr, uint256 indexed requestId, uint256 unstakeAmount, uint256[] chipsIds) func (_Staking *StakingFilterer) FilterUnstakeRequested(opts *bind.FilterOpts, user []common.Address, nodeAddr []common.Address, requestId []*big.Int) (*StakingUnstakeRequestedIterator, error) { var userRule []interface{} @@ -4214,9 +4153,9 @@ func (_Staking *StakingFilterer) FilterUnstakeRequested(opts *bind.FilterOpts, u return &StakingUnstakeRequestedIterator{contract: _Staking.contract, event: "UnstakeRequested", logs: logs, sub: sub}, nil } -// WatchUnstakeRequested is a free log subscription operation binding the contract event 0xdb16a7c2edf86059b1faf94dd3d8c2144c14ff49e54690aaa6eb633c796b6b0c. +// WatchUnstakeRequested is a free log subscription operation binding the contract event 0x2808f92d5a0fada467cbe4e766f62f323e78271a7471058a87ef63a9e3e4c5c5. // -// Solidity: event UnstakeRequested(address indexed user, address indexed nodeAddr, uint256 indexed requestId, uint256[] chipsIds) +// Solidity: event UnstakeRequested(address indexed user, address indexed nodeAddr, uint256 indexed requestId, uint256 unstakeAmount, uint256[] chipsIds) func (_Staking *StakingFilterer) WatchUnstakeRequested(opts *bind.WatchOpts, sink chan<- *StakingUnstakeRequested, user []common.Address, nodeAddr []common.Address, requestId []*big.Int) (event.Subscription, error) { var userRule []interface{} @@ -4264,9 +4203,9 @@ func (_Staking *StakingFilterer) WatchUnstakeRequested(opts *bind.WatchOpts, sin }), nil } -// ParseUnstakeRequested is a log parse operation binding the contract event 0xdb16a7c2edf86059b1faf94dd3d8c2144c14ff49e54690aaa6eb633c796b6b0c. +// ParseUnstakeRequested is a log parse operation binding the contract event 0x2808f92d5a0fada467cbe4e766f62f323e78271a7471058a87ef63a9e3e4c5c5. // -// Solidity: event UnstakeRequested(address indexed user, address indexed nodeAddr, uint256 indexed requestId, uint256[] chipsIds) +// Solidity: event UnstakeRequested(address indexed user, address indexed nodeAddr, uint256 indexed requestId, uint256 unstakeAmount, uint256[] chipsIds) func (_Staking *StakingFilterer) ParseUnstakeRequested(log types.Log) (*StakingUnstakeRequested, error) { event := new(StakingUnstakeRequested) if err := _Staking.contract.UnpackLog(event, "UnstakeRequested", log); err != nil { diff --git a/deploy/config.yaml b/deploy/config.yaml index b58ac4f2..3b2be62c 100644 --- a/deploy/config.yaml +++ b/deploy/config.yaml @@ -7,4 +7,4 @@ database: rss3_chain: endpoint_l1: https://rpc.ankr.com/eth_sepolia - endpoint_l2: https://rpc.testnet.rss3.dev + endpoint_l2: https://rpc.testnet.rss3.io diff --git a/go.mod b/go.mod index 17457ac2..b141e246 100644 --- a/go.mod +++ b/go.mod @@ -10,6 +10,7 @@ require ( github.com/ethereum/go-ethereum v1.13.10 github.com/go-playground/validator/v10 v10.16.0 github.com/labstack/echo/v4 v4.11.4 + github.com/lib/pq v1.10.9 github.com/naturalselectionlabs/rss3-node v0.0.0-20240108094705-95832810ba63 github.com/orlangure/gnomock v0.30.0 github.com/pressly/goose/v3 v3.17.0 @@ -77,7 +78,6 @@ require ( github.com/kr/text v0.2.0 // indirect github.com/labstack/gommon v0.4.2 // indirect github.com/leodido/go-urn v1.2.4 // indirect - github.com/lib/pq v1.10.9 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.14 // indirect diff --git a/internal/database/client.go b/internal/database/client.go index f6c57b58..c7c4b915 100644 --- a/internal/database/client.go +++ b/internal/database/client.go @@ -36,6 +36,14 @@ type Client interface { FindStakeStaker(ctx context.Context, user, node common.Address) (*schema.StakeStaker, error) SaveStakeStaker(ctx context.Context, stakeStaker *schema.StakeStaker) error + FindStakeTransaction(ctx context.Context, id common.Hash) (*schema.StakeTransaction, error) + FindStakeTransactions(ctx context.Context) ([]*schema.StakeTransaction, error) + FindStakeTransactionsByUser(ctx context.Context, address common.Address) ([]*schema.StakeTransaction, error) + FindStakeTransactionsByNode(ctx context.Context, address common.Address) ([]*schema.StakeTransaction, error) + FindStakeEventsByID(ctx context.Context, id common.Hash) ([]*schema.StakeEvent, error) + FindStakeEventsByIDs(ctx context.Context, ids []common.Hash) ([]*schema.StakeEvent, error) + SaveStakeTransaction(ctx context.Context, stakeTransaction *schema.StakeTransaction) error + SaveStakeEvent(ctx context.Context, stakeEvent *schema.StakeEvent) error } type Session interface { diff --git a/internal/database/dialer/cockroachdb/client_bridge.go b/internal/database/dialer/cockroachdb/client_bridge.go index ec75ebfd..5557d776 100644 --- a/internal/database/dialer/cockroachdb/client_bridge.go +++ b/internal/database/dialer/cockroachdb/client_bridge.go @@ -31,7 +31,7 @@ func (c *client) FindBridgeTransactions(ctx context.Context) ([]*schema.BridgeTr var rows []table.BridgeTransaction if err := c.database.WithContext(ctx).Find(&rows).Error; err != nil && !errors.Is(err, gorm.ErrRecordNotFound) { - return nil, fmt.Errorf("fin bridge transactions: %w", err) + return nil, fmt.Errorf("find bridge transactions: %w", err) } results := make([]*schema.BridgeTransaction, 0, len(rows)) @@ -52,7 +52,7 @@ func (c *client) FindBridgeTransactionsByAddress(ctx context.Context, address co var rows []table.BridgeTransaction if err := c.database.WithContext(ctx).Distinct("*").Where("sender = ? OR receiver = ?", address.String(), address.String()).Find(&rows).Error; err != nil && !errors.Is(err, gorm.ErrRecordNotFound) { - return nil, fmt.Errorf("fin bridge transactions: %w", err) + return nil, fmt.Errorf("find bridge transactions: %w", err) } results := make([]*schema.BridgeTransaction, 0, len(rows)) @@ -77,7 +77,7 @@ func (c *client) FindBridgeEventsByID(ctx context.Context, id common.Hash) (*sch return nil, database.ErrorRowNotFound } - return nil, fmt.Errorf("fin bridge event: %w", err) + return nil, fmt.Errorf("find bridge event: %w", err) } return row.Export() @@ -91,7 +91,7 @@ func (c *client) FindBridgeEventsByIDs(ctx context.Context, ids []common.Hash) ( }) if err := c.database.WithContext(ctx).Where("id IN ?", transactionIDs).Find(&rows).Error; err != nil && !errors.Is(err, gorm.ErrRecordNotFound) { - return nil, fmt.Errorf("fin bridge event: %w", err) + return nil, fmt.Errorf("find bridge event: %w", err) } results := make([]*schema.BridgeEvent, 0, len(rows)) diff --git a/internal/database/dialer/cockroachdb/client_stake.go b/internal/database/dialer/cockroachdb/client_stake.go index e2cba2ba..70d28046 100644 --- a/internal/database/dialer/cockroachdb/client_stake.go +++ b/internal/database/dialer/cockroachdb/client_stake.go @@ -3,10 +3,13 @@ package cockroachdb import ( "context" "errors" + "fmt" "github.com/ethereum/go-ethereum/common" + "github.com/naturalselectionlabs/rss3-global-indexer/internal/database" "github.com/naturalselectionlabs/rss3-global-indexer/internal/database/dialer/cockroachdb/table" "github.com/naturalselectionlabs/rss3-global-indexer/schema" + "github.com/samber/lo" "gorm.io/gorm" "gorm.io/gorm/clause" ) @@ -49,3 +52,148 @@ func (c *client) SaveStakeStaker(ctx context.Context, stakeStaker *schema.StakeS return c.database.WithContext(ctx).Clauses(clauses...).Create(&value).Error } + +func (c *client) FindStakeTransaction(ctx context.Context, id common.Hash) (*schema.StakeTransaction, error) { + var row table.StakeTransaction + + if err := c.database.WithContext(ctx).Where("id = ?", id.String()).First(&row).Error; err != nil { + if errors.Is(err, gorm.ErrRecordNotFound) { + return nil, database.ErrorRowNotFound + } + + return nil, fmt.Errorf("find stake transaction: %w", err) + } + + return row.Export() +} + +func (c *client) FindStakeTransactions(ctx context.Context) ([]*schema.StakeTransaction, error) { + var rows []table.StakeTransaction + + if err := c.database.WithContext(ctx).Find(&rows).Error; err != nil && !errors.Is(err, gorm.ErrRecordNotFound) { + return nil, fmt.Errorf("find stake transactions: %w", err) + } + + results := make([]*schema.StakeTransaction, 0, len(rows)) + + for _, row := range rows { + result, err := row.Export() + if err != nil { + return nil, fmt.Errorf("export stake transaction: %w", err) + } + + results = append(results, result) + } + + return results, nil +} + +func (c *client) FindStakeTransactionsByUser(ctx context.Context, address common.Address) ([]*schema.StakeTransaction, error) { + var rows []table.StakeTransaction + + if err := c.database.WithContext(ctx).Distinct("*").Where(`"user" = ?`, address.String(), address.String()).Find(&rows).Error; err != nil && !errors.Is(err, gorm.ErrRecordNotFound) { + return nil, fmt.Errorf("find stake transactions: %w", err) + } + + results := make([]*schema.StakeTransaction, 0, len(rows)) + + for _, row := range rows { + result, err := row.Export() + if err != nil { + return nil, fmt.Errorf("export stake transaction: %w", err) + } + + results = append(results, result) + } + + return results, nil +} + +func (c *client) FindStakeTransactionsByNode(ctx context.Context, address common.Address) ([]*schema.StakeTransaction, error) { + var rows []table.StakeTransaction + + if err := c.database.WithContext(ctx).Distinct("*").Where(`"node" = ?`, address.String(), address.String()).Find(&rows).Error; err != nil && !errors.Is(err, gorm.ErrRecordNotFound) { + return nil, fmt.Errorf("find stake transactions: %w", err) + } + + results := make([]*schema.StakeTransaction, 0, len(rows)) + + for _, row := range rows { + result, err := row.Export() + if err != nil { + return nil, fmt.Errorf("export stake transaction: %w", err) + } + + results = append(results, result) + } + + return results, nil +} + +func (c *client) FindStakeEventsByID(ctx context.Context, id common.Hash) ([]*schema.StakeEvent, error) { + var rows []table.StakeEvent + + if err := c.database.WithContext(ctx).Where("id = ?", id.String()).First(&rows).Error; err != nil { + if errors.Is(err, gorm.ErrRecordNotFound) { + return nil, database.ErrorRowNotFound + } + + return nil, fmt.Errorf("find stake event: %w", err) + } + + results := make([]*schema.StakeEvent, 0, len(rows)) + + for _, row := range rows { + result, err := row.Export() + if err != nil { + return nil, fmt.Errorf("export stake event: %w", err) + } + + results = append(results, result) + } + + return results, nil +} + +func (c *client) FindStakeEventsByIDs(ctx context.Context, ids []common.Hash) ([]*schema.StakeEvent, error) { + var rows []table.StakeEvent + + transactionIDs := lo.Map(ids, func(id common.Hash, _ int) string { + return id.String() + }) + + if err := c.database.WithContext(ctx).Where("id IN ?", transactionIDs).Find(&rows).Error; err != nil && !errors.Is(err, gorm.ErrRecordNotFound) { + return nil, fmt.Errorf("find stake event: %w", err) + } + + results := make([]*schema.StakeEvent, 0, len(rows)) + + for _, row := range rows { + result, err := row.Export() + if err != nil { + return nil, fmt.Errorf("export stake event: %w", err) + } + + results = append(results, result) + } + + return results, nil +} + +func (c *client) SaveStakeTransaction(ctx context.Context, stakeTransaction *schema.StakeTransaction) error { + var value table.StakeTransaction + if err := value.Import(*stakeTransaction); err != nil { + return fmt.Errorf("import stake transaction: %w", err) + } + + return c.database.WithContext(ctx).Create(&value).Error +} + +func (c *client) SaveStakeEvent(ctx context.Context, stakeEvent *schema.StakeEvent) error { + var value table.StakeEvent + if err := value.Import(*stakeEvent); err != nil { + return fmt.Errorf("import stake event: %w", err) + } + + return c.database.WithContext(ctx).Create(&value).Error +} diff --git a/internal/database/dialer/cockroachdb/migration/20240119093020_create_stake_transactions.sql b/internal/database/dialer/cockroachdb/migration/20240119093020_create_stake_transactions.sql new file mode 100644 index 00000000..d8d2efe6 --- /dev/null +++ b/internal/database/dialer/cockroachdb/migration/20240119093020_create_stake_transactions.sql @@ -0,0 +1,36 @@ +-- +goose Up +-- +goose StatementBegin +CREATE TABLE "stake"."transactions" +( + "id" text NOT NULL, + "type" text NOT NULL, + "user" text NOT NULL, + "node" text NOT NULL, + "value" decimal NOT NULL, + "chips" bigint[] NOT NULL, + + CONSTRAINT "pk_transactions" PRIMARY KEY ("id", "type") +); + +CREATE TABLE "stake"."events" +( + "id" text NOT NULL, + "type" text NOT NULL, + "transaction_hash" text NOT NULL, + "transaction_index" integer NOT NULL, + "transaction_status" integer NOT NULL, + "block_hash" text NOT NULL, + "block_number" bigint NOT NULL, + "block_timestamp" timestamptz NOT NULL, + + CONSTRAINT "pk_events" PRIMARY KEY ("transaction_hash", "block_hash") +); + +CREATE INDEX "idx_id" ON "stake"."events" ("id"); +-- +goose StatementEnd + +-- +goose Down +-- +goose StatementBegin +DROP TABLE "stake"."transactions"; +DROP TABLE "stake".events; +-- +goose StatementEnd diff --git a/internal/database/dialer/cockroachdb/table/stake_event.go b/internal/database/dialer/cockroachdb/table/stake_event.go new file mode 100644 index 00000000..7273a167 --- /dev/null +++ b/internal/database/dialer/cockroachdb/table/stake_event.go @@ -0,0 +1,58 @@ +package table + +import ( + "math/big" + "time" + + "github.com/ethereum/go-ethereum/common" + "github.com/naturalselectionlabs/rss3-global-indexer/schema" + gorm "gorm.io/gorm/schema" +) + +var ( + _ gorm.Tabler = (*StakeEvent)(nil) + _ schema.StakeEventTransformer = (*StakeEvent)(nil) +) + +type StakeEvent struct { + ID string `gorm:"column:id"` + Type string `gorm:"column:type"` + TransactionHash string `gorm:"column:transaction_hash"` + TransactionIndex uint `gorm:"column:transaction_index"` + TransactionStatus uint64 `gorm:"column:transaction_status"` + BlockHash string `gorm:"column:block_hash"` + BlockNumber uint64 `gorm:"column:block_number"` + BlockTimestamp time.Time `gorm:"column:block_timestamp"` +} + +func (b *StakeEvent) TableName() string { + return "stake.events" +} + +func (b *StakeEvent) Import(stakeEvent schema.StakeEvent) error { + b.ID = stakeEvent.ID.String() + b.Type = string(stakeEvent.Type) + b.TransactionHash = stakeEvent.TransactionHash.String() + b.TransactionIndex = stakeEvent.TransactionIndex + b.TransactionStatus = stakeEvent.TransactionStatus + b.BlockHash = stakeEvent.BlockHash.String() + b.BlockNumber = stakeEvent.BlockNumber.Uint64() + b.BlockTimestamp = stakeEvent.BlockTimestamp + + return nil +} + +func (b *StakeEvent) Export() (*schema.StakeEvent, error) { + stakeEvent := schema.StakeEvent{ + ID: common.HexToHash(b.ID), + Type: schema.StakeEventType(b.Type), + TransactionHash: common.HexToHash(b.TransactionHash), + TransactionIndex: b.TransactionIndex, + TransactionStatus: b.TransactionStatus, + BlockHash: common.HexToHash(b.BlockHash), + BlockNumber: new(big.Int).SetUint64(b.BlockNumber), + BlockTimestamp: b.BlockTimestamp, + } + + return &stakeEvent, nil +} diff --git a/internal/database/dialer/cockroachdb/table/stake_transaction.go b/internal/database/dialer/cockroachdb/table/stake_transaction.go new file mode 100644 index 00000000..2f0fb1f7 --- /dev/null +++ b/internal/database/dialer/cockroachdb/table/stake_transaction.go @@ -0,0 +1,58 @@ +package table + +import ( + "math/big" + + "github.com/ethereum/go-ethereum/common" + "github.com/lib/pq" + "github.com/naturalselectionlabs/rss3-global-indexer/schema" + "github.com/samber/lo" + "github.com/shopspring/decimal" + gorm "gorm.io/gorm/schema" +) + +var ( + _ gorm.Tabler = (*StakeTransaction)(nil) + _ schema.StakeTransactionTransformer = (*StakeTransaction)(nil) +) + +type StakeTransaction struct { + ID string `gorm:"column:id"` + Type string `gorm:"column:type"` + User string `gorm:"column:user"` + Node string `gorm:"column:node"` + Value decimal.Decimal `gorm:"column:value"` + Chips pq.Int64Array `gorm:"column:chips;type:bigint[]"` +} + +func (s *StakeTransaction) TableName() string { + return "stake.transactions" +} + +func (s *StakeTransaction) Export() (*schema.StakeTransaction, error) { + stakeTransaction := schema.StakeTransaction{ + ID: common.HexToHash(s.ID), + Type: schema.StakeTransactionType(s.Type), + User: common.HexToAddress(s.User), + Node: common.HexToAddress(s.Node), + Value: s.Value.BigInt(), + Chips: lo.Map(s.Chips, func(value int64, _ int) *big.Int { + return new(big.Int).SetInt64(value) + }), + } + + return &stakeTransaction, nil +} + +func (s *StakeTransaction) Import(stakeTransaction schema.StakeTransaction) error { + s.ID = stakeTransaction.ID.String() + s.Type = string(stakeTransaction.Type) + s.User = stakeTransaction.User.String() + s.Node = stakeTransaction.Node.String() + s.Value = decimal.NewFromBigInt(stakeTransaction.Value, 0) + s.Chips = lo.Map(stakeTransaction.Chips, func(value *big.Int, _ int) int64 { + return value.Int64() + }) + + return nil +} diff --git a/internal/hub/handler_bridge.go b/internal/hub/handler_bridge.go index 11b109f5..c979ea65 100644 --- a/internal/hub/handler_bridge.go +++ b/internal/hub/handler_bridge.go @@ -2,11 +2,13 @@ package hub import ( "database/sql" + "errors" "fmt" "net/http" "github.com/ethereum/go-ethereum/common" "github.com/labstack/echo/v4" + "github.com/naturalselectionlabs/rss3-global-indexer/internal/database" "github.com/naturalselectionlabs/rss3-global-indexer/internal/hub/model" "github.com/naturalselectionlabs/rss3-global-indexer/schema" "github.com/samber/lo" @@ -34,20 +36,24 @@ func (h *Hub) GetBridgeTransactions(c echo.Context) error { return c.NoContent(http.StatusInternalServerError) } + defer lo.Try(databaseTransaction.Rollback) + var transactions []*schema.BridgeTransaction if request.Address != nil { - if transactions, err = databaseTransaction.FindBridgeTransactionsByAddress(c.Request().Context(), common.HexToAddress(*request.Address)); err != nil { - zap.L().Error("find bridge transactions", zap.Error(err), zap.Any("request", request)) - - return c.NoContent(http.StatusInternalServerError) - } + transactions, err = databaseTransaction.FindBridgeTransactionsByAddress(c.Request().Context(), common.HexToAddress(*request.Address)) } else { - if transactions, err = databaseTransaction.FindBridgeTransactions(c.Request().Context()); err != nil { - zap.L().Error("find bridge transactions", zap.Error(err), zap.Any("request", request)) + transactions, err = databaseTransaction.FindBridgeTransactions(c.Request().Context()) + } - return c.NoContent(http.StatusInternalServerError) + if err != nil { + if errors.Is(err, database.ErrorRowNotFound) { + return c.NoContent(http.StatusNotFound) } + + zap.L().Error("find bridge transactions", zap.Error(err), zap.Any("request", request)) + + return c.NoContent(http.StatusInternalServerError) } ids := lo.Map(transactions, func(transaction *schema.BridgeTransaction, _ int) common.Hash { @@ -56,6 +62,10 @@ func (h *Hub) GetBridgeTransactions(c echo.Context) error { events, err := databaseTransaction.FindBridgeEventsByIDs(c.Request().Context(), ids) if err != nil { + if errors.Is(err, database.ErrorRowNotFound) { + return c.NoContent(http.StatusNotFound) + } + zap.L().Error("find bridge events", zap.Error(err), zap.Any("request", request)) return c.NoContent(http.StatusInternalServerError) @@ -103,8 +113,14 @@ func (h *Hub) GetBridgeTransaction(c echo.Context) error { return c.NoContent(http.StatusInternalServerError) } + defer lo.Try(databaseTransaction.Rollback) + transaction, err := databaseTransaction.FindBridgeTransaction(c.Request().Context(), common.HexToHash(*request.ID)) if err != nil { + if errors.Is(err, database.ErrorRowNotFound) { + return c.NoContent(http.StatusNotFound) + } + zap.L().Error("find bridge transaction", zap.Error(err), zap.Any("request", request)) return c.NoContent(http.StatusInternalServerError) @@ -112,6 +128,10 @@ func (h *Hub) GetBridgeTransaction(c echo.Context) error { events, err := databaseTransaction.FindBridgeEventsByIDs(c.Request().Context(), []common.Hash{transaction.ID}) if err != nil { + if errors.Is(err, database.ErrorRowNotFound) { + return c.NoContent(http.StatusNotFound) + } + zap.L().Error("find bridge events", zap.Error(err), zap.Any("request", request)) return c.NoContent(http.StatusInternalServerError) diff --git a/internal/hub/handler_stake.go b/internal/hub/handler_stake.go new file mode 100644 index 00000000..1ad23520 --- /dev/null +++ b/internal/hub/handler_stake.go @@ -0,0 +1,156 @@ +package hub + +import ( + "database/sql" + "errors" + "fmt" + "net/http" + + "github.com/ethereum/go-ethereum/common" + "github.com/labstack/echo/v4" + "github.com/naturalselectionlabs/rss3-global-indexer/internal/database" + "github.com/naturalselectionlabs/rss3-global-indexer/internal/hub/model" + "github.com/naturalselectionlabs/rss3-global-indexer/schema" + "github.com/samber/lo" + "go.uber.org/zap" +) + +type GetStakeTransactionsRequest struct { + User *string `query:"user"` + Node *string `query:"node"` +} + +func (h *Hub) GetStakeTransactions(c echo.Context) error { + var request GetStakeTransactionsRequest + if err := c.Bind(&request); err != nil { + return c.NoContent(http.StatusBadRequest) + } + + databaseTransactionOptions := sql.TxOptions{ + ReadOnly: true, + } + + databaseTransaction, err := h.databaseClient.Begin(c.Request().Context(), &databaseTransactionOptions) + if err != nil { + zap.L().Error("begin database transaction", zap.Error(err), zap.Any("request", request)) + + return c.NoContent(http.StatusInternalServerError) + } + + defer lo.Try(databaseTransaction.Rollback) + + var transactions []*schema.StakeTransaction + + switch { + case request.User != nil: + transactions, err = databaseTransaction.FindStakeTransactionsByUser(c.Request().Context(), common.HexToAddress(*request.User)) + case request.Node != nil: + transactions, err = databaseTransaction.FindStakeTransactionsByNode(c.Request().Context(), common.HexToAddress(*request.Node)) + default: + transactions, err = databaseTransaction.FindStakeTransactions(c.Request().Context()) + } + + if err != nil { + if errors.Is(err, database.ErrorRowNotFound) { + return c.NoContent(http.StatusNotFound) + } + + zap.L().Error("find stake transactions", zap.Error(err), zap.Any("request", request)) + + return c.NoContent(http.StatusInternalServerError) + } + + ids := lo.Map(transactions, func(transaction *schema.StakeTransaction, _ int) common.Hash { + return transaction.ID + }) + + events, err := databaseTransaction.FindStakeEventsByIDs(c.Request().Context(), ids) + if err != nil { + if errors.Is(err, database.ErrorRowNotFound) { + return c.NoContent(http.StatusNotFound) + } + + zap.L().Error("find stake events", zap.Error(err), zap.Any("request", request)) + + return c.NoContent(http.StatusInternalServerError) + } + + if err := databaseTransaction.Commit(); err != nil { + return fmt.Errorf("commit database transaction") + } + + transactionModels := make([]*model.StakeTransaction, 0, len(transactions)) + + for _, transaction := range transactions { + events := lo.Filter(events, func(event *schema.StakeEvent, _ int) bool { + return event.ID == transaction.ID + }) + + transactionModels = append(transactionModels, model.NewStakeTransaction(transaction, events)) + } + + var response Response + + response.Data = transactionModels + + return c.JSON(http.StatusOK, response) +} + +type GetStakeTransactionRequest struct { + ID *string `param:"id"` +} + +func (h *Hub) GetStakeTransaction(c echo.Context) error { + var request GetStakeTransactionRequest + if err := c.Bind(&request); err != nil { + return c.NoContent(http.StatusBadRequest) + } + + databaseTransactionOptions := sql.TxOptions{ + ReadOnly: true, + } + + databaseTransaction, err := h.databaseClient.Begin(c.Request().Context(), &databaseTransactionOptions) + if err != nil { + zap.L().Error("begin database transaction", zap.Error(err), zap.Any("request", request)) + + return c.NoContent(http.StatusInternalServerError) + } + + defer lo.Try(databaseTransaction.Rollback) + + transaction, err := databaseTransaction.FindStakeTransaction(c.Request().Context(), common.HexToHash(*request.ID)) + if err != nil { + if errors.Is(err, database.ErrorRowNotFound) { + return c.NoContent(http.StatusNotFound) + } + + zap.L().Error("find stake transaction", zap.Error(err), zap.Any("request", request)) + + return c.NoContent(http.StatusInternalServerError) + } + + events, err := databaseTransaction.FindStakeEventsByIDs(c.Request().Context(), []common.Hash{transaction.ID}) + if err != nil { + if errors.Is(err, database.ErrorRowNotFound) { + return c.NoContent(http.StatusNotFound) + } + + zap.L().Error("find stake events", zap.Error(err), zap.Any("request", request)) + + return c.NoContent(http.StatusInternalServerError) + } + + if err := databaseTransaction.Commit(); err != nil { + return fmt.Errorf("commit database transaction") + } + + events = lo.Filter(events, func(event *schema.StakeEvent, _ int) bool { + return event.ID == transaction.ID + }) + + var response Response + response.Data = model.NewStakeTransaction(transaction, events) + + return c.JSON(http.StatusOK, response) +} diff --git a/internal/hub/model/stake_transaction.go b/internal/hub/model/stake_transaction.go new file mode 100644 index 00000000..8fe499d0 --- /dev/null +++ b/internal/hub/model/stake_transaction.go @@ -0,0 +1,123 @@ +package model + +import ( + "time" + + "github.com/ethereum/go-ethereum/common" + "github.com/naturalselectionlabs/rss3-global-indexer/schema" + "github.com/shopspring/decimal" +) + +type StakeTransaction struct { + ID common.Hash `json:"id"` + User common.Address `json:"user"` + Node common.Address `json:"node"` + Event StakeTransactionEventTypes `json:"event"` +} + +type StakeTransactionEventTypes struct { + Deposit *StakeTransactionEventTypeDeposit `json:"deposit,omitempty"` + Withdraw *StakeTransactionEventTypeWithdraw `json:"withdraw,omitempty"` + Stake *StakeTransactionEventTypeStake `json:"stake,omitempty"` + Unstake *StakeTransactionEventTypeUnstake `json:"unstake,omitempty"` +} + +type StakeTransactionEventTypeDeposit struct { + Deposited *StakeTransactionEvent `json:"deposited,omitempty"` +} + +type StakeTransactionEventTypeWithdraw struct { + Requested *StakeTransactionEvent `json:"requested,omitempty"` + Claimed *StakeTransactionEvent `json:"claimed,omitempty"` +} + +type StakeTransactionEventTypeStake struct { + Staked *StakeTransactionEvent `json:"staked,omitempty"` +} + +type StakeTransactionEventTypeUnstake struct { + Requested *StakeTransactionEvent `json:"requested,omitempty"` + Claimed *StakeTransactionEvent `json:"claimed,omitempty"` +} + +type StakeTransactionEvent struct { + Block StakeTransactionEventBlock `json:"block"` + Transaction StakeTransactionEventTransaction `json:"transaction"` +} + +type StakeTransactionEventBlock struct { + Hash common.Hash `json:"hash"` + Number decimal.Decimal `json:"number"` + Timestamp time.Time `json:"timestamp"` +} + +type StakeTransactionEventTransaction struct { + Hash common.Hash `json:"hash"` + Index uint `json:"index"` +} + +func NewStakeTransaction(transaction *schema.StakeTransaction, events []*schema.StakeEvent) *StakeTransaction { + transactionModel := StakeTransaction{ + ID: transaction.ID, + User: transaction.User, + Node: transaction.Node, + } + + switch transaction.Type { + case schema.StakeTransactionTypeDeposit: + transactionModel.Event.Deposit = new(StakeTransactionEventTypeDeposit) + case schema.StakeTransactionTypeWithdraw: + transactionModel.Event.Withdraw = new(StakeTransactionEventTypeWithdraw) + case schema.StakeTransactionTypeStake: + transactionModel.Event.Stake = new(StakeTransactionEventTypeStake) + case schema.StakeTransactionTypeUnstake: + transactionModel.Event.Unstake = new(StakeTransactionEventTypeUnstake) + } + + for _, event := range events { + if event.ID != transaction.ID { + continue + } + + eventModel := StakeTransactionEvent{ + Block: StakeTransactionEventBlock{ + Hash: event.BlockHash, + Number: decimal.NewFromBigInt(event.BlockNumber, 0), + Timestamp: event.BlockTimestamp, + }, + Transaction: StakeTransactionEventTransaction{ + Hash: event.TransactionHash, + Index: event.TransactionIndex, + }, + } + + switch transaction.Type { + case schema.StakeTransactionTypeDeposit: + switch event.Type { + case schema.StakeEventTypeDepositDeposited: + transactionModel.Event.Deposit.Deposited = &eventModel + } + case schema.StakeTransactionTypeWithdraw: + switch event.Type { + case schema.StakeEventTypeWithdrawRequested: + transactionModel.Event.Withdraw.Requested = &eventModel + case schema.StakeEventTypeWithdrawClaimed: + transactionModel.Event.Withdraw.Claimed = &eventModel + } + case schema.StakeTransactionTypeStake: + switch event.Type { + case schema.StakeEventTypeStakeStaked: + transactionModel.Event.Stake.Staked = &eventModel + } + case schema.StakeTransactionTypeUnstake: + switch event.Type { + case schema.StakeEventTypeUnstakeRequested: + transactionModel.Event.Unstake.Requested = &eventModel + case schema.StakeEventTypeUnstakeClaimed: + transactionModel.Event.Unstake.Claimed = &eventModel + } + } + } + + return &transactionModel +} diff --git a/internal/hub/server.go b/internal/hub/server.go index bfeeda4a..eaa0cb42 100644 --- a/internal/hub/server.go +++ b/internal/hub/server.go @@ -52,6 +52,12 @@ func NewServer(ctx context.Context, databaseClient database.Client, ethereumClie instance.httpServer.GET("/bridge/transactions", instance.hub.GetBridgeTransactions) instance.httpServer.GET("/bridge/transactions/:id", instance.hub.GetBridgeTransaction) + + instance.httpServer.GET("/stake/transactions", instance.hub.GetStakeTransactions) + instance.httpServer.GET("/stake/transactions/:id", instance.hub.GetStakeTransaction) + // instance.httpServer.GET("/stake/nodes/:address/stakers", nil) + // instance.httpServer.GET("/stake/stakers/:address/nodes", nil) + instance.httpServer.GET("/staking", instance.hub.GetStakingHandler) instance.httpServer.GET("/bridging", instance.hub.GetBridgingHandler) diff --git a/internal/service/indexer/l2/indexer_stake.go b/internal/service/indexer/l2/indexer_stake.go index bd1814c7..341432e9 100644 --- a/internal/service/indexer/l2/indexer_stake.go +++ b/internal/service/indexer/l2/indexer_stake.go @@ -3,34 +3,176 @@ package l2 import ( "context" "fmt" + "time" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/naturalselectionlabs/rss3-global-indexer/contract/l2" "github.com/naturalselectionlabs/rss3-global-indexer/internal/database" + "github.com/naturalselectionlabs/rss3-global-indexer/schema" "github.com/shopspring/decimal" ) func (s *server) indexStakingLog(ctx context.Context, header *types.Header, transaction *types.Transaction, receipt *types.Receipt, log *types.Log, databaseTransaction database.Client) error { + fmt.Println(log) + switch eventHash := log.Topics[0]; eventHash { + case l2.EventHashStakingDeposited: + return s.indexStakingDepositedLog(ctx, header, transaction, receipt, log, databaseTransaction) + case l2.EventHashStakingWithdrawRequested: + return s.indexStakingWithdrawRequestedLog(ctx, header, transaction, receipt, log, databaseTransaction) + case l2.EventHashStakingWithdrawalClaimed: + return s.indexStakingWithdrawalClaimedLog(ctx, header, transaction, receipt, log, databaseTransaction) case l2.EventHashStakingStaked: return s.indexStakingStakedLog(ctx, header, transaction, receipt, log, databaseTransaction) + case l2.EventHashStakingUnstakeRequested: + return s.indexStakingUnstakeRequestedLog(ctx, header, transaction, receipt, log, databaseTransaction) case l2.EventHashStakingUnstakeClaimed: return s.indexStakingUnstakeClaimedLog(ctx, header, transaction, receipt, log, databaseTransaction) - default: - // Discard all unsupported events. - // l2.EventHashStakingDeposited - // l2.EventHashStakingWithdrawRequested - // l2.EventHashStakingWithdrawalClaimed + default: // Discard all unsupported events. return nil } } -func (s *server) indexStakingStakedLog(ctx context.Context, _ *types.Header, _ *types.Transaction, _ *types.Receipt, log *types.Log, databaseTransaction database.Client) error { +func (s *server) indexStakingDepositedLog(ctx context.Context, header *types.Header, transaction *types.Transaction, receipt *types.Receipt, log *types.Log, databaseTransaction database.Client) error { + event, err := s.contractStaking.ParseDeposited(*log) + if err != nil { + return fmt.Errorf("parse Deposited event: %w", err) + } + + user, err := types.Sender(types.LatestSignerForChainID(transaction.ChainId()), transaction) + if err != nil { + return fmt.Errorf("invalid transaction signer: %w", err) + } + + stakeTransaction := schema.StakeTransaction{ + ID: transaction.Hash(), + User: user, + Node: event.NodeAddr, + Type: schema.StakeTransactionTypeDeposit, + Value: event.Amount, + } + + if err := databaseTransaction.SaveStakeTransaction(ctx, &stakeTransaction); err != nil { + return fmt.Errorf("save stake transaction: %w", err) + } + + stakeEvent := schema.StakeEvent{ + ID: transaction.Hash(), + Type: schema.StakeEventTypeDepositDeposited, + TransactionHash: transaction.Hash(), + TransactionIndex: receipt.TransactionIndex, + TransactionStatus: receipt.Status, + BlockHash: header.Hash(), + BlockNumber: header.Number, + BlockTimestamp: time.Unix(int64(header.Time), 0), + } + + if err := databaseTransaction.SaveStakeEvent(ctx, &stakeEvent); err != nil { + return fmt.Errorf("save stake event: %w", err) + } + + return nil +} + +func (s *server) indexStakingWithdrawRequestedLog(ctx context.Context, header *types.Header, transaction *types.Transaction, receipt *types.Receipt, log *types.Log, databaseTransaction database.Client) error { + event, err := s.contractStaking.ParseWithdrawRequested(*log) + if err != nil { + return fmt.Errorf("parse WithdrawRequested event: %w", err) + } + + user, err := types.Sender(types.LatestSignerForChainID(transaction.ChainId()), transaction) + if err != nil { + return fmt.Errorf("invalid transaction signer: %w", err) + } + + stakeTransaction := schema.StakeTransaction{ + ID: common.BigToHash(event.RequestId), + Type: schema.StakeTransactionTypeWithdraw, + User: user, + Node: event.NodeAddr, + Value: event.Amount, + } + + if err := databaseTransaction.SaveStakeTransaction(ctx, &stakeTransaction); err != nil { + return fmt.Errorf("save stake transaction: %w", err) + } + + stakeEvent := schema.StakeEvent{ + ID: common.BigToHash(event.RequestId), + Type: schema.StakeEventTypeWithdrawRequested, + TransactionHash: transaction.Hash(), + TransactionIndex: receipt.TransactionIndex, + TransactionStatus: receipt.Status, + BlockHash: header.Hash(), + BlockNumber: header.Number, + BlockTimestamp: time.Unix(int64(header.Time), 0), + } + + if err := databaseTransaction.SaveStakeEvent(ctx, &stakeEvent); err != nil { + return fmt.Errorf("save stake event: %w", err) + } + + return nil +} + +func (s *server) indexStakingWithdrawalClaimedLog(ctx context.Context, header *types.Header, transaction *types.Transaction, receipt *types.Receipt, log *types.Log, databaseTransaction database.Client) error { + event, err := s.contractStaking.ParseWithdrawalClaimed(*log) + if err != nil { + return fmt.Errorf("parse WithdrawalClaimed event: %w", err) + } + + stakeEvent := schema.StakeEvent{ + ID: common.BigToHash(event.RequestId), + Type: schema.StakeEventTypeWithdrawClaimed, + TransactionHash: transaction.Hash(), + TransactionIndex: receipt.TransactionIndex, + TransactionStatus: receipt.Status, + BlockHash: header.Hash(), + BlockNumber: header.Number, + BlockTimestamp: time.Unix(int64(header.Time), 0), + } + + if err := databaseTransaction.SaveStakeEvent(ctx, &stakeEvent); err != nil { + return fmt.Errorf("save stake event: %w", err) + } + + return nil +} + +func (s *server) indexStakingStakedLog(ctx context.Context, header *types.Header, transaction *types.Transaction, receipt *types.Receipt, log *types.Log, databaseTransaction database.Client) error { event, err := s.contractStaking.ParseStaked(*log) if err != nil { return fmt.Errorf("parse Staked event: %w", err) } + stakeTransaction := schema.StakeTransaction{ + ID: transaction.Hash(), + Type: schema.StakeTransactionTypeStake, + User: event.User, + Node: event.NodeAddr, + Value: event.Amount, + } + + if err := databaseTransaction.SaveStakeTransaction(ctx, &stakeTransaction); err != nil { + return fmt.Errorf("save stake transaction: %w", err) + } + + stakeEvent := schema.StakeEvent{ + ID: transaction.Hash(), + Type: schema.StakeEventTypeStakeStaked, + TransactionHash: transaction.Hash(), + TransactionIndex: receipt.TransactionIndex, + TransactionStatus: receipt.Status, + BlockHash: header.Hash(), + BlockNumber: header.Number, + BlockTimestamp: time.Unix(int64(header.Time), 0), + } + + if err := databaseTransaction.SaveStakeEvent(ctx, &stakeEvent); err != nil { + return fmt.Errorf("save stake event: %w", err) + } + stakeStaker, err := databaseTransaction.FindStakeStaker(ctx, event.User, event.NodeAddr) if err != nil { return fmt.Errorf("find stake staker: %w", err) @@ -41,12 +183,63 @@ func (s *server) indexStakingStakedLog(ctx context.Context, _ *types.Header, _ * return databaseTransaction.SaveStakeStaker(ctx, stakeStaker) } -func (s *server) indexStakingUnstakeClaimedLog(ctx context.Context, _ *types.Header, _ *types.Transaction, _ *types.Receipt, log *types.Log, databaseTransaction database.Client) error { +func (s *server) indexStakingUnstakeRequestedLog(ctx context.Context, header *types.Header, transaction *types.Transaction, receipt *types.Receipt, log *types.Log, databaseTransaction database.Client) error { + event, err := s.contractStaking.ParseUnstakeRequested(*log) + if err != nil { + return fmt.Errorf("parse UnstakeRequested event: %w", err) + } + + stakeTransaction := schema.StakeTransaction{ + ID: common.BigToHash(event.RequestId), + Type: schema.StakeTransactionTypeUnstake, + User: event.User, + Node: event.NodeAddr, + Value: event.UnstakeAmount, + } + + if err := databaseTransaction.SaveStakeTransaction(ctx, &stakeTransaction); err != nil { + return fmt.Errorf("save stake transaction: %w", err) + } + + stakeEvent := schema.StakeEvent{ + ID: common.BigToHash(event.RequestId), + Type: schema.StakeEventTypeUnstakeRequested, + TransactionHash: transaction.Hash(), + TransactionIndex: receipt.TransactionIndex, + TransactionStatus: receipt.Status, + BlockHash: header.Hash(), + BlockNumber: header.Number, + BlockTimestamp: time.Unix(int64(header.Time), 0), + } + + if err := databaseTransaction.SaveStakeEvent(ctx, &stakeEvent); err != nil { + return fmt.Errorf("save stake event: %w", err) + } + + return nil +} + +func (s *server) indexStakingUnstakeClaimedLog(ctx context.Context, header *types.Header, transaction *types.Transaction, receipt *types.Receipt, log *types.Log, databaseTransaction database.Client) error { event, err := s.contractStaking.ParseUnstakeClaimed(*log) if err != nil { return fmt.Errorf("parse UnstakeClaimed event: %w", err) } + stakeEvent := schema.StakeEvent{ + ID: common.BigToHash(event.RequestId), + Type: schema.StakeEventTypeUnstakeClaimed, + TransactionHash: transaction.Hash(), + TransactionIndex: receipt.TransactionIndex, + TransactionStatus: receipt.Status, + BlockHash: header.Hash(), + BlockNumber: header.Number, + BlockTimestamp: time.Unix(int64(header.Time), 0), + } + + if err := databaseTransaction.SaveStakeEvent(ctx, &stakeEvent); err != nil { + return fmt.Errorf("save stake event: %w", err) + } + stakeStaker, err := databaseTransaction.FindStakeStaker(ctx, event.User, event.NodeAddr) if err != nil { return fmt.Errorf("find stake staker: %w", err) diff --git a/schema/stake_event.go b/schema/stake_event.go new file mode 100644 index 00000000..fbc9ec2f --- /dev/null +++ b/schema/stake_event.go @@ -0,0 +1,46 @@ +package schema + +import ( + "math/big" + "time" + + "github.com/ethereum/go-ethereum/common" +) + +type StakeEventType string + +const ( + StakeEventTypeDepositDeposited StakeEventType = "deposited" + + StakeEventTypeWithdrawRequested StakeEventType = "requested" + StakeEventTypeWithdrawClaimed StakeEventType = "claimed" + + StakeEventTypeStakeStaked StakeEventType = "staked" + + StakeEventTypeUnstakeRequested StakeEventType = "requested" + StakeEventTypeUnstakeClaimed StakeEventType = "claimed" +) + +type StakeEventImporter interface { + Import(stakeEvent StakeEvent) error +} + +type StakeEventExporter interface { + Export() (*StakeEvent, error) +} + +type StakeEventTransformer interface { + StakeEventImporter + StakeEventExporter +} + +type StakeEvent struct { + ID common.Hash `json:"id"` + Type StakeEventType `json:"type"` + TransactionHash common.Hash `json:"transactionHash"` + TransactionIndex uint `json:"transactionIndex"` + TransactionStatus uint64 `json:"transactionStatus"` + BlockHash common.Hash `json:"blockHash"` + BlockNumber *big.Int `json:"blockNumber"` + BlockTimestamp time.Time `json:"blockTimestamp"` +} diff --git a/schema/stake_transaction.go b/schema/stake_transaction.go new file mode 100644 index 00000000..daa8f71b --- /dev/null +++ b/schema/stake_transaction.go @@ -0,0 +1,38 @@ +package schema + +import ( + "math/big" + + "github.com/ethereum/go-ethereum/common" +) + +type StakeTransactionType string + +const ( + StakeTransactionTypeDeposit StakeTransactionType = "deposit" + StakeTransactionTypeWithdraw StakeTransactionType = "withdraw" + StakeTransactionTypeStake StakeTransactionType = "stake" + StakeTransactionTypeUnstake StakeTransactionType = "unstake" +) + +type StakeTransactionImporter interface { + Import(stakeTransaction StakeTransaction) error +} + +type StakeTransactionExporter interface { + Export() (*StakeTransaction, error) +} + +type StakeTransactionTransformer interface { + StakeTransactionImporter + StakeTransactionExporter +} + +type StakeTransaction struct { + ID common.Hash `json:"id"` + Type StakeTransactionType `json:"type"` + User common.Address `json:"sender"` + Node common.Address `json:"receiver"` + Value *big.Int `json:"value"` + Chips []*big.Int `json:"chips"` +}