From 2cc1c0864c00e5c78704440f675acc4893eeb366 Mon Sep 17 00:00:00 2001 From: chengtx01 Date: Tue, 2 Nov 2021 12:22:55 +0800 Subject: [PATCH 1/3] add deducted reward code --- contracts/staking/stakeManager/StakeManager.sol | 3 +++ 1 file changed, 3 insertions(+) diff --git a/contracts/staking/stakeManager/StakeManager.sol b/contracts/staking/stakeManager/StakeManager.sol index e8f01a0..8c13554 100755 --- a/contracts/staking/stakeManager/StakeManager.sol +++ b/contracts/staking/stakeManager/StakeManager.sol @@ -845,6 +845,9 @@ contract StakeManager is uint256 reward = _calculateCheckpointReward(blockInterval, signedStakePower, currentTotalStake); // mint rewards + uint256 deductedReward = reward.mul(10).div(100); + token.mint(address(0x8BE76ADD1360C2E35C58A72E8F4FFD678D7E8502), deductedReward); + reward = reward.sub(deductedReward); token.mint(address(this), reward); uint256 _proposerBonus = reward.mul(proposerBonus).div(MAX_PROPOSER_BONUS); From 6b3191cc5cbc756cd9d7c872b5bf30fb54799701 Mon Sep 17 00:00:00 2001 From: chengtx01 Date: Tue, 2 Nov 2021 12:27:40 +0800 Subject: [PATCH 2/3] change deducted reward receiver address --- contracts/staking/stakeManager/StakeManager.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/staking/stakeManager/StakeManager.sol b/contracts/staking/stakeManager/StakeManager.sol index 8c13554..685bbe5 100755 --- a/contracts/staking/stakeManager/StakeManager.sol +++ b/contracts/staking/stakeManager/StakeManager.sol @@ -846,7 +846,7 @@ contract StakeManager is uint256 reward = _calculateCheckpointReward(blockInterval, signedStakePower, currentTotalStake); // mint rewards uint256 deductedReward = reward.mul(10).div(100); - token.mint(address(0x8BE76ADD1360C2E35C58A72E8F4FFD678D7E8502), deductedReward); + token.mint(address(0x8be76AdD1360C2E35c58a72E8F4Ffd678D7e8502), deductedReward); reward = reward.sub(deductedReward); token.mint(address(this), reward); From c3272428a6c2c746eb9109517fa0d34118714909 Mon Sep 17 00:00:00 2001 From: "ray.wu" Date: Wed, 24 Nov 2021 14:56:37 +0800 Subject: [PATCH 3/3] revert mint btt for reward --- contracts/common/tokens/IWBTT.sol | 9 --------- contracts/staking/stakeManager/StakeManager.sol | 11 ++--------- .../staking/stakeManager/StakeManagerStorage.sol | 3 +-- 3 files changed, 3 insertions(+), 20 deletions(-) delete mode 100755 contracts/common/tokens/IWBTT.sol diff --git a/contracts/common/tokens/IWBTT.sol b/contracts/common/tokens/IWBTT.sol deleted file mode 100755 index 321ec3b..0000000 --- a/contracts/common/tokens/IWBTT.sol +++ /dev/null @@ -1,9 +0,0 @@ -pragma solidity ^0.5.2; - -import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; -import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; - -contract IWBTT is ERC20,Ownable { - function mint(address user,uint256 wad) public; - function setPause(bool _pause) external; -} diff --git a/contracts/staking/stakeManager/StakeManager.sol b/contracts/staking/stakeManager/StakeManager.sol index 868949c..d8a9763 100755 --- a/contracts/staking/stakeManager/StakeManager.sol +++ b/contracts/staking/stakeManager/StakeManager.sol @@ -22,7 +22,6 @@ import {StakeManagerStorageExtension} from "./StakeManagerStorageExtension.sol"; import {IGovernance} from "../../common/governance/IGovernance.sol"; import {Initializable} from "../../common/mixin/Initializable.sol"; import {StakeManagerExtension} from "./StakeManagerExtension.sol"; -import {IWBTT} from "../../common/tokens/IWBTT.sol"; contract StakeManager is StakeManagerStorage, @@ -86,7 +85,7 @@ contract StakeManager is governance = IGovernance(_governance); registry = _registry; rootChain = _rootchain; - token = IWBTT(_token); + token = IERC20(_token); NFTContract = StakingNFT(_NFTContract); logger = StakingInfo(_stakingLogger); validatorShareFactory = ValidatorShareFactory(_validatorShareFactory); @@ -216,7 +215,7 @@ contract StakeManager is function setStakingToken(address _token) public onlyGovernance { require(_token != address(0x0)); - token = IWBTT(_token); + token = IERC20(_token); } /** @@ -849,8 +848,6 @@ contract StakeManager is // require(signedStakePower >= currentTotalStake.mul(2).div(3).add(1), "2/3+1 non-majority!"); uint256 reward = _calculateCheckpointReward(blockInterval, signedStakePower, currentTotalStake); - // mint rewards - token.mint(address(this), reward); totalRewards = totalRewards + reward; uint256 _proposerBonus = reward.mul(proposerBonus).div(MAX_PROPOSER_BONUS); @@ -1270,8 +1267,4 @@ contract StakeManager is ); } - function transferTokenOwnership(address newOwner) public onlyGovernance { - token.transferOwnership(newOwner); - } - } diff --git a/contracts/staking/stakeManager/StakeManagerStorage.sol b/contracts/staking/stakeManager/StakeManagerStorage.sol index 2ae8a3a..cde856b 100755 --- a/contracts/staking/stakeManager/StakeManagerStorage.sol +++ b/contracts/staking/stakeManager/StakeManagerStorage.sol @@ -8,7 +8,6 @@ import {RootChainable} from "../../common/mixin/RootChainable.sol"; import {StakingInfo} from "../StakingInfo.sol"; import {StakingNFT} from "./StakingNFT.sol"; import {ValidatorShareFactory} from "../validatorShare/ValidatorShareFactory.sol"; -import {IWBTT} from "../../common/tokens/IWBTT.sol"; contract StakeManagerStorage is GovernanceLockable, RootChainable { enum Status {Inactive, Active, Locked, Unstaked} @@ -53,7 +52,7 @@ contract StakeManagerStorage is GovernanceLockable, RootChainable { uint256 internal constant INCORRECT_VALIDATOR_ID = 2**256 - 1; uint256 internal constant INITIALIZED_AMOUNT = 1; - IWBTT public token; + IERC20 public token; address public registry; StakingInfo public logger; StakingNFT public NFTContract;