/**
* .
* / \
* |.'.|
* |'.'|
* ,'| |`.
* |,-'-|-'-.|
* __|_| | _ _ _____ _
* | ___ \| | | | | | ___ \ | |
* | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | |
* | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| |
* | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | |
* \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_|
* +---------------------------------------------------+
* | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 |
* +---------------------------------------------------+
*
* Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned,
* decentralised, trustless and compatible with staking in Ethereum 2.0.
*
* For more information about Rocket Pool, visit https://rocketpool.net
*
* Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty
*
*/pragmasolidity >0.5.0 <0.9.0;// SPDX-License-Identifier: GPL-3.0-onlyinterfaceAddressSetStorageInterface{
functiongetCount(bytes32 _key) externalviewreturns (uint);
functiongetItem(bytes32 _key, uint _index) externalviewreturns (address);
functiongetIndexOf(bytes32 _key, address _value) externalviewreturns (int);
functionaddItem(bytes32 _key, address _value) external;
functionremoveItem(bytes32 _key, address _value) external;
}
Contract Source Code
File 2 of 21: IERC20.sol
// SPDX-License-Identifier: MITpragmasolidity >=0.6.0 <0.8.0;/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/interfaceIERC20{
/**
* @dev Returns the amount of tokens in existence.
*/functiontotalSupply() externalviewreturns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/functionbalanceOf(address account) externalviewreturns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/functiontransfer(address recipient, uint256 amount) externalreturns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/functionallowance(address owner, address spender) externalviewreturns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/functionapprove(address spender, uint256 amount) externalreturns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/functiontransferFrom(address sender, address recipient, uint256 amount) externalreturns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/eventTransfer(addressindexedfrom, addressindexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/eventApproval(addressindexed owner, addressindexed spender, uint256 value);
}
Contract Source Code
File 3 of 21: MinipoolDeposit.sol
/**
* .
* / \
* |.'.|
* |'.'|
* ,'| |`.
* |,-'-|-'-.|
* __|_| | _ _ _____ _
* | ___ \| | | | | | ___ \ | |
* | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | |
* | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| |
* | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | |
* \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_|
* +---------------------------------------------------+
* | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 |
* +---------------------------------------------------+
*
* Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned,
* decentralised, trustless and compatible with staking in Ethereum 2.0.
*
* For more information about Rocket Pool, visit https://rocketpool.net
*
* Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty
*
*/pragmasolidity 0.7.6;// SPDX-License-Identifier: GPL-3.0-only// Represents the type of deposits required by a minipoolenumMinipoolDeposit {
None, // Marks an invalid deposit type
Full, // The minipool requires 32 ETH from the node operator, 16 ETH of which will be refinanced from user deposits
Half, // The minipool required 16 ETH from the node operator to be matched with 16 ETH from user deposits
Empty, // The minipool requires 0 ETH from the node operator to be matched with 32 ETH from user deposits (trusted nodes only)
Variable // Indicates this minipool is of the new generation that supports a variable deposit amount
}
Contract Source Code
File 4 of 21: MinipoolDetails.sol
/**
* .
* / \
* |.'.|
* |'.'|
* ,'| |`.
* |,-'-|-'-.|
* __|_| | _ _ _____ _
* | ___ \| | | | | | ___ \ | |
* | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | |
* | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| |
* | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | |
* \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_|
* +---------------------------------------------------+
* | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 |
* +---------------------------------------------------+
*
* Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned,
* decentralised, trustless and compatible with staking in Ethereum 2.0.
*
* For more information about Rocket Pool, visit https://rocketpool.net
*
* Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty
*
*/pragmasolidity 0.7.6;// SPDX-License-Identifier: GPL-3.0-onlyimport"./MinipoolDeposit.sol";
import"./MinipoolStatus.sol";
// A struct containing all the information on-chain about a specific minipoolstructMinipoolDetails {
bool exists;
address minipoolAddress;
bytes pubkey;
MinipoolStatus status;
uint256 statusBlock;
uint256 statusTime;
bool finalised;
MinipoolDeposit depositType;
uint256 nodeFee;
uint256 nodeDepositBalance;
bool nodeDepositAssigned;
uint256 userDepositBalance;
bool userDepositAssigned;
uint256 userDepositAssignedTime;
bool useLatestDelegate;
address delegate;
address previousDelegate;
address effectiveDelegate;
uint256 penaltyCount;
uint256 penaltyRate;
address nodeAddress;
}
Contract Source Code
File 5 of 21: MinipoolStatus.sol
/**
* .
* / \
* |.'.|
* |'.'|
* ,'| |`.
* |,-'-|-'-.|
* __|_| | _ _ _____ _
* | ___ \| | | | | | ___ \ | |
* | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | |
* | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| |
* | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | |
* \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_|
* +---------------------------------------------------+
* | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 |
* +---------------------------------------------------+
*
* Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned,
* decentralised, trustless and compatible with staking in Ethereum 2.0.
*
* For more information about Rocket Pool, visit https://rocketpool.net
*
* Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty
*
*/pragmasolidity 0.7.6;// SPDX-License-Identifier: GPL-3.0-only// Represents a minipool's status within the networkenumMinipoolStatus {
Initialised, // The minipool has been initialised and is awaiting a deposit of user ETH
Prelaunch, // The minipool has enough ETH to begin staking and is awaiting launch by the node operator
Staking, // The minipool is currently staking
Withdrawable, // NO LONGER USED
Dissolved // The minipool has been dissolved and its user deposited ETH has been returned to the deposit pool
}
Contract Source Code
File 6 of 21: NodeDetails.sol
/**
* .
* / \
* |.'.|
* |'.'|
* ,'| |`.
* |,-'-|-'-.|
* __|_| | _ _ _____ _
* | ___ \| | | | | | ___ \ | |
* | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | |
* | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| |
* | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | |
* \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_|
* +---------------------------------------------------+
* | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 |
* +---------------------------------------------------+
*
* Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned,
* decentralised, trustless and compatible with staking in Ethereum 2.0.
*
* For more information about Rocket Pool, visit https://rocketpool.net
*
* Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty
*
*/pragmasolidity 0.7.6;// SPDX-License-Identifier: GPL-3.0-only// A struct containing all the information on-chain about a specific nodestructNodeDetails {
bool exists;
uint256 registrationTime;
string timezoneLocation;
bool feeDistributorInitialised;
address feeDistributorAddress;
uint256 rewardNetwork;
uint256 rplStake;
uint256 effectiveRPLStake;
uint256 minimumRPLStake;
uint256 maximumRPLStake;
uint256 ethMatched;
uint256 ethMatchedLimit;
uint256 minipoolCount;
uint256 balanceETH;
uint256 balanceRETH;
uint256 balanceRPL;
uint256 balanceOldRPL;
uint256 depositCreditBalance;
uint256 distributorBalanceUserETH;
uint256 distributorBalanceNodeETH;
address withdrawalAddress;
address pendingWithdrawalAddress;
bool smoothingPoolRegistrationState;
uint256 smoothingPoolRegistrationChanged;
address nodeAddress;
}
Contract Source Code
File 7 of 21: RocketBase.sol
/**
* .
* / \
* |.'.|
* |'.'|
* ,'| |`.
* |,-'-|-'-.|
* __|_| | _ _ _____ _
* | ___ \| | | | | | ___ \ | |
* | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | |
* | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| |
* | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | |
* \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_|
* +---------------------------------------------------+
* | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 |
* +---------------------------------------------------+
*
* Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned,
* decentralised, trustless and compatible with staking in Ethereum 2.0.
*
* For more information about Rocket Pool, visit https://rocketpool.net
*
* Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty
*
*/pragmasolidity 0.7.6;// SPDX-License-Identifier: GPL-3.0-onlyimport"../interface/RocketStorageInterface.sol";
/// @title Base settings / modifiers for each contract in Rocket Pool/// @author David RugendykeabstractcontractRocketBase{
// Calculate using this as the baseuint256constant calcBase =1ether;
// Version of the contractuint8public version;
// The main storage contract where primary persistant storage is maintained
RocketStorageInterface rocketStorage = RocketStorageInterface(0);
/*** Modifiers **********************************************************//**
* @dev Throws if called by any sender that doesn't match a Rocket Pool network contract
*/modifieronlyLatestNetworkContract() {
require(getBool(keccak256(abi.encodePacked("contract.exists", msg.sender))), "Invalid or outdated network contract");
_;
}
/**
* @dev Throws if called by any sender that doesn't match one of the supplied contract or is the latest version of that contract
*/modifieronlyLatestContract(stringmemory _contractName, address _contractAddress) {
require(_contractAddress == getAddress(keccak256(abi.encodePacked("contract.address", _contractName))), "Invalid or outdated contract");
_;
}
/**
* @dev Throws if called by any sender that isn't a registered node
*/modifieronlyRegisteredNode(address _nodeAddress) {
require(getBool(keccak256(abi.encodePacked("node.exists", _nodeAddress))), "Invalid node");
_;
}
/**
* @dev Throws if called by any sender that isn't a trusted node DAO member
*/modifieronlyTrustedNode(address _nodeAddress) {
require(getBool(keccak256(abi.encodePacked("dao.trustednodes.", "member", _nodeAddress))), "Invalid trusted node");
_;
}
/**
* @dev Throws if called by any sender that isn't a registered minipool
*/modifieronlyRegisteredMinipool(address _minipoolAddress) {
require(getBool(keccak256(abi.encodePacked("minipool.exists", _minipoolAddress))), "Invalid minipool");
_;
}
/**
* @dev Throws if called by any account other than a guardian account (temporary account allowed access to settings before DAO is fully enabled)
*/modifieronlyGuardian() {
require(msg.sender== rocketStorage.getGuardian(), "Account is not a temporary guardian");
_;
}
/*** Methods **********************************************************//// @dev Set the main Rocket Storage addressconstructor(RocketStorageInterface _rocketStorageAddress) {
// Update the contract address
rocketStorage = RocketStorageInterface(_rocketStorageAddress);
}
/// @dev Get the address of a network contract by namefunctiongetContractAddress(stringmemory _contractName) internalviewreturns (address) {
// Get the current contract addressaddress contractAddress = getAddress(keccak256(abi.encodePacked("contract.address", _contractName)));
// Check itrequire(contractAddress !=address(0x0), "Contract not found");
// Returnreturn contractAddress;
}
/// @dev Get the address of a network contract by name (returns address(0x0) instead of reverting if contract does not exist)functiongetContractAddressUnsafe(stringmemory _contractName) internalviewreturns (address) {
// Get the current contract addressaddress contractAddress = getAddress(keccak256(abi.encodePacked("contract.address", _contractName)));
// Returnreturn contractAddress;
}
/// @dev Get the name of a network contract by addressfunctiongetContractName(address _contractAddress) internalviewreturns (stringmemory) {
// Get the contract namestringmemory contractName = getString(keccak256(abi.encodePacked("contract.name", _contractAddress)));
// Check itrequire(bytes(contractName).length>0, "Contract not found");
// Returnreturn contractName;
}
/// @dev Get revert error message from a .call methodfunctiongetRevertMsg(bytesmemory _returnData) internalpurereturns (stringmemory) {
// If the _res length is less than 68, then the transaction failed silently (without a revert message)if (_returnData.length<68) return"Transaction reverted silently";
assembly {
// Slice the sighash.
_returnData :=add(_returnData, 0x04)
}
returnabi.decode(_returnData, (string)); // All that remains is the revert string
}
/*** Rocket Storage Methods ****************************************/// Note: Unused helpers have been removed to keep contract sizes down/// @dev Storage get methodsfunctiongetAddress(bytes32 _key) internalviewreturns (address) { return rocketStorage.getAddress(_key); }
functiongetUint(bytes32 _key) internalviewreturns (uint) { return rocketStorage.getUint(_key); }
functiongetString(bytes32 _key) internalviewreturns (stringmemory) { return rocketStorage.getString(_key); }
functiongetBytes(bytes32 _key) internalviewreturns (bytesmemory) { return rocketStorage.getBytes(_key); }
functiongetBool(bytes32 _key) internalviewreturns (bool) { return rocketStorage.getBool(_key); }
functiongetInt(bytes32 _key) internalviewreturns (int) { return rocketStorage.getInt(_key); }
functiongetBytes32(bytes32 _key) internalviewreturns (bytes32) { return rocketStorage.getBytes32(_key); }
/// @dev Storage set methodsfunctionsetAddress(bytes32 _key, address _value) internal{ rocketStorage.setAddress(_key, _value); }
functionsetUint(bytes32 _key, uint _value) internal{ rocketStorage.setUint(_key, _value); }
functionsetString(bytes32 _key, stringmemory _value) internal{ rocketStorage.setString(_key, _value); }
functionsetBytes(bytes32 _key, bytesmemory _value) internal{ rocketStorage.setBytes(_key, _value); }
functionsetBool(bytes32 _key, bool _value) internal{ rocketStorage.setBool(_key, _value); }
functionsetInt(bytes32 _key, int _value) internal{ rocketStorage.setInt(_key, _value); }
functionsetBytes32(bytes32 _key, bytes32 _value) internal{ rocketStorage.setBytes32(_key, _value); }
/// @dev Storage delete methodsfunctiondeleteAddress(bytes32 _key) internal{ rocketStorage.deleteAddress(_key); }
functiondeleteUint(bytes32 _key) internal{ rocketStorage.deleteUint(_key); }
functiondeleteString(bytes32 _key) internal{ rocketStorage.deleteString(_key); }
functiondeleteBytes(bytes32 _key) internal{ rocketStorage.deleteBytes(_key); }
functiondeleteBool(bytes32 _key) internal{ rocketStorage.deleteBool(_key); }
functiondeleteInt(bytes32 _key) internal{ rocketStorage.deleteInt(_key); }
functiondeleteBytes32(bytes32 _key) internal{ rocketStorage.deleteBytes32(_key); }
/// @dev Storage arithmetic methodsfunctionaddUint(bytes32 _key, uint256 _amount) internal{ rocketStorage.addUint(_key, _amount); }
functionsubUint(bytes32 _key, uint256 _amount) internal{ rocketStorage.subUint(_key, _amount); }
}
Contract Source Code
File 8 of 21: RocketDAONodeTrustedSettingsRewardsInterface.sol
/**
* .
* / \
* |.'.|
* |'.'|
* ,'| |`.
* |,-'-|-'-.|
* __|_| | _ _ _____ _
* | ___ \| | | | | | ___ \ | |
* | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | |
* | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| |
* | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | |
* \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_|
* +---------------------------------------------------+
* | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 |
* +---------------------------------------------------+
*
* Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned,
* decentralised, trustless and compatible with staking in Ethereum 2.0.
*
* For more information about Rocket Pool, visit https://rocketpool.net
*
* Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty
*
*/pragmasolidity 0.7.6;// SPDX-License-Identifier: GPL-3.0-onlyinterfaceRocketDAONodeTrustedSettingsRewardsInterface{
functiongetNetworkEnabled(uint256 _network) externalviewreturns (bool);
}
Contract Source Code
File 9 of 21: RocketDAOProtocolSettingsMinipoolInterface.sol
/**
* .
* / \
* |.'.|
* |'.'|
* ,'| |`.
* |,-'-|-'-.|
* __|_| | _ _ _____ _
* | ___ \| | | | | | ___ \ | |
* | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | |
* | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| |
* | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | |
* \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_|
* +---------------------------------------------------+
* | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 |
* +---------------------------------------------------+
*
* Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned,
* decentralised, trustless and compatible with staking in Ethereum 2.0.
*
* For more information about Rocket Pool, visit https://rocketpool.net
*
* Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty
*
*/pragmasolidity >0.5.0 <0.9.0;// SPDX-License-Identifier: GPL-3.0-onlyimport"../../../../types/MinipoolDeposit.sol";
interfaceRocketDAOProtocolSettingsMinipoolInterface{
functiongetLaunchBalance() externalviewreturns (uint256);
functiongetPreLaunchValue() externalpurereturns (uint256);
functiongetDepositUserAmount(MinipoolDeposit _depositType) externalviewreturns (uint256);
functiongetFullDepositUserAmount() externalviewreturns (uint256);
functiongetHalfDepositUserAmount() externalviewreturns (uint256);
functiongetVariableDepositAmount() externalviewreturns (uint256);
functiongetSubmitWithdrawableEnabled() externalviewreturns (bool);
functiongetBondReductionEnabled() externalviewreturns (bool);
functiongetLaunchTimeout() externalviewreturns (uint256);
functiongetMaximumCount() externalviewreturns (uint256);
functionisWithinUserDistributeWindow(uint256 _time) externalviewreturns (bool);
functionhasUserDistributeWindowPassed(uint256 _time) externalviewreturns (bool);
functiongetUserDistributeWindowStart() externalviewreturns (uint256);
functiongetUserDistributeWindowLength() externalviewreturns (uint256);
}
Contract Source Code
File 10 of 21: RocketDAOProtocolSettingsNodeInterface.sol
/**
* .
* / \
* |.'.|
* |'.'|
* ,'| |`.
* |,-'-|-'-.|
* __|_| | _ _ _____ _
* | ___ \| | | | | | ___ \ | |
* | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | |
* | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| |
* | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | |
* \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_|
* +---------------------------------------------------+
* | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 |
* +---------------------------------------------------+
*
* Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned,
* decentralised, trustless and compatible with staking in Ethereum 2.0.
*
* For more information about Rocket Pool, visit https://rocketpool.net
*
* Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty
*
*/pragmasolidity >0.5.0 <0.9.0;// SPDX-License-Identifier: GPL-3.0-onlyinterfaceRocketDAOProtocolSettingsNodeInterface{
functiongetRegistrationEnabled() externalviewreturns (bool);
functiongetSmoothingPoolRegistrationEnabled() externalviewreturns (bool);
functiongetDepositEnabled() externalviewreturns (bool);
functiongetVacantMinipoolsEnabled() externalviewreturns (bool);
functiongetMinimumPerMinipoolStake() externalviewreturns (uint256);
functiongetMaximumPerMinipoolStake() externalviewreturns (uint256);
}
Contract Source Code
File 11 of 21: RocketDAOProtocolSettingsRewardsInterface.sol
/**
* .
* / \
* |.'.|
* |'.'|
* ,'| |`.
* |,-'-|-'-.|
* __|_| | _ _ _____ _
* | ___ \| | | | | | ___ \ | |
* | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | |
* | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| |
* | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | |
* \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_|
* +---------------------------------------------------+
* | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 |
* +---------------------------------------------------+
*
* Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned,
* decentralised, trustless and compatible with staking in Ethereum 2.0.
*
* For more information about Rocket Pool, visit https://rocketpool.net
*
* Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty
*
*/pragmasolidity >0.5.0 <0.9.0;// SPDX-License-Identifier: GPL-3.0-onlyinterfaceRocketDAOProtocolSettingsRewardsInterface{
functionsetSettingRewardsClaimer(stringmemory _contractName, uint256 _perc) external;
functiongetRewardsClaimerPerc(stringmemory _contractName) externalviewreturns (uint256);
functiongetRewardsClaimerPercTimeUpdated(stringmemory _contractName) externalviewreturns (uint256);
functiongetRewardsClaimersPercTotal() externalviewreturns (uint256);
functiongetRewardsClaimIntervalTime() externalviewreturns (uint256);
}
// SPDX-License-Identifier: MITpragmasolidity >=0.6.0 <0.8.0;/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/librarySafeMath{
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/functiontryAdd(uint256 a, uint256 b) internalpurereturns (bool, uint256) {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/functiontrySub(uint256 a, uint256 b) internalpurereturns (bool, uint256) {
if (b > a) return (false, 0);
return (true, a - b);
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/functiontryMul(uint256 a, uint256 b) internalpurereturns (bool, uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the// benefit is lost if 'b' is also tested.// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522if (a ==0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/functiontryDiv(uint256 a, uint256 b) internalpurereturns (bool, uint256) {
if (b ==0) return (false, 0);
return (true, a / b);
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/functiontryMod(uint256 a, uint256 b) internalpurereturns (bool, uint256) {
if (b ==0) return (false, 0);
return (true, a % b);
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/functionadd(uint256 a, uint256 b) internalpurereturns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/functionsub(uint256 a, uint256 b) internalpurereturns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/functionmul(uint256 a, uint256 b) internalpurereturns (uint256) {
if (a ==0) return0;
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/functiondiv(uint256 a, uint256 b) internalpurereturns (uint256) {
require(b >0, "SafeMath: division by zero");
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/functionmod(uint256 a, uint256 b) internalpurereturns (uint256) {
require(b >0, "SafeMath: modulo by zero");
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/functionsub(uint256 a, uint256 b, stringmemory errorMessage) internalpurereturns (uint256) {
require(b <= a, errorMessage);
return a - b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryDiv}.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/functiondiv(uint256 a, uint256 b, stringmemory errorMessage) internalpurereturns (uint256) {
require(b >0, errorMessage);
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/functionmod(uint256 a, uint256 b, stringmemory errorMessage) internalpurereturns (uint256) {
require(b >0, errorMessage);
return a % b;
}
}