@@ -10,6 +10,11 @@ import {RocketDAOProtocolSettings} from "./RocketDAOProtocolSettings.sol";
1010/// @notice Network auction settings
1111contract RocketDAOProtocolSettingsNetwork is RocketDAOProtocolSettings , RocketDAOProtocolSettingsNetworkInterface {
1212
13+ modifier onlyAllowListedController () {
14+ require (isAllowListedController (msg .sender ), "Not on allow list " );
15+ _;
16+ }
17+
1318 constructor (RocketStorageInterface _rocketStorageAddress ) RocketDAOProtocolSettings (_rocketStorageAddress, "network " ) {
1419 version = 4 ;
1520 // Initialise settings on deployment
@@ -42,8 +47,6 @@ contract RocketDAOProtocolSettingsNetwork is RocketDAOProtocolSettings, RocketDA
4247 if (getBool (keccak256 (abi.encodePacked (settingNameSpace, "deployed " )))) {
4348 // Some safety guards for certain settings
4449 bytes32 settingKey = keccak256 (bytes (_settingPath));
45- bool voterShareModified = false ;
46- bool nodeShareModified = false ;
4750 if (settingKey == keccak256 (bytes ("network.consensus.threshold " ))) {
4851 require (_value >= 0.51 ether, "Consensus threshold must be 51% or higher " );
4952 } else if (settingKey == keccak256 (bytes ("network.node.fee.minimum " ))) {
@@ -55,32 +58,14 @@ contract RocketDAOProtocolSettingsNetwork is RocketDAOProtocolSettings, RocketDA
5558 } else if (settingKey == keccak256 (bytes ("network.submit.balances.frequency " ))) {
5659 require (_value >= 1 hours, "The submit frequency must be >= 1 hour " );
5760 } else if (settingKey == keccak256 (bytes ("network.node.commission.share.security.council.adder " ))) {
58- uint256 maxAdderValue = getSettingUint ("network.max.node.commission.share.council.adder " );
59- require (_value <= maxAdderValue, "Value must be <= max value " );
60- uint256 maxVoterValue = getSettingUint ("network.voter.share " );
61- require (_value <= maxVoterValue, "Value must be <= voter share " );
62- voterShareModified = true ;
63- nodeShareModified = true ;
61+ return _setNodeShareSecurityCouncilAdder (_value);
6462 } else if (settingKey == keccak256 (bytes ("network.node.commission.share " ))) {
65- nodeShareModified = true ;
63+ return _setNodeCommissionShare (_value) ;
6664 } else if (settingKey == keccak256 (bytes ("network.voter.share " ))) {
67- voterShareModified = true ;
65+ return _setVoterShare (_value) ;
6866 }
6967 // Update setting now
7068 _setSettingUint (_settingPath, _value);
71- // Check for changes to UARS parameters
72- if (voterShareModified || nodeShareModified) {
73- // Check rETH commission invariant
74- require (getRethCommission () <= 1 ether, "rETH Commission must be <= 100% " );
75- // If one of the UARS parameters changed, notify RocketNetworkRevenues
76- RocketNetworkRevenuesInterface rocketNetworkRevenues = RocketNetworkRevenuesInterface (getContractAddress ("rocketNetworkRevenues " ));
77- if (voterShareModified) {
78- rocketNetworkRevenues.setVoterShare (getEffectiveVoterShare ());
79- }
80- if (nodeShareModified) {
81- rocketNetworkRevenues.setNodeShare (getEffectiveNodeShare ());
82- }
83- }
8469 } else {
8570 // Update setting now
8671 _setSettingUint (_settingPath, _value);
@@ -98,7 +83,7 @@ contract RocketDAOProtocolSettingsNetwork is RocketDAOProtocolSettings, RocketDA
9883 }
9984
10085 function getMaxNodeShareSecurityCouncilAdder () override public view returns (uint256 ) {
101- return getSettingUint ("network.node.commission.share.security .council.adder " );
86+ return getSettingUint ("network.max. node.commission.share.council.adder " );
10287 }
10388
10489 function getVoterShare () override public view returns (uint256 ) {
@@ -194,4 +179,76 @@ contract RocketDAOProtocolSettingsNetwork is RocketDAOProtocolSettings, RocketDA
194179 function getSubmitRewardsEnabled () override external view returns (bool ) {
195180 return getSettingBool ("network.submit.rewards.enabled " );
196181 }
182+
183+ /// @notice Returns a list of addresses allowed to update commission share parameters
184+ function getAllowListedControllers () override public view returns (address [] memory ) {
185+ return getSettingAddressList ("network.allow.listed.controllers " );
186+ }
187+
188+ /// @notice Returns true if the supplied address is one of the allow listed controllers
189+ /// @param _address The address to check for on the allow list
190+ function isAllowListedController (address _address ) override public view returns (bool ) {
191+ address [] memory allowList = getAllowListedControllers ();
192+ for (uint256 i = 0 ; i < allowList.length ; ++ i) {
193+ if (allowList[i] == _address) return true ;
194+ }
195+ return false ;
196+ }
197+
198+ /// @notice Called by an explicitly allowed address to modify the security council adder parameter
199+ /// @param _value New value for the parameter
200+ function setNodeShareSecurityCouncilAdder (uint256 _value ) override external onlyAllowListedController {
201+ _setNodeShareSecurityCouncilAdder (_value);
202+ }
203+
204+ /// @notice Called by an explicitly allowed address to modify the node commission share parameter
205+ /// @param _value New value for the parameter
206+ function setNodeCommissionShare (uint256 _value ) override external onlyAllowListedController {
207+ _setNodeCommissionShare (_value);
208+ }
209+
210+ /// @notice Called by an explicitly allowed address to modify the voter share parameter
211+ /// @param _value New value for the parameter
212+ function setVoterShare (uint256 _value ) override external onlyAllowListedController {
213+ _setVoterShare (_value);
214+ }
215+
216+ /// @dev Internal implementation of setting the node share security council adder parameter
217+ function _setNodeShareSecurityCouncilAdder (uint256 _value ) internal {
218+ // Validate input
219+ uint256 maxAdderValue = getSettingUint ("network.max.node.commission.share.council.adder " );
220+ require (_value <= maxAdderValue, "Value must be <= max value " );
221+ uint256 maxVoterValue = getSettingUint ("network.voter.share " );
222+ require (_value <= maxVoterValue, "Value must be <= voter share " );
223+ // Make setting change
224+ _setSettingUint ("network.node.commission.share.security.council.adder " , _value);
225+ // Sanity check value
226+ require (getRethCommission () <= 1 ether, "rETH Commission must be <= 100% " );
227+ // Notify change of UARS parameter for snapshot
228+ RocketNetworkRevenuesInterface rocketNetworkRevenues = RocketNetworkRevenuesInterface (getContractAddress ("rocketNetworkRevenues " ));
229+ rocketNetworkRevenues.setVoterShare (getEffectiveVoterShare ());
230+ rocketNetworkRevenues.setNodeShare (getEffectiveNodeShare ());
231+ }
232+
233+ /// @dev Internal implementation of setting the node commission share parameter
234+ function _setNodeCommissionShare (uint256 _value ) internal {
235+ // Make setting change
236+ _setSettingUint ("network.node.commission.share " , _value);
237+ // Sanity check value
238+ require (getRethCommission () <= 1 ether, "rETH Commission must be <= 100% " );
239+ // Notify change of UARS parameter for snapshot
240+ RocketNetworkRevenuesInterface rocketNetworkRevenues = RocketNetworkRevenuesInterface (getContractAddress ("rocketNetworkRevenues " ));
241+ rocketNetworkRevenues.setNodeShare (getEffectiveNodeShare ());
242+ }
243+
244+ /// @dev Internal implementation of setting the voter share parameter
245+ function _setVoterShare (uint256 _value ) internal {
246+ // Make setting change
247+ _setSettingUint ("network.voter.share " , _value);
248+ // Sanity check value
249+ require (getRethCommission () <= 1 ether, "rETH Commission must be <= 100% " );
250+ // Notify change of UARS parameter for snapshot
251+ RocketNetworkRevenuesInterface rocketNetworkRevenues = RocketNetworkRevenuesInterface (getContractAddress ("rocketNetworkRevenues " ));
252+ rocketNetworkRevenues.setVoterShare (getEffectiveVoterShare ());
253+ }
197254}
0 commit comments