Skip to content

Commit

Permalink
Fix: liquid staking: interest validation
Browse files Browse the repository at this point in the history
  • Loading branch information
SigismundSchlomo committed Sep 13, 2024
1 parent 148a12f commit 3500d00
Show file tree
Hide file tree
Showing 3 changed files with 288 additions and 2 deletions.
286 changes: 286 additions & 0 deletions .openzeppelin/unknown-22040.json
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,292 @@
}
}
}
},
"c175c6f01c5abf83d845d8ced9752ce588423d3788c359bee97f1d6ecb7ecebf": {
"address": "0x7184DD655aacCCb28376Fa1B59e3712566Df670b",
"txHash": "0xc1ee43f1da0b1399c4f473dc9a50ffe9be7a7847386e5af211fedc8342baaccd",
"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": "__gap",
"offset": 0,
"slot": "1",
"type": "t_array(t_uint256)50_storage",
"contract": "ContextUpgradeable",
"src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:36"
},
{
"label": "__gap",
"offset": 0,
"slot": "51",
"type": "t_array(t_uint256)50_storage",
"contract": "ERC165Upgradeable",
"src": "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol:41"
},
{
"label": "_roles",
"offset": 0,
"slot": "101",
"type": "t_mapping(t_bytes32,t_struct(RoleData)179_storage)",
"contract": "AccessControlUpgradeable",
"src": "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol:62"
},
{
"label": "__gap",
"offset": 0,
"slot": "102",
"type": "t_array(t_uint256)49_storage",
"contract": "AccessControlUpgradeable",
"src": "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol:260"
},
{
"label": "nodeManager",
"offset": 0,
"slot": "151",
"type": "t_contract(LiquidNodesManager)14548",
"contract": "LiquidPool",
"src": "contracts/staking/liquid/LiquidPool.sol:17"
},
{
"label": "rewardsBank",
"offset": 0,
"slot": "152",
"type": "t_contract(RewardsBank)10477",
"contract": "LiquidPool",
"src": "contracts/staking/liquid/LiquidPool.sol:18"
},
{
"label": "tiers",
"offset": 0,
"slot": "153",
"type": "t_contract(StakingTiers)15953",
"contract": "LiquidPool",
"src": "contracts/staking/liquid/LiquidPool.sol:19"
},
{
"label": "lockKeeper",
"offset": 0,
"slot": "154",
"type": "t_contract(LockKeeper)7804",
"contract": "LiquidPool",
"src": "contracts/staking/liquid/LiquidPool.sol:20"
},
{
"label": "bondAddress",
"offset": 0,
"slot": "155",
"type": "t_address",
"contract": "LiquidPool",
"src": "contracts/staking/liquid/LiquidPool.sol:21"
},
{
"label": "stAmb",
"offset": 0,
"slot": "156",
"type": "t_contract(StAMB)15759",
"contract": "LiquidPool",
"src": "contracts/staking/liquid/LiquidPool.sol:22"
},
{
"label": "minStakeValue",
"offset": 0,
"slot": "157",
"type": "t_uint256",
"contract": "LiquidPool",
"src": "contracts/staking/liquid/LiquidPool.sol:24"
},
{
"label": "unstakeLockTime",
"offset": 0,
"slot": "158",
"type": "t_uint256",
"contract": "LiquidPool",
"src": "contracts/staking/liquid/LiquidPool.sol:25"
},
{
"label": "interest",
"offset": 0,
"slot": "159",
"type": "t_uint256",
"contract": "LiquidPool",
"src": "contracts/staking/liquid/LiquidPool.sol:27"
},
{
"label": "interestPeriod",
"offset": 0,
"slot": "160",
"type": "t_uint256",
"contract": "LiquidPool",
"src": "contracts/staking/liquid/LiquidPool.sol:28"
},
{
"label": "lastInterestTime",
"offset": 0,
"slot": "161",
"type": "t_uint256",
"contract": "LiquidPool",
"src": "contracts/staking/liquid/LiquidPool.sol:29"
},
{
"label": "fastUnstakePenalty",
"offset": 0,
"slot": "162",
"type": "t_uint256",
"contract": "LiquidPool",
"src": "contracts/staking/liquid/LiquidPool.sol:30"
},
{
"label": "totalRewards",
"offset": 0,
"slot": "163",
"type": "t_uint256",
"contract": "LiquidPool",
"src": "contracts/staking/liquid/LiquidPool.sol:32"
},
{
"label": "totalRewardsDebt",
"offset": 0,
"slot": "164",
"type": "t_uint256",
"contract": "LiquidPool",
"src": "contracts/staking/liquid/LiquidPool.sol:33"
},
{
"label": "rewardsCanClaim",
"offset": 0,
"slot": "165",
"type": "t_mapping(t_address,t_uint256)",
"contract": "LiquidPool",
"src": "contracts/staking/liquid/LiquidPool.sol:36"
},
{
"label": "rewardsDebt",
"offset": 0,
"slot": "166",
"type": "t_mapping(t_address,t_uint256)",
"contract": "LiquidPool",
"src": "contracts/staking/liquid/LiquidPool.sol:40"
},
{
"label": "lockedWithdraws",
"offset": 0,
"slot": "167",
"type": "t_mapping(t_address,t_uint256)",
"contract": "LiquidPool",
"src": "contracts/staking/liquid/LiquidPool.sol:42"
},
{
"label": "__gap",
"offset": 0,
"slot": "168",
"type": "t_array(t_uint256)10_storage",
"contract": "LiquidPool",
"src": "contracts/staking/liquid/LiquidPool.sol:44"
}
],
"types": {
"t_address": {
"label": "address",
"numberOfBytes": "20"
},
"t_array(t_uint256)10_storage": {
"label": "uint256[10]",
"numberOfBytes": "320"
},
"t_array(t_uint256)49_storage": {
"label": "uint256[49]",
"numberOfBytes": "1568"
},
"t_array(t_uint256)50_storage": {
"label": "uint256[50]",
"numberOfBytes": "1600"
},
"t_bool": {
"label": "bool",
"numberOfBytes": "1"
},
"t_bytes32": {
"label": "bytes32",
"numberOfBytes": "32"
},
"t_contract(LiquidNodesManager)14548": {
"label": "contract LiquidNodesManager",
"numberOfBytes": "20"
},
"t_contract(LockKeeper)7804": {
"label": "contract LockKeeper",
"numberOfBytes": "20"
},
"t_contract(RewardsBank)10477": {
"label": "contract RewardsBank",
"numberOfBytes": "20"
},
"t_contract(StAMB)15759": {
"label": "contract StAMB",
"numberOfBytes": "20"
},
"t_contract(StakingTiers)15953": {
"label": "contract StakingTiers",
"numberOfBytes": "20"
},
"t_mapping(t_address,t_bool)": {
"label": "mapping(address => bool)",
"numberOfBytes": "32"
},
"t_mapping(t_address,t_uint256)": {
"label": "mapping(address => uint256)",
"numberOfBytes": "32"
},
"t_mapping(t_bytes32,t_struct(RoleData)179_storage)": {
"label": "mapping(bytes32 => struct AccessControlUpgradeable.RoleData)",
"numberOfBytes": "32"
},
"t_struct(RoleData)179_storage": {
"label": "struct AccessControlUpgradeable.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_uint256": {
"label": "uint256",
"numberOfBytes": "32"
},
"t_uint8": {
"label": "uint8",
"numberOfBytes": "1"
}
}
}
}
}
}
2 changes: 1 addition & 1 deletion contracts/staking/liquid/LiquidPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ contract LiquidPool is UUPSUpgradeable, AccessControlUpgradeable, IOnBlockListen
// ADMIN METHODS

function setInterest(uint interest_, uint interestPeriod_) public onlyRole(DEFAULT_ADMIN_ROLE) {
require(interest_ >= 0 && interest_ <= 1000000, "Invalid percent value");
require(interest_ >= 0 && interest_ <= BILLION, "Invalid percent value");
interest = interest_;
interestPeriod = interestPeriod_;
}
Expand Down
2 changes: 1 addition & 1 deletion deployments/22040.json
Original file line number Diff line number Diff line change
Expand Up @@ -1659,7 +1659,7 @@
"deployTx": "0xae6f3627d4174536697a1536fe5522a36c0ff9581c5374a73fd4187bf9caceb0",
"fullyQualifiedName": "contracts/staking/liquid/LiquidPool.sol:LiquidPool",
"proxy": {
"implementation": "0x18a6c40b56C985f2D3C8eB93cA331b1c5a582024",
"implementation": "0x7184DD655aacCCb28376Fa1B59e3712566Df670b",
"fullyQualifiedName": "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol:ERC1967Proxy"
}
}
Expand Down

0 comments on commit 3500d00

Please sign in to comment.