Skip to content

Commit 0d7d943

Browse files
update
1 parent 2ec78fa commit 0d7d943

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

contracts/staking/token/LimitedTokenPool.sol

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ contract LimitedTokenPool is Initializable, AccessControl, IOnBlockListener {
2020
}
2121

2222
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
2525
uint interestRate;
2626
uint minDepositValue;
2727
uint minStakeValue;
@@ -30,7 +30,7 @@ contract LimitedTokenPool is Initializable, AccessControl, IOnBlockListener {
3030
uint stakeLockPeriod; // Time in seconds to how long the stake is locker before unstake
3131
uint maxTotalStakeValue;
3232
uint maxStakePerUserValue;
33-
uint stakeLimitsMultiplier; // Should be represented as parts of BILLION
33+
uint stakeLimitsMultiplier; // Represented as parts of BILLION 1 = Billion
3434
}
3535

3636
struct Info {
@@ -92,6 +92,7 @@ contract LimitedTokenPool is Initializable, AccessControl, IOnBlockListener {
9292
// OWNER METHODS
9393

9494
function setLimitsConfig(LimitsConfig calldata config) public onlyRole(DEFAULT_ADMIN_ROLE) {
95+
//TODO: Validate config
9596
limitsConfig = config;
9697
emit LimitsConfigChanged(config);
9798
}
@@ -150,6 +151,7 @@ contract LimitedTokenPool is Initializable, AccessControl, IOnBlockListener {
150151
require(mainConfig.profitableToken == address(0), "Pool: does not accept native coin");
151152
require(msg.value == amount, "Pool: wrong amount of native coin");
152153
} else {
154+
require(mainConfig.profitableToken != address(0), "Pool: does not accept ERC20 tokens");
153155
IERC20(mainConfig.profitableToken).safeTransferFrom(msg.sender, address(this), amount);
154156
}
155157

@@ -304,7 +306,7 @@ contract LimitedTokenPool is Initializable, AccessControl, IOnBlockListener {
304306
stakers[user].claimableRewards = 0;
305307

306308
// TODO: Use decimals for reward token price
307-
uint rewardTokenAmount = amount * limitsConfig.rewardTokenPrice;
309+
uint rewardTokenAmount = amount * limitsConfig.rewardTokenPrice / BILLION;
308310
if (mainConfig.rewardToken == address(0)) {
309311
rewardsBank.withdrawAmb(payable(user), amount);
310312
} else {
@@ -324,4 +326,9 @@ contract LimitedTokenPool is Initializable, AccessControl, IOnBlockListener {
324326
else info.totalRewardsDebt += newDebt - oldDebt;
325327
stakers[user].rewardsDebt = newDebt;
326328
}
329+
330+
function _isLimitsConfigValid(LimitsConfig calldata config) internal pure returns (bool) {
331+
332+
return true;
333+
}
327334
}

0 commit comments

Comments
 (0)