@@ -20,8 +20,8 @@ contract LimitedTokenPool is Initializable, AccessControl, IOnBlockListener {
20
20
}
21
21
22
22
struct LimitsConfig {
23
- uint rewardTokenPrice;
24
- uint interest;
23
+ uint rewardTokenPrice; // Represented as parts of BILLION 1 = Billion
24
+ uint interest; // represented as parts of BILLION. 100% = Billion
25
25
uint interestRate;
26
26
uint minDepositValue;
27
27
uint minStakeValue;
@@ -30,7 +30,7 @@ contract LimitedTokenPool is Initializable, AccessControl, IOnBlockListener {
30
30
uint stakeLockPeriod; // Time in seconds to how long the stake is locker before unstake
31
31
uint maxTotalStakeValue;
32
32
uint maxStakePerUserValue;
33
- uint stakeLimitsMultiplier; // Should be represented as parts of BILLION
33
+ uint stakeLimitsMultiplier; // Represented as parts of BILLION 1 = Billion
34
34
}
35
35
36
36
struct Info {
@@ -92,6 +92,7 @@ contract LimitedTokenPool is Initializable, AccessControl, IOnBlockListener {
92
92
// OWNER METHODS
93
93
94
94
function setLimitsConfig (LimitsConfig calldata config ) public onlyRole (DEFAULT_ADMIN_ROLE) {
95
+ //TODO: Validate config
95
96
limitsConfig = config;
96
97
emit LimitsConfigChanged (config);
97
98
}
@@ -150,6 +151,7 @@ contract LimitedTokenPool is Initializable, AccessControl, IOnBlockListener {
150
151
require (mainConfig.profitableToken == address (0 ), "Pool: does not accept native coin " );
151
152
require (msg .value == amount, "Pool: wrong amount of native coin " );
152
153
} else {
154
+ require (mainConfig.profitableToken != address (0 ), "Pool: does not accept ERC20 tokens " );
153
155
IERC20 (mainConfig.profitableToken).safeTransferFrom (msg .sender , address (this ), amount);
154
156
}
155
157
@@ -304,7 +306,7 @@ contract LimitedTokenPool is Initializable, AccessControl, IOnBlockListener {
304
306
stakers[user].claimableRewards = 0 ;
305
307
306
308
// TODO: Use decimals for reward token price
307
- uint rewardTokenAmount = amount * limitsConfig.rewardTokenPrice;
309
+ uint rewardTokenAmount = amount * limitsConfig.rewardTokenPrice / BILLION ;
308
310
if (mainConfig.rewardToken == address (0 )) {
309
311
rewardsBank.withdrawAmb (payable (user), amount);
310
312
} else {
@@ -324,4 +326,9 @@ contract LimitedTokenPool is Initializable, AccessControl, IOnBlockListener {
324
326
else info.totalRewardsDebt += newDebt - oldDebt;
325
327
stakers[user].rewardsDebt = newDebt;
326
328
}
329
+
330
+ function _isLimitsConfigValid (LimitsConfig calldata config ) internal pure returns (bool ) {
331
+
332
+ return true ;
333
+ }
327
334
}
0 commit comments