Skip to content

Commit e9c26aa

Browse files
committed
Merge branch 'minipool-approval'
2 parents 7716790 + ec44fb9 commit e9c26aa

33 files changed

+1129
-285
lines changed

contracts/contract/RocketStorage.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ contract RocketStorage is RocketStorageInterface {
8686
}
8787

8888
// Set this as being deployed now
89-
function getDeployedStatus() external view returns (bool) {
89+
function getDeployedStatus() external override view returns (bool) {
9090
return storageInit;
9191
}
9292

contracts/contract/dao/node/settings/RocketDAONodeTrustedSettings.sol

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ abstract contract RocketDAONodeTrustedSettings is RocketBase, RocketDAONodeTrust
4646
/*** Bools ****************/
4747

4848
// A general method to return any setting given the setting path is correct, only accepts bools
49-
function getSettingBool(string memory _settingPath) external view override returns (bool) {
49+
function getSettingBool(string memory _settingPath) public view override returns (bool) {
5050
return getBool(keccak256(abi.encodePacked(settingNameSpace, _settingPath)));
5151
}
5252

5353
// Update a setting, can only be executed by the DAO contract when a majority on a setting proposal has passed and been executed
54-
function setSettingBool(string memory _settingPath, bool _value) virtual external override onlyDAONodeTrustedProposal {
54+
function setSettingBool(string memory _settingPath, bool _value) virtual public override onlyDAONodeTrustedProposal {
5555
// Update setting now
5656
setBool(keccak256(abi.encodePacked(settingNameSpace, _settingPath)), _value);
5757
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
pragma solidity 0.7.6;
2+
3+
// SPDX-License-Identifier: GPL-3.0-only
4+
5+
import "@openzeppelin/contracts/math/SafeMath.sol";
6+
7+
import "./RocketDAONodeTrustedSettings.sol";
8+
import "../../../../interface/dao/node/settings/RocketDAONodeTrustedSettingsMinipoolInterface.sol";
9+
import "../../../../interface/dao/protocol/settings/RocketDAOProtocolSettingsMinipoolInterface.sol";
10+
11+
12+
// The Trusted Node DAO Minipool settings
13+
contract RocketDAONodeTrustedSettingsMinipool is RocketDAONodeTrustedSettings, RocketDAONodeTrustedSettingsMinipoolInterface {
14+
15+
using SafeMath for uint;
16+
17+
// Construct
18+
constructor(RocketStorageInterface _rocketStorageAddress) RocketDAONodeTrustedSettings(_rocketStorageAddress, "minipool") {
19+
// Set version
20+
version = 1;
21+
22+
// If deployed during initial deployment, initialise now (otherwise must be called after upgrade)
23+
if (!_rocketStorageAddress.getDeployedStatus()){
24+
initialise();
25+
}
26+
}
27+
28+
29+
// Initialise
30+
function initialise() public {
31+
// Initialize settings on deployment
32+
require(!getBool(keccak256(abi.encodePacked(settingNameSpace, "deployed"))), "Already initialised");
33+
// Init settings
34+
setSettingUint("minipool.scrub.period", 12 hours);
35+
setSettingUint("minipool.scrub.quorum", 0.51 ether);
36+
setSettingBool("minipool.scrub.penalty.enabled", false);
37+
// Settings initialised
38+
setBool(keccak256(abi.encodePacked(settingNameSpace, "deployed")), true);
39+
}
40+
41+
42+
// Update a setting, overrides inherited setting method with extra checks for this contract
43+
function setSettingUint(string memory _settingPath, uint256 _value) override public onlyDAONodeTrustedProposal {
44+
// Some safety guards for certain settings
45+
if(getBool(keccak256(abi.encodePacked(settingNameSpace, "deployed")))) {
46+
if(keccak256(abi.encodePacked(_settingPath)) == keccak256(abi.encodePacked("minipool.scrub.period"))) {
47+
RocketDAOProtocolSettingsMinipoolInterface rocketDAOProtocolSettingsMinipool = RocketDAOProtocolSettingsMinipoolInterface(getContractAddress("rocketDAOProtocolSettingsMinipool"));
48+
require(_value <= (rocketDAOProtocolSettingsMinipool.getLaunchTimeout().sub(1 hours)), "Scrub period must be less than launch timeout");
49+
}
50+
}
51+
// Update setting now
52+
setUint(keccak256(abi.encodePacked(settingNameSpace, _settingPath)), _value);
53+
}
54+
55+
// Getters
56+
57+
// How long minipools must wait before moving to staking status (can be scrubbed by ODAO before then)
58+
function getScrubPeriod() override external view returns (uint256) {
59+
return getSettingUint("minipool.scrub.period");
60+
}
61+
62+
// The required number of trusted nodes to vote to scrub a minipool
63+
function getScrubQuorum() override external view returns (uint256) {
64+
return getSettingUint("minipool.scrub.quorum");
65+
}
66+
67+
// True if scrubbing results in an RPL penalty for the node operator
68+
function getScrubPenaltyEnabled() override external view returns (bool) {
69+
return getSettingBool("minipool.scrub.penalty.enabled");
70+
}
71+
}

contracts/contract/dao/protocol/settings/RocketDAOProtocolSettingsMinipool.sol

+16-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import "@openzeppelin/contracts/math/SafeMath.sol";
66

77
import "./RocketDAOProtocolSettings.sol";
88
import "../../../../interface/dao/protocol/settings/RocketDAOProtocolSettingsMinipoolInterface.sol";
9+
import "../../../../interface/dao/node/settings/RocketDAONodeTrustedSettingsMinipoolInterface.sol";
910
import "../../../../types/MinipoolDeposit.sol";
1011

1112
// Network minipool settings
@@ -22,13 +23,26 @@ contract RocketDAOProtocolSettingsMinipool is RocketDAOProtocolSettings, RocketD
2223
if(!getBool(keccak256(abi.encodePacked(settingNameSpace, "deployed")))) {
2324
// Apply settings
2425
setSettingBool("minipool.submit.withdrawable.enabled", false);
25-
setSettingUint("minipool.launch.timeout", 5760); // ~24 hours
26+
setSettingUint("minipool.launch.timeout", 72 hours);
2627
setSettingUint("minipool.maximum.count", 14);
2728
// Settings initialised
2829
setBool(keccak256(abi.encodePacked(settingNameSpace, "deployed")), true);
2930
}
3031
}
3132

33+
// Update a setting, overrides inherited setting method with extra checks for this contract
34+
function setSettingUint(string memory _settingPath, uint256 _value) override public onlyDAOProtocolProposal {
35+
// Some safety guards for certain settings
36+
if(getBool(keccak256(abi.encodePacked(settingNameSpace, "deployed")))) {
37+
if(keccak256(abi.encodePacked(_settingPath)) == keccak256(abi.encodePacked("minipool.launch.timeout"))) {
38+
RocketDAONodeTrustedSettingsMinipoolInterface rocketDAONodeTrustedSettingsMinipool = RocketDAONodeTrustedSettingsMinipoolInterface(getContractAddress("rocketDAONodeTrustedSettingsMinipool"));
39+
require(_value >= (rocketDAONodeTrustedSettingsMinipool.getScrubPeriod().add(1 hours)), "Launch timeout must be greater than scrub period");
40+
}
41+
}
42+
// Update setting now
43+
setUint(keccak256(abi.encodePacked(settingNameSpace, _settingPath)), _value);
44+
}
45+
3246
// Balance required to launch minipool
3347
function getLaunchBalance() override public pure returns (uint256) {
3448
return 32 ether;
@@ -73,7 +87,7 @@ contract RocketDAOProtocolSettingsMinipool is RocketDAOProtocolSettings, RocketD
7387
return getSettingBool("minipool.submit.withdrawable.enabled");
7488
}
7589

76-
// Timeout period in blocks for prelaunch minipools to launch
90+
// Timeout period in seconds for prelaunch minipools to launch
7791
function getLaunchTimeout() override external view returns (uint256) {
7892
return getSettingUint("minipool.launch.timeout");
7993
}

contracts/contract/dao/protocol/settings/RocketDAOProtocolSettingsRewards.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ contract RocketDAOProtocolSettingsRewards is RocketDAOProtocolSettings, RocketDA
2323
setSettingRewardsClaimer('rocketClaimNode', 0.70 ether); // Bonded Node Rewards claim % amount - Percentage given of 1 ether
2424
setSettingRewardsClaimer('rocketClaimTrustedNode', 0.2 ether); // Trusted Node Rewards claim % amount - Percentage given of 1 ether
2525
// RPL Claims settings
26-
setSettingUint("rpl.rewards.claim.period.time", 28 days); // The time in which a claim period will span in seconds - 14 days by default
26+
setSettingUint("rpl.rewards.claim.period.time", 28 days); // The time in which a claim period will span in seconds - 28 days by default
2727
// Deployment check
2828
setBool(keccak256(abi.encodePacked(settingNameSpace, "deployed")), true); // Flag that this contract has been deployed, so default settings don't get reapplied on a contract upgrade
2929
}

0 commit comments

Comments
 (0)