Skip to content

Commit 351b0a2

Browse files
authored
Merge pull request #403 from OriginTrail/reworked-staking-only-fullscenario-test
added fullscenario test integration/Staking
2 parents 060442f + fc80193 commit 351b0a2

4 files changed

Lines changed: 2798 additions & 1 deletion

File tree

abi/StakingKPI.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,19 @@
256256
"stateMutability": "pure",
257257
"type": "function"
258258
},
259+
{
260+
"inputs": [],
261+
"name": "parametersStorage",
262+
"outputs": [
263+
{
264+
"internalType": "contract ParametersStorage",
265+
"name": "",
266+
"type": "address"
267+
}
268+
],
269+
"stateMutability": "view",
270+
"type": "function"
271+
},
259272
{
260273
"inputs": [],
261274
"name": "profileStorage",

contracts/StakingKPI.sol

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {ProfileLib} from "./libraries/ProfileLib.sol";
1414
import {IdentityLib} from "./libraries/IdentityLib.sol";
1515
import {EpochStorage} from "./storage/EpochStorage.sol";
1616
import {RandomSamplingStorage} from "./storage/RandomSamplingStorage.sol";
17+
import {ParametersStorage} from "./storage/ParametersStorage.sol";
1718

1819
contract StakingKPI is INamed, IVersioned, ContractStatus, IInitializable {
1920
string private constant _NAME = "StakingKPI";
@@ -26,6 +27,7 @@ contract StakingKPI is INamed, IVersioned, ContractStatus, IInitializable {
2627
DelegatorsInfo public delegatorsInfo;
2728
RandomSamplingStorage public randomSamplingStorage;
2829
EpochStorage public epochStorage;
30+
ParametersStorage public parametersStorage;
2931

3032
/**
3133
* @dev Initializes the StakingKPI contract with the Hub address for access control
@@ -51,6 +53,7 @@ contract StakingKPI is INamed, IVersioned, ContractStatus, IInitializable {
5153
delegatorsInfo = DelegatorsInfo(hub.getContractAddress("DelegatorsInfo"));
5254
randomSamplingStorage = RandomSamplingStorage(hub.getContractAddress("RandomSamplingStorage"));
5355
epochStorage = EpochStorage(hub.getContractAddress("EpochStorageV8"));
56+
parametersStorage = ParametersStorage(hub.getContractAddress("ParametersStorage"));
5457
}
5558

5659
/**
@@ -176,7 +179,9 @@ contract StakingKPI is INamed, IVersioned, ContractStatus, IInitializable {
176179
uint256 totalNodeRewards = (epocRewardsPool * nodeScore18) / allNodesScore18;
177180

178181
uint256 feePercentageForEpoch = profileStorage.getLatestOperatorFeePercentage(identityId);
179-
uint96 operatorFeeAmount = uint96((totalNodeRewards * feePercentageForEpoch) / 10_000);
182+
uint96 operatorFeeAmount = uint96(
183+
(totalNodeRewards * feePercentageForEpoch) / parametersStorage.maxOperatorFee()
184+
);
180185

181186
return totalNodeRewards - operatorFeeAmount;
182187
}

deploy/024_deploy_staking_kpi.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ func.dependencies = [
1717
'DelegatorsInfo',
1818
'RandomSamplingStorage',
1919
'EpochStorageV8',
20+
'ParametersStorage',
2021
];

0 commit comments

Comments
 (0)