diff --git a/.openzeppelin/polygon-mumbai.json b/.openzeppelin/polygon-mumbai.json index 3d5c8a0a..5c7a79a8 100644 --- a/.openzeppelin/polygon-mumbai.json +++ b/.openzeppelin/polygon-mumbai.json @@ -25728,9 +25728,9 @@ } } }, - "e4e39d4f48179890554261f8695a180ab6bf44e0ee08c631ce089716ebd9dc1d": { - "address": "0xf395Ee3EBe608e5f2E7F074433ce8D9ff5357EFb", - "txHash": "0x308ed38a9cabe0de9391e114b2a88e26db6cf1e24e52940fe4adb95159f486a9", + "ee056803b5a4e87acdb3b4a55599aa7a202ed955d094e623f22b477059d0bb27": { + "address": "0xaFd709C47646aDf5A098532b50880077465F3235", + "txHash": "0x025bc1a95a93f618e61562475e2577b05f1e5c0a2506e01b907323d0efe6c3e8", "layout": { "solcVersion": "0.8.9", "storage": [ @@ -25763,7 +25763,7 @@ "label": "_accessControl", "offset": 0, "slot": "51", - "type": "t_contract(IAccessControl)9925", + "type": "t_contract(IAccessControl)15000", "contract": "AccessManagedUpgradeable", "src": "contracts/components/utils/AccessManaged.sol:16" }, @@ -25818,28 +25818,68 @@ "src": "contracts/components/BaseComponentUpgradeable.sol:62" }, { - "label": "_accountThreatProperties", + "label": "unclaimedRewards", "offset": 0, "slot": "301", - "type": "t_mapping(t_address,t_struct(ThreatProperties)28986_storage)", - "contract": "ThreatOracleCore", - "src": "contracts/components/threat_oracle/ThreatOracleCore.sol:19" + "type": "t_uint256", + "contract": "RewardsDistributor", + "src": "contracts/components/staking/rewards/RewardsDistributor.sol:36" }, { - "label": "__gap", + "label": "_rewardsAccumulators", "offset": 0, "slot": "302", - "type": "t_array(t_uint256)49_storage", - "contract": "ThreatOracleCore", - "src": "contracts/components/threat_oracle/ThreatOracleCore.sol:106" + "type": "t_mapping(t_uint256,t_struct(DelegatedAccRewards)128442_storage)", + "contract": "RewardsDistributor", + "src": "contracts/components/staking/rewards/RewardsDistributor.sol:38" }, { - "label": "__gap", + "label": "rewardsPerEpoch", "offset": 0, - "slot": "351", - "type": "t_array(t_uint256)50_storage", - "contract": "ThreatOracle", - "src": "contracts/components/threat_oracle/ThreatOracle.sol:31" + "slot": "303", + "type": "t_mapping(t_uint256,t_mapping(t_uint256,t_uint256))", + "contract": "RewardsDistributor", + "src": "contracts/components/staking/rewards/RewardsDistributor.sol:40" + }, + { + "label": "rewardedEpochs", + "offset": 0, + "slot": "304", + "type": "t_mapping(t_uint256,t_mapping(t_uint256,t_bool))", + "contract": "RewardsDistributor", + "src": "contracts/components/staking/rewards/RewardsDistributor.sol:42" + }, + { + "label": "claimedRewardsPerEpoch", + "offset": 0, + "slot": "305", + "type": "t_mapping(t_uint256,t_mapping(t_uint256,t_mapping(t_address,t_bool)))", + "contract": "RewardsDistributor", + "src": "contracts/components/staking/rewards/RewardsDistributor.sol:44" + }, + { + "label": "delegationFees", + "offset": 0, + "slot": "306", + "type": "t_mapping(t_uint256,t_array(t_struct(DelegationFee)128474_storage)2_storage)", + "contract": "RewardsDistributor", + "src": "contracts/components/staking/rewards/RewardsDistributor.sol:51" + }, + { + "label": "delegationParamsEpochDelay", + "offset": 0, + "slot": "307", + "type": "t_uint256", + "contract": "RewardsDistributor", + "src": "contracts/components/staking/rewards/RewardsDistributor.sol:53" + }, + { + "label": "defaultFeeBps", + "offset": 0, + "slot": "308", + "type": "t_uint256", + "contract": "RewardsDistributor", + "src": "contracts/components/staking/rewards/RewardsDistributor.sol:54" } ], "types": { @@ -25847,6 +25887,14 @@ "label": "address", "numberOfBytes": "20" }, + "t_array(t_struct(DelegationFee)128474_storage)2_storage": { + "label": "struct RewardsDistributor.DelegationFee[2]", + "numberOfBytes": "64" + }, + "t_array(t_struct(EpochCheckpoint)127855_storage)dyn_storage": { + "label": "struct Accumulators.EpochCheckpoint[]", + "numberOfBytes": "32" + }, "t_array(t_uint256)49_storage": { "label": "uint256[49]", "numberOfBytes": "1568" @@ -25859,40 +25907,154 @@ "label": "bool", "numberOfBytes": "1" }, - "t_contract(IAccessControl)9925": { + "t_contract(IAccessControl)15000": { "label": "contract IAccessControl", "numberOfBytes": "20" }, - "t_mapping(t_address,t_struct(ThreatProperties)28986_storage)": { - "label": "mapping(address => struct ThreatOracleCore.ThreatProperties)", + "t_mapping(t_address,t_bool)": { + "label": "mapping(address => bool)", "numberOfBytes": "32" }, - "t_string_storage": { - "label": "string", + "t_mapping(t_address,t_struct(Accumulator)127860_storage)": { + "label": "mapping(address => struct Accumulators.Accumulator)", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_array(t_struct(DelegationFee)128474_storage)2_storage)": { + "label": "mapping(uint256 => struct RewardsDistributor.DelegationFee[2])", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_bool)": { + "label": "mapping(uint256 => bool)", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_bool))": { + "label": "mapping(uint256 => mapping(address => bool))", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_mapping(t_uint256,t_bool))": { + "label": "mapping(uint256 => mapping(uint256 => bool))", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_mapping(t_uint256,t_mapping(t_address,t_bool)))": { + "label": "mapping(uint256 => mapping(uint256 => mapping(address => bool)))", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_mapping(t_uint256,t_uint256))": { + "label": "mapping(uint256 => mapping(uint256 => uint256))", "numberOfBytes": "32" }, - "t_struct(ThreatProperties)28986_storage": { - "label": "struct ThreatOracleCore.ThreatProperties", + "t_mapping(t_uint256,t_struct(DelegatedAccRewards)128442_storage)": { + "label": "mapping(uint256 => struct RewardsDistributor.DelegatedAccRewards)", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_uint256)": { + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32" + }, + "t_struct(Accumulator)127860_storage": { + "label": "struct Accumulators.Accumulator", "members": [ { - "label": "category", - "type": "t_string_storage", + "label": "checkpoints", + "type": "t_array(t_struct(EpochCheckpoint)127855_storage)dyn_storage", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_struct(DelegatedAccRewards)128442_storage": { + "label": "struct RewardsDistributor.DelegatedAccRewards", + "members": [ + { + "label": "delegated", + "type": "t_struct(Accumulator)127860_storage", "offset": 0, "slot": "0" }, { - "label": "confidenceScore", - "type": "t_uint8", + "label": "delegators", + "type": "t_struct(Accumulator)127860_storage", + "offset": 0, + "slot": "1" + }, + { + "label": "delegatorsTotal", + "type": "t_struct(Accumulator)127860_storage", + "offset": 0, + "slot": "2" + }, + { + "label": "delegatorsPortions", + "type": "t_mapping(t_address,t_struct(Accumulator)127860_storage)", + "offset": 0, + "slot": "3" + } + ], + "numberOfBytes": "128" + }, + "t_struct(DelegationFee)128474_storage": { + "label": "struct RewardsDistributor.DelegationFee", + "members": [ + { + "label": "feeBps", + "type": "t_uint16", + "offset": 0, + "slot": "0" + }, + { + "label": "sinceEpoch", + "type": "t_uint240", + "offset": 2, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_struct(EpochCheckpoint)127855_storage": { + "label": "struct Accumulators.EpochCheckpoint", + "members": [ + { + "label": "timestamp", + "type": "t_uint32", + "offset": 0, + "slot": "0" + }, + { + "label": "rate", + "type": "t_uint224", + "offset": 4, + "slot": "0" + }, + { + "label": "value", + "type": "t_uint256", "offset": 0, "slot": "1" } ], "numberOfBytes": "64" }, + "t_uint16": { + "label": "uint16", + "numberOfBytes": "2" + }, + "t_uint224": { + "label": "uint224", + "numberOfBytes": "28" + }, + "t_uint240": { + "label": "uint240", + "numberOfBytes": "30" + }, "t_uint256": { "label": "uint256", "numberOfBytes": "32" }, + "t_uint32": { + "label": "uint32", + "numberOfBytes": "4" + }, "t_uint8": { "label": "uint8", "numberOfBytes": "1" diff --git a/.openzeppelin/polygon.json b/.openzeppelin/polygon.json index a19901d2..6a1945c8 100644 --- a/.openzeppelin/polygon.json +++ b/.openzeppelin/polygon.json @@ -14641,6 +14641,340 @@ } } } + }, + "4c133f0f72013f59d2d2fc4d06c1007ac1ed4b48cbd5cdfde76b28a1a033ba00": { + "address": "0xf87A30F7677f03982780a377C793c796FDAf52F8", + "txHash": "0x2b3d9085eb3a92af7259fda2d51279b9d8939effe9c81b1aef0a953140824626", + "layout": { + "solcVersion": "0.8.9", + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:62", + "retypedFrom": "bool" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:67" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "ContextUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:36" + }, + { + "label": "_accessControl", + "offset": 0, + "slot": "51", + "type": "t_contract(IAccessControl)15000", + "contract": "AccessManagedUpgradeable", + "src": "contracts/components/utils/AccessManaged.sol:16" + }, + { + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage", + "contract": "AccessManagedUpgradeable", + "src": "contracts/components/utils/AccessManaged.sol:68" + }, + { + "label": "_deprecated_router", + "offset": 0, + "slot": "101", + "type": "t_address", + "contract": "RoutedUpgradeable", + "src": "contracts/components/utils/Routed.sol:16", + "retypedFrom": "contract IRouter", + "renamedFrom": "_router" + }, + { + "label": "__gap", + "offset": 0, + "slot": "102", + "type": "t_array(t_uint256)49_storage", + "contract": "RoutedUpgradeable", + "src": "contracts/components/utils/Routed.sol:35" + }, + { + "label": "__gap", + "offset": 0, + "slot": "151", + "type": "t_array(t_uint256)50_storage", + "contract": "ERC1967UpgradeUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol:211" + }, + { + "label": "__gap", + "offset": 0, + "slot": "201", + "type": "t_array(t_uint256)50_storage", + "contract": "UUPSUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol:107" + }, + { + "label": "__gap", + "offset": 0, + "slot": "251", + "type": "t_array(t_uint256)50_storage", + "contract": "BaseComponentUpgradeable", + "src": "contracts/components/BaseComponentUpgradeable.sol:62" + }, + { + "label": "unclaimedRewards", + "offset": 0, + "slot": "301", + "type": "t_uint256", + "contract": "RewardsDistributor", + "src": "contracts/components/staking/rewards/RewardsDistributor.sol:36" + }, + { + "label": "_rewardsAccumulators", + "offset": 0, + "slot": "302", + "type": "t_mapping(t_uint256,t_struct(DelegatedAccRewards)128442_storage)", + "contract": "RewardsDistributor", + "src": "contracts/components/staking/rewards/RewardsDistributor.sol:38" + }, + { + "label": "rewardsPerEpoch", + "offset": 0, + "slot": "303", + "type": "t_mapping(t_uint256,t_mapping(t_uint256,t_uint256))", + "contract": "RewardsDistributor", + "src": "contracts/components/staking/rewards/RewardsDistributor.sol:40" + }, + { + "label": "rewardedEpochs", + "offset": 0, + "slot": "304", + "type": "t_mapping(t_uint256,t_mapping(t_uint256,t_bool))", + "contract": "RewardsDistributor", + "src": "contracts/components/staking/rewards/RewardsDistributor.sol:42" + }, + { + "label": "claimedRewardsPerEpoch", + "offset": 0, + "slot": "305", + "type": "t_mapping(t_uint256,t_mapping(t_uint256,t_mapping(t_address,t_bool)))", + "contract": "RewardsDistributor", + "src": "contracts/components/staking/rewards/RewardsDistributor.sol:44" + }, + { + "label": "delegationFees", + "offset": 0, + "slot": "306", + "type": "t_mapping(t_uint256,t_array(t_struct(DelegationFee)128474_storage)2_storage)", + "contract": "RewardsDistributor", + "src": "contracts/components/staking/rewards/RewardsDistributor.sol:51" + }, + { + "label": "delegationParamsEpochDelay", + "offset": 0, + "slot": "307", + "type": "t_uint256", + "contract": "RewardsDistributor", + "src": "contracts/components/staking/rewards/RewardsDistributor.sol:53" + }, + { + "label": "defaultFeeBps", + "offset": 0, + "slot": "308", + "type": "t_uint256", + "contract": "RewardsDistributor", + "src": "contracts/components/staking/rewards/RewardsDistributor.sol:54" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_struct(DelegationFee)128474_storage)2_storage": { + "label": "struct RewardsDistributor.DelegationFee[2]", + "numberOfBytes": "64" + }, + "t_array(t_struct(EpochCheckpoint)127855_storage)dyn_storage": { + "label": "struct Accumulators.EpochCheckpoint[]", + "numberOfBytes": "32" + }, + "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_contract(IAccessControl)15000": { + "label": "contract IAccessControl", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_bool)": { + "label": "mapping(address => bool)", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_struct(Accumulator)127860_storage)": { + "label": "mapping(address => struct Accumulators.Accumulator)", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_array(t_struct(DelegationFee)128474_storage)2_storage)": { + "label": "mapping(uint256 => struct RewardsDistributor.DelegationFee[2])", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_bool)": { + "label": "mapping(uint256 => bool)", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_bool))": { + "label": "mapping(uint256 => mapping(address => bool))", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_mapping(t_uint256,t_bool))": { + "label": "mapping(uint256 => mapping(uint256 => bool))", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_mapping(t_uint256,t_mapping(t_address,t_bool)))": { + "label": "mapping(uint256 => mapping(uint256 => mapping(address => bool)))", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_mapping(t_uint256,t_uint256))": { + "label": "mapping(uint256 => mapping(uint256 => uint256))", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_struct(DelegatedAccRewards)128442_storage)": { + "label": "mapping(uint256 => struct RewardsDistributor.DelegatedAccRewards)", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_uint256)": { + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32" + }, + "t_struct(Accumulator)127860_storage": { + "label": "struct Accumulators.Accumulator", + "members": [ + { + "label": "checkpoints", + "type": "t_array(t_struct(EpochCheckpoint)127855_storage)dyn_storage", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_struct(DelegatedAccRewards)128442_storage": { + "label": "struct RewardsDistributor.DelegatedAccRewards", + "members": [ + { + "label": "delegated", + "type": "t_struct(Accumulator)127860_storage", + "offset": 0, + "slot": "0" + }, + { + "label": "delegators", + "type": "t_struct(Accumulator)127860_storage", + "offset": 0, + "slot": "1" + }, + { + "label": "delegatorsTotal", + "type": "t_struct(Accumulator)127860_storage", + "offset": 0, + "slot": "2" + }, + { + "label": "delegatorsPortions", + "type": "t_mapping(t_address,t_struct(Accumulator)127860_storage)", + "offset": 0, + "slot": "3" + } + ], + "numberOfBytes": "128" + }, + "t_struct(DelegationFee)128474_storage": { + "label": "struct RewardsDistributor.DelegationFee", + "members": [ + { + "label": "feeBps", + "type": "t_uint16", + "offset": 0, + "slot": "0" + }, + { + "label": "sinceEpoch", + "type": "t_uint240", + "offset": 2, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_struct(EpochCheckpoint)127855_storage": { + "label": "struct Accumulators.EpochCheckpoint", + "members": [ + { + "label": "timestamp", + "type": "t_uint32", + "offset": 0, + "slot": "0" + }, + { + "label": "rate", + "type": "t_uint224", + "offset": 4, + "slot": "0" + }, + { + "label": "value", + "type": "t_uint256", + "offset": 0, + "slot": "1" + } + ], + "numberOfBytes": "64" + }, + "t_uint16": { + "label": "uint16", + "numberOfBytes": "2" + }, + "t_uint224": { + "label": "uint224", + "numberOfBytes": "28" + }, + "t_uint240": { + "label": "uint240", + "numberOfBytes": "30" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint32": { + "label": "uint32", + "numberOfBytes": "4" + }, + "t_uint8": { + "label": "uint8", + "numberOfBytes": "1" + } + } + } } } } diff --git a/contracts/components/staking/rewards/RewardsDistributor.sol b/contracts/components/staking/rewards/RewardsDistributor.sol index 5298cee5..ca5d6a33 100644 --- a/contracts/components/staking/rewards/RewardsDistributor.sol +++ b/contracts/components/staking/rewards/RewardsDistributor.sol @@ -244,7 +244,7 @@ contract RewardsDistributor is BaseComponentUpgradeable, SubjectTypeValidator, I /** * Sets delegation fee for a ScannerPool (required to own the ScannerPoolRegistry NFT). - * Change in fees will start having an effect in the beginning of the next reward epoch. + * Change in fees will start having an effect two epochs from now (i.e. current epoch + 2). * After the first time setting the parameter, it cannot be set again until delegationParamsEpochDelay epochs pass. * @param subjectType a DELEGATED subject type. * @param subjectId the DELEGATED subject id. @@ -260,7 +260,7 @@ contract RewardsDistributor is BaseComponentUpgradeable, SubjectTypeValidator, I if (Accumulators.getCurrentEpochNumber() < fees[1].sinceEpoch + delegationParamsEpochDelay) revert SetDelegationFeeNotReady(); fees[0] = fees[1]; } - fees[1] = DelegationFee({ feeBps: feeBps, sinceEpoch: Accumulators.getCurrentEpochNumber() + 1 }); + fees[1] = DelegationFee({ feeBps: feeBps, sinceEpoch: Accumulators.getCurrentEpochNumber() + 2 }); emit SetDelegationFee(subjectType, subjectId, fees[1].sinceEpoch, feeBps); } diff --git a/releases/1.2.7/index.yml b/releases/1.2.7/index.yml new file mode 100644 index 00000000..0fd2ea68 --- /dev/null +++ b/releases/1.2.7/index.yml @@ -0,0 +1,10 @@ +title: Granting New Role, Revoking One Role +network: polygon +deploy: prepare-upgrade 1.2.7 +verify: verify-deployed +finish: propose-admin +description: | + ## Output tx: + - Grant Core Dev multisig role of SCANNER_BETA_VERSION_ROLE + - Revoke SCANNER_POOL_ADMIN_ROLE role from Core Dev multisig + - Previously granted to fix broken enabled scanner counts \ No newline at end of file diff --git a/releases/1.2.7/mumbai/config/propose-admin.json b/releases/1.2.7/mumbai/config/propose-admin.json new file mode 100644 index 00000000..a0352605 --- /dev/null +++ b/releases/1.2.7/mumbai/config/propose-admin.json @@ -0,0 +1,10 @@ +{ + "AccessManager": [ + { + "methodName": "grantRole", + "params": [ + ["roles.SCANNER_BETA_VERSION_ROLE", "0x19AD705930B6695812c921f08b16F7DfAF59A536"] + ] + } + ] +} \ No newline at end of file diff --git a/releases/1.2.7/polygon/config/propose-admin.json b/releases/1.2.7/polygon/config/propose-admin.json new file mode 100644 index 00000000..69545c78 --- /dev/null +++ b/releases/1.2.7/polygon/config/propose-admin.json @@ -0,0 +1,16 @@ +{ + "AccessManager": [ + { + "methodName": "grantRole", + "params": [ + ["roles.SCANNER_BETA_VERSION_ROLE", "0xd1d4FaFd400fCD643132bb7eAF7682eE97E09C3e"] + ] + }, + { + "methodName": "revokeRole", + "params": [ + ["roles.SCANNER_POOL_ADMIN_ROLE", "0xd1d4FaFd400fCD643132bb7eAF7682eE97E09C3e"] + ] + } + ] +} \ No newline at end of file diff --git a/releases/1.2.8/index.yml b/releases/1.2.8/index.yml new file mode 100644 index 00000000..9a9947a6 --- /dev/null +++ b/releases/1.2.8/index.yml @@ -0,0 +1,15 @@ +title: Delegation fee update (live after two epochs) +network: mumbai +deploy: prepare-upgrade 1.2.8 +verify: verify-deployed +finish: propose-admin +description: | + ## Deployed new implementations: + - RewardsDistributor + + ## Output tx: + - Upgrade implementations + - Delegation fee updates will be live after two epochs, instead of one + - Call to update delegationParamsEpochDelay + - Decrease from two to one, so time when delegation fees can be updated remains the same + - Passing the same value for the default fee bps, as we don't want to change it \ No newline at end of file diff --git a/releases/1.2.8/mumbai/config/propose-admin.json b/releases/1.2.8/mumbai/config/propose-admin.json new file mode 100644 index 00000000..9d37c5e0 --- /dev/null +++ b/releases/1.2.8/mumbai/config/propose-admin.json @@ -0,0 +1,10 @@ +{ + "RewardsDistributor": [ + { + "methodName": "setDelegationParams", + "params": [ + ["1", "10000"] + ] + } + ] +} \ No newline at end of file diff --git a/releases/1.2.8/mumbai/config/upgrade.json b/releases/1.2.8/mumbai/config/upgrade.json new file mode 100644 index 00000000..0a4e97bc --- /dev/null +++ b/releases/1.2.8/mumbai/config/upgrade.json @@ -0,0 +1,14 @@ +{ + "RewardsDistributor": { + "impl": { + "opts": { + "unsafe-allow": [ + "delegatecall" + ], + "constructor-args": [ + "deployment.forwarder", "deployment.forta", "deployment.stake-subject-gateway" + ] + } + } + } +} \ No newline at end of file diff --git a/releases/1.2.8/mumbai/output/prepared-upgrades.json b/releases/1.2.8/mumbai/output/prepared-upgrades.json new file mode 100644 index 00000000..beea33e6 --- /dev/null +++ b/releases/1.2.8/mumbai/output/prepared-upgrades.json @@ -0,0 +1,16 @@ +{ + "rewards-distributor": { + "impl": { + "address": "0xaFd709C47646aDf5A098532b50880077465F3235", + "constructor-args": [ + "0x4E29Cea6D64be860f5eAba110686DcB585f393D6", + "0x107Ac13567b1b5D84691f890A5bA07EdaE1a11c3", + "0x02304eC24ba2996a83F595D7cf80e5571a406EFA" + ], + "init-args": [], + "name": "RewardsDistributor", + "timeout": 1200000, + "version": "0.1.0" + } + } +} \ No newline at end of file diff --git a/releases/1.2.8/polygon/config/propose-admin.json b/releases/1.2.8/polygon/config/propose-admin.json new file mode 100644 index 00000000..9d37c5e0 --- /dev/null +++ b/releases/1.2.8/polygon/config/propose-admin.json @@ -0,0 +1,10 @@ +{ + "RewardsDistributor": [ + { + "methodName": "setDelegationParams", + "params": [ + ["1", "10000"] + ] + } + ] +} \ No newline at end of file diff --git a/releases/1.2.8/polygon/config/upgrade.json b/releases/1.2.8/polygon/config/upgrade.json new file mode 100644 index 00000000..0a4e97bc --- /dev/null +++ b/releases/1.2.8/polygon/config/upgrade.json @@ -0,0 +1,14 @@ +{ + "RewardsDistributor": { + "impl": { + "opts": { + "unsafe-allow": [ + "delegatecall" + ], + "constructor-args": [ + "deployment.forwarder", "deployment.forta", "deployment.stake-subject-gateway" + ] + } + } + } +} \ No newline at end of file diff --git a/releases/1.2.8/polygon/output/prepared-upgrades.json b/releases/1.2.8/polygon/output/prepared-upgrades.json new file mode 100644 index 00000000..97649463 --- /dev/null +++ b/releases/1.2.8/polygon/output/prepared-upgrades.json @@ -0,0 +1,16 @@ +{ + "rewards-distributor": { + "impl": { + "address": "0xf87A30F7677f03982780a377C793c796FDAf52F8", + "constructor-args": [ + "0xff771084D7C2e54C0F9cA79dA23656514D2c5dd2", + "0x9ff62d1FC52A907B6DCbA8077c2DDCA6E6a9d3e1", + "0x587969Add789c13F64Bcc34Ff253BD9BFB78f38a" + ], + "init-args": [], + "name": "RewardsDistributor", + "timeout": 1200000, + "version": "0.1.0" + } + } +} \ No newline at end of file diff --git a/test/components/staking.rewards.test.js b/test/components/staking.rewards.test.js index aab186fb..9db43075 100644 --- a/test/components/staking.rewards.test.js +++ b/test/components/staking.rewards.test.js @@ -491,6 +491,32 @@ describe('Staking Rewards', function () { expect(await this.rewardsDistributor.delegationParamsEpochDelay()).to.not.be.equal(previousDelay); expect(await this.rewardsDistributor.delegationParamsEpochDelay()).to.be.equal(newDelay); }); + + it('should be able to set defaultFeeBps, and set again to same value, but update delegationParamsEpochDelay', async function () { + // Was initialized with a value of 1000 + const previousFeeBps = await this.rewardsDistributor.defaultFeeBps(); + // Was initialized with a value of 2 + const previousDelay = await this.rewardsDistributor.delegationParamsEpochDelay(); + + console.log(`previousFeeBps: ${previousFeeBps}`); + + const newFeeBps = 10000; + await this.rewardsDistributor.connect(this.accounts.admin).setDelegationParams(previousDelay, newFeeBps); + + expect(await this.rewardsDistributor.defaultFeeBps()).to.not.be.equal(previousFeeBps); + expect(await this.rewardsDistributor.defaultFeeBps()).to.be.equal(newFeeBps); + expect(await this.rewardsDistributor.delegationParamsEpochDelay()).to.be.equal(previousDelay); + + const newDelay = 1; + + await expect(this.rewardsDistributor.connect(this.accounts.admin).setDelegationParams(newDelay, newFeeBps)) + .to.emit(this.rewardsDistributor, 'SetDelegationParams') + .withArgs(newDelay, newFeeBps); + + expect(await this.rewardsDistributor.defaultFeeBps()).to.be.equal(newFeeBps); + expect(await this.rewardsDistributor.delegationParamsEpochDelay()).to.not.be.equal(previousDelay); + expect(await this.rewardsDistributor.delegationParamsEpochDelay()).to.be.equal(newDelay); + }); }); describe('Fee setting', function () { @@ -541,7 +567,7 @@ describe('Staking Rewards', function () { const currentEpoch = await this.rewardsDistributor.getCurrentEpochNumber(); expect(await this.rewardsDistributor.getDelegationFee(SCANNER_POOL_SUBJECT_TYPE, SCANNER_POOL_ID_2, currentEpoch)).to.be.equal(defaultFeeBps); - await helpers.time.increase(1 + EPOCH_LENGTH /* 1 week */); + await helpers.time.increase(2 * (1 + EPOCH_LENGTH) /* 2 weeks */); // fee is now in effect as zero const nextEpoch = await this.rewardsDistributor.getCurrentEpochNumber(); @@ -553,24 +579,25 @@ describe('Staking Rewards', function () { `SenderNotOwner("${this.accounts.user2.address}", ${SCANNER_POOL_ID})` ); }); - it('fee is in effect next period after setting', async function () { + + it('fee is in effect two periods after setting', async function () { const defaultRate = await this.rewardsDistributor.defaultFeeBps(); let currentEpoch = await this.rewardsDistributor.getCurrentEpochNumber(); await this.rewardsDistributor.connect(this.accounts.user1).setDelegationFeeBps(SCANNER_POOL_SUBJECT_TYPE, SCANNER_POOL_ID, '2500'); // fee still not in effect expect(await this.rewardsDistributor.getDelegationFee(SCANNER_POOL_SUBJECT_TYPE, SCANNER_POOL_ID, currentEpoch)).to.be.eq(defaultRate); - await helpers.time.increase(1 + EPOCH_LENGTH /* 1 week */); + await helpers.time.increase(2 * (1 + EPOCH_LENGTH) /* 2 weeks */); currentEpoch = await this.rewardsDistributor.getCurrentEpochNumber(); expect(await this.rewardsDistributor.getDelegationFee(SCANNER_POOL_SUBJECT_TYPE, SCANNER_POOL_ID, currentEpoch)).to.be.eq('2500'); - await helpers.time.increase(2 * (1 + EPOCH_LENGTH) /* 2 week */); + await helpers.time.increase(2 * (1 + EPOCH_LENGTH) /* 2 weeks */); await this.rewardsDistributor.connect(this.accounts.user1).setDelegationFeeBps(SCANNER_POOL_SUBJECT_TYPE, SCANNER_POOL_ID, '3000'); currentEpoch = await this.rewardsDistributor.getCurrentEpochNumber(); expect(await this.rewardsDistributor.getDelegationFee(SCANNER_POOL_SUBJECT_TYPE, SCANNER_POOL_ID, currentEpoch)).to.be.eq('2500'); - await helpers.time.increase(1 + EPOCH_LENGTH /* 1 week */); + await helpers.time.increase(2 * (1 + EPOCH_LENGTH) /* 2 weeks */); currentEpoch = await this.rewardsDistributor.getCurrentEpochNumber(); expect(await this.rewardsDistributor.getDelegationFee(SCANNER_POOL_SUBJECT_TYPE, SCANNER_POOL_ID, currentEpoch)).to.be.eq('3000');