Skip to content

Commit 4c19daf

Browse files
committed
Merge branch 'v1.2'
2 parents 967e4d3 + 5719926 commit 4c19daf

File tree

181 files changed

+28091
-22558
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

181 files changed

+28091
-22558
lines changed

.gitignore

+5-12
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
1-
app
2-
bin
3-
build
4-
app/config
5-
node_modules
6-
scTopics
7-
coverage.json
8-
coverage/
9-
coverageEnv/
1+
node_modules/
102
.vscode
11-
@openzeppelin
12-
1.0
13-
.idea
3+
.idea/
4+
cache/
5+
artifacts/
6+
.env

.mocharc.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"require": "hardhat/register",
3+
"timeout": 0
4+
}

.prettierignore

-1
This file was deleted.

.solcover.js

-16
This file was deleted.

.soliumignore

-1
This file was deleted.

.soliumrc.json

-20
This file was deleted.

README.md

+56-17
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,79 @@
1-
# Rocket Pool - Decentralised Ethereum liquid staking protocol
1+
# Rocket Pool - A next generation Ethereum proof of stake (PoS) infrastructure service and pool
22

33
<p align="center">
4-
<img src="https://raw.githubusercontent.com/rocket-pool/rocketpool/master/images/logo.png?raw=true" alt="Rocket Pool - Next Generation Decentralised Ethereum Proof-of-Stake (PoS) Infrastructure Service and Pool" width="250" />
4+
<img src="https://raw.githubusercontent.com/rocket-pool/rocketpool/master/images/logo.png?raw=true" alt="Rocket Pool - Next Generation Decentralised Ethereum Proof-of-Stake (PoS) Infrastructure Service and Pool" width="500" />
55
</p>
66

7-
Rocket Pool is the base layer protocol for decentralised and trustless ETH staking, both liquid using rETH and node operator staking.
7+
---
88

9-
Designed to support stakers of all shapes and sizes, Rocket Pool was built with the intent to allow anyone to trustlessly stake ETH to a network of decentralised node operators with full autonomy using protocol based incentives to make sure all parties work in each others best interests.
9+
`Rocket Pool` is a first of its kind Ethereum Proof of Stake (PoS) infrastructure service, designed to be highly decentralised, distributed and compatible with staking in Ethereum 2.0 on the beacon chain. It was first conceived in late 2016 and has since had several successful public betas over the life span of ETH2 development. The staking network allows any individual, business, defi dapp, wallet provider, SaaS provider, exchange — just about any service — the ability to provide their users with the option to earn staking rewards on their ETH holdings without worrying about maintaining an extensive staking infrastructure, just plug and play.
1010

11-
The core premise behind a protocol is to ensure the network is not beholden to any one party. This is a principle directly linked to Ethereum itself, and a mindset used at every stage of the process as Rocket Pool was developed.
11+
Staking with the Rocket Pool network is very flexible and unlike any other staking infrastructure for Ethereum 2.0 to date. When depositing ETH into the Rocket Pool smart contracts, you will be instantly issued a token called rETH which represents a tokenised staking deposit in the network. Its value and the rewards it gains over time will be reflected by the work each individual decentralised node operator gives the Rocket Pool network. Rocket Pool’s unique decentralised staking infrastructure is economically bonded to both be secure and scalable.
1212

13-
Rocket Pool strives to bring staking to the masses and embody the core ethos of Ethereum, DeFi, specifically the non-custodial, trustless nature that allows self-sovereignty to truly thrive in a decentralised ecosystem.
14-
15-
This is why creating the decentralised staking protocol layer for ETH is so important, especially with the vast majority of players either not having the technical skills to run a node, or the financial capacity to own 32 ETH.
13+
Rocket Pool isn't just a whitepaper, it's actual code. Be sure to read the [Rocket Pool 101 - FAQ for more information](https://medium.com/rocket-pool/rocket-pool-101-faq-ee683af10da9).
1614

1715
# Test Rocket Pool
1816

1917
<p align="center">
20-
<img src="https://raw.githubusercontent.com/rocket-pool/rocketpool/master/images/rocket-pool-atlas-test.png?raw=true" alt="Rocket Pool - Testing Ethereum Proof-of-Stake (PoS) Infrastructure Service and Pool for Ethereum 2.0 Beacon Chain"/>
18+
<img src="https://raw.githubusercontent.com/rocket-pool/rocketpool/master/images/rocket-pool-casper-pos-beacon-chain-test.png?raw=true" alt="Rocket Pool - Testing Ethereum Proof-of-Stake (PoS) Infrastructure Service and Pool for Ethereum 2.0 Beacon Chain"/>
2119
</p>
2220

23-
To see Rocket Pool in action, clone the repo and run Ganache with the latest version of truffle installed. A quick and easy way to do this is to use the test script provided with the project:
21+
To see Rocket Pool in action, clone the repo and run the test suite with the following commands:
2422
```bash
25-
$ npm install && npm test
23+
$ npm install
24+
$ npm test
2625
```
27-
This will start a local development node (if not already started) and put Rocket Pool through its paces. * These tests are extensive and can take up to 2-10 mins to run depending on your machines specs *.
26+
27+
# Rocket Pool White Paper
28+
29+
You can read the current Rocket Pool white paper here: [http://www.rocketpool.net/files/RocketPoolWhitePaper.pdf](http://www.rocketpool.net/files/RocketPoolWhitePaper.pdf).
2830

2931
# Contact and Additional Information
3032

31-
Check out [our website](https://www.rocketpool.net) for more information on Rocket Pool.
33+
Check out [our website](http://www.rocketpool.net) for more information on Rocket Pool.
34+
35+
Contact form: https://www.rocketpool.net/#contact
36+
37+
Twitter: https://twitter.com/Rocket_Pool
3238

33-
Read [our explainer series](https://medium.com/rocket-pool/rocket-pool-staking-protocol-part-1-8be4859e5fbd) for a 1000 foot overview of the protocol.
39+
Join our Discord chat channel! https://discordapp.com/invite/rocketpool
3440

35-
Read [our docs](https://docs.rocketpool.net) for more technical information on running a node.
41+
---
3642

37-
Follow us on twitter at [@Rocket_Pool](https://twitter.com/Rocket_Pool)
43+
# A Step-by-Step Beginners Guide
3844

39-
Join [our Discord chat channel](https://discord.gg/rocketpool)!
45+
The following worked example uses macOS Sierra 10.12.6 and VMware Fusion 8.5.8 - all versions correct as of 15/09/2017.
4046

47+
Download and install Ubuntu onto a new VM -> https://www.ubuntu.com/download/desktop - tested with v16.04
48+
49+
Open a terminal window and install some pre-requisites:
50+
51+
install git:
52+
```bash
53+
$ sudo apt -y install git
54+
```
55+
install curl:
56+
```bash
57+
$ sudo apt -y install curl
58+
```
59+
install npm:
60+
```bash
61+
$ sudo apt -y install npm
62+
```
63+
install node.js:
64+
```bash
65+
$ curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
66+
$ sudo apt-get -y install nodejs
67+
```
68+
get rocketpool:
69+
```bash
70+
$ git clone https://github.com/rocket-pool/rocketpool
71+
```
72+
open the rocketpool directory:
73+
```bash
74+
$ cd rocketpool
75+
```
76+
install npm packages and run tests:
77+
```bash
78+
$ npm install && npm test
79+
```

contracts/Migrations.sol

-28
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
pragma solidity 0.7.6;
2-
31
// SPDX-License-Identifier: GPL-3.0-only
2+
pragma solidity 0.7.6;
43

54
import "@openzeppelin/contracts/math/SafeMath.sol";
65

@@ -9,37 +8,33 @@ import "../../../../interface/dao/node/settings/RocketDAONodeTrustedSettingsMini
98
import "../../../../interface/dao/protocol/settings/RocketDAOProtocolSettingsMinipoolInterface.sol";
109

1110

12-
// The Trusted Node DAO Minipool settings
11+
/// @notice The Trusted Node DAO Minipool settings
1312
contract RocketDAONodeTrustedSettingsMinipool is RocketDAONodeTrustedSettings, RocketDAONodeTrustedSettingsMinipoolInterface {
1413

1514
using SafeMath for uint;
1615

17-
// Construct
1816
constructor(RocketStorageInterface _rocketStorageAddress) RocketDAONodeTrustedSettings(_rocketStorageAddress, "minipool") {
1917
// Set version
20-
version = 1;
18+
version = 2;
2119

2220
// If deployed during initial deployment, initialise now (otherwise must be called after upgrade)
23-
if (!_rocketStorageAddress.getDeployedStatus()){
24-
initialise();
21+
if (!getBool(keccak256(abi.encodePacked(settingNameSpace, "deployed")))) {
22+
// Init settings
23+
setSettingUint("minipool.scrub.period", 12 hours);
24+
setSettingUint("minipool.promotion.scrub.period", 3 days);
25+
setSettingUint("minipool.scrub.quorum", 0.51 ether);
26+
setSettingBool("minipool.scrub.penalty.enabled", false);
27+
setSettingUint("minipool.bond.reduction.window.start", 2 days);
28+
setSettingUint("minipool.bond.reduction.window.length", 2 days);
29+
setSettingUint("minipool.cancel.bond.reduction.quorum", 0.51 ether);
30+
// Settings initialised
31+
setBool(keccak256(abi.encodePacked(settingNameSpace, "deployed")), true);
2532
}
2633
}
2734

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
35+
/// @notice Update a setting, overrides inherited setting method with extra checks for this contract
36+
/// @param _settingPath The path of the setting within this contract's namespace
37+
/// @param _value The value to set it to
4338
function setSettingUint(string memory _settingPath, uint256 _value) override public onlyDAONodeTrustedProposal {
4439
// Some safety guards for certain settings
4540
if(getBool(keccak256(abi.encodePacked(settingNameSpace, "deployed")))) {
@@ -54,18 +49,45 @@ contract RocketDAONodeTrustedSettingsMinipool is RocketDAONodeTrustedSettings, R
5449

5550
// Getters
5651

57-
// How long minipools must wait before moving to staking status (can be scrubbed by ODAO before then)
52+
/// @notice How long minipools must wait before moving to staking status (can be scrubbed by ODAO before then)
5853
function getScrubPeriod() override external view returns (uint256) {
5954
return getSettingUint("minipool.scrub.period");
6055
}
6156

62-
// The required number of trusted nodes to vote to scrub a minipool
57+
/// @notice How long minipools must wait before promoting a vacant minipool to staking status (can be scrubbed by ODAO before then)
58+
function getPromotionScrubPeriod() override external view returns (uint256) {
59+
return getSettingUint("minipool.promotion.scrub.period");
60+
}
61+
62+
/// @notice Returns the required number of trusted nodes to vote to scrub a minipool
6363
function getScrubQuorum() override external view returns (uint256) {
6464
return getSettingUint("minipool.scrub.quorum");
6565
}
6666

67-
// True if scrubbing results in an RPL penalty for the node operator
67+
/// @notice Returns the required number of trusted nodes to vote to cancel a bond reduction
68+
function getCancelBondReductionQuorum() override external view returns (uint256) {
69+
return getSettingUint("minipool.cancel.bond.reduction.quorum");
70+
}
71+
72+
/// @notice Returns true if scrubbing results in an RPL penalty for the node operator
6873
function getScrubPenaltyEnabled() override external view returns (bool) {
6974
return getSettingBool("minipool.scrub.penalty.enabled");
7075
}
76+
77+
/// @notice Returns true if the given time is within the bond reduction window
78+
function isWithinBondReductionWindow(uint256 _time) override external view returns (bool) {
79+
uint256 start = getBondReductionWindowStart();
80+
uint256 length = getBondReductionWindowLength();
81+
return (_time >= start && _time < (start.add(length)));
82+
}
83+
84+
/// @notice Returns the start of the bond reduction window
85+
function getBondReductionWindowStart() override public view returns (uint256) {
86+
return getSettingUint("minipool.bond.reduction.window.start");
87+
}
88+
89+
/// @notice Returns the length of the bond reduction window
90+
function getBondReductionWindowLength() override public view returns (uint256) {
91+
return getSettingUint("minipool.bond.reduction.window.length");
92+
}
7193
}
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,63 @@
1-
pragma solidity 0.7.6;
2-
31
// SPDX-License-Identifier: GPL-3.0-only
2+
pragma solidity 0.7.6;
43

54
import "./RocketDAOProtocolSettings.sol";
65
import "../../../../interface/dao/protocol/settings/RocketDAOProtocolSettingsDepositInterface.sol";
76

8-
// Network deposit settings
9-
7+
/// @notice Network deposit settings
108
contract RocketDAOProtocolSettingsDeposit is RocketDAOProtocolSettings, RocketDAOProtocolSettingsDepositInterface {
119

12-
// Construct
1310
constructor(RocketStorageInterface _rocketStorageAddress) RocketDAOProtocolSettings(_rocketStorageAddress, "deposit") {
1411
// Set version
15-
version = 2;
12+
version = 3;
1613
// Initialize settings on deployment
1714
if(!getBool(keccak256(abi.encodePacked(settingNameSpace, "deployed")))) {
1815
// Apply settings
1916
setSettingBool("deposit.enabled", false);
2017
setSettingBool("deposit.assign.enabled", true);
2118
setSettingUint("deposit.minimum", 0.01 ether);
2219
setSettingUint("deposit.pool.maximum", 160 ether);
23-
setSettingUint("deposit.assign.maximum", 2);
20+
setSettingUint("deposit.assign.maximum", 90);
21+
setSettingUint("deposit.assign.socialised.maximum", 2);
2422
setSettingUint("deposit.fee", 0.0005 ether); // Set to approx. 1 day of rewards at 18.25% APR
2523
// Settings initialised
2624
setBool(keccak256(abi.encodePacked(settingNameSpace, "deployed")), true);
2725
}
2826
}
2927

30-
// Deposits currently enabled
28+
/// @notice Returns true if deposits are currently enabled
3129
function getDepositEnabled() override external view returns (bool) {
3230
return getSettingBool("deposit.enabled");
3331
}
3432

35-
// Deposit assignments currently enabled
33+
/// @notice Returns true if deposit assignments are currently enabled
3634
function getAssignDepositsEnabled() override external view returns (bool) {
3735
return getSettingBool("deposit.assign.enabled");
3836
}
3937

40-
// Minimum deposit size
38+
/// @notice Returns the minimum deposit size
4139
function getMinimumDeposit() override external view returns (uint256) {
4240
return getSettingUint("deposit.minimum");
4341
}
4442

45-
// The maximum size of the deposit pool
43+
/// @notice Returns the maximum size of the deposit pool
4644
function getMaximumDepositPoolSize() override external view returns (uint256) {
4745
return getSettingUint("deposit.pool.maximum");
4846
}
4947

50-
// The maximum number of deposit assignments to perform at once
48+
/// @notice Returns the maximum number of deposit assignments to perform at once
5149
function getMaximumDepositAssignments() override external view returns (uint256) {
5250
return getSettingUint("deposit.assign.maximum");
5351
}
5452

55-
// Get the fee paid on deposits
53+
/// @notice Returns the maximum number of socialised (ie, not related to deposit size) assignments to perform
54+
function getMaximumDepositSocialisedAssignments() override external view returns (uint256) {
55+
return getSettingUint("deposit.assign.socialised.maximum");
56+
}
57+
58+
/// @notice Returns the current fee paid on user deposits
5659
function getDepositFee() override external view returns (uint256) {
5760
return getSettingUint("deposit.fee");
5861
}
62+
5963
}

0 commit comments

Comments
 (0)