diff --git a/.openzeppelin/unknown-30746.json b/.openzeppelin/unknown-30746.json index 273aeca..1454f0a 100644 --- a/.openzeppelin/unknown-30746.json +++ b/.openzeppelin/unknown-30746.json @@ -3066,6 +3066,340 @@ } } } + }, + "f1bb44122edd6286070134dda7b7d29673f84486f1e5ce51a6c803974e7fe448": { + "address": "0xD322465FA2ff95e5B52309b795B17897F244f502", + "txHash": "0x23611b93329c3df460f125c5db60a1f017f83bb84ae745325dedda6139f6c23d", + "layout": { + "solcVersion": "0.8.17", + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:63", + "retypedFrom": "bool" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:68" + }, + { + "label": "_roles", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_bytes32,t_struct(RoleData)2225_storage)", + "contract": "AccessControl", + "src": "@openzeppelin/contracts/access/AccessControl.sol:56" + }, + { + "label": "active", + "offset": 0, + "slot": "2", + "type": "t_bool", + "contract": "LimitedTokenPool", + "src": "contracts/staking/token/LimitedTokenPool.sol:54" + }, + { + "label": "lockKeeper", + "offset": 1, + "slot": "2", + "type": "t_contract(LockKeeper)6343", + "contract": "LimitedTokenPool", + "src": "contracts/staking/token/LimitedTokenPool.sol:56" + }, + { + "label": "rewardsBank", + "offset": 0, + "slot": "3", + "type": "t_contract(RewardsBank)6551", + "contract": "LimitedTokenPool", + "src": "contracts/staking/token/LimitedTokenPool.sol:57" + }, + { + "label": "mainConfig", + "offset": 0, + "slot": "4", + "type": "t_struct(MainConfig)6577_storage", + "contract": "LimitedTokenPool", + "src": "contracts/staking/token/LimitedTokenPool.sol:59" + }, + { + "label": "limitsConfig", + "offset": 0, + "slot": "8", + "type": "t_struct(LimitsConfig)6600_storage", + "contract": "LimitedTokenPool", + "src": "contracts/staking/token/LimitedTokenPool.sol:60" + }, + { + "label": "info", + "offset": 0, + "slot": "19", + "type": "t_struct(Info)6611_storage", + "contract": "LimitedTokenPool", + "src": "contracts/staking/token/LimitedTokenPool.sol:61" + }, + { + "label": "stakers", + "offset": 0, + "slot": "24", + "type": "t_mapping(t_address,t_struct(Staker)6624_storage)", + "contract": "LimitedTokenPool", + "src": "contracts/staking/token/LimitedTokenPool.sol:63" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(LockKeeper)6343": { + "label": "contract LockKeeper", + "numberOfBytes": "20" + }, + "t_contract(RewardsBank)6551": { + "label": "contract RewardsBank", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_bool)": { + "label": "mapping(address => bool)", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_struct(Staker)6624_storage)": { + "label": "mapping(address => struct LimitedTokenPool.Staker)", + "numberOfBytes": "32" + }, + "t_mapping(t_bytes32,t_struct(RoleData)2225_storage)": { + "label": "mapping(bytes32 => struct AccessControl.RoleData)", + "numberOfBytes": "32" + }, + "t_string_storage": { + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(Info)6611_storage": { + "label": "struct LimitedTokenPool.Info", + "members": [ + { + "label": "totalStake", + "type": "t_uint256", + "offset": 0, + "slot": "0" + }, + { + "label": "totalDeposit", + "type": "t_uint256", + "offset": 0, + "slot": "1" + }, + { + "label": "totalRewards", + "type": "t_uint256", + "offset": 0, + "slot": "2" + }, + { + "label": "lastInterestUpdate", + "type": "t_uint256", + "offset": 0, + "slot": "3" + }, + { + "label": "totalRewardsDebt", + "type": "t_uint256", + "offset": 0, + "slot": "4" + } + ], + "numberOfBytes": "160" + }, + "t_struct(LimitsConfig)6600_storage": { + "label": "struct LimitedTokenPool.LimitsConfig", + "members": [ + { + "label": "rewardTokenPrice", + "type": "t_uint256", + "offset": 0, + "slot": "0" + }, + { + "label": "interest", + "type": "t_uint256", + "offset": 0, + "slot": "1" + }, + { + "label": "interestRate", + "type": "t_uint256", + "offset": 0, + "slot": "2" + }, + { + "label": "minDepositValue", + "type": "t_uint256", + "offset": 0, + "slot": "3" + }, + { + "label": "minStakeValue", + "type": "t_uint256", + "offset": 0, + "slot": "4" + }, + { + "label": "fastUnstakePenalty", + "type": "t_uint256", + "offset": 0, + "slot": "5" + }, + { + "label": "unstakeLockPeriod", + "type": "t_uint256", + "offset": 0, + "slot": "6" + }, + { + "label": "stakeLockPeriod", + "type": "t_uint256", + "offset": 0, + "slot": "7" + }, + { + "label": "maxTotalStakeValue", + "type": "t_uint256", + "offset": 0, + "slot": "8" + }, + { + "label": "maxStakePerUserValue", + "type": "t_uint256", + "offset": 0, + "slot": "9" + }, + { + "label": "stakeLimitsMultiplier", + "type": "t_uint256", + "offset": 0, + "slot": "10" + } + ], + "numberOfBytes": "352" + }, + "t_struct(MainConfig)6577_storage": { + "label": "struct LimitedTokenPool.MainConfig", + "members": [ + { + "label": "name", + "type": "t_string_storage", + "offset": 0, + "slot": "0" + }, + { + "label": "limitsMultiplierToken", + "type": "t_address", + "offset": 0, + "slot": "1" + }, + { + "label": "profitableToken", + "type": "t_address", + "offset": 0, + "slot": "2" + }, + { + "label": "rewardToken", + "type": "t_address", + "offset": 0, + "slot": "3" + } + ], + "numberOfBytes": "128" + }, + "t_struct(RoleData)2225_storage": { + "label": "struct AccessControl.RoleData", + "members": [ + { + "label": "members", + "type": "t_mapping(t_address,t_bool)", + "offset": 0, + "slot": "0" + }, + { + "label": "adminRole", + "type": "t_bytes32", + "offset": 0, + "slot": "1" + } + ], + "numberOfBytes": "64" + }, + "t_struct(Staker)6624_storage": { + "label": "struct LimitedTokenPool.Staker", + "members": [ + { + "label": "stake", + "type": "t_uint256", + "offset": 0, + "slot": "0" + }, + { + "label": "deposit", + "type": "t_uint256", + "offset": 0, + "slot": "1" + }, + { + "label": "rewardsDebt", + "type": "t_uint256", + "offset": 0, + "slot": "2" + }, + { + "label": "claimableRewards", + "type": "t_uint256", + "offset": 0, + "slot": "3" + }, + { + "label": "lockedWithdrawal", + "type": "t_uint256", + "offset": 0, + "slot": "4" + }, + { + "label": "stakedAt", + "type": "t_uint256", + "offset": 0, + "slot": "5" + } + ], + "numberOfBytes": "192" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "label": "uint8", + "numberOfBytes": "1" + } + } + } } } } diff --git a/contracts/staking/token/LimitedTokenPool.sol b/contracts/staking/token/LimitedTokenPool.sol index ded0c65..58980bf 100644 --- a/contracts/staking/token/LimitedTokenPool.sol +++ b/contracts/staking/token/LimitedTokenPool.sol @@ -238,7 +238,8 @@ contract LimitedTokenPool is Initializable, AccessControl, IOnBlockListener { } function onBlock() external { - _addInterest(); + if (info.lastInterestUpdate + limitsConfig.interestRate < block.timestamp) + _addInterest(); } // VIEW METHODS @@ -269,7 +270,6 @@ contract LimitedTokenPool is Initializable, AccessControl, IOnBlockListener { // INTERNAL METHODS function _addInterest() internal { - if (info.lastInterestUpdate + limitsConfig.interestRate > block.timestamp) return; uint timePassed = block.timestamp - info.lastInterestUpdate; uint newRewards = info.totalStake * limitsConfig.interest * timePassed / BILLION / limitsConfig.interestRate; diff --git a/deployments/30746.json b/deployments/30746.json index 1418196..9500943 100644 --- a/deployments/30746.json +++ b/deployments/30746.json @@ -1717,7 +1717,7 @@ } }, "Ecosystem_LimitedTokenPoolsManager_Multisig": { - "address": "0x07Fc48A302517ee4F78db39b64faa252ca868227", + "address": "0xD3DB63d658e108060b334512C22bA3b640290207", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -1753,11 +1753,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0x7cc3475a14219fe75c321e2d412c0927de013f6cfa4ce198b6f38782db18a1de", + "deployTx": "0x65eacd887a173eb872bc096a3aa940a7d172f4b135b0c19fc68cc79566bf5daf", "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" }, "Ecosystem_LimitedTokenPoolsManager_RewardsBank": { - "address": "0x8E4b7C6e186B50C67Bb3eEACE91c82D1B5f78194", + "address": "0xb23A1D12147f01eE4A6e3C4c0f0ac8c7DC3B3D97", "abi": [ "constructor()", "event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)", @@ -1773,11 +1773,11 @@ "function withdrawAmb(address addressTo, uint256 amount)", "function withdrawErc20(address tokenAddress, address addressTo, uint256 amount)" ], - "deployTx": "0x52e239066915d614595343e1d94883eb91ffb7611adcd368796f0591aeffe84e", + "deployTx": "0x0eb2e9f216afeaa0dc8ff2a87a813ee829670cbff28039c4ba2d8b1dad5aa07c", "fullyQualifiedName": "contracts/funds/RewardsBank.sol:RewardsBank" }, "Ecosystem_LimitedTokenPoolsManager": { - "address": "0x6A2Df3Bf4D3226320654adD161c0019D19BDfEF3", + "address": "0x8E5EAa7CCef240EF54dbeC2582300a63a8d19183", "abi": [ "constructor(address bank_, address lockKeeper_, address doubleSideBeacon_)", "event LimitedPoolActivated(address pool)", @@ -1803,7 +1803,7 @@ "function revokeRole(bytes32 role, address account)", "function supportsInterface(bytes4 interfaceId) view returns (bool)" ], - "deployTx": "0xf3e6344273a8ffe08552b25c31a951c34f6e2612b9018b0a001afcc7f82206c5", + "deployTx": "0xb3988828f64355e84693dbd7a17b9f564becaad040d0efe3960addf2f7beb300", "fullyQualifiedName": "contracts/staking/token/LimitedTokenPoolsManager.sol:LimitedTokenPoolsManager" } } \ No newline at end of file