From ab313be038315570827accc5ed354781f527bd7a Mon Sep 17 00:00:00 2001 From: Chen Chen <34592639+envestcc@users.noreply.github.com> Date: Wed, 10 Jul 2024 05:25:32 +0800 Subject: [PATCH] [staking] update new staking contract abi (#4326) --- ..._abi.json => contract_staking_abi_v2.json} | 1201 +++++++++-------- .../protocol/staking/contractstake_indexer.go | 2 +- e2etest/contract_staking_v2_test.go | 25 +- e2etest/native_staking_test.go | 27 +- e2etest/staking_contract_v2_bytecode | 2 +- .../stakingindex/event_handler.go | 2 +- 6 files changed, 640 insertions(+), 619 deletions(-) rename action/protocol/staking/{contract_staking_abi.json => contract_staking_abi_v2.json} (98%) diff --git a/action/protocol/staking/contract_staking_abi.json b/action/protocol/staking/contract_staking_abi_v2.json similarity index 98% rename from action/protocol/staking/contract_staking_abi.json rename to action/protocol/staking/contract_staking_abi_v2.json index 39e491aac2..e7a2672dfc 100644 --- a/action/protocol/staking/contract_staking_abi.json +++ b/action/protocol/staking/contract_staking_abi_v2.json @@ -1,289 +1,446 @@ [ { "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, { "internalType": "uint256", - "name": "_minAmount", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_bucketId", "type": "uint256" }, { - "internalType": "address payable", - "name": "_beneficiary", + "internalType": "address", + "name": "_delegate", "type": "address" } ], + "name": "changeDelegate", + "outputs": [], "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "ErrInvalidAmount", - "type": "error" + "type": "function" }, { - "inputs": [], - "name": "ErrInvalidDuration", - "type": "error" + "inputs": [ + { + "internalType": "uint256[]", + "name": "_bucketIds", + "type": "uint256[]" + }, + { + "internalType": "address", + "name": "_delegate", + "type": "address" + } + ], + "name": "changeDelegates", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "inputs": [], - "name": "ErrInvalidParameter", - "type": "error" + "inputs": [ + { + "internalType": "uint256", + "name": "_bucketId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "donate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "inputs": [], - "name": "ErrNotLockedBucket", - "type": "error" + "inputs": [ + { + "internalType": "uint256", + "name": "_bucketId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_newDuration", + "type": "uint256" + } + ], + "name": "expandBucket", + "outputs": [], + "stateMutability": "payable", + "type": "function" }, { - "inputs": [], - "name": "ErrNotOwner", - "type": "error" + "inputs": [ + { + "internalType": "uint256", + "name": "_bucketId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_duration", + "type": "uint256" + } + ], + "name": "lock", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "inputs": [], - "name": "ErrNotReady", - "type": "error" + "inputs": [ + { + "internalType": "uint256[]", + "name": "_bucketIds", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "_duration", + "type": "uint256" + } + ], + "name": "lock", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "inputs": [], - "name": "ErrNotStakedBucket", - "type": "error" + "inputs": [ + { + "internalType": "uint256[]", + "name": "bucketIds", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "_newDuration", + "type": "uint256" + } + ], + "name": "merge", + "outputs": [], + "stateMutability": "payable", + "type": "function" }, { "inputs": [], - "name": "ErrNotUnstakedBucket", - "type": "error" + "name": "pause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { "inputs": [], - "name": "ErrTransferFailed", - "type": "error" + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "anonymous": false, "inputs": [ { - "indexed": true, "internalType": "address", - "name": "owner", + "name": "from", "type": "address" }, { - "indexed": true, "internalType": "address", - "name": "approved", + "name": "to", "type": "address" }, { - "indexed": true, "internalType": "uint256", "name": "tokenId", "type": "uint256" } ], - "name": "Approval", - "type": "event" + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "anonymous": false, "inputs": [ { - "indexed": true, "internalType": "address", - "name": "owner", + "name": "from", "type": "address" }, { - "indexed": true, + "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" }, { - "indexed": false, "internalType": "bool", "name": "approved", "type": "bool" } ], - "name": "ApprovalForAll", - "type": "event" + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address payable", + "name": "_beneficiary", + "type": "address" + } + ], + "name": "setBeneficiary", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "anonymous": false, "inputs": [ { - "indexed": true, "internalType": "uint256", - "name": "bucketId", + "name": "_amount", "type": "uint256" }, { - "indexed": false, "internalType": "uint256", - "name": "amount", + "name": "_duration", "type": "uint256" }, { - "indexed": false, + "internalType": "address", + "name": "_delegate", + "type": "address" + }, + { "internalType": "uint256", - "name": "duration", + "name": "_count", "type": "uint256" } ], - "name": "BucketExpanded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "bucketId", - "type": "uint256" - }, + "name": "stake", + "outputs": [ { - "indexed": false, - "internalType": "address", - "name": "newDelegate", - "type": "address" + "internalType": "uint256[]", + "name": "bucketIds_", + "type": "uint256[]" } ], - "name": "DelegateChanged", - "type": "event" + "stateMutability": "payable", + "type": "function" }, { - "anonymous": false, "inputs": [ { - "indexed": true, "internalType": "uint256", - "name": "bucketId", + "name": "_duration", "type": "uint256" }, { - "indexed": true, "internalType": "address", - "name": "beneficiary", + "name": "_delegate", "type": "address" - }, + } + ], + "name": "stake", + "outputs": [ { - "indexed": false, "internalType": "uint256", - "name": "amount", + "name": "", "type": "uint256" } ], - "name": "Donated", - "type": "event" + "stateMutability": "payable", + "type": "function" }, { - "anonymous": false, "inputs": [ { - "indexed": true, "internalType": "uint256", - "name": "bucketId", + "name": "_amount", "type": "uint256" }, { - "indexed": false, "internalType": "uint256", - "name": "duration", + "name": "_duration", "type": "uint256" + }, + { + "internalType": "address[]", + "name": "_delegates", + "type": "address[]" } ], - "name": "Locked", - "type": "event" + "name": "stake", + "outputs": [ + { + "internalType": "uint256[]", + "name": "bucketIds_", + "type": "uint256[]" + } + ], + "stateMutability": "payable", + "type": "function" }, { - "anonymous": false, "inputs": [ { - "indexed": false, - "internalType": "uint256[]", - "name": "bucketIds", - "type": "uint256[]" + "internalType": "address", + "name": "from", + "type": "address" }, { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" + "internalType": "address", + "name": "to", + "type": "address" }, { - "indexed": false, "internalType": "uint256", - "name": "duration", + "name": "tokenId", "type": "uint256" } ], - "name": "Merged", - "type": "event" + "name": "transferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "anonymous": false, "inputs": [ { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" } ], - "name": "OwnershipTransferred", - "type": "event" + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "anonymous": false, "inputs": [ { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" + "internalType": "uint256", + "name": "_minAmount", + "type": "uint256" } ], - "name": "Paused", - "type": "event" + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "ErrInvalidAmount", + "type": "error" + }, + { + "inputs": [], + "name": "ErrInvalidDuration", + "type": "error" + }, + { + "inputs": [], + "name": "ErrInvalidParameter", + "type": "error" + }, + { + "inputs": [], + "name": "ErrNotLockedBucket", + "type": "error" + }, + { + "inputs": [], + "name": "ErrNotOwner", + "type": "error" + }, + { + "inputs": [], + "name": "ErrNotReady", + "type": "error" + }, + { + "inputs": [], + "name": "ErrNotStakedBucket", + "type": "error" + }, + { + "inputs": [], + "name": "ErrNotUnstakedBucket", + "type": "error" + }, + { + "inputs": [], + "name": "ErrTransferFailed", + "type": "error" }, { "anonymous": false, "inputs": [ { "indexed": true, - "internalType": "uint256", - "name": "bucketId", - "type": "uint256" - }, - { - "indexed": false, "internalType": "address", - "name": "delegate", + "name": "owner", "type": "address" }, { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" }, { - "indexed": false, + "indexed": true, "internalType": "uint256", - "name": "duration", + "name": "tokenId", "type": "uint256" } ], - "name": "Staked", + "name": "Approval", "type": "event" }, { @@ -292,23 +449,23 @@ { "indexed": true, "internalType": "address", - "name": "from", + "name": "owner", "type": "address" }, { "indexed": true, "internalType": "address", - "name": "to", + "name": "operator", "type": "address" }, { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" } ], - "name": "Transfer", + "name": "ApprovalForAll", "type": "event" }, { @@ -316,25 +473,37 @@ "inputs": [ { "indexed": true, - "internalType": "uint256", - "name": "bucketId", - "type": "uint256" + "internalType": "address", + "name": "beneficiary", + "type": "address" } ], - "name": "Unlocked", + "name": "BeneficiaryChanged", "type": "event" }, { "anonymous": false, "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "bucketId", + "type": "uint256" + }, { "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "duration", + "type": "uint256" } ], - "name": "Unpaused", + "name": "BucketExpanded", "type": "event" }, { @@ -345,9 +514,15 @@ "internalType": "uint256", "name": "bucketId", "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "newDelegate", + "type": "address" } ], - "name": "Unstaked", + "name": "DelegateChanged", "type": "event" }, { @@ -362,229 +537,150 @@ { "indexed": true, "internalType": "address", - "name": "recipient", + "name": "beneficiary", "type": "address" - } - ], - "name": "Withdrawal", - "type": "event" - }, - { - "inputs": [], - "name": "MAX_DURATION", - "outputs": [ + }, { + "indexed": false, "internalType": "uint256", - "name": "", + "name": "amount", "type": "uint256" } ], - "stateMutability": "view", - "type": "function" + "name": "Donated", + "type": "event" }, { - "inputs": [], - "name": "MIN_AMOUNT", - "outputs": [ + "anonymous": false, + "inputs": [ { + "indexed": true, "internalType": "uint256", - "name": "", + "name": "bucketId", "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "ONE_DAY", - "outputs": [ + }, { + "indexed": false, "internalType": "uint256", - "name": "", + "name": "duration", "type": "uint256" } ], - "stateMutability": "view", - "type": "function" + "name": "Locked", + "type": "event" }, { - "inputs": [], - "name": "UINT256_MAX", - "outputs": [ + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256[]", + "name": "bucketIds", + "type": "uint256[]" + }, { + "indexed": false, "internalType": "uint256", - "name": "", + "name": "amount", "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "UNSTAKE_FREEZE_BLOCKS", - "outputs": [ + }, { + "indexed": false, "internalType": "uint256", - "name": "", + "name": "duration", "type": "uint256" } ], - "stateMutability": "view", - "type": "function" + "name": "Merged", + "type": "event" }, { + "anonymous": false, "inputs": [ { + "indexed": true, "internalType": "address", - "name": "to", + "name": "previousOwner", "type": "address" }, { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { + "indexed": true, "internalType": "address", - "name": "owner", + "name": "newOwner", "type": "address" } ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" + "name": "OwnershipTransferred", + "type": "event" }, { - "inputs": [], - "name": "beneficiary", - "outputs": [ + "anonymous": false, + "inputs": [ { - "internalType": "address payable", - "name": "", + "indexed": false, + "internalType": "address", + "name": "account", "type": "address" } ], - "stateMutability": "view", - "type": "function" + "name": "Paused", + "type": "event" }, { + "anonymous": false, "inputs": [ { + "indexed": true, "internalType": "uint256", - "name": "_bucketId", + "name": "bucketId", "type": "uint256" - } - ], - "name": "blocksToUnstake", - "outputs": [ + }, { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ + "indexed": false, + "internalType": "address", + "name": "delegate", + "type": "address" + }, { + "indexed": false, "internalType": "uint256", - "name": "_bucketId", + "name": "amount", "type": "uint256" - } - ], - "name": "blocksToWithdraw", - "outputs": [ + }, { + "indexed": false, "internalType": "uint256", - "name": "", + "name": "duration", "type": "uint256" } ], - "stateMutability": "view", - "type": "function" + "name": "Staked", + "type": "event" }, { + "anonymous": false, "inputs": [ { - "internalType": "uint256", - "name": "_bucketId", - "type": "uint256" - } - ], - "name": "bucketOf", - "outputs": [ + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, { - "components": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "duration", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "unlockedAt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "unstakedAt", - "type": "uint256" - }, - { - "internalType": "address", - "name": "delegate", - "type": "address" - } - ], - "internalType": "struct Bucket", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, { + "indexed": true, "internalType": "uint256", - "name": "_bucketId", + "name": "tokenId", "type": "uint256" - }, - { - "internalType": "address", - "name": "_delegate", - "type": "address" } ], - "name": "changeDelegate", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "name": "Transfer", + "type": "event" }, { "inputs": [ @@ -592,14 +688,9 @@ "internalType": "uint256[]", "name": "_bucketIds", "type": "uint256[]" - }, - { - "internalType": "address", - "name": "_delegate", - "type": "address" } ], - "name": "changeDelegates", + "name": "unlock", "outputs": [], "stateMutability": "nonpayable", "type": "function" @@ -610,78 +701,45 @@ "internalType": "uint256", "name": "_bucketId", "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" } ], - "name": "donate", + "name": "unlock", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { + "anonymous": false, "inputs": [ { + "indexed": true, "internalType": "uint256", - "name": "_bucketId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_newDuration", + "name": "bucketId", "type": "uint256" } ], - "name": "expandBucket", - "outputs": [], - "stateMutability": "payable", - "type": "function" + "name": "Unlocked", + "type": "event" }, { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getApproved", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", + "inputs": [], + "name": "unpause", + "outputs": [], + "stateMutability": "nonpayable", "type": "function" }, { + "anonymous": false, "inputs": [ { + "indexed": false, "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "operator", + "name": "account", "type": "address" } ], - "name": "isApprovedForAll", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" + "name": "Unpaused", + "type": "event" }, { "inputs": [ @@ -689,14 +747,9 @@ "internalType": "uint256", "name": "_bucketId", "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_duration", - "type": "uint256" } ], - "name": "lock", + "name": "unstake", "outputs": [], "stateMutability": "nonpayable", "type": "function" @@ -707,273 +760,230 @@ "internalType": "uint256[]", "name": "_bucketIds", "type": "uint256[]" - }, - { - "internalType": "uint256", - "name": "_duration", - "type": "uint256" } ], - "name": "lock", + "name": "unstake", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { + "anonymous": false, "inputs": [ { - "internalType": "uint256[]", - "name": "bucketIds", - "type": "uint256[]" - }, - { + "indexed": true, "internalType": "uint256", - "name": "_newDuration", + "name": "bucketId", "type": "uint256" } ], - "name": "merge", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" + "name": "Unstaked", + "type": "event" }, { "inputs": [ { "internalType": "uint256", - "name": "tokenId", + "name": "_bucketId", "type": "uint256" - } - ], - "name": "ownerOf", - "outputs": [ + }, { - "internalType": "address", - "name": "", + "internalType": "address payable", + "name": "_recipient", "type": "address" } ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pause", + "name": "withdraw", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { - "inputs": [], - "name": "paused", - "outputs": [ + "inputs": [ { - "internalType": "bool", - "name": "", - "type": "bool" + "internalType": "uint256[]", + "name": "_bucketIds", + "type": "uint256[]" + }, + { + "internalType": "address payable", + "name": "_recipient", + "type": "address" } ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", + "name": "withdraw", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { + "anonymous": false, "inputs": [ { - "internalType": "address", - "name": "from", - "type": "address" + "indexed": true, + "internalType": "uint256", + "name": "bucketId", + "type": "uint256" }, { + "indexed": true, "internalType": "address", - "name": "to", + "name": "recipient", "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" } ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "name": "Withdrawal", + "type": "event" }, { "inputs": [ { "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", + "name": "owner", "type": "address" - }, + } + ], + "name": "balanceOf", + "outputs": [ { "internalType": "uint256", - "name": "tokenId", + "name": "", "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" } ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { - "inputs": [ + "inputs": [], + "name": "beneficiary", + "outputs": [ { - "internalType": "address", - "name": "operator", + "internalType": "address payable", + "name": "", "type": "address" - }, - { - "internalType": "bool", - "name": "approved", - "type": "bool" } ], - "name": "setApprovalForAll", - "outputs": [], - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", - "name": "_amount", + "name": "_bucketId", "type": "uint256" - }, + } + ], + "name": "blocksToUnstake", + "outputs": [ { "internalType": "uint256", - "name": "_duration", + "name": "", "type": "uint256" - }, - { - "internalType": "address", - "name": "_delegate", - "type": "address" - }, + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ { "internalType": "uint256", - "name": "_count", + "name": "_bucketId", "type": "uint256" } ], - "name": "stake", + "name": "blocksToWithdraw", "outputs": [ { - "internalType": "uint256[]", - "name": "bucketIds_", - "type": "uint256[]" + "internalType": "uint256", + "name": "", + "type": "uint256" } ], - "stateMutability": "payable", + "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", - "name": "_duration", + "name": "_bucketId", "type": "uint256" - }, - { - "internalType": "address", - "name": "_delegate", - "type": "address" } ], - "name": "stake", + "name": "bucketOf", "outputs": [ { - "internalType": "uint256", + "components": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "unlockedAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "unstakedAt", + "type": "uint256" + }, + { + "internalType": "address", + "name": "delegate", + "type": "address" + } + ], + "internalType": "struct Bucket", "name": "", - "type": "uint256" + "type": "tuple" } ], - "stateMutability": "payable", + "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", - "name": "_amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_duration", + "name": "tokenId", "type": "uint256" - }, - { - "internalType": "address[]", - "name": "_delegates", - "type": "address[]" } ], - "name": "stake", + "name": "getApproved", "outputs": [ { - "internalType": "uint256[]", - "name": "bucketIds_", - "type": "uint256[]" + "internalType": "address", + "name": "", + "type": "address" } ], - "stateMutability": "payable", + "stateMutability": "view", "type": "function" }, { "inputs": [ { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" } ], - "name": "supportsInterface", + "name": "isApprovedForAll", "outputs": [ { "internalType": "bool", @@ -986,26 +996,33 @@ }, { "inputs": [], - "name": "symbol", + "name": "MAX_DURATION", "outputs": [ { - "internalType": "string", + "internalType": "uint256", "name": "", - "type": "string" + "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { - "inputs": [ + "inputs": [], + "name": "MIN_AMOUNT", + "outputs": [ { "internalType": "uint256", - "name": "tokenId", + "name": "", "type": "uint256" } ], - "name": "tokenURI", + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", "outputs": [ { "internalType": "string", @@ -1017,134 +1034,138 @@ "type": "function" }, { - "inputs": [ + "inputs": [], + "name": "ONE_DAY", + "outputs": [ { - "internalType": "address", - "name": "from", - "type": "address" - }, + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ { "internalType": "address", - "name": "to", + "name": "", "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" } ], - "name": "transferFrom", - "outputs": [], - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ { "internalType": "address", - "name": "newOwner", + "name": "", "type": "address" } ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { - "inputs": [ + "inputs": [], + "name": "paused", + "outputs": [ { - "internalType": "uint256[]", - "name": "_bucketIds", - "type": "uint256[]" + "internalType": "bool", + "name": "", + "type": "bool" } ], - "name": "unlock", - "outputs": [], - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { "inputs": [ { - "internalType": "uint256", - "name": "_bucketId", - "type": "uint256" + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" } ], - "name": "unlock", - "outputs": [], - "stateMutability": "nonpayable", + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", "type": "function" }, { "inputs": [], - "name": "unpause", - "outputs": [], - "stateMutability": "nonpayable", + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", - "name": "_bucketId", + "name": "tokenId", "type": "uint256" } ], - "name": "unstake", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ + "name": "tokenURI", + "outputs": [ { - "internalType": "uint256[]", - "name": "_bucketIds", - "type": "uint256[]" + "internalType": "string", + "name": "", + "type": "string" } ], - "name": "unstake", - "outputs": [], - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { - "inputs": [ + "inputs": [], + "name": "UINT256_MAX", + "outputs": [ { "internalType": "uint256", - "name": "_bucketId", + "name": "", "type": "uint256" - }, - { - "internalType": "address payable", - "name": "_recipient", - "type": "address" } ], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { - "inputs": [ - { - "internalType": "uint256[]", - "name": "_bucketIds", - "type": "uint256[]" - }, + "inputs": [], + "name": "UNSTAKE_FREEZE_BLOCKS", + "outputs": [ { - "internalType": "address payable", - "name": "_recipient", - "type": "address" + "internalType": "uint256", + "name": "", + "type": "uint256" } ], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" } ] \ No newline at end of file diff --git a/action/protocol/staking/contractstake_indexer.go b/action/protocol/staking/contractstake_indexer.go index a33fa647ff..1a3225f2ef 100644 --- a/action/protocol/staking/contractstake_indexer.go +++ b/action/protocol/staking/contractstake_indexer.go @@ -15,7 +15,7 @@ import ( var ( // StakingContractJSONABI is the abi json of staking contract - //go:embed contract_staking_abi.json + //go:embed contract_staking_abi_v2.json StakingContractJSONABI string // StakingContractABI is the abi of staking contract StakingContractABI abi.ABI diff --git a/e2etest/contract_staking_v2_test.go b/e2etest/contract_staking_v2_test.go index e507f82ead..8c5703fa46 100644 --- a/e2etest/contract_staking_v2_test.go +++ b/e2etest/contract_staking_v2_test.go @@ -83,7 +83,7 @@ func TestContractStakingV2(t *testing.T) { preActs: []*actionWithTime{ {mustNoErr(action.SignedCandidateRegister(test.nonceMgr.pop(identityset.Address(candOwnerID).String()), "cand1", identityset.Address(1).String(), identityset.Address(1).String(), identityset.Address(candOwnerID).String(), registerAmount.String(), 1, true, nil, gasLimit, gasPrice, identityset.PrivateKey(candOwnerID), action.WithChainID(chainID))), time.Now()}, }, - act: &actionWithTime{mustNoErr(action.SignedExecution("", identityset.PrivateKey(contractCreator), test.nonceMgr.pop(identityset.Address(contractCreator).String()), big.NewInt(0), gasLimit, gasPrice, append(bytecode, mustCallData("", minAmount, common.BytesToAddress(identityset.Address(beneficiaryID).Bytes()))...), action.WithChainID(chainID))), time.Now()}, + act: &actionWithTime{mustNoErr(action.SignedExecution("", identityset.PrivateKey(contractCreator), test.nonceMgr.pop(identityset.Address(contractCreator).String()), big.NewInt(0), gasLimit, gasPrice, append(bytecode, mustCallData("", minAmount)...), action.WithChainID(chainID))), time.Now()}, expect: []actionExpect{successExpect, &executionExpect{contractAddress}}, }, { @@ -94,9 +94,10 @@ func TestContractStakingV2(t *testing.T) { _, ok := tmpVotes.SetString(candidate.TotalWeightedVotes, 10) require.True(ok) }, - act: &actionWithTime{mustNoErr(action.SignedExecution(contractAddress, identityset.PrivateKey(stakerID), test.nonceMgr.pop(identityset.Address(stakerID).String()), stakeAmount, gasLimit, gasPrice, mustCallData("stake(uint256,address)", stakeDurationBlocks, common.BytesToAddress(identityset.Address(candOwnerID).Bytes())), action.WithChainID(chainID))), stakeTime}, + preActs: []*actionWithTime{{mustNoErr(action.SignedExecution(contractAddress, identityset.PrivateKey(contractCreator), test.nonceMgr.pop(identityset.Address(contractCreator).String()), big.NewInt(0), gasLimit, gasPrice, mustCallData("setBeneficiary(address)", common.BytesToAddress(identityset.Address(beneficiaryID).Bytes())), action.WithChainID(chainID))), stakeTime}}, + act: &actionWithTime{mustNoErr(action.SignedExecution(contractAddress, identityset.PrivateKey(stakerID), test.nonceMgr.pop(identityset.Address(stakerID).String()), stakeAmount, gasLimit, gasPrice, mustCallData("stake(uint256,address)", stakeDurationBlocks, common.BytesToAddress(identityset.Address(candOwnerID).Bytes())), action.WithChainID(chainID))), stakeTime}, expect: []actionExpect{successExpect, - &bucketExpect{&iotextypes.VoteBucket{Index: 1, ContractAddress: contractAddress, Owner: identityset.Address(stakerID).String(), CandidateAddress: identityset.Address(candOwnerID).String(), StakedDuration: uint32(stakeDurationBlocks.Uint64() / uint64(blocksPerDay)), StakedDurationBlockNumber: stakeDurationBlocks.Uint64(), CreateTime: timestamppb.New(time.Time{}), StakeStartTime: timestamppb.New(time.Time{}), StakeStartBlockHeight: 3, CreateBlockHeight: 3, UnstakeStartTime: timestamppb.New(time.Time{}), UnstakeStartBlockHeight: uint64(math.MaxUint64), StakedAmount: stakeAmount.String(), AutoStake: true}}, + &bucketExpect{&iotextypes.VoteBucket{Index: 1, ContractAddress: contractAddress, Owner: identityset.Address(stakerID).String(), CandidateAddress: identityset.Address(candOwnerID).String(), StakedDuration: uint32(stakeDurationBlocks.Uint64() / uint64(blocksPerDay)), StakedDurationBlockNumber: stakeDurationBlocks.Uint64(), CreateTime: timestamppb.New(time.Time{}), StakeStartTime: timestamppb.New(time.Time{}), StakeStartBlockHeight: 4, CreateBlockHeight: 4, UnstakeStartTime: timestamppb.New(time.Time{}), UnstakeStartBlockHeight: uint64(math.MaxUint64), StakedAmount: stakeAmount.String(), AutoStake: true}}, &candidateExpect{"cand1", &iotextypes.CandidateV2{OwnerAddress: identityset.Address(candOwnerID).String(), Id: identityset.Address(candOwnerID).String(), OperatorAddress: identityset.Address(1).String(), RewardAddress: identityset.Address(1).String(), Name: "cand1", TotalWeightedVotes: "1256001586604779503009155", SelfStakingTokens: registerAmount.String(), SelfStakeBucketIdx: 0}}, &functionExpect{func(test *e2etest, act *action.SealedEnvelope, receipt *action.Receipt, err error) { candidate, err := test.getCandidateByName("cand1") @@ -110,7 +111,7 @@ func TestContractStakingV2(t *testing.T) { name: "unlock", act: &actionWithTime{mustNoErr(action.SignedExecution(contractAddress, identityset.PrivateKey(stakerID), test.nonceMgr.pop(identityset.Address(stakerID).String()), big.NewInt(0), gasLimit, gasPrice, mustCallData("unlock(uint256)", big.NewInt(1)), action.WithChainID(chainID))), unlockTime}, expect: []actionExpect{successExpect, - &bucketExpect{&iotextypes.VoteBucket{Index: 1, ContractAddress: contractAddress, Owner: identityset.Address(stakerID).String(), CandidateAddress: identityset.Address(candOwnerID).String(), StakedDuration: uint32(stakeDurationBlocks.Uint64() / uint64(blocksPerDay)), StakedDurationBlockNumber: stakeDurationBlocks.Uint64(), CreateTime: timestamppb.New(time.Time{}), StakeStartTime: timestamppb.New(time.Time{}), StakeStartBlockHeight: 4, CreateBlockHeight: 3, UnstakeStartTime: timestamppb.New(time.Time{}), UnstakeStartBlockHeight: math.MaxUint64, StakedAmount: stakeAmount.String(), AutoStake: false}}, + &bucketExpect{&iotextypes.VoteBucket{Index: 1, ContractAddress: contractAddress, Owner: identityset.Address(stakerID).String(), CandidateAddress: identityset.Address(candOwnerID).String(), StakedDuration: uint32(stakeDurationBlocks.Uint64() / uint64(blocksPerDay)), StakedDurationBlockNumber: stakeDurationBlocks.Uint64(), CreateTime: timestamppb.New(time.Time{}), StakeStartTime: timestamppb.New(time.Time{}), StakeStartBlockHeight: 5, CreateBlockHeight: 4, UnstakeStartTime: timestamppb.New(time.Time{}), UnstakeStartBlockHeight: math.MaxUint64, StakedAmount: stakeAmount.String(), AutoStake: false}}, &functionExpect{func(test *e2etest, act *action.SealedEnvelope, receipt *action.Receipt, err error) { candidate, err := test.getCandidateByName("cand1") require.NoError(err) @@ -126,7 +127,7 @@ func TestContractStakingV2(t *testing.T) { name: "lock", act: &actionWithTime{mustNoErr(action.SignedExecution(contractAddress, identityset.PrivateKey(stakerID), test.nonceMgr.pop(identityset.Address(stakerID).String()), big.NewInt(0), gasLimit, gasPrice, mustCallData("lock(uint256,uint256)", big.NewInt(1), big.NewInt(0).Mul(big.NewInt(2), stakeDurationBlocks)), action.WithChainID(chainID))), time.Now()}, expect: []actionExpect{successExpect, - &bucketExpect{&iotextypes.VoteBucket{Index: 1, ContractAddress: contractAddress, Owner: identityset.Address(stakerID).String(), CandidateAddress: identityset.Address(candOwnerID).String(), StakedDuration: uint32(stakeDurationBlocks.Uint64()/uint64(blocksPerDay)) * 2, StakedDurationBlockNumber: stakeDurationBlocks.Uint64() * 2, CreateTime: timestamppb.New(time.Time{}), StakeStartTime: timestamppb.New(time.Time{}), StakeStartBlockHeight: 3, CreateBlockHeight: 3, UnstakeStartTime: timestamppb.New(time.Time{}), UnstakeStartBlockHeight: math.MaxUint64, StakedAmount: stakeAmount.String(), AutoStake: true}}, + &bucketExpect{&iotextypes.VoteBucket{Index: 1, ContractAddress: contractAddress, Owner: identityset.Address(stakerID).String(), CandidateAddress: identityset.Address(candOwnerID).String(), StakedDuration: uint32(stakeDurationBlocks.Uint64()/uint64(blocksPerDay)) * 2, StakedDurationBlockNumber: stakeDurationBlocks.Uint64() * 2, CreateTime: timestamppb.New(time.Time{}), StakeStartTime: timestamppb.New(time.Time{}), StakeStartBlockHeight: 4, CreateBlockHeight: 4, UnstakeStartTime: timestamppb.New(time.Time{}), UnstakeStartBlockHeight: math.MaxUint64, StakedAmount: stakeAmount.String(), AutoStake: true}}, &functionExpect{func(test *e2etest, act *action.SealedEnvelope, receipt *action.Receipt, err error) { candidate, err := test.getCandidateByName("cand1") require.NoError(err) @@ -145,7 +146,7 @@ func TestContractStakingV2(t *testing.T) { }, genTransferActions(20)...), act: &actionWithTime{mustNoErr(action.SignedExecution(contractAddress, identityset.PrivateKey(stakerID), test.nonceMgr.pop(identityset.Address(stakerID).String()), big.NewInt(0), gasLimit, gasPrice, mustCallData("unstake(uint256)", big.NewInt(1)), action.WithChainID(chainID))), time.Now()}, expect: []actionExpect{successExpect, - &bucketExpect{&iotextypes.VoteBucket{Index: 1, ContractAddress: contractAddress, Owner: identityset.Address(stakerID).String(), CandidateAddress: identityset.Address(candOwnerID).String(), StakedDuration: uint32(2 * stakeDurationBlocks.Uint64() / uint64(blocksPerDay)), StakedDurationBlockNumber: stakeDurationBlocks.Uint64() * 2, CreateTime: timestamppb.New(time.Time{}), StakeStartTime: timestamppb.New(time.Time{}), StakeStartBlockHeight: 6, CreateBlockHeight: 3, UnstakeStartTime: timestamppb.New(time.Time{}), UnstakeStartBlockHeight: 27, StakedAmount: stakeAmount.String(), AutoStake: false}}, + &bucketExpect{&iotextypes.VoteBucket{Index: 1, ContractAddress: contractAddress, Owner: identityset.Address(stakerID).String(), CandidateAddress: identityset.Address(candOwnerID).String(), StakedDuration: uint32(2 * stakeDurationBlocks.Uint64() / uint64(blocksPerDay)), StakedDurationBlockNumber: stakeDurationBlocks.Uint64() * 2, CreateTime: timestamppb.New(time.Time{}), StakeStartTime: timestamppb.New(time.Time{}), StakeStartBlockHeight: 7, CreateBlockHeight: 4, UnstakeStartTime: timestamppb.New(time.Time{}), UnstakeStartBlockHeight: 28, StakedAmount: stakeAmount.String(), AutoStake: false}}, &functionExpect{func(test *e2etest, act *action.SealedEnvelope, receipt *action.Receipt, err error) { candidate, err := test.getCandidateByName("cand1") require.NoError(err) @@ -183,7 +184,7 @@ func TestContractStakingV2(t *testing.T) { }, act: &actionWithTime{mustNoErr(action.SignedExecution(contractAddress, identityset.PrivateKey(stakerID), test.nonceMgr.pop(identityset.Address(stakerID).String()), big.NewInt(0), gasLimit, gasPrice, mustCallData("changeDelegate(uint256,address)", big.NewInt(2), common.BytesToAddress(identityset.Address(candOwnerID2).Bytes())), action.WithChainID(chainID))), time.Now()}, expect: []actionExpect{successExpect, - &bucketExpect{&iotextypes.VoteBucket{Index: 2, ContractAddress: contractAddress, Owner: identityset.Address(stakerID).String(), CandidateAddress: identityset.Address(candOwnerID2).String(), StakedDuration: uint32(stakeDurationBlocks.Uint64() / uint64(blocksPerDay)), StakedDurationBlockNumber: stakeDurationBlocks.Uint64(), CreateTime: timestamppb.New(time.Time{}), StakeStartTime: timestamppb.New(time.Time{}), StakeStartBlockHeight: 60, CreateBlockHeight: 60, UnstakeStartTime: timestamppb.New(time.Time{}), UnstakeStartBlockHeight: math.MaxUint64, StakedAmount: stakeAmount.String(), AutoStake: true}}, + &bucketExpect{&iotextypes.VoteBucket{Index: 2, ContractAddress: contractAddress, Owner: identityset.Address(stakerID).String(), CandidateAddress: identityset.Address(candOwnerID2).String(), StakedDuration: uint32(stakeDurationBlocks.Uint64() / uint64(blocksPerDay)), StakedDurationBlockNumber: stakeDurationBlocks.Uint64(), CreateTime: timestamppb.New(time.Time{}), StakeStartTime: timestamppb.New(time.Time{}), StakeStartBlockHeight: 61, CreateBlockHeight: 61, UnstakeStartTime: timestamppb.New(time.Time{}), UnstakeStartBlockHeight: math.MaxUint64, StakedAmount: stakeAmount.String(), AutoStake: true}}, &functionExpect{func(test *e2etest, act *action.SealedEnvelope, receipt *action.Receipt, err error) { candidate, err := test.getCandidateByName("cand1") require.NoError(err) @@ -201,8 +202,8 @@ func TestContractStakingV2(t *testing.T) { }, act: &actionWithTime{mustNoErr(action.SignedExecution(contractAddress, identityset.PrivateKey(stakerID), test.nonceMgr.pop(identityset.Address(stakerID).String()), big.NewInt(0).Mul(big.NewInt(10), stakeAmount), gasLimit, gasPrice, mustCallData("stake(uint256,uint256,address,uint256)", stakeAmount, stakeDurationBlocks, common.BytesToAddress(identityset.Address(candOwnerID2).Bytes()), big.NewInt(10)), action.WithChainID(chainID))), time.Now()}, expect: []actionExpect{successExpect, - &bucketExpect{&iotextypes.VoteBucket{Index: 3, ContractAddress: contractAddress, Owner: identityset.Address(stakerID).String(), CandidateAddress: identityset.Address(candOwnerID2).String(), StakedDuration: uint32(stakeDurationBlocks.Uint64() / uint64(blocksPerDay)), StakedDurationBlockNumber: stakeDurationBlocks.Uint64(), CreateTime: timestamppb.New(time.Time{}), StakeStartTime: timestamppb.New(time.Time{}), StakeStartBlockHeight: 62, CreateBlockHeight: 62, UnstakeStartTime: timestamppb.New(time.Time{}), UnstakeStartBlockHeight: math.MaxUint64, StakedAmount: stakeAmount.String(), AutoStake: true}}, - &bucketExpect{&iotextypes.VoteBucket{Index: 12, ContractAddress: contractAddress, Owner: identityset.Address(stakerID).String(), CandidateAddress: identityset.Address(candOwnerID2).String(), StakedDuration: uint32(stakeDurationBlocks.Uint64() / uint64(blocksPerDay)), StakedDurationBlockNumber: stakeDurationBlocks.Uint64(), CreateTime: timestamppb.New(time.Time{}), StakeStartTime: timestamppb.New(time.Time{}), StakeStartBlockHeight: 62, CreateBlockHeight: 62, UnstakeStartTime: timestamppb.New(time.Time{}), UnstakeStartBlockHeight: math.MaxUint64, StakedAmount: stakeAmount.String(), AutoStake: true}}, + &bucketExpect{&iotextypes.VoteBucket{Index: 3, ContractAddress: contractAddress, Owner: identityset.Address(stakerID).String(), CandidateAddress: identityset.Address(candOwnerID2).String(), StakedDuration: uint32(stakeDurationBlocks.Uint64() / uint64(blocksPerDay)), StakedDurationBlockNumber: stakeDurationBlocks.Uint64(), CreateTime: timestamppb.New(time.Time{}), StakeStartTime: timestamppb.New(time.Time{}), StakeStartBlockHeight: 63, CreateBlockHeight: 63, UnstakeStartTime: timestamppb.New(time.Time{}), UnstakeStartBlockHeight: math.MaxUint64, StakedAmount: stakeAmount.String(), AutoStake: true}}, + &bucketExpect{&iotextypes.VoteBucket{Index: 12, ContractAddress: contractAddress, Owner: identityset.Address(stakerID).String(), CandidateAddress: identityset.Address(candOwnerID2).String(), StakedDuration: uint32(stakeDurationBlocks.Uint64() / uint64(blocksPerDay)), StakedDurationBlockNumber: stakeDurationBlocks.Uint64(), CreateTime: timestamppb.New(time.Time{}), StakeStartTime: timestamppb.New(time.Time{}), StakeStartBlockHeight: 63, CreateBlockHeight: 63, UnstakeStartTime: timestamppb.New(time.Time{}), UnstakeStartBlockHeight: math.MaxUint64, StakedAmount: stakeAmount.String(), AutoStake: true}}, &functionExpect{func(test *e2etest, act *action.SealedEnvelope, receipt *action.Receipt, err error) { candidate, err := test.getCandidateByName("cand2") require.NoError(err) @@ -216,7 +217,7 @@ func TestContractStakingV2(t *testing.T) { name: "merge", act: &actionWithTime{mustNoErr(action.SignedExecution(contractAddress, identityset.PrivateKey(stakerID), test.nonceMgr.pop(identityset.Address(stakerID).String()), big.NewInt(0), gasLimit, gasPrice, mustCallData("merge(uint256[],uint256)", []*big.Int{big.NewInt(3), big.NewInt(4), big.NewInt(5)}, stakeDurationBlocks), action.WithChainID(chainID))), time.Now()}, expect: []actionExpect{successExpect, - &bucketExpect{&iotextypes.VoteBucket{Index: 3, ContractAddress: contractAddress, Owner: identityset.Address(stakerID).String(), CandidateAddress: identityset.Address(candOwnerID2).String(), StakedDuration: uint32(stakeDurationBlocks.Uint64() / uint64(blocksPerDay)), StakedDurationBlockNumber: stakeDurationBlocks.Uint64(), CreateTime: timestamppb.New(time.Time{}), StakeStartTime: timestamppb.New(time.Time{}), StakeStartBlockHeight: 62, CreateBlockHeight: 62, UnstakeStartTime: timestamppb.New(time.Time{}), UnstakeStartBlockHeight: math.MaxUint64, StakedAmount: big.NewInt(0).Mul(stakeAmount, big.NewInt(3)).String(), AutoStake: true}}, + &bucketExpect{&iotextypes.VoteBucket{Index: 3, ContractAddress: contractAddress, Owner: identityset.Address(stakerID).String(), CandidateAddress: identityset.Address(candOwnerID2).String(), StakedDuration: uint32(stakeDurationBlocks.Uint64() / uint64(blocksPerDay)), StakedDurationBlockNumber: stakeDurationBlocks.Uint64(), CreateTime: timestamppb.New(time.Time{}), StakeStartTime: timestamppb.New(time.Time{}), StakeStartBlockHeight: 63, CreateBlockHeight: 63, UnstakeStartTime: timestamppb.New(time.Time{}), UnstakeStartBlockHeight: math.MaxUint64, StakedAmount: big.NewInt(0).Mul(stakeAmount, big.NewInt(3)).String(), AutoStake: true}}, &noBucketExpect{4, contractAddress}, &noBucketExpect{5, contractAddress}, &functionExpect{func(test *e2etest, act *action.SealedEnvelope, receipt *action.Receipt, err error) { candidate, err := test.getCandidateByName("cand2") @@ -233,7 +234,7 @@ func TestContractStakingV2(t *testing.T) { name: "expand", act: &actionWithTime{mustNoErr(action.SignedExecution(contractAddress, identityset.PrivateKey(stakerID), test.nonceMgr.pop(identityset.Address(stakerID).String()), stakeAmount, gasLimit, gasPrice, mustCallData("expandBucket(uint256,uint256)", big.NewInt(3), big.NewInt(0).Mul(stakeDurationBlocks, big.NewInt(2))), action.WithChainID(chainID))), time.Now()}, expect: []actionExpect{successExpect, - &bucketExpect{&iotextypes.VoteBucket{Index: 3, ContractAddress: contractAddress, Owner: identityset.Address(stakerID).String(), CandidateAddress: identityset.Address(candOwnerID2).String(), StakedDuration: uint32(stakeDurationBlocks.Uint64()/uint64(blocksPerDay)) * 2, StakedDurationBlockNumber: stakeDurationBlocks.Uint64() * 2, CreateTime: timestamppb.New(time.Time{}), StakeStartTime: timestamppb.New(time.Time{}), StakeStartBlockHeight: 62, CreateBlockHeight: 62, UnstakeStartTime: timestamppb.New(time.Time{}), UnstakeStartBlockHeight: math.MaxUint64, StakedAmount: big.NewInt(0).Mul(stakeAmount, big.NewInt(4)).String(), AutoStake: true}}, + &bucketExpect{&iotextypes.VoteBucket{Index: 3, ContractAddress: contractAddress, Owner: identityset.Address(stakerID).String(), CandidateAddress: identityset.Address(candOwnerID2).String(), StakedDuration: uint32(stakeDurationBlocks.Uint64()/uint64(blocksPerDay)) * 2, StakedDurationBlockNumber: stakeDurationBlocks.Uint64() * 2, CreateTime: timestamppb.New(time.Time{}), StakeStartTime: timestamppb.New(time.Time{}), StakeStartBlockHeight: 63, CreateBlockHeight: 63, UnstakeStartTime: timestamppb.New(time.Time{}), UnstakeStartBlockHeight: math.MaxUint64, StakedAmount: big.NewInt(0).Mul(stakeAmount, big.NewInt(4)).String(), AutoStake: true}}, }, }, { @@ -246,7 +247,7 @@ func TestContractStakingV2(t *testing.T) { }, act: &actionWithTime{mustNoErr(action.SignedExecution(contractAddress, identityset.PrivateKey(stakerID), test.nonceMgr.pop(identityset.Address(stakerID).String()), big.NewInt(0), gasLimit, gasPrice, mustCallData("donate(uint256,uint256)", big.NewInt(3), stakeAmount), action.WithChainID(chainID))), time.Now()}, expect: []actionExpect{successExpect, - &bucketExpect{&iotextypes.VoteBucket{Index: 3, ContractAddress: contractAddress, Owner: identityset.Address(stakerID).String(), CandidateAddress: identityset.Address(candOwnerID2).String(), StakedDuration: uint32(stakeDurationBlocks.Uint64()/uint64(blocksPerDay)) * 2, StakedDurationBlockNumber: stakeDurationBlocks.Uint64() * 2, CreateTime: timestamppb.New(time.Time{}), StakeStartTime: timestamppb.New(time.Time{}), StakeStartBlockHeight: 62, CreateBlockHeight: 62, UnstakeStartTime: timestamppb.New(time.Time{}), UnstakeStartBlockHeight: math.MaxUint64, StakedAmount: big.NewInt(0).Mul(stakeAmount, big.NewInt(3)).String(), AutoStake: true}}, + &bucketExpect{&iotextypes.VoteBucket{Index: 3, ContractAddress: contractAddress, Owner: identityset.Address(stakerID).String(), CandidateAddress: identityset.Address(candOwnerID2).String(), StakedDuration: uint32(stakeDurationBlocks.Uint64()/uint64(blocksPerDay)) * 2, StakedDurationBlockNumber: stakeDurationBlocks.Uint64() * 2, CreateTime: timestamppb.New(time.Time{}), StakeStartTime: timestamppb.New(time.Time{}), StakeStartBlockHeight: 63, CreateBlockHeight: 63, UnstakeStartTime: timestamppb.New(time.Time{}), UnstakeStartBlockHeight: math.MaxUint64, StakedAmount: big.NewInt(0).Mul(stakeAmount, big.NewInt(3)).String(), AutoStake: true}}, &functionExpect{func(test *e2etest, act *action.SealedEnvelope, receipt *action.Receipt, err error) { resp, err := test.api.GetAccount(context.Background(), &iotexapi.GetAccountRequest{Address: identityset.Address(beneficiaryID).String()}) require.NoError(err) diff --git a/e2etest/native_staking_test.go b/e2etest/native_staking_test.go index a92d76cc25..350e4044de 100644 --- a/e2etest/native_staking_test.go +++ b/e2etest/native_staking_test.go @@ -845,21 +845,24 @@ func TestCandidateTransferOwnership(t *testing.T) { minAmount, _ := big.NewInt(0).SetString("1000000000000000000000", 10) // 1000 IOTX bytecode, err := hex.DecodeString(stakingContractV2Bytecode) require.NoError(err) - deployCode, err := staking.StakingContractABI.Constructor.Inputs.Pack(minAmount, common.BytesToAddress(identityset.Address(stakerID).Bytes())) - deployCode = append(bytecode, deployCode...) - require.NoError(err) + mustCallData := func(m string, args ...any) []byte { + data, err := abiCall(staking.StakingContractABI, m, args...) + require.NoError(err) + return data + } + deployCode := append(bytecode, mustCallData("", minAmount)...) test.run([]*testcase{ { name: "deploy staking contract", act: &actionWithTime{mustNoErr(action.SignedExecution("", identityset.PrivateKey(stakerID), test.nonceMgr.pop(identityset.Address(stakerID).String()), big.NewInt(0), gasLimit, gasPrice, deployCode, action.WithChainID(chainID))), time.Now()}, expect: []actionExpect{ successExpect, &executionExpect{contractAddress}, - &accountExpect{identityset.Address(stakerID), "99999999999999999996387414", test.nonceMgr[identityset.Address(stakerID).String()]}, }, }, { name: "non-owner cannot migrate stake", preActs: []*actionWithTime{ + {mustNoErr(action.SignedExecution(contractAddress, identityset.PrivateKey(stakerID), test.nonceMgr.pop(identityset.Address(stakerID).String()), big.NewInt(0), gasLimit, gasPrice, mustCallData("setBeneficiary(address)", common.BytesToAddress(identityset.Address(stakerID).Bytes())), action.WithChainID(chainID))), stakeTime}, {mustNoErr(action.SignedCandidateRegister(test.nonceMgr.pop(identityset.Address(candOwnerID).String()), "cand1", identityset.Address(1).String(), identityset.Address(1).String(), identityset.Address(candOwnerID).String(), registerAmount.String(), 1, true, nil, gasLimit, gasPrice, identityset.PrivateKey(candOwnerID), action.WithChainID(chainID))), time.Now()}, {mustNoErr(action.SignedCreateStake(test.nonceMgr.pop(identityset.Address(stakerID).String()), "cand1", stakeAmount.String(), stakeDurationDays, true, nil, gasLimit, gasPrice, identityset.PrivateKey(stakerID), action.WithChainID(chainID))), stakeTime}, }, @@ -867,7 +870,6 @@ func TestCandidateTransferOwnership(t *testing.T) { expect: []actionExpect{ &basicActionExpect{nil, uint64(iotextypes.ReceiptStatus_ErrUnauthorizedOperator), ""}, &bucketExpect{&iotextypes.VoteBucket{Index: 1, CandidateAddress: identityset.Address(candOwnerID).String(), StakedAmount: stakeAmount.String(), AutoStake: true, StakedDuration: stakeDurationDays, Owner: identityset.Address(stakerID).String(), CreateTime: timestamppb.New(stakeTime), StakeStartTime: timestamppb.New(stakeTime), UnstakeStartTime: ×tamppb.Timestamp{}}}, - &accountExpect{identityset.Address(stakerID), "99989999999999999996377414", test.nonceMgr[identityset.Address(stakerID).String()]}, &candidateExpect{"cand1", &iotextypes.CandidateV2{Name: "cand1", Id: identityset.Address(candOwnerID).String(), OperatorAddress: identityset.Address(1).String(), RewardAddress: identityset.Address(1).String(), TotalWeightedVotes: "1256001586604779503009155", SelfStakingTokens: registerAmount.String(), OwnerAddress: identityset.Address(candOwnerID).String(), SelfStakeBucketIdx: 0}}, }, }, @@ -887,7 +889,7 @@ func TestCandidateTransferOwnership(t *testing.T) { expect: []actionExpect{ successExpect, &fullActionExpect{ - address.StakingProtocolAddr, 212034, + address.StakingProtocolAddr, 212012, []*action.TransactionLog{ { Type: iotextypes.TransactionLogType_GAS_FEE, @@ -903,7 +905,7 @@ func TestCandidateTransferOwnership(t *testing.T) { }, { Type: iotextypes.TransactionLogType_GAS_FEE, - Amount: big.NewInt(202034), + Amount: big.NewInt(202012), Sender: identityset.Address(stakerID).String(), Recipient: address.RewardingPoolAddr, }, @@ -915,9 +917,8 @@ func TestCandidateTransferOwnership(t *testing.T) { }, }, }, - &bucketExpect{&iotextypes.VoteBucket{Index: 1, CandidateAddress: identityset.Address(candOwnerID).String(), StakedAmount: stakeAmount.String(), AutoStake: true, StakedDuration: stakeDurationDays, StakedDurationBlockNumber: uint64(stakeDurationDays) * uint64(blocksPerDay), CreateBlockHeight: 5, StakeStartBlockHeight: 5, UnstakeStartBlockHeight: math.MaxUint64, Owner: identityset.Address(stakerID).String(), ContractAddress: contractAddress, CreateTime: timestamppb.New(time.Time{}), StakeStartTime: timestamppb.New(time.Time{}), UnstakeStartTime: timestamppb.New(time.Time{})}}, + &bucketExpect{&iotextypes.VoteBucket{Index: 1, CandidateAddress: identityset.Address(candOwnerID).String(), StakedAmount: stakeAmount.String(), AutoStake: true, StakedDuration: stakeDurationDays, StakedDurationBlockNumber: uint64(stakeDurationDays) * uint64(blocksPerDay), CreateBlockHeight: 6, StakeStartBlockHeight: 6, UnstakeStartBlockHeight: math.MaxUint64, Owner: identityset.Address(stakerID).String(), ContractAddress: contractAddress, CreateTime: timestamppb.New(time.Time{}), StakeStartTime: timestamppb.New(time.Time{}), UnstakeStartTime: timestamppb.New(time.Time{})}}, &noBucketExpect{1, ""}, - &accountExpect{identityset.Address(stakerID), "99989999999999999996165380", test.nonceMgr[identityset.Address(stakerID).String()]}, &candidateExpect{"cand1", &iotextypes.CandidateV2{Name: "cand1", Id: identityset.Address(candOwnerID).String(), OperatorAddress: identityset.Address(1).String(), RewardAddress: identityset.Address(1).String(), TotalWeightedVotes: "1256001586604779503009155", SelfStakingTokens: registerAmount.String(), OwnerAddress: identityset.Address(candOwnerID).String(), SelfStakeBucketIdx: 0}}, &functionExpect{func(test *e2etest, act *action.SealedEnvelope, receipt *action.Receipt, err error) { resp, err := test.api.GetAccount(context.Background(), &iotexapi.GetAccountRequest{ @@ -946,7 +947,6 @@ func TestCandidateTransferOwnership(t *testing.T) { expect: []actionExpect{ successExpect, &bucketExpect{&iotextypes.VoteBucket{Index: 2, CandidateAddress: identityset.Address(candOwnerID).String(), StakedAmount: unit.ConvertIotxToRau(100).String(), AutoStake: true, StakedDuration: stakeDurationDays, Owner: identityset.Address(stakerID).String(), CreateTime: timestamppb.New(stakeTime), StakeStartTime: timestamppb.New(stakeTime), UnstakeStartTime: ×tamppb.Timestamp{}}}, - &accountExpect{identityset.Address(stakerID), "99989899999999999996155380", test.nonceMgr[identityset.Address(stakerID).String()]}, }, }, { @@ -956,17 +956,16 @@ func TestCandidateTransferOwnership(t *testing.T) { expect: []actionExpect{ &basicActionExpect{nil, uint64(iotextypes.ReceiptStatus_ErrExecutionReverted), ""}, &fullActionExpect{ - address.StakingProtocolAddr, 29425, []*action.TransactionLog{ + address.StakingProtocolAddr, 29447, []*action.TransactionLog{ { Type: iotextypes.TransactionLogType_GAS_FEE, - Amount: big.NewInt(29425), + Amount: big.NewInt(29447), Sender: identityset.Address(stakerID).String(), Recipient: address.RewardingPoolAddr, }, }, }, &bucketExpect{&iotextypes.VoteBucket{Index: 2, CandidateAddress: identityset.Address(candOwnerID).String(), StakedAmount: unit.ConvertIotxToRau(100).String(), AutoStake: true, StakedDuration: stakeDurationDays, Owner: identityset.Address(stakerID).String(), CreateTime: timestamppb.New(stakeTime), StakeStartTime: timestamppb.New(stakeTime), UnstakeStartTime: ×tamppb.Timestamp{}}}, - &accountExpect{identityset.Address(stakerID), "99989899999999999996125955", test.nonceMgr[identityset.Address(stakerID).String()]}, }, }, { @@ -1020,7 +1019,7 @@ func TestCandidateTransferOwnership(t *testing.T) { GasPrice: gasPrice.String(), }) require.NoError(err) - require.Equal(uint64(194934), resp.Gas) + require.Equal(uint64(194912), resp.Gas) }}}, }, }) diff --git a/e2etest/staking_contract_v2_bytecode b/e2etest/staking_contract_v2_bytecode index 6689c2992f..103ae4961e 100644 --- a/e2etest/staking_contract_v2_bytecode +++ b/e2etest/staking_contract_v2_bytecode @@ -1 +1 @@ -60a060405234801562000010575f80fd5b5060405162002f9a38038062002f9a83398101604081905262000033916200013a565b60405180604001604052806009815260200168109d58dad95d13919560ba1b815250604051806040016040528060038152602001621092d560ea1b815250815f908162000081919062000214565b50600162000090828262000214565b505050620000ad620000a7620000e560201b60201c565b620000e9565b6006805460ff60a01b19169055608091909152600980546001600160a01b0319166001600160a01b03909216919091179055620002e0565b3390565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b5f80604083850312156200014c575f80fd5b825160208401519092506001600160a01b03811681146200016b575f80fd5b809150509250929050565b634e487b7160e01b5f52604160045260245ffd5b600181811c908216806200019f57607f821691505b602082108103620001be57634e487b7160e01b5f52602260045260245ffd5b50919050565b601f8211156200020f57805f5260205f20601f840160051c81016020851015620001eb5750805b601f840160051c820191505b818110156200020c575f8155600101620001f7565b50505b505050565b81516001600160401b0381111562000230576200023062000176565b62000248816200024184546200018a565b84620001c4565b602080601f8311600181146200027e575f8415620002665750858301515b5f19600386901b1c1916600185901b178555620002d8565b5f85815260208120601f198616915b82811015620002ae578886015182559484019460019091019084016200028d565b5085821015620002cc57878501515f19600388901b60f8161c191681555b505060018460011b0185555b505050505050565b608051612c9a620003005f395f818161071f0152611bd80152612c9a5ff3fe60806040526004361061025e575f3560e01c8063715018a61161013f578063b88d4fde116100b3578063ddbcb5fa11610078578063ddbcb5fa1461070e578063e449f34114610741578063e985e9c514610760578063eec7ee73146107a7578063f0b56b5d146107ba578063f2fde38b146107ce575f80fd5b8063b88d4fde1461068a578063b8f4bd7b146106a9578063bbe33ea5146106c8578063c87b56dd146106db578063d0949f99146106fa575f80fd5b80638da5cb5b116101045780638da5cb5b146105e857806393b6ef591461060557806395d89b411461062457806398ca3b7614610638578063a22cb46514610657578063b1724b4614610676575f80fd5b8063715018a6146105865780637acb77571461059a5780638456cb59146105ad57806384ac79b0146105c1578063863e76db146105d4575f80fd5b806338af3eed116101d65780635ceb8b5b1161019b5780635ceb8b5b146104cb5780635d36598f146104ea5780636198e339146105095780636352211e1461052857806370a0823114610547578063711563d414610566575f80fd5b806338af3eed146103f65780633f4ba83a1461041557806342842e0e14610429578063431cd92a146104485780635c975abb146104ad575f80fd5b8063095ea7b311610227578063095ea7b31461033c5780630cdd53f61461035b5780630f5b2ca51461037a5780631338736f1461039957806323b872dd146103b85780632e17de78146103d7575f80fd5b8062f714ce1461026257806301ffc9a71461028357806303459b16146102b757806306fdde03146102e4578063081812fc14610305575b5f80fd5b34801561026d575f80fd5b5061028161027c3660046124c4565b6107ed565b005b34801561028e575f80fd5b506102a261029d366004612507565b61080e565b60405190151581526020015b60405180910390f35b3480156102c2575f80fd5b506102d66102d1366004612522565b61085f565b6040519081526020016102ae565b3480156102ef575f80fd5b506102f8610883565b6040516102ae9190612586565b348015610310575f80fd5b5061032461031f366004612522565b610912565b6040516001600160a01b0390911681526020016102ae565b348015610347575f80fd5b50610281610356366004612598565b610937565b348015610366575f80fd5b506102816103753660046125c2565b610a4b565b348015610385575f80fd5b506102816103943660046124c4565b610b12565b3480156103a4575f80fd5b506102816103b33660046125c2565b610b28565b3480156103c3575f80fd5b506102816103d23660046125e2565b610b43565b3480156103e2575f80fd5b506102816103f1366004612522565b610b74565b348015610401575f80fd5b50600954610324906001600160a01b031681565b348015610420575f80fd5b50610281610b88565b348015610434575f80fd5b506102816104433660046125e2565b610b9a565b348015610453575f80fd5b50610467610462366004612522565b610bb4565b6040516102ae9190815181526020808301519082015260408083015190820152606080830151908201526080918201516001600160a01b03169181019190915260a00190565b3480156104b8575f80fd5b50600654600160a01b900460ff166102a2565b3480156104d6575f80fd5b506102816104e5366004612668565b610c4a565b3480156104f5575f80fd5b506102816105043660046126b0565b610c95565b348015610514575f80fd5b50610281610523366004612522565b610cd0565b348015610533575f80fd5b50610324610542366004612522565b610ce1565b348015610552575f80fd5b506102d66105613660046126ef565b610d40565b61057961057436600461270a565b610dc4565b6040516102ae9190612746565b348015610591575f80fd5b50610281610e91565b6102d66105a83660046124c4565b610ea2565b3480156105b8575f80fd5b50610281610ed1565b6102816105cf3660046125c2565b610ee1565b3480156105df575f80fd5b506102d6600a81565b3480156105f3575f80fd5b506006546001600160a01b0316610324565b348015610610575f80fd5b506102d661061f366004612522565b610f9e565b34801561062f575f80fd5b506102f8610fdc565b348015610643575f80fd5b50610281610652366004612789565b610feb565b348015610662575f80fd5b506102816106713660046127dc565b611027565b348015610681575f80fd5b506102d6611032565b348015610695575f80fd5b506102816106a4366004612851565b61104d565b3480156106b4575f80fd5b506102816106c3366004612789565b61107f565b6102816106d6366004612668565b6110bb565b3480156106e6575f80fd5b506102f86106f5366004612522565b6111ee565b348015610705575f80fd5b506102d65f1981565b348015610719575f80fd5b506102d67f000000000000000000000000000000000000000000000000000000000000000081565b34801561074c575f80fd5b5061028161075b3660046126b0565b61125d565b34801561076b575f80fd5b506102a261077a36600461290e565b6001600160a01b039182165f90815260056020908152604080832093909416825291909152205460ff1690565b6105796107b536600461293a565b611298565b3480156107c5575f80fd5b506102d6611382565b3480156107d9575f80fd5b506102816107e83660046126ef565b61138e565b6107f5611404565b816107ff81611451565b610809838361148b565b505050565b5f6001600160e01b031982166380ac58cd60e01b148061083e57506001600160e01b03198216635b5e139f60e01b145b8061085957506301ffc9a760e01b6001600160e01b03198316145b92915050565b5f6108698261151f565b5f828152600860205260409020600301546108599061157d565b60605f8054610891906129fb565b80601f01602080910402602001604051908101604052809291908181526020018280546108bd906129fb565b80156109085780601f106108df57610100808354040283529160200191610908565b820191905f5260205f20905b8154815290600101906020018083116108eb57829003601f168201915b5050505050905090565b5f61091c8261151f565b505f908152600460205260409020546001600160a01b031690565b5f61094182610ce1565b9050806001600160a01b0316836001600160a01b0316036109b35760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b03821614806109cf57506109cf813361077a565b610a415760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c00000060648201526084016109aa565b61080983836115d0565b81610a5581611451565b5f8381526008602052604090206003810154610a709061163d565b8054831180610a7d575082155b15610a9b576040516359b9300b60e11b815260040160405180910390fd5b82815f015f828254610aad9190612a47565b9091555050600954610ac8906001600160a01b03168461165e565b6009546040518481526001600160a01b039091169085907f1b606d34afacd55873aba0fd274841a10c63e18455f2dffebad2fc60a36b2c839060200160405180910390a350505050565b610b1a611404565b610b2482826116ce565b5050565b610b30611404565b610b3981611775565b610b2482826117c1565b610b4d3382611851565b610b695760405162461bcd60e51b81526004016109aa90612a5a565b6108098383836118cd565b610b7c611404565b610b8581611a3c565b50565b610b90611acd565b610b98611b27565b565b61080983838360405180602001604052805f81525061104d565b610bea6040518060a001604052805f81526020015f81526020015f81526020015f81526020015f6001600160a01b031681525090565b610bf38261151f565b505f90815260086020908152604091829020825160a08101845281548152600182015492810192909252600281015492820192909252600382015460608201526004909101546001600160a01b0316608082015290565b610c52611404565b610c5b81611775565b5f5b82811015610c8f57610c87848483818110610c7a57610c7a612aa7565b90506020020135836117c1565b600101610c5d565b50505050565b610c9d611404565b5f5b8181101561080957610cc8838383818110610cbc57610cbc612aa7565b90506020020135611b7c565b600101610c9f565b610cd8611404565b610b8581611b7c565b5f818152600260205260408120546001600160a01b0316806108595760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016109aa565b5f6001600160a01b038216610da95760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b60648201526084016109aa565b506001600160a01b03165f9081526003602052604090205490565b6060610dce611404565b610dd785611bd6565b610de084611775565b34610deb8387612abb565b14610e09576040516359b9300b60e11b815260040160405180910390fd5b8167ffffffffffffffff811115610e2257610e2261280c565b604051908082528060200260200182016040528015610e4b578160200160208202803683370190505b5090505f5b82811015610e8857610e63868686611c17565b828281518110610e7557610e75612aa7565b6020908102919091010152600101610e50565b50949350505050565b610e99611acd565b610b985f611cff565b5f610eab611404565b34610eb581611bd6565b610ebe84611775565b610ec9818585611c17565b949350505050565b610ed9611acd565b610b98611d50565b610ee9611404565b81610ef381611451565b610efc82611775565b5f8381526008602052604090206002810154610f1790611d93565b8060010154831015610f3c5760405163257a8d4b60e11b815260040160405180910390fd5b34815f015f828254610f4e9190612ad2565b9091555050600181018390558054604080519182526020820185905285917fd29e04160a74f0dbab5e7b82ef0392d86d11ac2939e5883eb3353be4cfedb83e91015b60405180910390a250505050565b5f610fa88261151f565b5f8281526008602052604090206003810154610fc39061163d565b610fd581600201548260010154611db4565b9392505050565b606060018054610891906129fb565b610ff3611404565b5f5b82811015610c8f5761101f84848381811061101257611012612aa7565b90506020020135836116ce565b600101610ff5565b610b24338383611deb565b61103f600a61016d612abb565b61104a906003612abb565b81565b6110573383611851565b6110735760405162461bcd60e51b81526004016109aa90612a5a565b610c8f84848484611eb8565b611087611404565b5f5b82811015610c8f576110b38484838181106110a6576110a6612aa7565b905060200201358361148b565b600101611089565b6110c3611404565b600182116110e457604051637e878a5f60e11b815260040160405180910390fd5b6110ed81611775565b345f80845b80156111e5575f190186868281811061110d5761110d612aa7565b90506020020135925061111f83611451565b5f838152600860205260409020600381015490925061113d9061163d565b61114f82600201548360010154611db4565b85101561116f5760405163257a8d4b60e11b815260040160405180910390fd5b815461117b9085612ad2565b935080156111915761118c83611eeb565b6110f2565b5f196002830155838255600182018590556040517fb3f4c8ca702dbbd32d9a25ce17b1942a5060284d9d69fc4fcac8fb0397891b12906111d8908990899088908a90612ae5565b60405180910390a16110f2565b50505050505050565b60606111f98261151f565b5f61120e60408051602081019091525f815290565b90505f81511161122c5760405180602001604052805f815250610fd5565b8061123684611f8a565b604051602001611247929190612b29565b6040516020818303038152906040529392505050565b611265611404565b5f5b818110156108095761129083838381811061128457611284612aa7565b90506020020135611a3c565b600101611267565b60606112a2611404565b6112ab84611bd6565b6112b483611775565b348251856112c29190612abb565b146112e0576040516359b9300b60e11b815260040160405180910390fd5b815167ffffffffffffffff8111156112fa576112fa61280c565b604051908082528060200260200182016040528015611323578160200160208202803683370190505b5090505f5b825181101561137a57611355858585848151811061134857611348612aa7565b6020026020010151611c17565b82828151811061136757611367612aa7565b6020908102919091010152600101611328565b509392505050565b61104a600a6003612abb565b611396611acd565b6001600160a01b0381166113fb5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016109aa565b610b8581611cff565b600654600160a01b900460ff1615610b985760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016109aa565b61145a81610ce1565b6001600160a01b0316336001600160a01b031614610b8557604051630da4973960e31b815260040160405180910390fd5b8161149581611451565b5f83815260086020526040902060038101546114b09061157d565b156114ce57604051634e395b8560e01b815260040160405180910390fd5b6114d784611eeb565b6114e483825f015461165e565b6040516001600160a01b0384169085907fd964a27d45f595739c13d8b1160b57491050cacf3a2e5602207277d6228f64ee905f90a350505050565b5f818152600260205260409020546001600160a01b0316610b855760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016109aa565b5f5f19820361159f57604051636263fd5f60e11b815260040160405180910390fd5b5f6115ac600a6003612abb565b6115b69084612ad2565b90504381116115c757505f92915050565b43900392915050565b5f81815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061160482610ce1565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b5f198114610b85576040516343febe2b60e01b815260040160405180910390fd5b5f826001600160a01b0316826040515f6040518083038185875af1925050503d805f81146116a7576040519150601f19603f3d011682016040523d82523d5f602084013e6116ac565b606091505b505090508061080957604051639a7058e160e01b815260040160405180910390fd5b816116d881611451565b5f83815260086020526040902060038101546116f39061163d565b60048101546001600160a01b0380851691160361172357604051637e878a5f60e11b815260040160405180910390fd5b6004810180546001600160a01b0319166001600160a01b03851690811790915560405190815284907f6f08c7e76d830d5f3d0a18fd27f4d8c0049b24a8689ddb39625e0864d894a9c190602001610f90565b611780600a82612b57565b1515806117a35750611795600a61016d612abb565b6117a0906003612abb565b81115b15610b855760405163257a8d4b60e11b815260040160405180910390fd5b816117cb81611451565b5f83815260086020526040902060038101546117e69061163d565b6117f881600201548260010154611db4565b8310156118185760405163257a8d4b60e11b815260040160405180910390fd5b5f19600282015560405183815284907f907fece23ce39fbcbceb71e515043fe29408353fbb393b25b35eb8a70a4bad0b90602001610f90565b5f8061185c83610ce1565b9050806001600160a01b0316846001600160a01b031614806118a257506001600160a01b038082165f9081526005602090815260408083209388168352929052205460ff165b80610ec95750836001600160a01b03166118bb84610912565b6001600160a01b031614949350505050565b826001600160a01b03166118e082610ce1565b6001600160a01b0316146119065760405162461bcd60e51b81526004016109aa90612b76565b6001600160a01b0382166119685760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016109aa565b611975838383600161201a565b826001600160a01b031661198882610ce1565b6001600160a01b0316146119ae5760405162461bcd60e51b81526004016109aa90612b76565b5f81815260046020908152604080832080546001600160a01b03199081169091556001600160a01b038781168086526003855283862080545f1901905590871680865283862080546001019055868652600290945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b80611a4681611451565b5f8281526008602052604090206003810154611a619061163d565b611a7381600201548260010154611db4565b15611a9157604051634e395b8560e01b815260040160405180910390fd5b4360028201819055600382015560405183907f11725367022c3ff288940f4b5473aa61c2da6a24af7363a1128ee2401e8983b2905f90a2505050565b6006546001600160a01b03163314610b985760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016109aa565b611b2f612026565b6006805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b80611b8681611451565b5f8281526008602052604090206002810154611ba190611d93565b43600282015560405183907ff27b6ce5b2f5e68ddb2fd95a8a909d4ecf1daaac270935fff052feacb24f1842905f90a2505050565b7f0000000000000000000000000000000000000000000000000000000000000000811015610b85576040516359b9300b60e11b815260040160405180910390fd5b5f80611c2560075460010190565b60078190556040805160a08101825287815260208082018881525f19838501818152606085019182526001600160a01b038a8116608087019081525f8981526008909652969094209451855591516001850155905160028401555160038301559151600490910180546001600160a01b031916919092161790559050611cab3382612076565b604080516001600160a01b03851681526020810187905290810185905281907f17700ceb1658b18206f427c1578048e87504106b14ec69e9b4586d9a95174a329060600160405180910390a2949350505050565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b611d58611404565b6006805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611b5f3390565b5f198114610b855760405163da808c7560e01b815260040160405180910390fd5b5f5f198303611dc4575080610859565b5f611dcf8385612ad2565b9050438111611de1575f915050610859565b4390039392505050565b816001600160a01b0316836001600160a01b031603611e4c5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016109aa565b6001600160a01b038381165f81815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b611ec38484846118cd565b611ecf8484848461208f565b610c8f5760405162461bcd60e51b81526004016109aa90612bbb565b5f611ef582610ce1565b9050611f04815f84600161201a565b611f0d82610ce1565b5f83815260046020908152604080832080546001600160a01b03199081169091556001600160a01b0385168085526003845282852080545f190190558785526002909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b60605f611f968361218c565b60010190505f8167ffffffffffffffff811115611fb557611fb561280c565b6040519080825280601f01601f191660200182016040528015611fdf576020820181803683370190505b5090508181016020015b5f19016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084611fe957509392505050565b610c8f84848484612263565b600654600160a01b900460ff16610b985760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016109aa565b610b24828260405180602001604052805f8152506122e9565b5f6001600160a01b0384163b1561218157604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906120d2903390899088908890600401612c0d565b6020604051808303815f875af192505050801561210c575060408051601f3d908101601f1916820190925261210991810190612c49565b60015b612167573d808015612139576040519150601f19603f3d011682016040523d82523d5f602084013e61213e565b606091505b5080515f0361215f5760405162461bcd60e51b81526004016109aa90612bbb565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610ec9565b506001949350505050565b5f8072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106121ca5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef810000000083106121f6576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061221457662386f26fc10000830492506010015b6305f5e100831061222c576305f5e100830492506008015b612710831061224057612710830492506004015b60648310612252576064830492506002015b600a83106108595760010192915050565b6001811115610c8f576001600160a01b038416156122a8576001600160a01b0384165f90815260036020526040812080548392906122a2908490612a47565b90915550505b6001600160a01b03831615610c8f576001600160a01b0383165f90815260036020526040812080548392906122de908490612ad2565b909155505050505050565b6122f3838361231b565b6122ff5f84848461208f565b6108095760405162461bcd60e51b81526004016109aa90612bbb565b6001600160a01b0382166123715760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016109aa565b5f818152600260205260409020546001600160a01b0316156123d55760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016109aa565b6123e25f8383600161201a565b5f818152600260205260409020546001600160a01b0316156124465760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016109aa565b6001600160a01b0382165f81815260036020908152604080832080546001019055848352600290915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6001600160a01b0381168114610b85575f80fd5b5f80604083850312156124d5575f80fd5b8235915060208301356124e7816124b0565b809150509250929050565b6001600160e01b031981168114610b85575f80fd5b5f60208284031215612517575f80fd5b8135610fd5816124f2565b5f60208284031215612532575f80fd5b5035919050565b5f5b8381101561255357818101518382015260200161253b565b50505f910152565b5f8151808452612572816020860160208601612539565b601f01601f19169290920160200192915050565b602081525f610fd5602083018461255b565b5f80604083850312156125a9575f80fd5b82356125b4816124b0565b946020939093013593505050565b5f80604083850312156125d3575f80fd5b50508035926020909101359150565b5f805f606084860312156125f4575f80fd5b83356125ff816124b0565b9250602084013561260f816124b0565b929592945050506040919091013590565b5f8083601f840112612630575f80fd5b50813567ffffffffffffffff811115612647575f80fd5b6020830191508360208260051b8501011115612661575f80fd5b9250929050565b5f805f6040848603121561267a575f80fd5b833567ffffffffffffffff811115612690575f80fd5b61269c86828701612620565b909790965060209590950135949350505050565b5f80602083850312156126c1575f80fd5b823567ffffffffffffffff8111156126d7575f80fd5b6126e385828601612620565b90969095509350505050565b5f602082840312156126ff575f80fd5b8135610fd5816124b0565b5f805f806080858703121561271d575f80fd5b84359350602085013592506040850135612736816124b0565b9396929550929360600135925050565b602080825282518282018190525f9190848201906040850190845b8181101561277d57835183529284019291840191600101612761565b50909695505050505050565b5f805f6040848603121561279b575f80fd5b833567ffffffffffffffff8111156127b1575f80fd5b6127bd86828701612620565b90945092505060208401356127d1816124b0565b809150509250925092565b5f80604083850312156127ed575f80fd5b82356127f8816124b0565b9150602083013580151581146124e7575f80fd5b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f1916810167ffffffffffffffff811182821017156128495761284961280c565b604052919050565b5f805f8060808587031215612864575f80fd5b843561286f816124b0565b9350602085810135612880816124b0565b935060408601359250606086013567ffffffffffffffff808211156128a3575f80fd5b818801915088601f8301126128b6575f80fd5b8135818111156128c8576128c861280c565b6128da601f8201601f19168501612820565b915080825289848285010111156128ef575f80fd5b80848401858401375f8482840101525080935050505092959194509250565b5f806040838503121561291f575f80fd5b823561292a816124b0565b915060208301356124e7816124b0565b5f805f6060848603121561294c575f80fd5b833592506020808501359250604085013567ffffffffffffffff80821115612972575f80fd5b818701915087601f830112612985575f80fd5b8135818111156129975761299761280c565b8060051b91506129a8848301612820565b818152918301840191848101908a8411156129c1575f80fd5b938501935b838510156129eb57843592506129db836124b0565b82825293850193908501906129c6565b8096505050505050509250925092565b600181811c90821680612a0f57607f821691505b602082108103612a2d57634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52601160045260245ffd5b8181038181111561085957610859612a33565b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b634e487b7160e01b5f52603260045260245ffd5b808202811582820484141761085957610859612a33565b8082018082111561085957610859612a33565b606080825281018490525f6001600160fb1b03851115612b03575f80fd5b8460051b8087608085013760208301949094525060408101919091520160800192915050565b5f8351612b3a818460208801612539565b835190830190612b4e818360208801612539565b01949350505050565b5f82612b7157634e487b7160e01b5f52601260045260245ffd5b500690565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6001600160a01b03858116825284166020820152604081018390526080606082018190525f90612c3f9083018461255b565b9695505050505050565b5f60208284031215612c59575f80fd5b8151610fd5816124f256fea2646970667358221220205b2909c5a9d941c62e75ad22db4e210223e35d30466fe9ac16d3f20eeb406b64736f6c63430008160033 \ No newline at end of file +60a060405234801562000010575f80fd5b506040516200301d3803806200301d833981016040819052620000339162000118565b60405180604001604052806009815260200168109d58dad95d13919560ba1b815250604051806040016040528060038152602001621092d560ea1b815250815f9081620000819190620001d0565b506001620000908282620001d0565b505050620000ad620000a7620000c360201b60201c565b620000c7565b6006805460ff60a01b1916905560805262000298565b3390565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b5f6020828403121562000129575f80fd5b5051919050565b634e487b7160e01b5f52604160045260245ffd5b600181811c908216806200015957607f821691505b6020821081036200017857634e487b7160e01b5f52602260045260245ffd5b50919050565b601f821115620001cb575f81815260208120601f850160051c81016020861015620001a65750805b601f850160051c820191505b81811015620001c757828155600101620001b2565b5050505b505050565b81516001600160401b03811115620001ec57620001ec62000130565b6200020481620001fd845462000144565b846200017e565b602080601f8311600181146200023a575f8415620002225750858301515b5f19600386901b1c1916600185901b178555620001c7565b5f85815260208120601f198616915b828110156200026a5788860151825594840194600190910190840162000249565b50858210156200028857878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b608051612d5e620002bf5f395f818161074901528181610acd0152611ca80152612d5e5ff3fe608060405260043610610269575f3560e01c8063711563d41161014a578063b1724b46116100be578063ddbcb5fa11610078578063ddbcb5fa14610738578063e449f3411461076b578063e985e9c51461078a578063eec7ee73146107d1578063f0b56b5d146107e4578063f2fde38b146107f8575f80fd5b8063b1724b46146106a0578063b88d4fde146106b4578063b8f4bd7b146106d3578063bbe33ea5146106f2578063c87b56dd14610705578063d0949f9914610724575f80fd5b8063863e76db1161010f578063863e76db146105fe5780638da5cb5b1461061257806393b6ef591461062f57806395d89b411461064e57806398ca3b7614610662578063a22cb46514610681575f80fd5b8063711563d414610590578063715018a6146105b05780637acb7757146105c45780638456cb59146105d757806384ac79b0146105eb575f80fd5b80632e17de78116101e15780635c975abb116101a65780635c975abb146104d75780635ceb8b5b146104f55780635d36598f146105145780636198e339146105335780636352211e1461055257806370a0823114610571575f80fd5b80632e17de781461040157806338af3eed146104205780633f4ba83a1461043f57806342842e0e14610453578063431cd92a14610472575f80fd5b8063095ea7b311610232578063095ea7b3146103475780630cdd53f6146103665780630f5b2ca5146103855780631338736f146103a45780631c31f710146103c357806323b872dd146103e2575f80fd5b8062f714ce1461026d57806301ffc9a71461028e57806303459b16146102c257806306fdde03146102ef578063081812fc14610310575b5f80fd5b348015610278575f80fd5b5061028c610287366004612588565b610817565b005b348015610299575f80fd5b506102ad6102a83660046125cb565b610838565b60405190151581526020015b60405180910390f35b3480156102cd575f80fd5b506102e16102dc3660046125e6565b610889565b6040519081526020016102b9565b3480156102fa575f80fd5b506103036108ad565b6040516102b9919061264a565b34801561031b575f80fd5b5061032f61032a3660046125e6565b61093c565b6040516001600160a01b0390911681526020016102b9565b348015610352575f80fd5b5061028c61036136600461265c565b610961565b348015610371575f80fd5b5061028c610380366004612686565b610a75565b348015610390575f80fd5b5061028c61039f366004612588565b610b91565b3480156103af575f80fd5b5061028c6103be366004612686565b610ba7565b3480156103ce575f80fd5b5061028c6103dd3660046126a6565b610bc2565b3480156103ed575f80fd5b5061028c6103fc3660046126c1565b610c13565b34801561040c575f80fd5b5061028c61041b3660046125e6565b610c44565b34801561042b575f80fd5b5060095461032f906001600160a01b031681565b34801561044a575f80fd5b5061028c610c58565b34801561045e575f80fd5b5061028c61046d3660046126c1565b610c6a565b34801561047d575f80fd5b5061049161048c3660046125e6565b610c84565b6040516102b99190815181526020808301519082015260408083015190820152606080830151908201526080918201516001600160a01b03169181019190915260a00190565b3480156104e2575f80fd5b50600654600160a01b900460ff166102ad565b348015610500575f80fd5b5061028c61050f366004612747565b610d1a565b34801561051f575f80fd5b5061028c61052e36600461278f565b610d65565b34801561053e575f80fd5b5061028c61054d3660046125e6565b610da0565b34801561055d575f80fd5b5061032f61056c3660046125e6565b610db1565b34801561057c575f80fd5b506102e161058b3660046126a6565b610e10565b6105a361059e3660046127ce565b610e94565b6040516102b9919061280a565b3480156105bb575f80fd5b5061028c610f61565b6102e16105d2366004612588565b610f72565b3480156105e2575f80fd5b5061028c610fa1565b61028c6105f9366004612686565b610fb1565b348015610609575f80fd5b506102e1600a81565b34801561061d575f80fd5b506006546001600160a01b031661032f565b34801561063a575f80fd5b506102e16106493660046125e6565b61106e565b348015610659575f80fd5b506103036110ac565b34801561066d575f80fd5b5061028c61067c36600461284d565b6110bb565b34801561068c575f80fd5b5061028c61069b3660046128a0565b6110f7565b3480156106ab575f80fd5b506102e1611102565b3480156106bf575f80fd5b5061028c6106ce366004612915565b61111d565b3480156106de575f80fd5b5061028c6106ed36600461284d565b61114f565b61028c610700366004612747565b61118b565b348015610710575f80fd5b5061030361071f3660046125e6565b6112be565b34801561072f575f80fd5b506102e15f1981565b348015610743575f80fd5b506102e17f000000000000000000000000000000000000000000000000000000000000000081565b348015610776575f80fd5b5061028c61078536600461278f565b61132d565b348015610795575f80fd5b506102ad6107a43660046129d2565b6001600160a01b039182165f90815260056020908152604080832093909416825291909152205460ff1690565b6105a36107df3660046129fe565b611368565b3480156107ef575f80fd5b506102e1611452565b348015610803575f80fd5b5061028c6108123660046126a6565b61145e565b61081f6114d4565b8161082981611521565b610833838361155b565b505050565b5f6001600160e01b031982166380ac58cd60e01b148061086857506001600160e01b03198216635b5e139f60e01b145b8061088357506301ffc9a760e01b6001600160e01b03198316145b92915050565b5f610893826115ef565b5f828152600860205260409020600301546108839061164d565b60605f80546108bb90612abf565b80601f01602080910402602001604051908101604052809291908181526020018280546108e790612abf565b80156109325780601f1061090957610100808354040283529160200191610932565b820191905f5260205f20905b81548152906001019060200180831161091557829003601f168201915b5050505050905090565b5f610946826115ef565b505f908152600460205260409020546001600160a01b031690565b5f61096b82610db1565b9050806001600160a01b0316836001600160a01b0316036109dd5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b03821614806109f957506109f981336107a4565b610a6b5760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c00000060648201526084016109d4565b61083383836116a0565b81610a7f81611521565b6009546001600160a01b0316610aa857604051637e878a5f60e11b815260040160405180910390fd5b5f8381526008602052604090206003810154610ac39061170d565b80548390610af2907f000000000000000000000000000000000000000000000000000000000000000090612b0b565b1080610afc575082155b15610b1a576040516359b9300b60e11b815260040160405180910390fd5b82815f015f828254610b2c9190612b0b565b9091555050600954610b47906001600160a01b03168461172e565b6009546040518481526001600160a01b039091169085907f1b606d34afacd55873aba0fd274841a10c63e18455f2dffebad2fc60a36b2c839060200160405180910390a350505050565b610b996114d4565b610ba3828261179e565b5050565b610baf6114d4565b610bb881611845565b610ba38282611891565b610bca611921565b600980546001600160a01b0319166001600160a01b0383169081179091556040517f373c72efabe4ef3e552ff77838be729f3bc3d8c586df0012902d1baa2377fa1d905f90a250565b610c1d338261197b565b610c395760405162461bcd60e51b81526004016109d490612b1e565b6108338383836119f7565b610c4c6114d4565b610c5581611b66565b50565b610c60611921565b610c68611bf7565b565b61083383838360405180602001604052805f81525061111d565b610cba6040518060a001604052805f81526020015f81526020015f81526020015f81526020015f6001600160a01b031681525090565b610cc3826115ef565b505f90815260086020908152604091829020825160a08101845281548152600182015492810192909252600281015492820192909252600382015460608201526004909101546001600160a01b0316608082015290565b610d226114d4565b610d2b81611845565b5f5b82811015610d5f57610d57848483818110610d4a57610d4a612b6b565b9050602002013583611891565b600101610d2d565b50505050565b610d6d6114d4565b5f5b8181101561083357610d98838383818110610d8c57610d8c612b6b565b90506020020135611c4c565b600101610d6f565b610da86114d4565b610c5581611c4c565b5f818152600260205260408120546001600160a01b0316806108835760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016109d4565b5f6001600160a01b038216610e795760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b60648201526084016109d4565b506001600160a01b03165f9081526003602052604090205490565b6060610e9e6114d4565b610ea785611ca6565b610eb084611845565b34610ebb8387612b7f565b14610ed9576040516359b9300b60e11b815260040160405180910390fd5b8167ffffffffffffffff811115610ef257610ef26128d0565b604051908082528060200260200182016040528015610f1b578160200160208202803683370190505b5090505f5b82811015610f5857610f33868686611ce7565b828281518110610f4557610f45612b6b565b6020908102919091010152600101610f20565b50949350505050565b610f69611921565b610c685f611dcf565b5f610f7b6114d4565b34610f8581611ca6565b610f8e84611845565b610f99818585611ce7565b949350505050565b610fa9611921565b610c68611e20565b610fb96114d4565b81610fc381611521565b610fcc82611845565b5f8381526008602052604090206002810154610fe790611e63565b806001015483101561100c5760405163257a8d4b60e11b815260040160405180910390fd5b34815f015f82825461101e9190612b96565b9091555050600181018390558054604080519182526020820185905285917fd29e04160a74f0dbab5e7b82ef0392d86d11ac2939e5883eb3353be4cfedb83e91015b60405180910390a250505050565b5f611078826115ef565b5f82815260086020526040902060038101546110939061170d565b6110a581600201548260010154611e84565b9392505050565b6060600180546108bb90612abf565b6110c36114d4565b5f5b82811015610d5f576110ef8484838181106110e2576110e2612b6b565b905060200201358361179e565b6001016110c5565b610ba3338383611ebb565b61110f600a61016d612b7f565b61111a906003612b7f565b81565b611127338361197b565b6111435760405162461bcd60e51b81526004016109d490612b1e565b610d5f84848484611f88565b6111576114d4565b5f5b82811015610d5f5761118384848381811061117657611176612b6b565b905060200201358361155b565b600101611159565b6111936114d4565b600182116111b457604051637e878a5f60e11b815260040160405180910390fd5b6111bd81611845565b345f80845b80156112b5575f19018686828181106111dd576111dd612b6b565b9050602002013592506111ef83611521565b5f838152600860205260409020600381015490925061120d9061170d565b61121f82600201548360010154611e84565b85101561123f5760405163257a8d4b60e11b815260040160405180910390fd5b815461124b9085612b96565b935080156112615761125c83611fbb565b6111c2565b5f196002830155838255600182018590556040517fb3f4c8ca702dbbd32d9a25ce17b1942a5060284d9d69fc4fcac8fb0397891b12906112a8908990899088908a90612ba9565b60405180910390a16111c2565b50505050505050565b60606112c9826115ef565b5f6112de60408051602081019091525f815290565b90505f8151116112fc5760405180602001604052805f8152506110a5565b806113068461205a565b604051602001611317929190612bed565b6040516020818303038152906040529392505050565b6113356114d4565b5f5b818110156108335761136083838381811061135457611354612b6b565b90506020020135611b66565b600101611337565b60606113726114d4565b61137b84611ca6565b61138483611845565b348251856113929190612b7f565b146113b0576040516359b9300b60e11b815260040160405180910390fd5b815167ffffffffffffffff8111156113ca576113ca6128d0565b6040519080825280602002602001820160405280156113f3578160200160208202803683370190505b5090505f5b825181101561144a57611425858585848151811061141857611418612b6b565b6020026020010151611ce7565b82828151811061143757611437612b6b565b60209081029190910101526001016113f8565b509392505050565b61111a600a6003612b7f565b611466611921565b6001600160a01b0381166114cb5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016109d4565b610c5581611dcf565b600654600160a01b900460ff1615610c685760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016109d4565b61152a81610db1565b6001600160a01b0316336001600160a01b031614610c5557604051630da4973960e31b815260040160405180910390fd5b8161156581611521565b5f83815260086020526040902060038101546115809061164d565b1561159e57604051634e395b8560e01b815260040160405180910390fd5b6115a784611fbb565b6115b483825f015461172e565b6040516001600160a01b0384169085907fd964a27d45f595739c13d8b1160b57491050cacf3a2e5602207277d6228f64ee905f90a350505050565b5f818152600260205260409020546001600160a01b0316610c555760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016109d4565b5f5f19820361166f57604051636263fd5f60e11b815260040160405180910390fd5b5f61167c600a6003612b7f565b6116869084612b96565b905043811161169757505f92915050565b43900392915050565b5f81815260046020526040902080546001600160a01b0319166001600160a01b03841690811790915581906116d482610db1565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b5f198114610c55576040516343febe2b60e01b815260040160405180910390fd5b5f826001600160a01b0316826040515f6040518083038185875af1925050503d805f8114611777576040519150601f19603f3d011682016040523d82523d5f602084013e61177c565b606091505b505090508061083357604051639a7058e160e01b815260040160405180910390fd5b816117a881611521565b5f83815260086020526040902060038101546117c39061170d565b60048101546001600160a01b038085169116036117f357604051637e878a5f60e11b815260040160405180910390fd5b6004810180546001600160a01b0319166001600160a01b03851690811790915560405190815284907f6f08c7e76d830d5f3d0a18fd27f4d8c0049b24a8689ddb39625e0864d894a9c190602001611060565b611850600a82612c1b565b1515806118735750611865600a61016d612b7f565b611870906003612b7f565b81115b15610c555760405163257a8d4b60e11b815260040160405180910390fd5b8161189b81611521565b5f83815260086020526040902060038101546118b69061170d565b6118c881600201548260010154611e84565b8310156118e85760405163257a8d4b60e11b815260040160405180910390fd5b5f19600282015560405183815284907f907fece23ce39fbcbceb71e515043fe29408353fbb393b25b35eb8a70a4bad0b90602001611060565b6006546001600160a01b03163314610c685760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016109d4565b5f8061198683610db1565b9050806001600160a01b0316846001600160a01b031614806119cc57506001600160a01b038082165f9081526005602090815260408083209388168352929052205460ff165b80610f995750836001600160a01b03166119e58461093c565b6001600160a01b031614949350505050565b826001600160a01b0316611a0a82610db1565b6001600160a01b031614611a305760405162461bcd60e51b81526004016109d490612c3a565b6001600160a01b038216611a925760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016109d4565b611a9f83838360016120ea565b826001600160a01b0316611ab282610db1565b6001600160a01b031614611ad85760405162461bcd60e51b81526004016109d490612c3a565b5f81815260046020908152604080832080546001600160a01b03199081169091556001600160a01b038781168086526003855283862080545f1901905590871680865283862080546001019055868652600290945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b80611b7081611521565b5f8281526008602052604090206003810154611b8b9061170d565b611b9d81600201548260010154611e84565b15611bbb57604051634e395b8560e01b815260040160405180910390fd5b4360028201819055600382015560405183907f11725367022c3ff288940f4b5473aa61c2da6a24af7363a1128ee2401e8983b2905f90a2505050565b611bff612170565b6006805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b80611c5681611521565b5f8281526008602052604090206002810154611c7190611e63565b43600282015560405183907ff27b6ce5b2f5e68ddb2fd95a8a909d4ecf1daaac270935fff052feacb24f1842905f90a2505050565b7f0000000000000000000000000000000000000000000000000000000000000000811015610c55576040516359b9300b60e11b815260040160405180910390fd5b5f80611cf560075460010190565b60078190556040805160a08101825287815260208082018881525f19838501818152606085019182526001600160a01b038a8116608087019081525f8981526008909652969094209451855591516001850155905160028401555160038301559151600490910180546001600160a01b031916919092161790559050611d7b33826121c0565b604080516001600160a01b03851681526020810187905290810185905281907f17700ceb1658b18206f427c1578048e87504106b14ec69e9b4586d9a95174a329060600160405180910390a2949350505050565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b611e286114d4565b6006805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611c2f3390565b5f198114610c555760405163da808c7560e01b815260040160405180910390fd5b5f5f198303611e94575080610883565b5f611e9f8385612b96565b9050438111611eb1575f915050610883565b4390039392505050565b816001600160a01b0316836001600160a01b031603611f1c5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016109d4565b6001600160a01b038381165f81815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b611f938484846119f7565b611f9f848484846121d9565b610d5f5760405162461bcd60e51b81526004016109d490612c7f565b5f611fc582610db1565b9050611fd4815f8460016120ea565b611fdd82610db1565b5f83815260046020908152604080832080546001600160a01b03199081169091556001600160a01b0385168085526003845282852080545f190190558785526002909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b60605f612066836122d6565b60010190505f8167ffffffffffffffff811115612085576120856128d0565b6040519080825280601f01601f1916602001820160405280156120af576020820181803683370190505b5090508181016020015b5f19016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a85049450846120b957509392505050565b6001811115610d5f576001600160a01b0384161561212f576001600160a01b0384165f9081526003602052604081208054839290612129908490612b0b565b90915550505b6001600160a01b03831615610d5f576001600160a01b0383165f9081526003602052604081208054839290612165908490612b96565b909155505050505050565b600654600160a01b900460ff16610c685760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016109d4565b610ba3828260405180602001604052805f8152506123ad565b5f6001600160a01b0384163b156122cb57604051630a85bd0160e11b81526001600160a01b0385169063150b7a029061221c903390899088908890600401612cd1565b6020604051808303815f875af1925050508015612256575060408051601f3d908101601f1916820190925261225391810190612d0d565b60015b6122b1573d808015612283576040519150601f19603f3d011682016040523d82523d5f602084013e612288565b606091505b5080515f036122a95760405162461bcd60e51b81526004016109d490612c7f565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610f99565b506001949350505050565b5f8072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106123145772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310612340576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061235e57662386f26fc10000830492506010015b6305f5e1008310612376576305f5e100830492506008015b612710831061238a57612710830492506004015b6064831061239c576064830492506002015b600a83106108835760010192915050565b6123b783836123df565b6123c35f8484846121d9565b6108335760405162461bcd60e51b81526004016109d490612c7f565b6001600160a01b0382166124355760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016109d4565b5f818152600260205260409020546001600160a01b0316156124995760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016109d4565b6124a65f838360016120ea565b5f818152600260205260409020546001600160a01b03161561250a5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016109d4565b6001600160a01b0382165f81815260036020908152604080832080546001019055848352600290915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6001600160a01b0381168114610c55575f80fd5b5f8060408385031215612599575f80fd5b8235915060208301356125ab81612574565b809150509250929050565b6001600160e01b031981168114610c55575f80fd5b5f602082840312156125db575f80fd5b81356110a5816125b6565b5f602082840312156125f6575f80fd5b5035919050565b5f5b838110156126175781810151838201526020016125ff565b50505f910152565b5f81518084526126368160208601602086016125fd565b601f01601f19169290920160200192915050565b602081525f6110a5602083018461261f565b5f806040838503121561266d575f80fd5b823561267881612574565b946020939093013593505050565b5f8060408385031215612697575f80fd5b50508035926020909101359150565b5f602082840312156126b6575f80fd5b81356110a581612574565b5f805f606084860312156126d3575f80fd5b83356126de81612574565b925060208401356126ee81612574565b929592945050506040919091013590565b5f8083601f84011261270f575f80fd5b50813567ffffffffffffffff811115612726575f80fd5b6020830191508360208260051b8501011115612740575f80fd5b9250929050565b5f805f60408486031215612759575f80fd5b833567ffffffffffffffff81111561276f575f80fd5b61277b868287016126ff565b909790965060209590950135949350505050565b5f80602083850312156127a0575f80fd5b823567ffffffffffffffff8111156127b6575f80fd5b6127c2858286016126ff565b90969095509350505050565b5f805f80608085870312156127e1575f80fd5b843593506020850135925060408501356127fa81612574565b9396929550929360600135925050565b602080825282518282018190525f9190848201906040850190845b8181101561284157835183529284019291840191600101612825565b50909695505050505050565b5f805f6040848603121561285f575f80fd5b833567ffffffffffffffff811115612875575f80fd5b612881868287016126ff565b909450925050602084013561289581612574565b809150509250925092565b5f80604083850312156128b1575f80fd5b82356128bc81612574565b9150602083013580151581146125ab575f80fd5b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561290d5761290d6128d0565b604052919050565b5f805f8060808587031215612928575f80fd5b843561293381612574565b935060208581013561294481612574565b935060408601359250606086013567ffffffffffffffff80821115612967575f80fd5b818801915088601f83011261297a575f80fd5b81358181111561298c5761298c6128d0565b61299e601f8201601f191685016128e4565b915080825289848285010111156129b3575f80fd5b80848401858401375f8482840101525080935050505092959194509250565b5f80604083850312156129e3575f80fd5b82356129ee81612574565b915060208301356125ab81612574565b5f805f60608486031215612a10575f80fd5b833592506020808501359250604085013567ffffffffffffffff80821115612a36575f80fd5b818701915087601f830112612a49575f80fd5b813581811115612a5b57612a5b6128d0565b8060051b9150612a6c8483016128e4565b818152918301840191848101908a841115612a85575f80fd5b938501935b83851015612aaf5784359250612a9f83612574565b8282529385019390850190612a8a565b8096505050505050509250925092565b600181811c90821680612ad357607f821691505b602082108103612af157634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52601160045260245ffd5b8181038181111561088357610883612af7565b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b634e487b7160e01b5f52603260045260245ffd5b808202811582820484141761088357610883612af7565b8082018082111561088357610883612af7565b606080825281018490525f6001600160fb1b03851115612bc7575f80fd5b8460051b8087608085013760208301949094525060408101919091520160800192915050565b5f8351612bfe8184602088016125fd565b835190830190612c128183602088016125fd565b01949350505050565b5f82612c3557634e487b7160e01b5f52601260045260245ffd5b500690565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6001600160a01b03858116825284166020820152604081018390526080606082018190525f90612d039083018461261f565b9695505050505050565b5f60208284031215612d1d575f80fd5b81516110a5816125b656fea2646970667358221220027ee4608b145a8ed59ffb66440679a45eb618169f56d7700c19cfd1133cd9d664736f6c63430008140033 \ No newline at end of file diff --git a/systemcontractindex/stakingindex/event_handler.go b/systemcontractindex/stakingindex/event_handler.go index f5ed8deffe..e10c8256f0 100644 --- a/systemcontractindex/stakingindex/event_handler.go +++ b/systemcontractindex/stakingindex/event_handler.go @@ -82,7 +82,7 @@ func (eh *eventHandler) HandleEvent(ctx context.Context, blk *block.Block, actLo return eh.handleDonatedEvent(event) case "Transfer": return eh.handleTransferEvent(event) - case "Approval", "ApprovalForAll", "OwnershipTransferred", "Paused", "Unpaused": + case "Approval", "ApprovalForAll", "OwnershipTransferred", "Paused", "Unpaused", "BeneficiaryChanged": // not require handling events return nil default: