Showing preview only (2,118K chars total). Download the full file or copy to clipboard to get everything.
Repository: darcius/rocketpool
Branch: master
Commit: fef41a4f7cf9
Files: 308
Total size: 2.0 MB
Directory structure:
gitextract_0qumgsk9/
├── .gitattributes
├── .github/
│ └── workflows/
│ └── CI.yml
├── .gitignore
├── .mocharc.json
├── LICENSE
├── README.md
├── contracts/
│ ├── .gitattributes
│ ├── contract/
│ │ ├── RocketBase.sol
│ │ ├── RocketStorage.sol
│ │ ├── RocketVault.sol
│ │ ├── auction/
│ │ │ └── RocketAuctionManager.sol
│ │ ├── casper/
│ │ │ └── compiled/
│ │ │ └── Deposit.abi
│ │ ├── dao/
│ │ │ ├── RocketDAOProposal.sol
│ │ │ ├── node/
│ │ │ │ ├── RocketDAONodeTrusted.sol
│ │ │ │ ├── RocketDAONodeTrustedActions.sol
│ │ │ │ ├── RocketDAONodeTrustedProposals.sol
│ │ │ │ ├── RocketDAONodeTrustedUpgrade.sol
│ │ │ │ └── settings/
│ │ │ │ ├── RocketDAONodeTrustedSettings.sol
│ │ │ │ ├── RocketDAONodeTrustedSettingsMembers.sol
│ │ │ │ ├── RocketDAONodeTrustedSettingsMinipool.sol
│ │ │ │ ├── RocketDAONodeTrustedSettingsProposals.sol
│ │ │ │ └── RocketDAONodeTrustedSettingsRewards.sol
│ │ │ ├── protocol/
│ │ │ │ ├── RocketDAOProtocol.sol
│ │ │ │ ├── RocketDAOProtocolActions.sol
│ │ │ │ ├── RocketDAOProtocolProposal.sol
│ │ │ │ ├── RocketDAOProtocolProposals.sol
│ │ │ │ ├── RocketDAOProtocolVerifier.sol
│ │ │ │ └── settings/
│ │ │ │ ├── RocketDAOProtocolSettings.sol
│ │ │ │ ├── RocketDAOProtocolSettingsAuction.sol
│ │ │ │ ├── RocketDAOProtocolSettingsDeposit.sol
│ │ │ │ ├── RocketDAOProtocolSettingsInflation.sol
│ │ │ │ ├── RocketDAOProtocolSettingsMegapool.sol
│ │ │ │ ├── RocketDAOProtocolSettingsMinipool.sol
│ │ │ │ ├── RocketDAOProtocolSettingsNetwork.sol
│ │ │ │ ├── RocketDAOProtocolSettingsNode.sol
│ │ │ │ ├── RocketDAOProtocolSettingsProposals.sol
│ │ │ │ ├── RocketDAOProtocolSettingsRewards.sol
│ │ │ │ └── RocketDAOProtocolSettingsSecurity.sol
│ │ │ └── security/
│ │ │ ├── RocketDAOSecurity.sol
│ │ │ ├── RocketDAOSecurityActions.sol
│ │ │ ├── RocketDAOSecurityProposals.sol
│ │ │ └── RocketDAOSecurityUpgrade.sol
│ │ ├── deposit/
│ │ │ └── RocketDepositPool.sol
│ │ ├── helper/
│ │ │ ├── BeaconStateVerifierMock.sol
│ │ │ ├── MegapoolUpgradeHelper.sol
│ │ │ ├── PenaltyTest.sol
│ │ │ ├── RevertOnTransfer.sol
│ │ │ ├── SnapshotTest.sol
│ │ │ ├── SnapshotTimeTest.sol
│ │ │ ├── StakeHelper.sol
│ │ │ └── StorageHelper.sol
│ │ ├── megapool/
│ │ │ ├── RocketMegapoolDelegate.sol
│ │ │ ├── RocketMegapoolDelegateBase.sol
│ │ │ ├── RocketMegapoolFactory.sol
│ │ │ ├── RocketMegapoolManager.sol
│ │ │ ├── RocketMegapoolPenalties.sol
│ │ │ ├── RocketMegapoolProxy.sol
│ │ │ └── RocketMegapoolStorageLayout.sol
│ │ ├── minipool/
│ │ │ ├── RocketMinipoolBase.sol
│ │ │ ├── RocketMinipoolBondReducer.sol
│ │ │ ├── RocketMinipoolDelegate.sol
│ │ │ ├── RocketMinipoolFactory.sol
│ │ │ ├── RocketMinipoolManager.sol
│ │ │ ├── RocketMinipoolPenalty.sol
│ │ │ ├── RocketMinipoolQueue.sol
│ │ │ └── RocketMinipoolStorageLayout.sol
│ │ ├── network/
│ │ │ ├── RocketNetworkBalances.sol
│ │ │ ├── RocketNetworkFees.sol
│ │ │ ├── RocketNetworkPenalties.sol
│ │ │ ├── RocketNetworkPrices.sol
│ │ │ ├── RocketNetworkRevenues.sol
│ │ │ ├── RocketNetworkSnapshots.sol
│ │ │ ├── RocketNetworkSnapshotsTime.sol
│ │ │ └── RocketNetworkVoting.sol
│ │ ├── node/
│ │ │ ├── RocketNodeDeposit.sol
│ │ │ ├── RocketNodeDistributor.sol
│ │ │ ├── RocketNodeDistributorDelegate.sol
│ │ │ ├── RocketNodeDistributorFactory.sol
│ │ │ ├── RocketNodeDistributorStorageLayout.sol
│ │ │ ├── RocketNodeManager.sol
│ │ │ └── RocketNodeStaking.sol
│ │ ├── rewards/
│ │ │ ├── RocketClaimDAO.sol
│ │ │ ├── RocketMerkleDistributorMainnet.sol
│ │ │ ├── RocketRewardsPool.sol
│ │ │ └── RocketSmoothingPool.sol
│ │ ├── token/
│ │ │ ├── RocketTokenRETH.sol
│ │ │ ├── RocketTokenRPL.sol
│ │ │ └── temp/
│ │ │ └── RocketTokenDummyRPL.sol
│ │ └── util/
│ │ ├── AddressQueueStorage.sol
│ │ ├── AddressSetStorage.sol
│ │ ├── BeaconStateVerifier.sol
│ │ ├── Context.sol
│ │ ├── ERC20.sol
│ │ ├── ERC20Burnable.sol
│ │ ├── LinkedListStorage.sol
│ │ ├── LinkedListStorageHelper.sol
│ │ ├── SSZ.sol
│ │ ├── SafeERC20.sol
│ │ └── SafeMath.sol
│ ├── interface/
│ │ ├── RocketStorageInterface.sol
│ │ ├── RocketVaultInterface.sol
│ │ ├── RocketVaultWithdrawerInterface.sol
│ │ ├── auction/
│ │ │ └── RocketAuctionManagerInterface.sol
│ │ ├── casper/
│ │ │ └── DepositInterface.sol
│ │ ├── dao/
│ │ │ ├── RocketDAOProposalInterface.sol
│ │ │ ├── node/
│ │ │ │ ├── RocketDAONodeTrustedActionsInterface.sol
│ │ │ │ ├── RocketDAONodeTrustedInterface.sol
│ │ │ │ ├── RocketDAONodeTrustedProposalsInterface.sol
│ │ │ │ ├── RocketDAONodeTrustedUpgradeInterface.sol
│ │ │ │ └── settings/
│ │ │ │ ├── RocketDAONodeTrustedSettingsInterface.sol
│ │ │ │ ├── RocketDAONodeTrustedSettingsMembersInterface.sol
│ │ │ │ ├── RocketDAONodeTrustedSettingsMinipoolInterface.sol
│ │ │ │ ├── RocketDAONodeTrustedSettingsProposalsInterface.sol
│ │ │ │ └── RocketDAONodeTrustedSettingsRewardsInterface.sol
│ │ │ ├── protocol/
│ │ │ │ ├── RocketDAOProtocolActionsInterface.sol
│ │ │ │ ├── RocketDAOProtocolInterface.sol
│ │ │ │ ├── RocketDAOProtocolProposalInterface.sol
│ │ │ │ ├── RocketDAOProtocolProposalsInterface.sol
│ │ │ │ ├── RocketDAOProtocolVerifierInterface.sol
│ │ │ │ └── settings/
│ │ │ │ ├── RocketDAOProtocolSettingsAuctionInterface.sol
│ │ │ │ ├── RocketDAOProtocolSettingsDepositInterface.sol
│ │ │ │ ├── RocketDAOProtocolSettingsInflationInterface.sol
│ │ │ │ ├── RocketDAOProtocolSettingsInterface.sol
│ │ │ │ ├── RocketDAOProtocolSettingsMegapoolInterface.sol
│ │ │ │ ├── RocketDAOProtocolSettingsMinipoolInterface.sol
│ │ │ │ ├── RocketDAOProtocolSettingsNetworkInterface.sol
│ │ │ │ ├── RocketDAOProtocolSettingsNodeInterface.sol
│ │ │ │ ├── RocketDAOProtocolSettingsProposalsInterface.sol
│ │ │ │ ├── RocketDAOProtocolSettingsRewardsInterface.sol
│ │ │ │ └── RocketDAOProtocolSettingsSecurityInterface.sol
│ │ │ └── security/
│ │ │ ├── RocketDAOSecurityActionsInterface.sol
│ │ │ ├── RocketDAOSecurityInterface.sol
│ │ │ ├── RocketDAOSecurityProposalsInterface.sol
│ │ │ └── RocketDAOSecurityUpgradeInterface.sol
│ │ ├── deposit/
│ │ │ └── RocketDepositPoolInterface.sol
│ │ ├── megapool/
│ │ │ ├── RocketMegapoolDelegateBaseInterface.sol
│ │ │ ├── RocketMegapoolDelegateInterface.sol
│ │ │ ├── RocketMegapoolFactoryInterface.sol
│ │ │ ├── RocketMegapoolInterface.sol
│ │ │ ├── RocketMegapoolManagerInterface.sol
│ │ │ ├── RocketMegapoolPenaltiesInterface.sol
│ │ │ └── RocketMegapoolProxyInterface.sol
│ │ ├── minipool/
│ │ │ ├── RocketMinipoolBaseInterface.sol
│ │ │ ├── RocketMinipoolBondReducerInterface.sol
│ │ │ ├── RocketMinipoolFactoryInterface.sol
│ │ │ ├── RocketMinipoolInterface.sol
│ │ │ ├── RocketMinipoolManagerInterface.sol
│ │ │ ├── RocketMinipoolPenaltyInterface.sol
│ │ │ └── RocketMinipoolQueueInterface.sol
│ │ ├── network/
│ │ │ ├── RocketNetworkBalancesInterface.sol
│ │ │ ├── RocketNetworkFeesInterface.sol
│ │ │ ├── RocketNetworkPenaltiesInterface.sol
│ │ │ ├── RocketNetworkPricesInterface.sol
│ │ │ ├── RocketNetworkRevenuesInterface.sol
│ │ │ ├── RocketNetworkSnapshotsInterface.sol
│ │ │ ├── RocketNetworkSnapshotsTimeInterface.sol
│ │ │ └── RocketNetworkVotingInterface.sol
│ │ ├── node/
│ │ │ ├── RocketNodeDepositInterface.sol
│ │ │ ├── RocketNodeDistributorFactoryInterface.sol
│ │ │ ├── RocketNodeDistributorInterface.sol
│ │ │ ├── RocketNodeManagerInterface.sol
│ │ │ └── RocketNodeStakingInterface.sol
│ │ ├── rewards/
│ │ │ ├── RocketMerkleDistributorMainnetInterface.sol
│ │ │ ├── RocketRewardsPoolInterface.sol
│ │ │ ├── RocketRewardsRelayInterface.sol
│ │ │ ├── RocketSmoothingPoolInterface.sol
│ │ │ └── claims/
│ │ │ ├── RocketClaimDAOInterface.sol
│ │ │ ├── RocketClaimNodeInterface.sol
│ │ │ └── RocketClaimTrustedNodeInterface.sol
│ │ ├── token/
│ │ │ ├── RocketTokenRETHInterface.sol
│ │ │ └── RocketTokenRPLInterface.sol
│ │ └── util/
│ │ ├── AddressQueueStorageInterface.sol
│ │ ├── AddressSetStorageInterface.sol
│ │ ├── BeaconStateVerifierInterface.sol
│ │ ├── IERC20.sol
│ │ ├── IERC20Burnable.sol
│ │ └── LinkedListStorageInterface.sol
│ ├── thirdparty/
│ │ ├── EthBalanceChecker/
│ │ │ └── EthBalanceChecker.sol
│ │ ├── Multicall2/
│ │ │ └── Multicall2.sol
│ │ ├── RocketSignerRegistry/
│ │ │ ├── RocketSignerRegistry.sol
│ │ │ └── interface/
│ │ │ └── RocketSignerRegistryInterface.sol
│ │ └── UniswapOracleMock/
│ │ └── UniswapOracleMock.sol
│ └── types/
│ ├── MinipoolDeposit.sol
│ ├── MinipoolDetails.sol
│ ├── MinipoolStatus.sol
│ ├── NodeDetails.sol
│ ├── RewardSubmission.sol
│ └── SettingType.sol
├── hardhat-common.config.js
├── hardhat-deploy.config.js
├── hardhat.config.js
├── package.json
├── remapping.json
├── scripts/
│ ├── console.js
│ ├── deploy-upgrade.v1.4.js
│ ├── deploy.js
│ ├── etherscan-verify.js
│ ├── preamble.sol
│ └── upgrade-test.sh
└── test/
├── _helpers/
│ ├── auction.js
│ ├── beaconchain.js
│ ├── bigmath.js
│ ├── bn.js
│ ├── console.js
│ ├── dao.js
│ ├── defaults.js
│ ├── deployer.js
│ ├── deployment.js
│ ├── deposit.js
│ ├── invariants.js
│ ├── megapool.js
│ ├── minipool.js
│ ├── network.js
│ ├── node.js
│ ├── settings.js
│ ├── tokens.js
│ └── verify.js
├── _utils/
│ ├── artifacts.js
│ ├── beacon.js
│ ├── contract.js
│ ├── evm.js
│ ├── formatting.js
│ ├── merkle-tree.js
│ ├── snapshotting.js
│ ├── testing.js
│ └── upgrade.js
├── auction/
│ ├── auction-tests.js
│ ├── scenario-claim-bid.js
│ ├── scenario-create-lot.js
│ ├── scenario-place-bid.js
│ └── scenario-recover-rpl.js
├── dao/
│ ├── dao-node-trusted-tests.js
│ ├── dao-protocol-tests.js
│ ├── dao-protocol-treasury-tests.js
│ ├── dao-security-tests.js
│ ├── scenario-dao-node-trusted-bootstrap.js
│ ├── scenario-dao-node-trusted.js
│ ├── scenario-dao-proposal.js
│ ├── scenario-dao-protocol-bootstrap.js
│ ├── scenario-dao-protocol-treasury.js
│ ├── scenario-dao-protocol.js
│ ├── scenario-dao-security-upgrade.js
│ └── scenario-dao-security.js
├── deposit/
│ ├── deposit-pool-tests.js
│ ├── scenario-assign-deposits.js
│ └── scenario-deposit.js
├── megapool/
│ ├── megapool-tests.js
│ ├── scenario-apply-penalty.js
│ ├── scenario-challenge.js
│ ├── scenario-dissolve.js
│ ├── scenario-distribute.js
│ ├── scenario-exit-queue.js
│ ├── scenario-exit.js
│ ├── scenario-reduce-bond.js
│ ├── scenario-repay-debt.js
│ ├── scenario-stake.js
│ └── scenario-withdraw-credit.js
├── minipool/
│ ├── minipool-scrub-tests.js
│ ├── minipool-status-tests.js
│ ├── minipool-tests.js
│ ├── minipool-vacant-tests.js
│ ├── minipool-withdrawal-tests.js
│ ├── scenario-close.js
│ ├── scenario-dissolve.js
│ ├── scenario-reduce-bond.js
│ ├── scenario-refund.js
│ ├── scenario-scrub.js
│ ├── scenario-skim-rewards.js
│ ├── scenario-stake.js
│ └── scenario-withdraw-validator-balance.js
├── network/
│ ├── network-balances-tests.js
│ ├── network-fees-tests.js
│ ├── network-prices-tests.js
│ ├── network-revenues-tests.js
│ ├── network-snapshots-tests.js
│ ├── network-voting-tests.js
│ ├── scenario-submit-balances.js
│ ├── scenario-submit-penalties.js
│ └── scenario-submit-prices.js
├── node/
│ ├── node-distributor-tests.js
│ ├── node-manager-tests.js
│ ├── node-staking-tests.js
│ ├── scenario-deposit-v2.js
│ ├── scenario-distribute-rewards.js
│ ├── scenario-register-smoothing-pool.js
│ ├── scenario-register.js
│ ├── scenario-set-timezone.js
│ ├── scenario-set-withdrawal-address.js
│ ├── scenario-stake-rpl.js
│ ├── scenario-unstake-legacy-rpl.js
│ ├── scenario-unstake-rpl.js
│ └── scenario-withdraw-rpl.js
├── rewards/
│ ├── rewards-tests.js
│ ├── scenario-claim-and-stake-rewards.js
│ ├── scenario-claim-rewards.js
│ ├── scenario-rewards-claim.js
│ └── scenario-submit-rewards.js
├── rocket-pool-tests.js
├── token/
│ ├── reth-tests.js
│ ├── rpl-tests.js
│ ├── scenario-reth-burn.js
│ ├── scenario-reth-transfer.js
│ ├── scenario-rpl-allow-fixed.js
│ ├── scenario-rpl-burn-fixed.js
│ ├── scenario-rpl-inflation.js
│ └── scenario-rpl-mint-fixed.js
└── util/
├── util-tests.js
└── verifier-tests.js
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitattributes
================================================
*.sol linguist-language=Solidity
================================================
FILE: .github/workflows/CI.yml
================================================
name: CI
on: [push]
jobs:
run-ci:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v3
with:
node-version: 18
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Components
run: npm install
- name: Run Rocket Pool tests
run: npm test
================================================
FILE: .gitignore
================================================
node_modules/
.vscode
.idea/
cache/
artifacts/
.env
coverage/
coverage.json
deployments/
================================================
FILE: .mocharc.json
================================================
{
"require": "hardhat/register",
"timeout": 0
}
================================================
FILE: LICENSE
================================================
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
================================================
FILE: README.md
================================================
<picture>
<img alt="Rocket Pool - Decentralised Ethereum Liquid Staking Protocol" src="https://raw.githubusercontent.com/rocket-pool/.github/main/assets/logo.svg" width="auto" height="120">
</picture>
# Rocket Pool - Decentralised Ethereum Liquid Staking Protocol
Rocket Pool is a decentralized Ethereum liquid staking protocol. It lets people participate in Ethereum staking without needing to run a full validator with 32 ETH, and it also lowers the technical barrier for running nodes. Here’s a breakdown:
### For Regular Stakers
- Users can stake as little as 0.01 ETH by depositing into Rocket Pool’s smart contracts
- In return, they receive rETH (Rocket Pool ETH), a liquid staking token that automatically accrues staking rewards over time
- rETH can be traded, used in DeFi, or redeemed for ETH + rewards
### For Node Operators
- People who want to run validator nodes can join Rocket Pool by staking 8 ETH (instead of the full 32 ETH)
- Rocket Pool pairs that 8 ETH with the ETH deposited by rETH users to make a full validator
- They earn consensus rewards (ETH) plus commission from the rETH users for running the node
### Why It’s Different
- Lower capital requirement, 8 ETH instead of 32 ETH
- Better yield than solo staking for node operators
- Decentralized alternative to centralized exchanges’ staking services
- Permissionless: anyone can run a node, no approval required
- rETH token means stakers don’t have their ETH locked; they can use rETH across DeFi
Learn more at [https://rocketpool.net](https://rocketpool.net).
# Test Rocket Pool
<picture>
<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"/>
</picture>
To see Rocket Pool in action, clone the repo and run the test suite with the following commands:
```bash
$ npm install
$ npm test
```
Having issues? Have an idea? Interested in research?
Our friendly community are available to help via our discord.
<a target="_blank" href="https://discord.gg/rocketpool">
<img src="https://dcbadge.limes.pink/api/server/https://discord.gg/rocketpool">
</a>
================================================
FILE: contracts/.gitattributes
================================================
*.sol linguist-language=Solidity
================================================
FILE: contracts/contract/RocketBase.sol
================================================
pragma solidity >0.5.0 <0.9.0;
// SPDX-License-Identifier: GPL-3.0-only
import "../interface/RocketStorageInterface.sol";
/// @title Base settings / modifiers for each contract in Rocket Pool
/// @author David Rugendyke
abstract contract RocketBase {
// Calculate using this as the base
uint256 constant calcBase = 1 ether;
// Version of the contract
uint8 public version;
// The main storage contract where primary persistant storage is maintained
RocketStorageInterface rocketStorage = RocketStorageInterface(address(0));
/*** Modifiers **********************************************************/
/**
* @dev Throws if called by any sender that doesn't match a Rocket Pool network contract
*/
modifier onlyLatestNetworkContract() {
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
*/
modifier onlyLatestContract(string memory _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
*/
modifier onlyRegisteredNode(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
*/
modifier onlyTrustedNode(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
*/
modifier onlyRegisteredMinipool(address _minipoolAddress) {
require(getBool(keccak256(abi.encodePacked("minipool.exists", _minipoolAddress))), "Invalid minipool");
_;
}
/**
* @dev Throws if called by any sender that isn't a registered megapool
*/
modifier onlyRegisteredMegapool(address _megapoolAddress) {
require(getBool(keccak256(abi.encodePacked("megapool.exists", _megapoolAddress))), "Invalid megapool");
_;
}
/**
* @dev Throws if called by any sender that isn't a registered minipool or megapool
*/
modifier onlyRegisteredMinipoolOrMegapool(address _caller) {
require(
getBool(keccak256(abi.encodePacked("megapool.exists", _caller))) ||
getBool(keccak256(abi.encodePacked("minipool.exists", _caller)))
, "Invalid caller");
_;
}
/**
* @dev Throws if called by any account other than a guardian account (temporary account allowed access to settings before DAO is fully enabled)
*/
modifier onlyGuardian() {
require(msg.sender == rocketStorage.getGuardian(), "Account is not a temporary guardian");
_;
}
/*** Methods **********************************************************/
/// @dev Set the main Rocket Storage address
constructor(RocketStorageInterface _rocketStorageAddress) {
// Update the contract address
rocketStorage = RocketStorageInterface(_rocketStorageAddress);
}
/// @dev Get the address of a network contract by name
function getContractAddress(string memory _contractName) internal view returns (address) {
// Get the current contract address
address contractAddress = getAddress(keccak256(abi.encodePacked("contract.address", _contractName)));
// Check it
require(contractAddress != address(0x0), "Contract not found");
// Return
return contractAddress;
}
/// @dev Get the address of a network contract by name (returns address(0x0) instead of reverting if contract does not exist)
function getContractAddressUnsafe(string memory _contractName) internal view returns (address) {
// Get the current contract address
address contractAddress = getAddress(keccak256(abi.encodePacked("contract.address", _contractName)));
// Return
return contractAddress;
}
/// @dev Get the name of a network contract by address
function getContractName(address _contractAddress) internal view returns (string memory) {
// Get the contract name
string memory contractName = getString(keccak256(abi.encodePacked("contract.name", _contractAddress)));
// Check it
require(bytes(contractName).length > 0, "Contract not found");
// Return
return contractName;
}
/// @dev Get revert error message from a .call method
function getRevertMsg(bytes memory _returnData) internal pure returns (string memory) {
// 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)
}
return abi.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 methods
function getAddress(bytes32 _key) internal view returns (address) { return rocketStorage.getAddress(_key); }
function getUint(bytes32 _key) internal view returns (uint) { return rocketStorage.getUint(_key); }
function getString(bytes32 _key) internal view returns (string memory) { return rocketStorage.getString(_key); }
function getBytes(bytes32 _key) internal view returns (bytes memory) { return rocketStorage.getBytes(_key); }
function getBool(bytes32 _key) internal view returns (bool) { return rocketStorage.getBool(_key); }
function getInt(bytes32 _key) internal view returns (int) { return rocketStorage.getInt(_key); }
function getBytes32(bytes32 _key) internal view returns (bytes32) { return rocketStorage.getBytes32(_key); }
/// @dev Storage set methods
function setAddress(bytes32 _key, address _value) internal { rocketStorage.setAddress(_key, _value); }
function setUint(bytes32 _key, uint _value) internal { rocketStorage.setUint(_key, _value); }
function setString(bytes32 _key, string memory _value) internal { rocketStorage.setString(_key, _value); }
function setBytes(bytes32 _key, bytes memory _value) internal { rocketStorage.setBytes(_key, _value); }
function setBool(bytes32 _key, bool _value) internal { rocketStorage.setBool(_key, _value); }
function setInt(bytes32 _key, int _value) internal { rocketStorage.setInt(_key, _value); }
function setBytes32(bytes32 _key, bytes32 _value) internal { rocketStorage.setBytes32(_key, _value); }
/// @dev Storage delete methods
function deleteAddress(bytes32 _key) internal { rocketStorage.deleteAddress(_key); }
function deleteUint(bytes32 _key) internal { rocketStorage.deleteUint(_key); }
function deleteString(bytes32 _key) internal { rocketStorage.deleteString(_key); }
function deleteBytes(bytes32 _key) internal { rocketStorage.deleteBytes(_key); }
function deleteBool(bytes32 _key) internal { rocketStorage.deleteBool(_key); }
function deleteInt(bytes32 _key) internal { rocketStorage.deleteInt(_key); }
function deleteBytes32(bytes32 _key) internal { rocketStorage.deleteBytes32(_key); }
/// @dev Storage arithmetic methods
function addUint(bytes32 _key, uint256 _amount) internal { rocketStorage.addUint(_key, _amount); }
function subUint(bytes32 _key, uint256 _amount) internal { rocketStorage.subUint(_key, _amount); }
}
================================================
FILE: contracts/contract/RocketStorage.sol
================================================
pragma solidity 0.7.6;
// SPDX-License-Identifier: GPL-3.0-only
import "../interface/RocketStorageInterface.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
/// @title The primary persistent storage for Rocket Pool
/// @author David Rugendyke
contract RocketStorage is RocketStorageInterface {
// Events
event NodeWithdrawalAddressSet(address indexed node, address indexed withdrawalAddress, uint256 time);
event GuardianChanged(address oldGuardian, address newGuardian);
// Libraries
using SafeMath for uint256;
// Storage maps
mapping(bytes32 => string) private stringStorage;
mapping(bytes32 => bytes) private bytesStorage;
mapping(bytes32 => uint256) private uintStorage;
mapping(bytes32 => int256) private intStorage;
mapping(bytes32 => address) private addressStorage;
mapping(bytes32 => bool) private booleanStorage;
mapping(bytes32 => bytes32) private bytes32Storage;
// Protected storage (not accessible by network contracts)
mapping(address => address) private withdrawalAddresses;
mapping(address => address) private pendingWithdrawalAddresses;
// Guardian address
address guardian;
address newGuardian;
// Flag storage has been initialised
bool storageInit = false;
/// @dev Only allow access from the latest version of a contract in the Rocket Pool network after deployment
modifier onlyLatestRocketNetworkContract() {
if (storageInit == true) {
// Make sure the access is permitted to only contracts in our Dapp
require(booleanStorage[keccak256(abi.encodePacked("contract.exists", msg.sender))], "Invalid or outdated network contract");
} else {
// Only Dapp and the guardian account are allowed access during initialisation.
// tx.origin is only safe to use in this case for deployment since no external contracts are interacted with
require((
booleanStorage[keccak256(abi.encodePacked("contract.exists", msg.sender))] || tx.origin == guardian
), "Invalid or outdated network contract attempting access during deployment");
}
_;
}
/// @dev Construct RocketStorage
constructor() {
// Set the guardian upon deployment
guardian = msg.sender;
}
// Get guardian address
function getGuardian() external override view returns (address) {
return guardian;
}
// Transfers guardianship to a new address
function setGuardian(address _newAddress) external override {
// Check tx comes from current guardian
require(msg.sender == guardian, "Is not guardian account");
// Store new address awaiting confirmation
newGuardian = _newAddress;
}
// Confirms change of guardian
function confirmGuardian() external override {
// Check tx came from new guardian address
require(msg.sender == newGuardian, "Confirmation must come from new guardian address");
// Store old guardian for event
address oldGuardian = guardian;
// Update guardian and clear storage
guardian = newGuardian;
delete newGuardian;
// Emit event
emit GuardianChanged(oldGuardian, guardian);
}
// Set this as being deployed now
function getDeployedStatus() external override view returns (bool) {
return storageInit;
}
// Set this as being deployed now
function setDeployedStatus() external {
// Only guardian can lock this down
require(msg.sender == guardian, "Is not guardian account");
// Set it now
storageInit = true;
}
// Protected storage
// Get a node's withdrawal address
function getNodeWithdrawalAddress(address _nodeAddress) public override view returns (address) {
// If no withdrawal address has been set, return the nodes address
address withdrawalAddress = withdrawalAddresses[_nodeAddress];
if (withdrawalAddress == address(0)) {
return _nodeAddress;
}
return withdrawalAddress;
}
// Get a node's pending withdrawal address
function getNodePendingWithdrawalAddress(address _nodeAddress) external override view returns (address) {
return pendingWithdrawalAddresses[_nodeAddress];
}
// Set a node's withdrawal address
function setWithdrawalAddress(address _nodeAddress, address _newWithdrawalAddress, bool _confirm) external override {
// Check new withdrawal address
require(_newWithdrawalAddress != address(0x0), "Invalid withdrawal address");
// Confirm the transaction is from the node's current withdrawal address
address withdrawalAddress = getNodeWithdrawalAddress(_nodeAddress);
require(withdrawalAddress == msg.sender, "Only a tx from a node's withdrawal address can update it");
// Update immediately if confirmed
if (_confirm) {
updateWithdrawalAddress(_nodeAddress, _newWithdrawalAddress);
}
// Set pending withdrawal address if not confirmed
else {
pendingWithdrawalAddresses[_nodeAddress] = _newWithdrawalAddress;
}
}
// Confirm a node's new withdrawal address
function confirmWithdrawalAddress(address _nodeAddress) external override {
// Get node by pending withdrawal address
require(pendingWithdrawalAddresses[_nodeAddress] == msg.sender, "Confirmation must come from the pending withdrawal address");
delete pendingWithdrawalAddresses[_nodeAddress];
// Update withdrawal address
updateWithdrawalAddress(_nodeAddress, msg.sender);
}
// Update a node's withdrawal address
function updateWithdrawalAddress(address _nodeAddress, address _newWithdrawalAddress) private {
// Set new withdrawal address
withdrawalAddresses[_nodeAddress] = _newWithdrawalAddress;
// Emit withdrawal address set event
emit NodeWithdrawalAddressSet(_nodeAddress, _newWithdrawalAddress, block.timestamp);
}
/// @param _key The key for the record
function getAddress(bytes32 _key) override external view returns (address r) {
return addressStorage[_key];
}
/// @param _key The key for the record
function getUint(bytes32 _key) override external view returns (uint256 r) {
return uintStorage[_key];
}
/// @param _key The key for the record
function getString(bytes32 _key) override external view returns (string memory) {
return stringStorage[_key];
}
/// @param _key The key for the record
function getBytes(bytes32 _key) override external view returns (bytes memory) {
return bytesStorage[_key];
}
/// @param _key The key for the record
function getBool(bytes32 _key) override external view returns (bool r) {
return booleanStorage[_key];
}
/// @param _key The key for the record
function getInt(bytes32 _key) override external view returns (int r) {
return intStorage[_key];
}
/// @param _key The key for the record
function getBytes32(bytes32 _key) override external view returns (bytes32 r) {
return bytes32Storage[_key];
}
/// @param _key The key for the record
function setAddress(bytes32 _key, address _value) onlyLatestRocketNetworkContract override external {
addressStorage[_key] = _value;
}
/// @param _key The key for the record
function setUint(bytes32 _key, uint _value) onlyLatestRocketNetworkContract override external {
uintStorage[_key] = _value;
}
/// @param _key The key for the record
function setString(bytes32 _key, string calldata _value) onlyLatestRocketNetworkContract override external {
stringStorage[_key] = _value;
}
/// @param _key The key for the record
function setBytes(bytes32 _key, bytes calldata _value) onlyLatestRocketNetworkContract override external {
bytesStorage[_key] = _value;
}
/// @param _key The key for the record
function setBool(bytes32 _key, bool _value) onlyLatestRocketNetworkContract override external {
booleanStorage[_key] = _value;
}
/// @param _key The key for the record
function setInt(bytes32 _key, int _value) onlyLatestRocketNetworkContract override external {
intStorage[_key] = _value;
}
/// @param _key The key for the record
function setBytes32(bytes32 _key, bytes32 _value) onlyLatestRocketNetworkContract override external {
bytes32Storage[_key] = _value;
}
/// @param _key The key for the record
function deleteAddress(bytes32 _key) onlyLatestRocketNetworkContract override external {
delete addressStorage[_key];
}
/// @param _key The key for the record
function deleteUint(bytes32 _key) onlyLatestRocketNetworkContract override external {
delete uintStorage[_key];
}
/// @param _key The key for the record
function deleteString(bytes32 _key) onlyLatestRocketNetworkContract override external {
delete stringStorage[_key];
}
/// @param _key The key for the record
function deleteBytes(bytes32 _key) onlyLatestRocketNetworkContract override external {
delete bytesStorage[_key];
}
/// @param _key The key for the record
function deleteBool(bytes32 _key) onlyLatestRocketNetworkContract override external {
delete booleanStorage[_key];
}
/// @param _key The key for the record
function deleteInt(bytes32 _key) onlyLatestRocketNetworkContract override external {
delete intStorage[_key];
}
/// @param _key The key for the record
function deleteBytes32(bytes32 _key) onlyLatestRocketNetworkContract override external {
delete bytes32Storage[_key];
}
/// @param _key The key for the record
/// @param _amount An amount to add to the record's value
function addUint(bytes32 _key, uint256 _amount) onlyLatestRocketNetworkContract override external {
uintStorage[_key] = uintStorage[_key].add(_amount);
}
/// @param _key The key for the record
/// @param _amount An amount to subtract from the record's value
function subUint(bytes32 _key, uint256 _amount) onlyLatestRocketNetworkContract override external {
uintStorage[_key] = uintStorage[_key].sub(_amount);
}
}
================================================
FILE: contracts/contract/RocketVault.sol
================================================
pragma solidity 0.7.6;
// SPDX-License-Identifier: GPL-3.0-only
import "./RocketBase.sol";
import "./util/SafeERC20.sol";
import "../interface/RocketVaultInterface.sol";
import "../interface/RocketVaultWithdrawerInterface.sol";
import "../interface/util/IERC20Burnable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
// ETH and rETH are stored here to prevent contract upgrades from affecting balances
// The RocketVault contract must not be upgraded
contract RocketVault is RocketBase, RocketVaultInterface {
// Libs
using SafeMath for uint;
using SafeERC20 for IERC20;
// Network contract balances
mapping(string => uint256) etherBalances;
mapping(bytes32 => uint256) tokenBalances;
// Events
event EtherDeposited(string indexed by, uint256 amount, uint256 time);
event EtherWithdrawn(string indexed by, uint256 amount, uint256 time);
event TokenDeposited(bytes32 indexed by, address indexed tokenAddress, uint256 amount, uint256 time);
event TokenWithdrawn(bytes32 indexed by, address indexed tokenAddress, uint256 amount, uint256 time);
event TokenBurned(bytes32 indexed by, address indexed tokenAddress, uint256 amount, uint256 time);
event TokenTransfer(bytes32 indexed by, bytes32 indexed to, address indexed tokenAddress, uint256 amount, uint256 time);
// Construct
constructor(RocketStorageInterface _rocketStorageAddress) RocketBase(_rocketStorageAddress) {
version = 1;
}
// Get a contract's ETH balance by address
function balanceOf(string memory _networkContractName) override external view returns (uint256) {
// Return balance
return etherBalances[_networkContractName];
}
// Get the balance of a token held by a network contract
function balanceOfToken(string memory _networkContractName, IERC20 _tokenAddress) override external view returns (uint256) {
// Return balance
return tokenBalances[keccak256(abi.encodePacked(_networkContractName, _tokenAddress))];
}
// Accept an ETH deposit from a network contract
// Only accepts calls from Rocket Pool network contracts
function depositEther() override external payable onlyLatestNetworkContract {
// Valid amount?
require(msg.value > 0, "No valid amount of ETH given to deposit");
// Get contract key
string memory contractName = getContractName(msg.sender);
// Update contract balance
etherBalances[contractName] = etherBalances[contractName].add(msg.value);
// Emit ether deposited event
emit EtherDeposited(contractName, msg.value, block.timestamp);
}
// Withdraw an amount of ETH to a network contract
// Only accepts calls from Rocket Pool network contracts
function withdrawEther(uint256 _amount) override external onlyLatestNetworkContract {
// Valid amount?
require(_amount > 0, "No valid amount of ETH given to withdraw");
// Get contract key
string memory contractName = getContractName(msg.sender);
// Check and update contract balance
require(etherBalances[contractName] >= _amount, "Insufficient contract ETH balance");
etherBalances[contractName] = etherBalances[contractName].sub(_amount);
// Withdraw
RocketVaultWithdrawerInterface withdrawer = RocketVaultWithdrawerInterface(msg.sender);
withdrawer.receiveVaultWithdrawalETH{value: _amount}();
// Emit ether withdrawn event
emit EtherWithdrawn(contractName, _amount, block.timestamp);
}
// Accept an token deposit and assign its balance to a network contract (saves a large amount of gas this way through not needing a double token transfer via a network contract first)
function depositToken(string memory _networkContractName, IERC20 _tokenContract, uint256 _amount) override external {
// Valid amount?
require(_amount > 0, "No valid amount of tokens given to deposit");
// Make sure the network contract is valid (will throw if not)
require(getContractAddress(_networkContractName) != address(0x0), "Not a valid network contract");
// Get contract key
bytes32 contractKey = keccak256(abi.encodePacked(_networkContractName, address(_tokenContract)));
// Send the tokens to this contract now
require(_tokenContract.transferFrom(msg.sender, address(this), _amount), "Token transfer was not successful");
// Update contract balance
tokenBalances[contractKey] = tokenBalances[contractKey].add(_amount);
// Emit token transfer
emit TokenDeposited(contractKey, address(_tokenContract), _amount, block.timestamp);
}
// Withdraw an amount of a ERC20 token to an address
// Only accepts calls from Rocket Pool network contracts
function withdrawToken(address _withdrawalAddress, IERC20 _tokenAddress, uint256 _amount) override external onlyLatestNetworkContract {
// Valid amount?
require(_amount > 0, "No valid amount of tokens given to withdraw");
// Get contract key
bytes32 contractKey = keccak256(abi.encodePacked(getContractName(msg.sender), _tokenAddress));
// Update balances
tokenBalances[contractKey] = tokenBalances[contractKey].sub(_amount);
// Get the token ERC20 instance
IERC20 tokenContract = IERC20(_tokenAddress);
// Withdraw to the desired address
require(tokenContract.transfer(_withdrawalAddress, _amount), "Rocket Vault token withdrawal unsuccessful");
// Emit token withdrawn event
emit TokenWithdrawn(contractKey, address(_tokenAddress), _amount, block.timestamp);
}
// Transfer token from one contract to another
// Only accepts calls from Rocket Pool network contracts
function transferToken(string memory _networkContractName, IERC20 _tokenAddress, uint256 _amount) override external onlyLatestNetworkContract {
// Valid amount?
require(_amount > 0, "No valid amount of tokens given to transfer");
// Make sure the network contract is valid (will throw if not)
require(getContractAddress(_networkContractName) != address(0x0), "Not a valid network contract");
// Get contract keys
bytes32 contractKeyFrom = keccak256(abi.encodePacked(getContractName(msg.sender), _tokenAddress));
bytes32 contractKeyTo = keccak256(abi.encodePacked(_networkContractName, _tokenAddress));
// Update balances
tokenBalances[contractKeyFrom] = tokenBalances[contractKeyFrom].sub(_amount);
tokenBalances[contractKeyTo] = tokenBalances[contractKeyTo].add(_amount);
// Emit token withdrawn event
emit TokenTransfer(contractKeyFrom, contractKeyTo, address(_tokenAddress), _amount, block.timestamp);
}
// Burns an amount of a token that implements a burn(uint256) method
// Only accepts calls from Rocket Pool network contracts
function burnToken(IERC20Burnable _tokenAddress, uint256 _amount) override external onlyLatestNetworkContract {
// Get contract key
bytes32 contractKey = keccak256(abi.encodePacked(getContractName(msg.sender), _tokenAddress));
// Update balances
tokenBalances[contractKey] = tokenBalances[contractKey].sub(_amount);
// Get the token ERC20 instance
IERC20Burnable tokenContract = IERC20Burnable(_tokenAddress);
// Burn the tokens
tokenContract.burn(_amount);
// Emit token burn event
emit TokenBurned(contractKey, address(_tokenAddress), _amount, block.timestamp);
}
}
================================================
FILE: contracts/contract/auction/RocketAuctionManager.sol
================================================
pragma solidity 0.7.6;
// SPDX-License-Identifier: GPL-3.0-only
import "@openzeppelin/contracts/math/SafeMath.sol";
import "../RocketBase.sol";
import "../../interface/auction/RocketAuctionManagerInterface.sol";
import "../../interface/deposit/RocketDepositPoolInterface.sol";
import "../../interface/network/RocketNetworkPricesInterface.sol";
import "../../interface/dao/protocol/settings/RocketDAOProtocolSettingsAuctionInterface.sol";
import "../../interface/RocketVaultInterface.sol";
// Facilitates RPL liquidation auctions
contract RocketAuctionManager is RocketBase, RocketAuctionManagerInterface {
// Libs
using SafeMath for uint;
// Events
event LotCreated(uint256 indexed lotIndex, address indexed by, uint256 rplAmount, uint256 time);
event BidPlaced(uint256 indexed lotIndex, address indexed by, uint256 bidAmount, uint256 time);
event BidClaimed(uint256 indexed lotIndex, address indexed by, uint256 bidAmount, uint256 rplAmount, uint256 time);
event RPLRecovered(uint256 indexed lotIndex, address indexed by, uint256 rplAmount, uint256 time);
// Construct
constructor(RocketStorageInterface _rocketStorageAddress) RocketBase(_rocketStorageAddress) {
version = 1;
}
// Get the total RPL balance of the contract
function getTotalRPLBalance() override public view returns (uint256) {
RocketVaultInterface rocketVault = RocketVaultInterface(getContractAddress("rocketVault"));
return rocketVault.balanceOfToken("rocketAuctionManager", IERC20(getContractAddress("rocketTokenRPL")));
}
// Get/set the allotted RPL balance of the contract
function getAllottedRPLBalance() override public view returns (uint256) {
return getUint(keccak256("auction.rpl.allotted"));
}
function increaseAllottedRPLBalance(uint256 _amount) private {
addUint(keccak256(abi.encodePacked("auction.rpl.allotted")), _amount);
}
function decreaseAllottedRPLBalance(uint256 _amount) private {
subUint(keccak256(abi.encodePacked("auction.rpl.allotted")), _amount);
}
// Get the remaining (unallotted) RPL balance of the contract
function getRemainingRPLBalance() override public view returns (uint256) {
return getTotalRPLBalance().sub(getAllottedRPLBalance());
}
// Get/set the number of lots for auction
function getLotCount() override public view returns (uint256) {
return getUint(keccak256("auction.lots.count"));
}
function setLotCount(uint256 _amount) private {
setUint(keccak256("auction.lots.count"), _amount);
}
// Get lot details
function getLotExists(uint256 _index) override public view returns (bool) {
return getBool(keccak256(abi.encodePacked("auction.lot.exists", _index)));
}
function getLotStartBlock(uint256 _index) override public view returns (uint256) {
return getUint(keccak256(abi.encodePacked("auction.lot.block.start", _index)));
}
function getLotEndBlock(uint256 _index) override public view returns (uint256) {
return getUint(keccak256(abi.encodePacked("auction.lot.block.end", _index)));
}
function getLotStartPrice(uint256 _index) override public view returns (uint256) {
return getUint(keccak256(abi.encodePacked("auction.lot.price.start", _index)));
}
function getLotReservePrice(uint256 _index) override public view returns (uint256) {
return getUint(keccak256(abi.encodePacked("auction.lot.price.reserve", _index)));
}
function getLotTotalRPLAmount(uint256 _index) override public view returns (uint256) {
return getUint(keccak256(abi.encodePacked("auction.lot.rpl.total", _index)));
}
// Get/set the total ETH amount bid on a lot
function getLotTotalBidAmount(uint256 _index) override public view returns (uint256) {
return getUint(keccak256(abi.encodePacked("auction.lot.bid.total", _index)));
}
function increaseLotTotalBidAmount(uint256 _index, uint256 _amount) private {
addUint(keccak256(abi.encodePacked("auction.lot.bid.total", _index)), _amount);
}
// Get/set the ETH amount bid on a lot by an address
function getLotAddressBidAmount(uint256 _index, address _bidder) override public view returns (uint256) {
return getUint(keccak256(abi.encodePacked("auction.lot.bid.address", _index, _bidder)));
}
function setLotAddressBidAmount(uint256 _index, address _bidder, uint256 _amount) private {
setUint(keccak256(abi.encodePacked("auction.lot.bid.address", _index, _bidder)), _amount);
}
function increaseLotAddressBidAmount(uint256 _index, address _bidder, uint256 _amount) private {
addUint(keccak256(abi.encodePacked("auction.lot.bid.address", _index, _bidder)), _amount);
}
// Get/set the lot's RPL recovered status
function getLotRPLRecovered(uint256 _index) override public view returns (bool) {
return getBool(keccak256(abi.encodePacked("auction.lot.rpl.recovered", _index)));
}
function setLotRPLRecovered(uint256 _index, bool _recovered) private {
setBool(keccak256(abi.encodePacked("auction.lot.rpl.recovered", _index)), _recovered);
}
// Get the RPL price for a lot at a block
function getLotPriceAtBlock(uint256 _index, uint256 _block) override public view returns (uint256) {
// Get lot parameters
uint256 startBlock = getLotStartBlock(_index);
uint256 endBlock = getLotEndBlock(_index);
uint256 startPrice = getLotStartPrice(_index);
uint256 endPrice = getLotReservePrice(_index);
// Calculate & return
if (_block <= startBlock) { return startPrice; }
if (_block >= endBlock) { return endPrice; }
uint256 tn = _block.sub(startBlock);
uint256 td = endBlock.sub(startBlock);
return startPrice.sub(startPrice.sub(endPrice).mul(tn).mul(tn).div(td).div(td));
}
// Get the RPL price for a lot at the current block
function getLotPriceAtCurrentBlock(uint256 _index) override public view returns (uint256) {
return getLotPriceAtBlock(_index, block.number);
}
// Get the RPL price for a lot based on total ETH amount bid
function getLotPriceByTotalBids(uint256 _index) override public view returns (uint256) {
return calcBase.mul(getLotTotalBidAmount(_index)).div(getLotTotalRPLAmount(_index));
}
// Get the current RPL price for a lot
// Returns the clearing price if cleared, or the price at the current block otherwise
function getLotCurrentPrice(uint256 _index) override public view returns (uint256) {
uint256 blockPrice = getLotPriceAtCurrentBlock(_index);
uint256 bidPrice = getLotPriceByTotalBids(_index);
if (bidPrice > blockPrice) { return bidPrice; }
else { return blockPrice; }
}
// Get the amount of claimed RPL in a lot
function getLotClaimedRPLAmount(uint256 _index) override public view returns (uint256) {
uint256 claimed = calcBase.mul(getLotTotalBidAmount(_index)).div(getLotCurrentPrice(_index));
uint256 total = getLotTotalRPLAmount(_index);
// Due to integer arithmetic, the calculated claimed amount may be slightly greater than the total
if (claimed > total) {
return total;
}
return claimed;
}
// Get the amount of remaining RPL in a lot
function getLotRemainingRPLAmount(uint256 _index) override public view returns (uint256) {
return getLotTotalRPLAmount(_index).sub(getLotClaimedRPLAmount(_index));
}
// Check whether a lot has cleared
function getLotIsCleared(uint256 _index) override external view returns (bool) {
if (block.number >= getLotEndBlock(_index)) { return true; }
if (getLotPriceByTotalBids(_index) >= getLotPriceAtCurrentBlock(_index)) { return true; }
return false;
}
// Create a new lot for auction
function createLot() override external onlyLatestContract("rocketAuctionManager", address(this)) {
// Load contracts
RocketDAOProtocolSettingsAuctionInterface rocketAuctionSettings = RocketDAOProtocolSettingsAuctionInterface(getContractAddress("rocketDAOProtocolSettingsAuction"));
RocketNetworkPricesInterface rocketNetworkPrices = RocketNetworkPricesInterface(getContractAddress("rocketNetworkPrices"));
// Get remaining RPL balance & RPL price
uint256 remainingRplBalance = getRemainingRPLBalance();
uint256 rplPrice = rocketNetworkPrices.getRPLPrice();
// Check lot can be created
require(rocketAuctionSettings.getCreateLotEnabled(), "Creating lots is currently disabled");
require(remainingRplBalance >= calcBase.mul(rocketAuctionSettings.getLotMinimumEthValue()).div(rplPrice), "Insufficient RPL balance to create new lot");
// Calculate lot RPL amount
uint256 lotRplAmount = remainingRplBalance;
uint256 maximumLotRplAmount = calcBase.mul(rocketAuctionSettings.getLotMaximumEthValue()).div(rplPrice);
if (lotRplAmount > maximumLotRplAmount) { lotRplAmount = maximumLotRplAmount; }
// Create lot
uint256 lotIndex = getLotCount();
setBool(keccak256(abi.encodePacked("auction.lot.exists", lotIndex)), true);
setUint(keccak256(abi.encodePacked("auction.lot.block.start", lotIndex)), block.number);
setUint(keccak256(abi.encodePacked("auction.lot.block.end", lotIndex)), block.number.add(rocketAuctionSettings.getLotDuration()));
setUint(keccak256(abi.encodePacked("auction.lot.price.start", lotIndex)), rplPrice.mul(rocketAuctionSettings.getStartingPriceRatio()).div(calcBase));
setUint(keccak256(abi.encodePacked("auction.lot.price.reserve", lotIndex)), rplPrice.mul(rocketAuctionSettings.getReservePriceRatio()).div(calcBase));
setUint(keccak256(abi.encodePacked("auction.lot.rpl.total", lotIndex)), lotRplAmount);
// Increment lot count & increase allotted RPL balance
setLotCount(lotIndex.add(1));
increaseAllottedRPLBalance(lotRplAmount);
// Emit lot created event
emit LotCreated(lotIndex, msg.sender, lotRplAmount, block.timestamp);
}
// Bid on a lot
function placeBid(uint256 _lotIndex) override external payable onlyLatestContract("rocketAuctionManager", address(this)) {
// Load contracts
RocketDAOProtocolSettingsAuctionInterface rocketAuctionSettings = RocketDAOProtocolSettingsAuctionInterface(getContractAddress("rocketDAOProtocolSettingsAuction"));
RocketDepositPoolInterface rocketDepositPool = RocketDepositPoolInterface(getContractAddress("rocketDepositPool"));
// Check bid amount
require(msg.value > 0, "Invalid bid amount");
// Check lot exists
require(getLotExists(_lotIndex), "Lot does not exist");
// Check lot can be bid on
require(rocketAuctionSettings.getBidOnLotEnabled(), "Bidding on lots is currently disabled");
require(block.number < getLotEndBlock(_lotIndex), "Lot bidding period has concluded");
// Check lot has RPL remaining
uint256 remainingRplAmount = getLotRemainingRPLAmount(_lotIndex);
require(remainingRplAmount > 0, "Lot RPL allocation has been exhausted");
// Calculate the bid amount
uint256 bidAmount = msg.value;
uint256 maximumBidAmount = remainingRplAmount.mul(getLotPriceAtCurrentBlock(_lotIndex)).div(calcBase);
if (bidAmount > maximumBidAmount) { bidAmount = maximumBidAmount; }
// Increase lot bid amounts
increaseLotTotalBidAmount(_lotIndex, bidAmount);
increaseLotAddressBidAmount(_lotIndex, msg.sender, bidAmount);
// Transfer bid amount to deposit pool
rocketDepositPool.recycleLiquidatedStake{value: bidAmount}();
// Refund excess ETH to sender
if (msg.value > bidAmount) { msg.sender.transfer(msg.value.sub(bidAmount)); }
// Emit bid placed event
emit BidPlaced(_lotIndex, msg.sender, bidAmount, block.timestamp);
}
// Claim RPL from a lot
function claimBid(uint256 _lotIndex) override external onlyLatestContract("rocketAuctionManager", address(this)) {
// Check lot exists
require(getLotExists(_lotIndex), "Lot does not exist");
// Get lot price info
uint256 blockPrice = getLotPriceAtCurrentBlock(_lotIndex);
uint256 bidPrice = getLotPriceByTotalBids(_lotIndex);
// Check lot can be claimed from
require(block.number >= getLotEndBlock(_lotIndex) || bidPrice >= blockPrice, "Lot has not cleared yet");
// Get & check address bid amount
uint256 bidAmount = getLotAddressBidAmount(_lotIndex, msg.sender);
require(bidAmount > 0, "Address has no RPL to claim");
// Calculate current lot price
uint256 currentPrice;
if (bidPrice > blockPrice) { currentPrice = bidPrice; }
else { currentPrice = blockPrice; }
// Calculate RPL claim amount
uint256 rplAmount = calcBase.mul(bidAmount).div(currentPrice);
// Due to integer arithmetic, there may be a tiny bit less than calculated
uint256 allottedAmount = getAllottedRPLBalance();
if (rplAmount > allottedAmount) {
rplAmount = allottedAmount;
}
// Transfer RPL to bidder
RocketVaultInterface rocketVault = RocketVaultInterface(getContractAddress("rocketVault"));
rocketVault.withdrawToken(msg.sender, IERC20(getContractAddress("rocketTokenRPL")), rplAmount);
// Decrease allotted RPL balance & update address bid amount
decreaseAllottedRPLBalance(rplAmount);
setLotAddressBidAmount(_lotIndex, msg.sender, 0);
// Emit bid claimed event
emit BidClaimed(_lotIndex, msg.sender, bidAmount, rplAmount, block.timestamp);
}
// Recover unclaimed RPL from a lot
function recoverUnclaimedRPL(uint256 _lotIndex) override external onlyLatestContract("rocketAuctionManager", address(this)) {
// Check lot exists and has not already had RPL recovered
require(getLotExists(_lotIndex), "Lot does not exist");
require(!getLotRPLRecovered(_lotIndex), "Unclaimed RPL has already been recovered from the lot");
// Check RPL can be reclaimed from lot
require(block.number >= getLotEndBlock(_lotIndex), "Lot bidding period has not concluded yet");
// Get & check remaining RPL amount
uint256 remainingRplAmount = getLotRemainingRPLAmount(_lotIndex);
require(remainingRplAmount > 0, "No unclaimed RPL is available to recover");
// Decrease allotted RPL balance & set RPL recovered status
decreaseAllottedRPLBalance(remainingRplAmount);
setLotRPLRecovered(_lotIndex, true);
// Emit RPL recovered event
emit RPLRecovered(_lotIndex, msg.sender, remainingRplAmount, block.timestamp);
}
}
================================================
FILE: contracts/contract/casper/compiled/Deposit.abi
================================================
[{"name": "DepositEvent", "inputs": [{"type": "bytes", "name": "pubkey", "indexed": false}, {"type": "bytes", "name": "withdrawal_credentials", "indexed": false}, {"type": "bytes", "name": "amount", "indexed": false}, {"type": "bytes", "name": "signature", "indexed": false}, {"type": "bytes", "name": "index", "indexed": false}], "anonymous": false, "type": "event"}, {"outputs": [], "inputs": [], "constant": false, "payable": false, "type": "constructor"}, {"name": "get_deposit_root", "outputs": [{"type": "bytes32", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 91674}, {"name": "get_deposit_count", "outputs": [{"type": "bytes", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 10433}, {"name": "deposit", "outputs": [], "inputs": [{"type": "bytes", "name": "pubkey"}, {"type": "bytes", "name": "withdrawal_credentials"}, {"type": "bytes", "name": "signature"}, {"type": "bytes32", "name": "deposit_data_root"}], "constant": false, "payable": true, "type": "function", "gas": 1334547}]
================================================
FILE: contracts/contract/dao/RocketDAOProposal.sol
================================================
pragma solidity 0.7.6;
// SPDX-License-Identifier: GPL-3.0-only
import "../RocketBase.sol";
import "../../interface/dao/RocketDAOProposalInterface.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
// A DAO proposal
contract RocketDAOProposal is RocketBase, RocketDAOProposalInterface {
using SafeMath for uint;
// Events
event ProposalAdded(address indexed proposer, string indexed proposalDAO, uint256 indexed proposalID, bytes payload, uint256 time);
event ProposalVoted(uint256 indexed proposalID, address indexed voter, bool indexed supported, uint256 time);
event ProposalExecuted(uint256 indexed proposalID, address indexed executor, uint256 time);
event ProposalCancelled(uint256 indexed proposalID, address indexed canceller, uint256 time);
// The namespace for any data stored in the trusted node DAO (do not change)
string constant private daoProposalNameSpace = "dao.proposal.";
// Only allow the DAO contract to access
modifier onlyDAOContract(string memory _daoName) {
// Load contracts
require(keccak256(abi.encodePacked(getContractName(msg.sender))) == keccak256(abi.encodePacked(_daoName)), "Sender is not the required DAO contract");
_;
}
// Construct
constructor(RocketStorageInterface _rocketStorageAddress) RocketBase(_rocketStorageAddress) {
// Version
version = 2;
}
/*** Proposals ****************/
// Get the current total proposals
function getTotal() override public view returns (uint256) {
return getUint(keccak256(abi.encodePacked(daoProposalNameSpace, "total")));
}
// Get the DAO that this proposal belongs too
function getDAO(uint256 _proposalID) override public view returns (string memory) {
return getString(keccak256(abi.encodePacked(daoProposalNameSpace, "dao", _proposalID)));
}
// Get the member who proposed
function getProposer(uint256 _proposalID) override public view returns (address) {
return getAddress(keccak256(abi.encodePacked(daoProposalNameSpace, "proposer", _proposalID)));
}
// Get the proposal message
function getMessage(uint256 _proposalID) override external view returns (string memory) {
return getString(keccak256(abi.encodePacked(daoProposalNameSpace, "message", _proposalID)));
}
// Get the start block of this proposal
function getStart(uint256 _proposalID) override public view returns (uint256) {
return getUint(keccak256(abi.encodePacked(daoProposalNameSpace, "start", _proposalID)));
}
// Get the end block of this proposal
function getEnd(uint256 _proposalID) override public view returns (uint256) {
return getUint(keccak256(abi.encodePacked(daoProposalNameSpace, "end", _proposalID)));
}
// The block where the proposal expires and can no longer be executed if it is successful
function getExpires(uint256 _proposalID) override public view returns (uint256) {
return getUint(keccak256(abi.encodePacked(daoProposalNameSpace, "expires", _proposalID)));
}
// Get the created status of this proposal
function getCreated(uint256 _proposalID) override external view returns (uint256) {
return getUint(keccak256(abi.encodePacked(daoProposalNameSpace, "created", _proposalID)));
}
// Get the votes count for this proposal
function getVotesFor(uint256 _proposalID) override public view returns (uint256) {
return getUint(keccak256(abi.encodePacked(daoProposalNameSpace, "votes.for", _proposalID)));
}
// Get the votes count against this proposal
function getVotesAgainst(uint256 _proposalID) override public view returns (uint256) {
return getUint(keccak256(abi.encodePacked(daoProposalNameSpace, "votes.against", _proposalID)));
}
// How many votes are required for the proposal to succeed
function getVotesRequired(uint256 _proposalID) override public view returns (uint256) {
return getUint(keccak256(abi.encodePacked(daoProposalNameSpace, "votes.required", _proposalID)));
}
// Get the cancelled status of this proposal
function getCancelled(uint256 _proposalID) override public view returns (bool) {
return getBool(keccak256(abi.encodePacked(daoProposalNameSpace, "cancelled", _proposalID)));
}
// Get the executed status of this proposal
function getExecuted(uint256 _proposalID) override public view returns (bool) {
return getBool(keccak256(abi.encodePacked(daoProposalNameSpace, "executed", _proposalID)));
}
// Get the votes against count of this proposal
function getPayload(uint256 _proposalID) override public view returns (bytes memory) {
return getBytes(keccak256(abi.encodePacked(daoProposalNameSpace, "payload", _proposalID)));
}
// Returns true if this proposal has already been voted on by a member
function getReceiptHasVoted(uint256 _proposalID, address _nodeAddress) override public view returns (bool) {
return getBool(keccak256(abi.encodePacked(daoProposalNameSpace, "receipt.hasVoted", _proposalID, _nodeAddress)));
}
// Returns true if this proposal was supported by this member
function getReceiptSupported(uint256 _proposalID, address _nodeAddress) override external view returns (bool) {
return getBool(keccak256(abi.encodePacked(daoProposalNameSpace, "receipt.supported", _proposalID, _nodeAddress)));
}
// Return the state of the specified proposal
// A successful proposal can be executed immediately
function getState(uint256 _proposalID) override public view returns (ProposalState) {
// Check the proposal ID is legit
require(getTotal() >= _proposalID && _proposalID > 0, "Invalid proposal ID");
// Get the amount of votes for and against
uint256 votesFor = getVotesFor(_proposalID);
uint256 votesAgainst = getVotesAgainst(_proposalID);
// Now return the state of the current proposal
if (getCancelled(_proposalID)) {
// Cancelled by the proposer?
return ProposalState.Cancelled;
// Has it been executed?
} else if (getExecuted(_proposalID)) {
return ProposalState.Executed;
// Is the proposal pending? Eg. waiting to be voted on
} else if (block.timestamp < getStart(_proposalID)) {
return ProposalState.Pending;
// Vote was successful, is now awaiting execution
} else if (votesFor >= getVotesRequired(_proposalID) && block.timestamp < getExpires(_proposalID)) {
return ProposalState.Succeeded;
// The proposal is active and can be voted on
} else if (block.timestamp < getEnd(_proposalID)) {
return ProposalState.Active;
// Check the votes, was it defeated?
} else if (votesFor <= votesAgainst || votesFor < getVotesRequired(_proposalID)) {
return ProposalState.Defeated;
} else {
// Was it successful, but has now expired? and cannot be executed anymore?
return ProposalState.Expired;
}
}
// Add a proposal to the an RP DAO, immeditately becomes active
// Calldata is passed as the payload to execute upon passing the proposal
function add(address _member, string memory _dao, string memory _message, uint256 _startTime, uint256 _duration, uint256 _expires, uint256 _votesRequired, bytes memory _payload) override external onlyDAOContract(_dao) returns (uint256) {
// Basic checks
require(_startTime > block.timestamp, "Proposal start time must be in the future");
require(_duration > 0, "Proposal cannot have a duration of 0");
require(_expires > 0, "Proposal cannot have a execution expiration of 0");
require(_votesRequired > 0, "Proposal cannot have a 0 votes required to be successful");
// Set the end block
uint256 endTime = _startTime.add(_duration);
// Set the expires block
uint256 expires = endTime.add(_expires);
// Get the proposal ID
uint256 proposalID = getTotal().add(1);
// The data structure for a proposal
setAddress(keccak256(abi.encodePacked(daoProposalNameSpace, "proposer", proposalID)), _member); // Which member is making the proposal
setString(keccak256(abi.encodePacked(daoProposalNameSpace, "dao", proposalID)), _dao); // The DAO the proposal relates too
setString(keccak256(abi.encodePacked(daoProposalNameSpace, "message", proposalID)), _message); // A general message that can be included with the proposal
setUint(keccak256(abi.encodePacked(daoProposalNameSpace, "start", proposalID)), _startTime); // The time the proposal becomes active for voting on
setUint(keccak256(abi.encodePacked(daoProposalNameSpace, "end", proposalID)), endTime); // The time the proposal where voting ends
setUint(keccak256(abi.encodePacked(daoProposalNameSpace, "expires", proposalID)), expires); // The time when the proposal expires and can no longer be executed if it is successful
setUint(keccak256(abi.encodePacked(daoProposalNameSpace, "created", proposalID)), block.timestamp); // The time the proposal was created at
setUint(keccak256(abi.encodePacked(daoProposalNameSpace, "votes.for", proposalID)), 0); // Votes for this proposal
setUint(keccak256(abi.encodePacked(daoProposalNameSpace, "votes.against", proposalID)), 0); // Votes against this proposal
setUint(keccak256(abi.encodePacked(daoProposalNameSpace, "votes.required", proposalID)), _votesRequired); // How many votes are required for the proposal to pass
setBool(keccak256(abi.encodePacked(daoProposalNameSpace, "cancelled", proposalID)), false); // The proposer can cancel this proposal, but only before it passes
setBool(keccak256(abi.encodePacked(daoProposalNameSpace, "executed", proposalID)), false); // Has this proposals calldata been executed?
setBytes(keccak256(abi.encodePacked(daoProposalNameSpace, "payload", proposalID)), _payload); // A calldata payload to execute after it is successful
// Update the total proposals
setUint(keccak256(abi.encodePacked(daoProposalNameSpace, "total")), proposalID);
// Log it
emit ProposalAdded(_member, _dao, proposalID, _payload, block.timestamp);
// Done
return proposalID;
}
// Voting for or against a proposal
function vote(address _member, uint256 _votes, uint256 _proposalID, bool _support) override external onlyDAOContract(getDAO(_proposalID)) {
// Successful proposals can be executed immediately, add this as a check for people who are still trying to vote after it has passed
require(getState(_proposalID) != ProposalState.Succeeded, "Proposal has passed, voting is complete and the proposal can now be executed");
// Check the proposal is in a state that can be voted on
require(getState(_proposalID) == ProposalState.Active, "Voting is not active for this proposal");
// Has this member already voted on this proposal?
require(!getReceiptHasVoted(_proposalID, _member), "Member has already voted on proposal");
// Add votes to proposal
if(_support) {
addUint(keccak256(abi.encodePacked(daoProposalNameSpace, "votes.for", _proposalID)), _votes);
}else{
addUint(keccak256(abi.encodePacked(daoProposalNameSpace, "votes.against", _proposalID)), _votes);
}
// Record the vote receipt now
setUint(keccak256(abi.encodePacked(daoProposalNameSpace, "receipt.votes", _proposalID, _member)), _votes);
setBool(keccak256(abi.encodePacked(daoProposalNameSpace, "receipt.hasVoted", _proposalID, _member)), true);
setBool(keccak256(abi.encodePacked(daoProposalNameSpace, "receipt.supported", _proposalID, _member)), _support);
// Log it
emit ProposalVoted(_proposalID, _member, _support, block.timestamp);
}
// Execute a proposal if it has passed
function execute(uint256 _proposalID) override external {
// Firstly make sure this proposal has passed
require(getState(_proposalID) == ProposalState.Succeeded, "Proposal has not succeeded, has expired or has already been executed");
// Set as executed now before running payload
setBool(keccak256(abi.encodePacked(daoProposalNameSpace, "executed", _proposalID)), true);
// Ok all good, lets run the payload on the dao contract that the proposal relates too, it should execute one of the methods on this contract
(bool success, bytes memory response) = getContractAddress(getDAO(_proposalID)).call(getPayload(_proposalID));
// Was there an error?
require(success, getRevertMsg(response));
// Log it
emit ProposalExecuted(_proposalID, tx.origin, block.timestamp);
}
// Cancel a proposal, can be cancelled by the original proposer only if it hasn't been executed yet
function cancel(address _member, uint256 _proposalID) override external onlyDAOContract(getDAO(_proposalID)) {
// Firstly make sure this proposal can be cancelled
require(getState(_proposalID) == ProposalState.Pending || getState(_proposalID) == ProposalState.Active, "Proposal can only be cancelled if pending or active");
// Only allow the proposer to cancel
require(getProposer(_proposalID) == _member, "Proposal can only be cancelled by the proposer");
// Set as cancelled now
setBool(keccak256(abi.encodePacked(daoProposalNameSpace, "cancelled", _proposalID)), true);
// Log it
emit ProposalCancelled(_proposalID, _member, block.timestamp);
}
}
================================================
FILE: contracts/contract/dao/node/RocketDAONodeTrusted.sol
================================================
pragma solidity 0.7.6;
// SPDX-License-Identifier: GPL-3.0-only
import "../../RocketBase.sol";
import "../../../interface/RocketVaultInterface.sol";
import "../../../interface/dao/node/RocketDAONodeTrustedInterface.sol";
import "../../../interface/dao/node/RocketDAONodeTrustedProposalsInterface.sol";
import "../../../interface/dao/node/RocketDAONodeTrustedActionsInterface.sol";
import "../../../interface/dao/node/settings/RocketDAONodeTrustedSettingsMembersInterface.sol";
import "../../../interface/dao/RocketDAOProposalInterface.sol";
import "../../../interface/util/AddressSetStorageInterface.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
// The Trusted Node DAO
contract RocketDAONodeTrusted is RocketBase, RocketDAONodeTrustedInterface {
using SafeMath for uint;
// The namespace for any data stored in the trusted node DAO (do not change)
string constant daoNameSpace = "dao.trustednodes.";
// Min amount of trusted node members required in the DAO
uint256 constant daoMemberMinCount = 3;
// Only allow bootstrapping when enabled
modifier onlyBootstrapMode() {
require(getBootstrapModeDisabled() == false, "Bootstrap mode not engaged");
_;
}
// Only when the DAO needs new members due to being below the required min
modifier onlyLowMemberMode() {
require(getMemberCount() < daoMemberMinCount, "Low member mode not engaged");
_;
}
// Construct
constructor(RocketStorageInterface _rocketStorageAddress) RocketBase(_rocketStorageAddress) {
// Version
version = 1;
}
/**** DAO Properties **************/
// Returns true if bootstrap mode is disabled
function getBootstrapModeDisabled() override public view returns (bool) {
return getBool(keccak256(abi.encodePacked(daoNameSpace, "bootstrapmode.disabled")));
}
/*** Proposals ****************/
// Return the amount of member votes need for a proposal to pass
function getMemberQuorumVotesRequired() override external view returns (uint256) {
// Load contracts
RocketDAONodeTrustedSettingsMembersInterface rocketDAONodeTrustedSettingsMembers = RocketDAONodeTrustedSettingsMembersInterface(getContractAddress("rocketDAONodeTrustedSettingsMembers"));
// Calculate and return votes required
return getMemberCount().mul(rocketDAONodeTrustedSettingsMembers.getQuorum());
}
/*** Members ******************/
// Return true if the node addressed passed is a member of the trusted node DAO
function getMemberIsValid(address _nodeAddress) override external view returns (bool) {
return getBool(keccak256(abi.encodePacked(daoNameSpace, "member", _nodeAddress)));
}
// Get a trusted node member address by index
function getMemberAt(uint256 _index) override external view returns (address) {
AddressSetStorageInterface addressSetStorage = AddressSetStorageInterface(getContractAddress("addressSetStorage"));
return addressSetStorage.getItem(keccak256(abi.encodePacked(daoNameSpace, "member.index")), _index);
}
// Total number of members in the current trusted node DAO
function getMemberCount() override public view returns (uint256) {
AddressSetStorageInterface addressSetStorage = AddressSetStorageInterface(getContractAddress("addressSetStorage"));
return addressSetStorage.getCount(keccak256(abi.encodePacked(daoNameSpace, "member.index")));
}
// Min required member count for the DAO
function getMemberMinRequired() override external pure returns (uint256) {
return daoMemberMinCount;
}
// Get the last time this user made a proposal
function getMemberLastProposalTime(address _nodeAddress) override external view returns (uint256) {
return getUint(keccak256(abi.encodePacked(daoNameSpace, "member.proposal.lasttime", _nodeAddress)));
}
// Get the ID of a trusted node member
function getMemberID(address _nodeAddress) override external view returns (string memory) {
return getString(keccak256(abi.encodePacked(daoNameSpace, "member.id", _nodeAddress)));
}
// Get the URL of a trusted node member
function getMemberUrl(address _nodeAddress) override external view returns (string memory) {
return getString(keccak256(abi.encodePacked(daoNameSpace, "member.url", _nodeAddress)));
}
// Get the block the member joined at
function getMemberJoinedTime(address _nodeAddress) override external view returns (uint256) {
return getUint(keccak256(abi.encodePacked(daoNameSpace, "member.joined.time", _nodeAddress)));
}
// Get data that was recorded about a proposal that was executed
function getMemberProposalExecutedTime(string memory _proposalType, address _nodeAddress) override external view returns (uint256) {
return getUint(keccak256(abi.encodePacked(daoNameSpace, "member.executed.time", _proposalType, _nodeAddress)));
}
// Get the RPL bond amount the user deposited to join
function getMemberRPLBondAmount(address _nodeAddress) override external view returns (uint256) {
return getUint(keccak256(abi.encodePacked(daoNameSpace, "member.bond.rpl", _nodeAddress)));
}
// Is this member currently being 'challenged' to see if their node is responding
function getMemberIsChallenged(address _nodeAddress) override external view returns (bool) {
// Has this member been challenged recently and still within the challenge window to respond? If there is a challenge block recorded against them, they are actively being challenged.
return getUint(keccak256(abi.encodePacked(daoNameSpace, "member.challenged.time", _nodeAddress))) > 0 ? true : false;
}
// How many unbonded validators this member has
function getMemberUnbondedValidatorCount(address _nodeAddress) override external view returns (uint256) {
return getUint(keccak256(abi.encodePacked(daoNameSpace, "member.validator.unbonded.count", _nodeAddress)));
}
// Increment/decrement a member's unbonded validator count
// Only accepts calls from the RocketMinipoolManager contract
function incrementMemberUnbondedValidatorCount(address _nodeAddress) override external onlyLatestContract("rocketDAONodeTrusted", address(this)) onlyLatestContract("rocketMinipoolManager", msg.sender) {
addUint(keccak256(abi.encodePacked(daoNameSpace, "member.validator.unbonded.count", _nodeAddress)), 1);
}
function decrementMemberUnbondedValidatorCount(address _nodeAddress) override external onlyLatestContract("rocketDAONodeTrusted", address(this)) onlyRegisteredMinipool(msg.sender) {
subUint(keccak256(abi.encodePacked(daoNameSpace, "member.validator.unbonded.count", _nodeAddress)), 1);
}
/**** Bootstrapping ***************/
// Bootstrap mode - In bootstrap mode, guardian can add members at will
function bootstrapMember(string memory _id, string memory _url, address _nodeAddress) override external onlyGuardian onlyBootstrapMode onlyRegisteredNode(_nodeAddress) onlyLatestContract("rocketDAONodeTrusted", address(this)) {
// Ok good to go, lets add them
RocketDAONodeTrustedProposalsInterface(getContractAddress("rocketDAONodeTrustedProposals")).proposalInvite(_id, _url, _nodeAddress);
}
// Bootstrap mode - Uint Setting
function bootstrapSettingUint(string memory _settingContractName, string memory _settingPath, uint256 _value) override external onlyGuardian onlyBootstrapMode onlyLatestContract("rocketDAONodeTrusted", address(this)) {
// Ok good to go, lets update the settings
RocketDAONodeTrustedProposalsInterface(getContractAddress("rocketDAONodeTrustedProposals")).proposalSettingUint(_settingContractName, _settingPath, _value);
}
// Bootstrap mode - Bool Setting
function bootstrapSettingBool(string memory _settingContractName, string memory _settingPath, bool _value) override external onlyGuardian onlyBootstrapMode onlyLatestContract("rocketDAONodeTrusted", address(this)) {
// Ok good to go, lets update the settings
RocketDAONodeTrustedProposalsInterface(getContractAddress("rocketDAONodeTrustedProposals")).proposalSettingBool(_settingContractName, _settingPath, _value);
}
// Bootstrap mode - Upgrade contracts or their ABI
function bootstrapUpgrade(string memory _type, string memory _name, string memory _contractAbi, address _contractAddress) override external onlyGuardian onlyBootstrapMode onlyLatestContract("rocketDAONodeTrusted", address(this)) {
// Ok good to go, lets update the settings
RocketDAONodeTrustedProposalsInterface(getContractAddress("rocketDAONodeTrustedProposals")).proposalUpgrade(_type, _name, _contractAbi, _contractAddress);
}
// Bootstrap mode - Disable RP Access (only RP can call this to hand over full control to the DAO)
function bootstrapDisable(bool _confirmDisableBootstrapMode) override external onlyGuardian onlyBootstrapMode onlyLatestContract("rocketDAONodeTrusted", address(this)) {
require(_confirmDisableBootstrapMode == true, "You must confirm disabling bootstrap mode, it can only be done once!");
setBool(keccak256(abi.encodePacked(daoNameSpace, "bootstrapmode.disabled")), true);
}
/**** Recovery ***************/
// In an explicable black swan scenario where the DAO loses more than the min membership required (3), this method can be used by a regular node operator to join the DAO
// Must have their ID, URL, current RPL bond amount available and must be called by their current registered node account
function memberJoinRequired(string memory _id, string memory _url) override external onlyLowMemberMode onlyRegisteredNode(msg.sender) onlyLatestContract("rocketDAONodeTrusted", address(this)) {
// Ok good to go, lets update the settings
RocketDAONodeTrustedProposalsInterface(getContractAddress("rocketDAONodeTrustedProposals")).proposalInvite(_id, _url, msg.sender);
// Get the to automatically join as a member (by a regular proposal, they would have to manually accept, but this is no ordinary situation)
RocketDAONodeTrustedActionsInterface(getContractAddress("rocketDAONodeTrustedActions")).actionJoinRequired(msg.sender);
}
}
================================================
FILE: contracts/contract/dao/node/RocketDAONodeTrustedActions.sol
================================================
pragma solidity 0.7.6;
// SPDX-License-Identifier: GPL-3.0-only
import "../../RocketBase.sol";
import "../../../interface/RocketVaultInterface.sol";
import "../../../interface/dao/node/RocketDAONodeTrustedInterface.sol";
import "../../../interface/dao/node/RocketDAONodeTrustedActionsInterface.sol";
import "../../../interface/dao/node/settings/RocketDAONodeTrustedSettingsMembersInterface.sol";
import "../../../interface/dao/node/settings/RocketDAONodeTrustedSettingsProposalsInterface.sol";
import "../../../interface/rewards/claims/RocketClaimTrustedNodeInterface.sol";
import "../../../interface/util/AddressSetStorageInterface.sol";
import "../../../interface/util/IERC20Burnable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
// The Trusted Node DAO Actions
contract RocketDAONodeTrustedActions is RocketBase, RocketDAONodeTrustedActionsInterface {
using SafeMath for uint;
// Events
event ActionJoined(address indexed nodeAddress, uint256 rplBondAmount, uint256 time);
event ActionLeave(address indexed nodeAddress, uint256 rplBondAmount, uint256 time);
event ActionKick(address indexed nodeAddress, uint256 rplBondAmount, uint256 time);
event ActionChallengeMade(address indexed nodeChallengedAddress, address indexed nodeChallengerAddress, uint256 time);
event ActionChallengeDecided(address indexed nodeChallengedAddress, address indexed nodeChallengeDeciderAddress, bool success, uint256 time);
// The namespace for any data stored in the trusted node DAO (do not change)
string constant private daoNameSpace = "dao.trustednodes.";
// Construct
constructor(RocketStorageInterface _rocketStorageAddress) RocketBase(_rocketStorageAddress) {
// Version
version = 2;
}
/*** Internal Methods **********************/
// Add a new member to the DAO
function _memberAdd(address _nodeAddress, uint256 _rplBondAmountPaid) private onlyRegisteredNode(_nodeAddress) {
// Load contracts
RocketDAONodeTrustedInterface rocketDAONode = RocketDAONodeTrustedInterface(getContractAddress("rocketDAONodeTrusted"));
AddressSetStorageInterface addressSetStorage = AddressSetStorageInterface(getContractAddress("addressSetStorage"));
// Check current node status
require(rocketDAONode.getMemberIsValid(_nodeAddress) != true, "This node is already part of the trusted node DAO");
// Flag them as a member now that they have accepted the invitation and record the size of the bond they paid
setBool(keccak256(abi.encodePacked(daoNameSpace, "member", _nodeAddress)), true);
// Add the bond amount they have paid
if(_rplBondAmountPaid > 0) setUint(keccak256(abi.encodePacked(daoNameSpace, "member.bond.rpl", _nodeAddress)), _rplBondAmountPaid);
// Record the block number they joined at
setUint(keccak256(abi.encodePacked(daoNameSpace, "member.joined.time", _nodeAddress)), block.timestamp);
// Add to member index now
addressSetStorage.addItem(keccak256(abi.encodePacked(daoNameSpace, "member.index")), _nodeAddress);
}
// Remove a member from the DAO
function _memberRemove(address _nodeAddress) private onlyTrustedNode(_nodeAddress) {
// Load contracts
AddressSetStorageInterface addressSetStorage = AddressSetStorageInterface(getContractAddress("addressSetStorage"));
// Remove their membership now
deleteBool(keccak256(abi.encodePacked(daoNameSpace, "member", _nodeAddress)));
deleteAddress(keccak256(abi.encodePacked(daoNameSpace, "member.address", _nodeAddress)));
deleteString(keccak256(abi.encodePacked(daoNameSpace, "member.id", _nodeAddress)));
deleteString(keccak256(abi.encodePacked(daoNameSpace, "member.url", _nodeAddress)));
deleteUint(keccak256(abi.encodePacked(daoNameSpace, "member.bond.rpl", _nodeAddress)));
deleteUint(keccak256(abi.encodePacked(daoNameSpace, "member.joined.time", _nodeAddress)));
deleteUint(keccak256(abi.encodePacked(daoNameSpace, "member.challenged.time", _nodeAddress)));
// Clean up the invited/leave proposals
deleteUint(keccak256(abi.encodePacked(daoNameSpace, "member.executed.time", "invited", _nodeAddress)));
deleteUint(keccak256(abi.encodePacked(daoNameSpace, "member.executed.time", "leave", _nodeAddress)));
// Remove from member index now
addressSetStorage.removeItem(keccak256(abi.encodePacked(daoNameSpace, "member.index")), _nodeAddress);
}
// A member official joins the DAO with their bond ready, if successful they are added as a member
function _memberJoin(address _nodeAddress) private {
// Set some intiial contract address
address rocketVaultAddress = getContractAddress("rocketVault");
address rocketTokenRPLAddress = getContractAddress("rocketTokenRPL");
// Load contracts
IERC20 rplInflationContract = IERC20(rocketTokenRPLAddress);
RocketVaultInterface rocketVault = RocketVaultInterface(rocketVaultAddress);
RocketDAONodeTrustedInterface rocketDAONode = RocketDAONodeTrustedInterface(getContractAddress("rocketDAONodeTrusted"));
RocketDAONodeTrustedSettingsMembersInterface rocketDAONodeTrustedSettingsMembers = RocketDAONodeTrustedSettingsMembersInterface(getContractAddress("rocketDAONodeTrustedSettingsMembers"));
RocketDAONodeTrustedSettingsProposalsInterface rocketDAONodeTrustedSettingsProposals = RocketDAONodeTrustedSettingsProposalsInterface(getContractAddress("rocketDAONodeTrustedSettingsProposals"));
// The time that the member was successfully invited to join the DAO
uint256 memberInvitedTime = rocketDAONode.getMemberProposalExecutedTime("invited", _nodeAddress);
// Have they been invited?
require(memberInvitedTime > 0, "This node has not been invited to join");
// The current member bond amount in RPL that's required
uint256 rplBondAmount = rocketDAONodeTrustedSettingsMembers.getRPLBond();
// Has their invite expired?
require(memberInvitedTime.add(rocketDAONodeTrustedSettingsProposals.getActionTime()) > block.timestamp, "This node's invitation to join has expired, please apply again");
// Verify they have allowed this contract to spend their RPL for the bond
require(rplInflationContract.allowance(_nodeAddress, address(this)) >= rplBondAmount, "Not enough allowance given to RocketDAONodeTrusted contract for transfer of RPL bond tokens");
// Transfer the tokens to this contract now
require(rplInflationContract.transferFrom(_nodeAddress, address(this), rplBondAmount), "Token transfer to RocketDAONodeTrusted contract was not successful");
// Allow RocketVault to transfer these tokens to itself now
require(rplInflationContract.approve(rocketVaultAddress, rplBondAmount), "Approval for RocketVault to spend RocketDAONodeTrusted RPL bond tokens was not successful");
// Let vault know it can move these tokens to itself now and credit the balance to this contract
rocketVault.depositToken(getContractName(address(this)), IERC20(rocketTokenRPLAddress), rplBondAmount);
// Add them as a member now that they have accepted the invitation and record the size of the bond they paid
_memberAdd(_nodeAddress, rplBondAmount);
// Log it
emit ActionJoined(_nodeAddress, rplBondAmount, block.timestamp);
}
/*** Action Methods ************************/
// When a new member has been successfully invited to join, they must call this method to join officially
// They will be required to have the RPL bond amount in their account
// This method allows us to only allow them to join if they have a working node account and have been officially invited
function actionJoin() override external onlyRegisteredNode(msg.sender) onlyLatestContract("rocketDAONodeTrustedActions", address(this)) {
_memberJoin(msg.sender);
}
// When the DAO has suffered a loss of members due to unforseen blackswan issue and has < the min required amount (3), a regular bonded node can directly join as a member and recover the DAO
// They will be required to have the RPL bond amount in their account. This is called directly from RocketDAONodeTrusted.
function actionJoinRequired(address _nodeAddress) override external onlyRegisteredNode(_nodeAddress) onlyLatestContract("rocketDAONodeTrusted", msg.sender) {
_memberJoin(_nodeAddress);
}
// When a new member has successfully requested to leave with a proposal, they must call this method to leave officially and receive their RPL bond
function actionLeave(address _rplBondRefundAddress) override external onlyTrustedNode(msg.sender) onlyLatestContract("rocketDAONodeTrustedActions", address(this)) {
// Load contracts
RocketVaultInterface rocketVault = RocketVaultInterface(getContractAddress("rocketVault"));
RocketDAONodeTrustedInterface rocketDAONode = RocketDAONodeTrustedInterface(getContractAddress("rocketDAONodeTrusted"));
RocketDAONodeTrustedSettingsProposalsInterface rocketDAONodeTrustedSettingsProposals = RocketDAONodeTrustedSettingsProposalsInterface(getContractAddress("rocketDAONodeTrustedSettingsProposals"));
// Check this wouldn't dip below the min required trusted nodes
require(rocketDAONode.getMemberCount() > rocketDAONode.getMemberMinRequired(), "Member count will fall below min required");
// Get the time that they were approved to leave at
uint256 leaveAcceptedTime = rocketDAONode.getMemberProposalExecutedTime("leave", msg.sender);
// Has their leave request expired?
require(leaveAcceptedTime.add(rocketDAONodeTrustedSettingsProposals.getActionTime()) > block.timestamp, "This member has not been approved to leave or request has expired, please apply to leave again");
// They were successful, lets refund their RPL Bond
uint256 rplBondRefundAmount = rocketDAONode.getMemberRPLBondAmount(msg.sender);
// Refund
if(rplBondRefundAmount > 0) {
// Valid withdrawal address
require(_rplBondRefundAddress != address(0x0), "Member has not supplied a valid address for their RPL bond refund");
// Send tokens now
rocketVault.withdrawToken(_rplBondRefundAddress, IERC20(getContractAddress("rocketTokenRPL")), rplBondRefundAmount);
}
// Remove them now
_memberRemove(msg.sender);
// Log it
emit ActionLeave(msg.sender, rplBondRefundAmount, block.timestamp);
}
// A member can be evicted from the DAO by proposal, send their remaining RPL balance to them and remove from the DAO
// Is run via the main DAO contract when the proposal passes and is executed
function actionKick(address _nodeAddress, uint256 _rplFine) override external onlyTrustedNode(_nodeAddress) onlyLatestContract("rocketDAONodeTrustedProposals", msg.sender) {
// Load contracts
RocketVaultInterface rocketVault = RocketVaultInterface(getContractAddress("rocketVault"));
RocketDAONodeTrustedInterface rocketDAONode = RocketDAONodeTrustedInterface(getContractAddress("rocketDAONodeTrusted"));
IERC20 rplToken = IERC20(getContractAddress("rocketTokenRPL"));
// Get the
uint256 rplBondRefundAmount = rocketDAONode.getMemberRPLBondAmount(_nodeAddress);
// Refund
if (rplBondRefundAmount > 0) {
// Send tokens now if the vault can cover it
if(rplToken.balanceOf(address(rocketVault)) >= rplBondRefundAmount) rocketVault.withdrawToken(_nodeAddress, IERC20(getContractAddress("rocketTokenRPL")), rplBondRefundAmount);
}
// Burn the fine
if (_rplFine > 0) {
rocketVault.burnToken(IERC20Burnable(getContractAddress("rocketTokenRPL")), _rplFine);
}
// Remove the member now
_memberRemove(_nodeAddress);
// Log it
emit ActionKick(_nodeAddress, rplBondRefundAmount, block.timestamp);
}
// In the event that the majority/all of members go offline permanently and no more proposals could be passed, a current member or a regular node can 'challenge' a DAO members node to respond
// If it does not respond in the given window, it can be removed as a member. The one who removes the member after the challenge isn't met, must be another node other than the proposer to provide some oversight
// This should only be used in an emergency situation to recover the DAO. Members that need removing when consensus is still viable, should be done via the 'kick' method.
function actionChallengeMake(address _nodeAddress) override external onlyTrustedNode(_nodeAddress) onlyRegisteredNode(msg.sender) onlyLatestContract("rocketDAONodeTrustedActions", address(this)) payable {
// Load contracts
RocketDAONodeTrustedInterface rocketDAONode = RocketDAONodeTrustedInterface(getContractAddress("rocketDAONodeTrusted"));
RocketDAONodeTrustedSettingsMembersInterface rocketDAONodeTrustedSettingsMembers = RocketDAONodeTrustedSettingsMembersInterface(getContractAddress("rocketDAONodeTrustedSettingsMembers"));
// Members can challenge other members for free, but for a regular bonded node to challenge a DAO member, requires non-refundable payment to prevent spamming
if(rocketDAONode.getMemberIsValid(msg.sender) != true) require(msg.value == rocketDAONodeTrustedSettingsMembers.getChallengeCost(), "Non DAO members must pay ETH to challenge a members node");
// Can't challenge yourself duh
require(msg.sender != _nodeAddress, "You cannot challenge yourself");
// Is this member already being challenged?
require(!rocketDAONode.getMemberIsChallenged(_nodeAddress), "Member is already being challenged");
// Has this node recently made another challenge and not waited for the cooldown to pass?
require(getUint(keccak256(abi.encodePacked(daoNameSpace, "node.challenge.created.time", msg.sender))).add(rocketDAONodeTrustedSettingsMembers.getChallengeCooldown()) < block.timestamp, "You must wait for the challenge cooldown to pass before issuing another challenge");
// Ok challenge accepted
// Record the last time this member challenged
setUint(keccak256(abi.encodePacked(daoNameSpace, "node.challenge.created.time", msg.sender)), block.timestamp);
// Record the challenge block now
setUint(keccak256(abi.encodePacked(daoNameSpace, "member.challenged.time", _nodeAddress)), block.timestamp);
// Record who made the challenge
setAddress(keccak256(abi.encodePacked(daoNameSpace, "member.challenged.by", _nodeAddress)), msg.sender);
// Log it
emit ActionChallengeMade(_nodeAddress, msg.sender, block.timestamp);
}
// Decides the success of a challenge. If called by the challenged node within the challenge window, the challenge is defeated and the member stays as they have indicated their node is still alive.
// If called after the challenge window has passed by anyone except the original challenge initiator, then the challenge has succeeded and the member is removed
function actionChallengeDecide(address _nodeAddress) override external onlyTrustedNode(_nodeAddress) onlyRegisteredNode(msg.sender) onlyLatestContract("rocketDAONodeTrustedActions", address(this)) {
// Load contracts
RocketDAONodeTrustedSettingsMembersInterface rocketDAONodeTrustedSettingsMembers = RocketDAONodeTrustedSettingsMembersInterface(getContractAddress("rocketDAONodeTrustedSettingsMembers"));
// Was the challenge successful?
bool challengeSuccess = false;
// Get the block the challenge was initiated at
bytes32 challengeTimeKey = keccak256(abi.encodePacked(daoNameSpace, "member.challenged.time", _nodeAddress));
uint256 challengeTime = getUint(challengeTimeKey);
// If challenge time is 0, the member hasn't been challenged or they have successfully responded to the challenge previously
require(challengeTime > 0, "Member hasn't been challenged or they have successfully responded to the challenge already");
// Allow the challenged member to refute the challenge at anytime. If the window has passed and the challenge node does not run this method, any member can decide the challenge and eject the absent member
// Is it the node being challenged?
if(_nodeAddress == msg.sender) {
// Challenge is defeated, node has responded
deleteUint(challengeTimeKey);
}else{
// The challenge refute window has passed, the member can be ejected now
require(challengeTime.add(rocketDAONodeTrustedSettingsMembers.getChallengeWindow()) < block.timestamp, "Refute window has not yet passed");
// Node has been challenged and failed to respond in the given window, remove them as a member and their bond is burned
_memberRemove(_nodeAddress);
// Challenge was successful
challengeSuccess = true;
}
// Log it
emit ActionChallengeDecided(_nodeAddress, msg.sender, challengeSuccess, block.timestamp);
}
}
================================================
FILE: contracts/contract/dao/node/RocketDAONodeTrustedProposals.sol
================================================
pragma solidity 0.7.6;
// SPDX-License-Identifier: GPL-3.0-only
import "../../RocketBase.sol";
import "../../../interface/dao/node/RocketDAONodeTrustedInterface.sol";
import "../../../interface/dao/node/RocketDAONodeTrustedProposalsInterface.sol";
import "../../../interface/dao/node/RocketDAONodeTrustedActionsInterface.sol";
import "../../../interface/dao/node/RocketDAONodeTrustedUpgradeInterface.sol";
import "../../../interface/dao/node/settings/RocketDAONodeTrustedSettingsInterface.sol";
import "../../../interface/dao/node/settings/RocketDAONodeTrustedSettingsProposalsInterface.sol";
import "../../../interface/dao/RocketDAOProposalInterface.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
// The Trusted Node DAO Proposals
contract RocketDAONodeTrustedProposals is RocketBase, RocketDAONodeTrustedProposalsInterface {
using SafeMath for uint;
// The namespace for any data stored in the trusted node DAO (do not change)
string constant daoNameSpace = "dao.trustednodes.";
// Only allow certain contracts to execute methods
modifier onlyExecutingContracts() {
// Methods are either executed by bootstrapping methods in rocketDAONodeTrusted or by people executing passed proposals in rocketDAOProposal
require(msg.sender == getContractAddress("rocketDAONodeTrusted") || msg.sender == getContractAddress("rocketDAOProposal"), "Sender is not permitted to access executing methods");
_;
}
// Construct
constructor(RocketStorageInterface _rocketStorageAddress) RocketBase(_rocketStorageAddress) {
// Version
version = 1;
}
/*** Proposals **********************/
// Create a DAO proposal with calldata, if successful will be added to a queue where it can be executed
// A general message can be passed by the proposer along with the calldata payload that can be executed if the proposal passes
function propose(string memory _proposalMessage, bytes memory _payload) override external onlyTrustedNode(msg.sender) onlyLatestContract("rocketDAONodeTrustedProposals", address(this)) returns (uint256) {
// Load contracts
RocketDAOProposalInterface daoProposal = RocketDAOProposalInterface(getContractAddress("rocketDAOProposal"));
RocketDAONodeTrustedInterface daoNodeTrusted = RocketDAONodeTrustedInterface(getContractAddress("rocketDAONodeTrusted"));
RocketDAONodeTrustedSettingsProposalsInterface rocketDAONodeTrustedSettingsProposals = RocketDAONodeTrustedSettingsProposalsInterface(getContractAddress("rocketDAONodeTrustedSettingsProposals"));
// Check this user can make a proposal now
require(daoNodeTrusted.getMemberLastProposalTime(msg.sender).add(rocketDAONodeTrustedSettingsProposals.getCooldownTime()) <= block.timestamp, "Member has not waited long enough to make another proposal");
// Require the min amount of members are in to make a proposal
require(daoNodeTrusted.getMemberCount() >= daoNodeTrusted.getMemberMinRequired(), "Min member count not met to allow proposals to be added");
// Record the last time this user made a proposal
setUint(keccak256(abi.encodePacked(daoNameSpace, "member.proposal.lasttime", msg.sender)), block.timestamp);
// Create the proposal
return daoProposal.add(msg.sender, "rocketDAONodeTrustedProposals", _proposalMessage, block.timestamp.add(rocketDAONodeTrustedSettingsProposals.getVoteDelayTime()), rocketDAONodeTrustedSettingsProposals.getVoteTime(), rocketDAONodeTrustedSettingsProposals.getExecuteTime(), daoNodeTrusted.getMemberQuorumVotesRequired(), _payload);
}
// Vote on a proposal
function vote(uint256 _proposalID, bool _support) override external onlyTrustedNode(msg.sender) onlyLatestContract("rocketDAONodeTrustedProposals", address(this)) {
// Load contracts
RocketDAOProposalInterface daoProposal = RocketDAOProposalInterface(getContractAddress("rocketDAOProposal"));
RocketDAONodeTrustedInterface daoNodeTrusted = RocketDAONodeTrustedInterface(getContractAddress("rocketDAONodeTrusted"));
// Did they join after this proposal was created? If so, they can't vote or it'll throw off the set proposalVotesRequired
require(daoNodeTrusted.getMemberJoinedTime(msg.sender) < daoProposal.getCreated(_proposalID), "Member cannot vote on proposal created before they became a member");
// Vote now, one vote per trusted node member
daoProposal.vote(msg.sender, 1 ether, _proposalID, _support);
}
// Cancel a proposal
function cancel(uint256 _proposalID) override external onlyTrustedNode(msg.sender) onlyLatestContract("rocketDAONodeTrustedProposals", address(this)) {
// Load contracts
RocketDAOProposalInterface daoProposal = RocketDAOProposalInterface(getContractAddress("rocketDAOProposal"));
// Cancel now, will succeed if it is the original proposer
daoProposal.cancel(msg.sender, _proposalID);
}
// Execute a proposal
function execute(uint256 _proposalID) override external onlyLatestContract("rocketDAONodeTrustedProposals", address(this)) {
// Load contracts
RocketDAOProposalInterface daoProposal = RocketDAOProposalInterface(getContractAddress("rocketDAOProposal"));
// Execute now
daoProposal.execute(_proposalID);
}
/*** Proposal - Members **********************/
// A new DAO member being invited, can only be done via a proposal or in bootstrap mode
// Provide an ID that indicates who is running the trusted node and the address of the registered node that they wish to propose joining the dao
function proposalInvite(string memory _id, string memory _url, address _nodeAddress) override external onlyExecutingContracts onlyRegisteredNode(_nodeAddress) {
// Their proposal executed, record the block
setUint(keccak256(abi.encodePacked(daoNameSpace, "member.executed.time", "invited", _nodeAddress)), block.timestamp);
// Ok all good, lets get their invitation and member data setup
// They are initially only invited to join, so their membership isn't set as true until they accept it in RocketDAONodeTrustedActions
_memberInit(_id, _url, _nodeAddress);
}
// A current member proposes leaving the trusted node DAO, when successful they will be allowed to collect their RPL bond
function proposalLeave(address _nodeAddress) override external onlyExecutingContracts onlyTrustedNode(_nodeAddress) {
// Load contracts
RocketDAONodeTrustedInterface daoNodeTrusted = RocketDAONodeTrustedInterface(getContractAddress("rocketDAONodeTrusted"));
// Check this wouldn't dip below the min required trusted nodes (also checked when the node has a successful proposal and attempts to exit)
require(daoNodeTrusted.getMemberCount() > daoNodeTrusted.getMemberMinRequired(), "Member count will fall below min required");
// Their proposal to leave has been accepted, record the block
setUint(keccak256(abi.encodePacked(daoNameSpace, "member.executed.time", "leave", _nodeAddress)), block.timestamp);
}
// Propose to kick a current member from the DAO with an optional RPL bond fine
function proposalKick(address _nodeAddress, uint256 _rplFine) override external onlyExecutingContracts onlyTrustedNode(_nodeAddress) {
// Load contracts
RocketDAONodeTrustedInterface daoNodeTrusted = RocketDAONodeTrustedInterface(getContractAddress("rocketDAONodeTrusted"));
RocketDAONodeTrustedActionsInterface daoActionsContract = RocketDAONodeTrustedActionsInterface(getContractAddress("rocketDAONodeTrustedActions"));
// How much is their RPL bond?
uint256 rplBondAmount = daoNodeTrusted.getMemberRPLBondAmount(_nodeAddress);
// Check fine amount can be covered
require(_rplFine <= rplBondAmount, "RPL Fine must be lower or equal to the RPL bond amount of the node being kicked");
// Set their bond amount minus the fine
setUint(keccak256(abi.encodePacked(daoNameSpace, "member.bond.rpl", _nodeAddress)), rplBondAmount.sub(_rplFine));
// Kick them now
daoActionsContract.actionKick(_nodeAddress, _rplFine);
}
/*** Proposal - Settings ***************/
// Change one of the current uint256 settings of the DAO
function proposalSettingUint(string memory _settingContractName, string memory _settingPath, uint256 _value) override external onlyExecutingContracts() {
// Load contracts
RocketDAONodeTrustedSettingsInterface rocketDAONodeTrustedSettings = RocketDAONodeTrustedSettingsInterface(getContractAddress(_settingContractName));
// Lets update
rocketDAONodeTrustedSettings.setSettingUint(_settingPath, _value);
}
// Change one of the current bool settings of the DAO
function proposalSettingBool(string memory _settingContractName, string memory _settingPath, bool _value) override external onlyExecutingContracts() {
// Load contracts
RocketDAONodeTrustedSettingsInterface rocketDAONodeTrustedSettings = RocketDAONodeTrustedSettingsInterface(getContractAddress(_settingContractName));
// Lets update
rocketDAONodeTrustedSettings.setSettingBool(_settingPath, _value);
}
/*** Proposal - Upgrades ***************/
// Upgrade contracts or ABI's if the DAO agrees
function proposalUpgrade(string memory _type, string memory _name, string memory _contractAbi, address _contractAddress) override external onlyExecutingContracts() {
// Load contracts
RocketDAONodeTrustedUpgradeInterface rocketDAONodeTrustedUpgradeInterface = RocketDAONodeTrustedUpgradeInterface(getContractAddress("rocketDAONodeTrustedUpgrade"));
// Lets update
rocketDAONodeTrustedUpgradeInterface.upgrade(_type, _name, _contractAbi, _contractAddress);
}
/*** Internal ***************/
// Add a new potential members data, they are not official members yet, just propsective
function _memberInit(string memory _id, string memory _url, address _nodeAddress) private onlyRegisteredNode(_nodeAddress) {
// Load contracts
RocketDAONodeTrustedInterface daoNodeTrusted = RocketDAONodeTrustedInterface(getContractAddress("rocketDAONodeTrusted"));
// Check current node status
require(!daoNodeTrusted.getMemberIsValid(_nodeAddress), "This node is already part of the trusted node DAO");
// Verify the ID is min 3 chars
require(bytes(_id).length >= 3, "The ID for this new member must be at least 3 characters");
// Check URL length
require(bytes(_url).length >= 6, "The URL for this new member must be at least 6 characters");
// Member initial data, not official until the bool is flagged as true
setBool(keccak256(abi.encodePacked(daoNameSpace, "member", _nodeAddress)), false);
setAddress(keccak256(abi.encodePacked(daoNameSpace, "member.address", _nodeAddress)), _nodeAddress);
setString(keccak256(abi.encodePacked(daoNameSpace, "member.id", _nodeAddress)), _id);
setString(keccak256(abi.encodePacked(daoNameSpace, "member.url", _nodeAddress)), _url);
setUint(keccak256(abi.encodePacked(daoNameSpace, "member.bond.rpl", _nodeAddress)), 0);
setUint(keccak256(abi.encodePacked(daoNameSpace, "member.joined.time", _nodeAddress)), 0);
}
}
================================================
FILE: contracts/contract/dao/node/RocketDAONodeTrustedUpgrade.sol
================================================
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.8.30;
import {RocketStorageInterface} from "../../../interface/RocketStorageInterface.sol";
import {RocketDAONodeTrustedUpgradeInterface} from "../../../interface/dao/node/RocketDAONodeTrustedUpgradeInterface.sol";
import {RocketDAOProtocolSettingsSecurityInterface} from "../../../interface/dao/protocol/settings/RocketDAOProtocolSettingsSecurityInterface.sol";
import {RocketBase} from "../../RocketBase.sol";
/// @notice Handles network contract upgrades
contract RocketDAONodeTrustedUpgrade is RocketBase, RocketDAONodeTrustedUpgradeInterface {
// Events
event UpgradePending(uint256 upgradeProposalID, bytes32 indexed upgradeType, bytes32 indexed name, uint256 time);
event UpgradeVetoed(uint256 upgradeProposalID, uint256 time);
event ContractUpgraded(bytes32 indexed name, address indexed oldAddress, address indexed newAddress, uint256 time);
event ContractAdded(bytes32 indexed name, address indexed newAddress, uint256 time);
event ABIUpgraded(bytes32 indexed name, uint256 time);
event ABIAdded(bytes32 indexed name, uint256 time);
// The namespace for any storage data used by this contract
string constant private daoUpgradeNameSpace = "dao.upgrade.";
// Immutables
bytes32 immutable internal daoTrustedBootstrapKey;
bytes32 immutable internal typeUpgradeContract;
bytes32 immutable internal typeAddContract;
bytes32 immutable internal typeUpgradeABI;
bytes32 immutable internal typeAddABI;
// Only allow bootstrapping when enabled
modifier onlyBootstrapMode() {
require(getBool(daoTrustedBootstrapKey) == false, "Bootstrap mode not engaged");
_;
}
// Construct
constructor(RocketStorageInterface _rocketStorageAddress) RocketBase(_rocketStorageAddress) {
version = 2;
// Precompute keys
typeUpgradeContract = keccak256(abi.encodePacked("upgradeContract"));
typeAddContract = keccak256(abi.encodePacked("addContract"));
typeUpgradeABI = keccak256(abi.encodePacked("upgradeABI"));
typeAddABI = keccak256(abi.encodePacked("addABI"));
daoTrustedBootstrapKey = keccak256(abi.encodePacked("dao.trustednodes.", "bootstrapmode.disabled"));
}
/// @notice Called when an upgrade proposal is executed, creates an upgrade proposal that can be vetoed by the
/// security council or executed after the upgrade delay period has passed
/// @param _type Type of upgrade (valid values: "upgradeContract", "addContract", "upgradeABI", "addABI")
/// @param _name Contract name to upgrade
/// @param _contractAbi ABI of the upgraded contract
/// @param _contractAddress Address of the upgraded contract
function upgrade(string memory _type, string memory _name, string memory _contractAbi, address _contractAddress) override external onlyLatestContract("rocketDAONodeTrustedProposals", msg.sender) {
uint256 upgradeProposalID = getTotal() + 1;
// Compute when the proposal can be executed if not vetoed by the security council
uint256 startTime = block.timestamp;
RocketDAOProtocolSettingsSecurityInterface rocketDAOProtocolSettingsSecurity = RocketDAOProtocolSettingsSecurityInterface(getContractAddress("rocketDAOProtocolSettingsSecurity"));
uint256 endTime = startTime + rocketDAOProtocolSettingsSecurity.getUpgradeDelay();
// Store data
bytes32 typeHash = keccak256(abi.encodePacked(_type));
setBytes32(keccak256(abi.encodePacked(daoUpgradeNameSpace, "type", upgradeProposalID)), typeHash);
setString(keccak256(abi.encodePacked(daoUpgradeNameSpace, "name", upgradeProposalID)), _name);
setString(keccak256(abi.encodePacked(daoUpgradeNameSpace, "abi", upgradeProposalID)), _contractAbi);
setAddress(keccak256(abi.encodePacked(daoUpgradeNameSpace, "address", upgradeProposalID)), _contractAddress);
setUint(keccak256(abi.encodePacked(daoUpgradeNameSpace, "end", upgradeProposalID)), endTime);
addUint(keccak256(abi.encodePacked(daoUpgradeNameSpace, "total")), 1);
// Emit event
emit UpgradePending(upgradeProposalID, typeHash, keccak256(abi.encodePacked(_name)), block.timestamp);
}
/// @notice Called by the proposal contract when a veto passes
/// @param _upgradeProposalID ID of the upgrade proposal to veto
function veto(uint256 _upgradeProposalID) override external onlyLatestContract("rocketDAOSecurityUpgrade", msg.sender) {
// Validate proposal state
require(getState(_upgradeProposalID) == UpgradeProposalState.Pending, "Proposal has already succeeded, expired, or executed");
// Mark the upgrade as vetoed
setBool(keccak256(abi.encodePacked(daoUpgradeNameSpace, "vetoed", _upgradeProposalID)), true);
// Emit event
emit UpgradeVetoed(_upgradeProposalID, block.timestamp);
}
/// @notice Called after upgrade delay has passed to perform the upgrade
/// @param _upgradeProposalID ID of the upgrade proposal to execute
/// @dev Must be called by a registered trusted node
function execute(uint256 _upgradeProposalID) override external onlyTrustedNode(msg.sender) {
// Validate proposal state
require(getState(_upgradeProposalID) == UpgradeProposalState.Succeeded, "Proposal has not succeeded or has been vetoed or executed");
// Mark as executed
setBool(keccak256(abi.encodePacked(daoUpgradeNameSpace, "executed", _upgradeProposalID)), true);
// Execute the upgrade
_execute(getType(_upgradeProposalID), getName(_upgradeProposalID), getUpgradeABI(_upgradeProposalID), getUpgradeAddress(_upgradeProposalID));
}
/// @notice Immediately execute an upgrade if bootstrap mode is still enabled
/// @param _type Type of upgrade (valid values: "upgradeContract", "addContract", "upgradeABI", "addABI")
/// @param _name Contract name to upgrade
/// @param _contractAbi ABI of the upgraded contract
/// @param _contractAddress Address of the upgraded contract
function bootstrapUpgrade(string memory _type, string memory _name, string memory _contractAbi, address _contractAddress) override external onlyGuardian onlyBootstrapMode {
bytes32 typeHash = keccak256(abi.encodePacked(_type));
_execute(typeHash, _name, _contractAbi, _contractAddress);
}
/// @dev Internal implementation of the execution process
function _execute(bytes32 _typeHash, string memory _name, string memory _contractAbi, address _contractAddress) internal {
if (_typeHash == typeUpgradeContract) _upgradeContract(_name, _contractAddress, _contractAbi);
else if (_typeHash == typeAddContract) _addContract(_name, _contractAddress, _contractAbi);
else if (_typeHash == typeUpgradeABI) _upgradeABI(_name, _contractAbi);
else if (_typeHash == typeAddABI) _addABI(_name, _contractAbi);
else revert("Invalid upgrade type");
}
/// @dev Performs an update to a contract and ABI simultaneously
function _upgradeContract(string memory _name, address _contractAddress, string memory _contractAbi) internal {
// Check contract being upgraded
bytes32 nameHash = keccak256(abi.encodePacked(_name));
require(nameHash != keccak256(abi.encodePacked("rocketVault")), "Cannot upgrade the vault");
require(nameHash != keccak256(abi.encodePacked("rocketTokenRETH")), "Cannot upgrade token contracts");
require(nameHash != keccak256(abi.encodePacked("rocketTokenRPL")), "Cannot upgrade token contracts");
require(nameHash != keccak256(abi.encodePacked("rocketTokenRPLFixedSupply")), "Cannot upgrade token contracts");
require(nameHash != keccak256(abi.encodePacked("casperDeposit")), "Cannot upgrade the casper deposit contract");
require(nameHash != keccak256(abi.encodePacked("rocketMinipoolPenalty")), "Cannot upgrade minipool penalty contract");
// Get old contract address & check contract exists
address oldContractAddress = getAddress(keccak256(abi.encodePacked("contract.address", _name)));
require(oldContractAddress != address(0x0), "Contract does not exist");
// Check new contract address
require(_contractAddress != address(0x0), "Invalid contract address");
require(_contractAddress != oldContractAddress, "The contract address cannot be set to its current address");
require(!getBool(keccak256(abi.encodePacked("contract.exists", _contractAddress))), "Contract address is already in use");
// Check ABI isn't empty
require(bytes(_contractAbi).length > 0, "Empty ABI is invalid");
// Register new contract
setBool(keccak256(abi.encodePacked("contract.exists", _contractAddress)), true);
setString(keccak256(abi.encodePacked("contract.name", _contractAddress)), _name);
setAddress(keccak256(abi.encodePacked("contract.address", _name)), _contractAddress);
setString(keccak256(abi.encodePacked("contract.abi", _name)), _contractAbi);
// Deregister old contract
deleteString(keccak256(abi.encodePacked("contract.name", oldContractAddress)));
deleteBool(keccak256(abi.encodePacked("contract.exists", oldContractAddress)));
// Emit contract upgraded event
emit ContractUpgraded(nameHash, oldContractAddress, _contractAddress, block.timestamp);
}
/// @dev Adds a new contract to the protocol
function _addContract(string memory _name, address _contractAddress, string memory _contractAbi) internal {
// Check contract name
bytes32 nameHash = keccak256(abi.encodePacked(_name));
require(bytes(_name).length > 0, "Invalid contract name");
// Cannot add contract if it already exists (use upgradeContract instead)
require(getAddress(keccak256(abi.encodePacked("contract.address", _name))) == address(0x0), "Contract name is already in use");
// Cannot add contract if already in use as ABI only
string memory existingAbi = getString(keccak256(abi.encodePacked("contract.abi", _name)));
require(bytes(existingAbi).length == 0, "Contract name is already in use");
// Check contract address
require(_contractAddress != address(0x0), "Invalid contract address");
require(!getBool(keccak256(abi.encodePacked("contract.exists", _contractAddress))), "Contract address is already in use");
// Check ABI isn't empty
require(bytes(_contractAbi).length > 0, "Empty ABI is invalid");
// Register contract
setBool(keccak256(abi.encodePacked("contract.exists", _contractAddress)), true);
setString(keccak256(abi.encodePacked("contract.name", _contractAddress)), _name);
setAddress(keccak256(abi.encodePacked("contract.address", _name)), _contractAddress);
setString(keccak256(abi.encodePacked("contract.abi", _name)), _contractAbi);
// Emit contract added event
emit ContractAdded(nameHash, _contractAddress, block.timestamp);
}
/// @dev Upgrades an existing ABI
function _upgradeABI(string memory _name, string memory _contractAbi) internal {
// Check ABI exists
string memory existingAbi = getString(keccak256(abi.encodePacked("contract.abi", _name)));
require(bytes(existingAbi).length > 0, "ABI does not exist");
// Sanity checks
require(bytes(_contractAbi).length > 0, "Empty ABI is invalid");
require(keccak256(bytes(existingAbi)) != keccak256(bytes(_contractAbi)), "ABIs are identical");
// Set ABI
setString(keccak256(abi.encodePacked("contract.abi", _name)), _contractAbi);
// Emit ABI upgraded event
emit ABIUpgraded(keccak256(abi.encodePacked(_name)), block.timestamp);
}
/// @dev Adds a new ABI to the protocol
function _addABI(string memory _name, string memory _contractAbi) internal {
// Check ABI name
bytes32 nameHash = keccak256(abi.encodePacked(_name));
require(bytes(_name).length > 0, "Invalid ABI name");
// Sanity check
require(bytes(_contractAbi).length > 0, "Empty ABI is invalid");
// Cannot add ABI if name is already used for an existing network contract
require(getAddress(keccak256(abi.encodePacked("contract.address", _name))) == address(0x0), "ABI name is already in use");
// Cannot add ABI if ABI already exists for this name (use upgradeABI instead)
string memory existingAbi = getString(keccak256(abi.encodePacked("contract.abi", _name)));
require(bytes(existingAbi).length == 0, "ABI name is already in use");
// Set ABI
setString(keccak256(abi.encodePacked("contract.abi", _name)), _contractAbi);
// Emit ABI added event
emit ABIAdded(nameHash, block.timestamp);
}
/// @notice Get the total number of upgrade proposals
function getTotal() override public view returns (uint256) {
return getUint(keccak256(abi.encodePacked(daoUpgradeNameSpace, "total")));
}
/// @notice Return the state of the specified upgrade proposal
/// @param _upgradeProposalID ID of the upgrade proposal to query
function getState(uint256 _upgradeProposalID) override public view returns (UpgradeProposalState) {
// Check the proposal ID is legit
require(getTotal() >= _upgradeProposalID && _upgradeProposalID > 0, "Invalid upgrade proposal ID");
if (getVetoed(_upgradeProposalID)) {
return UpgradeProposalState.Vetoed;
} else if (getExecuted(_upgradeProposalID)) {
return UpgradeProposalState.Executed;
} else if (block.timestamp < getEnd(_upgradeProposalID)) {
return UpgradeProposalState.Pending;
} else {
return UpgradeProposalState.Succeeded;
}
}
/// @notice Get the end time of this proposal (when the upgrade delay ends)
/// @param _upgradeProposalID ID of the upgrade proposal to query
function getEnd(uint256 _upgradeProposalID) override public view returns (uint256) {
return getUint(keccak256(abi.encodePacked(daoUpgradeNameSpace, "end", _upgradeProposalID)));
}
/// @notice Get whether the proposal has been executed
/// @param _upgradeProposalID ID of the upgrade proposal to query
function getExecuted(uint256 _upgradeProposalID) override public view returns (bool) {
return getBool(keccak256(abi.encodePacked(daoUpgradeNameSpace, "executed", _upgradeProposalID)));
}
/// @notice Get whether the proposal has been vetoed
/// @param _upgradeProposalID ID of the upgrade proposal to query
function getVetoed(uint256 _upgradeProposalID) override public view returns (bool) {
return getBool(keccak256(abi.encodePacked(daoUpgradeNameSpace, "vetoed", _upgradeProposalID)));
}
/// @notice Get the proposal type
/// @param _upgradeProposalID ID of the upgrade proposal to query
function getType(uint256 _upgradeProposalID) override public view returns (bytes32) {
return getBytes32(keccak256(abi.encodePacked(daoUpgradeNameSpace, "type", _upgradeProposalID)));
}
/// @notice Get the proposed upgrade contract name
/// @param _upgradeProposalID ID of the upgrade proposal to query
function getName(uint256 _upgradeProposalID) override public view returns (string memory) {
return getString(keccak256(abi.encodePacked(daoUpgradeNameSpace, "name", _upgradeProposalID)));
}
/// @notice Get the proposed upgrade contract address
/// @param _upgradeProposalID ID of the upgrade proposal to query
function getUpgradeAddress(uint256 _upgradeProposalID) override public view returns (address) {
return getAddress(keccak256(abi.encodePacked(daoUpgradeNameSpace, "address", _upgradeProposalID)));
}
/// @notice Get the proposed upgrade contract ABI
/// @param _upgradeProposalID ID of the upgrade proposal to query
function getUpgradeABI(uint256 _upgradeProposalID) override public view returns (string memory) {
return getString(keccak256(abi.encodePacked(daoUpgradeNameSpace, "abi", _upgradeProposalID)));
}
}
================================================
FILE: contracts/contract/dao/node/settings/RocketDAONodeTrustedSettings.sol
================================================
pragma solidity 0.7.6;
// SPDX-License-Identifier: GPL-3.0-only
import "../../../RocketBase.sol";
import "../../../../interface/dao/node/settings/RocketDAONodeTrustedSettingsInterface.sol";
// Settings in RP which the DAO will have full control over
// This settings contract enables storage using setting paths with namespaces, rather than explicit set methods
abstract contract RocketDAONodeTrustedSettings is RocketBase, RocketDAONodeTrustedSettingsInterface {
// The namespace for a particular group of settings
bytes32 settingNameSpace;
// Only allow updating from the DAO proposals contract
modifier onlyDAONodeTrustedProposal() {
// If this contract has been initialised, only allow access from the proposals contract
if(getBool(keccak256(abi.encodePacked(settingNameSpace, "deployed")))) require(getContractAddress("rocketDAONodeTrustedProposals") == msg.sender, "Only DAO Node Trusted Proposals contract can update a setting");
_;
}
// Construct
constructor(RocketStorageInterface _rocketStorageAddress, string memory _settingNameSpace) RocketBase(_rocketStorageAddress) {
// Apply the setting namespace
settingNameSpace = keccak256(abi.encodePacked("dao.trustednodes.setting.", _settingNameSpace));
}
/*** Uints ****************/
// A general method to return any setting given the setting path is correct, only accepts uints
function getSettingUint(string memory _settingPath) public view override returns (uint256) {
return getUint(keccak256(abi.encodePacked(settingNameSpace, _settingPath)));
}
// Update a Uint setting, can only be executed by the DAO contract when a majority on a setting proposal has passed and been executed
function setSettingUint(string memory _settingPath, uint256 _value) virtual public override onlyDAONodeTrustedProposal {
// Update setting now
setUint(keccak256(abi.encodePacked(settingNameSpace, _settingPath)), _value);
}
/*** Bools ****************/
// A general method to return any setting given the setting path is correct, only accepts bools
function getSettingBool(string memory _settingPath) public view override returns (bool) {
return getBool(keccak256(abi.encodePacked(settingNameSpace, _settingPath)));
}
// Update a setting, can only be executed by the DAO contract when a majority on a setting proposal has passed and been executed
function setSettingBool(string memory _settingPath, bool _value) virtual public override onlyDAONodeTrustedProposal {
// Update setting now
setBool(keccak256(abi.encodePacked(settingNameSpace, _settingPath)), _value);
}
}
================================================
FILE: contracts/contract/dao/node/settings/RocketDAONodeTrustedSettingsMembers.sol
================================================
pragma solidity 0.7.6;
// SPDX-License-Identifier: GPL-3.0-only
import "./RocketDAONodeTrustedSettings.sol";
import "../../../../interface/dao/node/settings/RocketDAONodeTrustedSettingsMembersInterface.sol";
// The Trusted Node DAO Members
contract RocketDAONodeTrustedSettingsMembers is RocketDAONodeTrustedSettings, RocketDAONodeTrustedSettingsMembersInterface {
// Construct
constructor(RocketStorageInterface _rocketStorageAddress) RocketDAONodeTrustedSettings(_rocketStorageAddress, "members") {
// Set version
version = 1;
// Initialize settings on deployment
if(!getBool(keccak256(abi.encodePacked(settingNameSpace, "deployed")))) {
// Init settings
setSettingUint("members.quorum", 0.51 ether); // Member quorum threshold that must be met for proposals to pass (51%)
setSettingUint("members.rplbond", 1750 ether); // Bond amount required for a new member to join (in RPL)
setSettingUint("members.minipool.unbonded.max", 30); // The amount of unbonded minipool validators members can make (these validators are only used if no regular bonded validators are available)
setSettingUint("members.minipool.unbonded.min.fee", 0.8 ether); // Node fee must be over this percentage of the maximum fee before validator members are allowed to make unbonded pools (80%)
setSettingUint("members.challenge.cooldown", 7 days); // How long a member must wait before performing another challenge in seconds
setSettingUint("members.challenge.window", 7 days); // How long a member has to respond to a challenge in seconds
setSettingUint("members.challenge.cost", 1 ether); // How much it costs a non-member to challenge a members node. It's free for current members to challenge other members.
// Settings initialised
setBool(keccak256(abi.encodePacked(settingNameSpace, "deployed")), true);
}
}
/*** Set Uint *****************************************/
// Update a setting, overrides inherited setting method with extra checks for this contract
function setSettingUint(string memory _settingPath, uint256 _value) override public onlyDAONodeTrustedProposal {
// Some safety guards for certain settings
if(keccak256(abi.encodePacked(_settingPath)) == keccak256(abi.encodePacked("members.quorum"))) require(_value > 0 ether && _value <= 0.9 ether, "Quorum setting must be > 0 & <= 90%");
// Update setting now
setUint(keccak256(abi.encodePacked(settingNameSpace, _settingPath)), _value);
}
// Getters
// The member proposal quorum threshold for this DAO
function getQuorum() override external view returns (uint256) {
return getSettingUint("members.quorum");
}
// Amount of RPL needed for a new member
function getRPLBond() override external view returns (uint256) {
return getSettingUint("members.rplbond");
}
// The amount of unbonded minipool validators members can make (these validators are only used if no regular bonded validators are available)
function getMinipoolUnbondedMax() override external view returns (uint256) {
return getSettingUint("members.minipool.unbonded.max");
}
// Node fee must be over this percentage of the maximum fee before validator members are allowed to make unbonded pools
function getMinipoolUnbondedMinFee() override external view returns (uint256) {
return getSettingUint('members.minipool.unbonded.min.fee');
}
// How long a member must wait before making consecutive challenges in seconds
function getChallengeCooldown() override external view returns (uint256) {
return getSettingUint("members.challenge.cooldown");
}
// The window available to meet any node challenges in seconds
function getChallengeWindow() override external view returns (uint256) {
return getSettingUint("members.challenge.window");
}
// How much it costs a non-member to challenge a members node. It's free for current members to challenge other members.
function getChallengeCost() override external view returns (uint256) {
return getSettingUint("members.challenge.cost");
}
}
================================================
FILE: contracts/contract/dao/node/settings/RocketDAONodeTrustedSettingsMinipool.sol
================================================
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.7.6;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./RocketDAONodeTrustedSettings.sol";
import "../../../../interface/dao/node/settings/RocketDAONodeTrustedSettingsMinipoolInterface.sol";
import "../../../../interface/dao/protocol/settings/RocketDAOProtocolSettingsMinipoolInterface.sol";
/// @notice The Trusted Node DAO Minipool settings
contract RocketDAONodeTrustedSettingsMinipool is RocketDAONodeTrustedSettings, RocketDAONodeTrustedSettingsMinipoolInterface {
using SafeMath for uint;
constructor(RocketStorageInterface _rocketStorageAddress) RocketDAONodeTrustedSettings(_rocketStorageAddress, "minipool") {
// Set version
version = 2;
// If deployed during initial deployment, initialise now (otherwise must be called after upgrade)
if (!getBool(keccak256(abi.encodePacked(settingNameSpace, "deployed")))) {
// Init settings
setSettingUint("minipool.scrub.period", 12 hours);
setSettingUint("minipool.promotion.scrub.period", 3 days);
setSettingUint("minipool.scrub.quorum", 0.51 ether);
setSettingBool("minipool.scrub.penalty.enabled", false);
setSettingUint("minipool.bond.reduction.window.start", 2 days);
setSettingUint("minipool.bond.reduction.window.length", 2 days);
setSettingUint("minipool.cancel.bond.reduction.quorum", 0.51 ether);
// Settings initialised
setBool(keccak256(abi.encodePacked(settingNameSpace, "deployed")), true);
}
}
/// @notice Update a setting, overrides inherited setting method with extra checks for this contract
/// @param _settingPath The path of the setting within this contract's namespace
/// @param _value The value to set it to
function setSettingUint(string memory _settingPath, uint256 _value) override public onlyDAONodeTrustedProposal {
// Some safety guards for certain settings
if(getBool(keccak256(abi.encodePacked(settingNameSpace, "deployed")))) {
if(keccak256(abi.encodePacked(_settingPath)) == keccak256(abi.encodePacked("minipool.scrub.period"))) {
RocketDAOProtocolSettingsMinipoolInterface rocketDAOProtocolSettingsMinipool = RocketDAOProtocolSettingsMinipoolInterface(getContractAddress("rocketDAOProtocolSettingsMinipool"));
require(_value <= (rocketDAOProtocolSettingsMinipool.getLaunchTimeout().sub(1 hours)), "Scrub period must be less than launch timeout");
}
}
// Update setting now
setUint(keccak256(abi.encodePacked(settingNameSpace, _settingPath)), _value);
}
// Getters
/// @notice How long minipools must wait before moving to staking status (can be scrubbed by ODAO before then)
function getScrubPeriod() override external view returns (uint256) {
return getSettingUint("minipool.scrub.period");
}
/// @notice How long minipools must wait before promoting a vacant minipool to staking status (can be scrubbed by ODAO before then)
function getPromotionScrubPeriod() override external view returns (uint256) {
return getSettingUint("minipool.promotion.scrub.period");
}
/// @notice Returns the required number of trusted nodes to vote to scrub a minipool
function getScrubQuorum() override external view returns (uint256) {
return getSettingUint("minipool.scrub.quorum");
}
/// @notice Returns the required number of trusted nodes to vote to cancel a bond reduction
function getCancelBondReductionQuorum() override external view returns (uint256) {
return getSettingUint("minipool.cancel.bond.reduction.quorum");
}
/// @notice Returns true if scrubbing results in an RPL penalty for the node operator
function getScrubPenaltyEnabled() override external view returns (bool) {
return getSettingBool("minipool.scrub.penalty.enabled");
}
/// @notice Returns true if the given time is within the bond reduction window
function isWithinBondReductionWindow(uint256 _time) override external view returns (bool) {
uint256 start = getBondReductionWindowStart();
uint256 length = getBondReductionWindowLength();
return (_time >= start && _time < (start.add(length)));
}
/// @notice Returns the start of the bond reduction window
function getBondReductionWindowStart() override public view returns (uint256) {
return getSettingUint("minipool.bond.reduction.window.start");
}
/// @notice Returns the length of the bond reduction window
function getBondReductionWindowLength() override public view returns (uint256) {
return getSettingUint("minipool.bond.reduction.window.length");
}
}
================================================
FILE: contracts/contract/dao/node/settings/RocketDAONodeTrustedSettingsProposals.sol
================================================
pragma solidity 0.7.6;
// SPDX-License-Identifier: GPL-3.0-only
import "./RocketDAONodeTrustedSettings.sol";
import "../../../../interface/dao/node/settings/RocketDAONodeTrustedSettingsProposalsInterface.sol";
// The Trusted Node DAO Members
contract RocketDAONodeTrustedSettingsProposals is RocketDAONodeTrustedSettings, RocketDAONodeTrustedSettingsProposalsInterface {
// Construct
constructor(RocketStorageInterface _rocketStorageAddress) RocketDAONodeTrustedSettings(_rocketStorageAddress, "proposals") {
// Set version
version = 1;
// Initialize settings on deployment
if(!getBool(keccak256(abi.encodePacked(settingNameSpace, "deployed")))) {
// Init settings
setSettingUint("proposal.cooldown.time", 2 days); // How long before a member can make sequential proposals
setSettingUint("proposal.vote.time", 2 weeks); // How long a proposal can be voted on
setSettingUint("proposal.vote.delay.time", 1 weeks); // How long before a proposal can be voted on after it is created
setSettingUint("proposal.execute.time", 4 weeks); // How long a proposal can be executed after its voting period is finished
setSettingUint("proposal.action.time", 4 weeks); // Certain proposals require a secondary action to be run after the proposal is successful (joining, leaving etc). This is how long until that action expires
// Settings initialised
setBool(keccak256(abi.encodePacked(settingNameSpace, "deployed")), true);
}
}
// Getters
// How long before a member can make sequential proposals
function getCooldownTime() override external view returns (uint256) {
return getSettingUint("proposal.cooldown.time");
}
// How long a proposal can be voted on
function getVoteTime() override external view returns (uint256) {
return getSettingUint("proposal.vote.time");
}
// How long before a proposal can be voted on after it is created
function getVoteDelayTime() override external view returns (uint256) {
return getSettingUint("proposal.vote.delay.time");
}
// How long a proposal can be executed after its voting period is finished
function getExecuteTime() override external view returns (uint256) {
return getSettingUint("proposal.execute.time");
}
// Certain proposals require a secondary action to be run after the proposal is successful (joining, leaving etc). This is how long until that action expires
function getActionTime() override external view returns (uint256) {
return getSettingUint("proposal.action.time");
}
}
================================================
FILE: contracts/contract/dao/node/settings/RocketDAONodeTrustedSettingsRewards.sol
================================================
pragma solidity 0.7.6;
// SPDX-License-Identifier: GPL-3.0-only
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./RocketDAONodeTrustedSettings.sol";
import "../../../../interface/dao/node/settings/RocketDAONodeTrustedSettingsRewardsInterface.sol";
import "../../../../interface/dao/protocol/settings/RocketDAOProtocolSettingsRewardsInterface.sol";
// The Trusted Node DAO Rewards settings
contract RocketDAONodeTrustedSettingsRewards is RocketDAONodeTrustedSettings, RocketDAONodeTrustedSettingsRewardsInterface {
using SafeMath for uint;
// Construct
constructor(RocketStorageInterface _rocketStorageAddress) RocketDAONodeTrustedSettings(_rocketStorageAddress, "rewards") {
// Set version
version = 2;
// Initialize settings on deployment
if(!getBool(keccak256(abi.encodePacked(settingNameSpace, "deployed")))) {
// Init settings
setSettingBool("rewards.network.enabled", true);
// Settings initialised
setBool(keccak256(abi.encodePacked(settingNameSpace, "deployed")), true);
}
}
// Update a setting, overrides inherited setting method with extra checks for this contract
function setSettingBool(string memory _settingPath, bool _value) override public onlyDAONodeTrustedProposal {
// Some safety guards for certain settings
if(getBool(keccak256(abi.encodePacked(settingNameSpace, "deployed")))) {
// oDAO should never disable main net rewards
if(keccak256(abi.encodePacked(_settingPath)) == keccak256(abi.encodePacked("rewards.network.enabled", uint256(0)))) {
revert("Cannot disable network 0");
}
}
// Update setting now
setBool(keccak256(abi.encodePacked(settingNameSpace, _settingPath)), _value);
}
// Getters
function getNetworkEnabled(uint256 _network) override external view returns (bool) {
return getBool(keccak256(abi.encodePacked(settingNameSpace, "rewards.network.enabled", _network)));
}
}
================================================
FILE: contracts/contract/dao/protocol/RocketDAOProtocol.sol
================================================
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.8.30;
import {RocketStorageInterface} from "../../../interface/RocketStorageInterface.sol";
import {RocketDAOProtocolInterface} from "../../../interface/dao/protocol/RocketDAOProtocolInterface.sol";
import {RocketDAOProtocolProposalsInterface} from "../../../interface/dao/protocol/RocketDAOProtocolProposalsInterface.sol";
import {SettingType} from "../../../types/SettingType.sol";
import {RocketBase} from "../../RocketBase.sol";
/// @notice The Rocket Pool Protocol DAO (pDAO)
contract RocketDAOProtocol is RocketBase, RocketDAOProtocolInterface {
// Events
event BootstrapSettingMulti(string[] settingContractNames, string[] settingPaths, SettingType[] types, bytes[] values, uint256 time);
event BootstrapSettingUint(string settingContractName, string settingPath, uint256 value, uint256 time);
event BootstrapSettingBool(string settingContractName, string settingPath, bool value, uint256 time);
event BootstrapSettingAddress(string settingContractName, string settingPath, address value, uint256 time);
event BootstrapSettingAddressList(string settingContractName, string settingPath, address[] value, uint256 time);
event BootstrapSettingClaimers(uint256 trustedNodePercent, uint256 protocolPercent, uint256 nodePercent, uint256 time);
event BootstrapSpendTreasury(string invoiceID, address recipientAddress, uint256 amount, uint256 time);
event BootstrapTreasuryNewContract(string contractName, address recipientAddress, uint256 amountPerPeriod, uint256 periodLength, uint256 startTime, uint256 numPeriods, uint256 time);
event BootstrapTreasuryUpdateContract(string contractName, address recipientAddress, uint256 amountPerPeriod, uint256 periodLength, uint256 numPeriods, uint256 time);
event BootstrapSecurityInvite(string id, address memberAddress, uint256 time);
event BootstrapSecurityKick(address memberAddress, uint256 time);
event BootstrapDisabled(uint256 time);
event BootstrapProtocolDAOEnabled(uint256 block, uint256 time);
// The namespace for any data stored in the network DAO (do not change)
string constant internal daoNameSpace = "dao.protocol.";
// Only allow bootstrapping when enabled
modifier onlyBootstrapMode() {
require(getBootstrapModeDisabled() == false, "Bootstrap mode not engaged");
_;
}
constructor(RocketStorageInterface _rocketStorageAddress) RocketBase(_rocketStorageAddress) {
version = 3;
}
/**** DAO Properties **************/
/// @notice Returns true if bootstrap mode is disabled
function getBootstrapModeDisabled() override public view returns (bool) {
return getBool(keccak256(abi.encodePacked(daoNameSpace, "bootstrapmode.disabled")));
}
/// @notice Get the last time this user made a proposal
function getMemberLastProposalTime(address _nodeAddress) override external view returns (uint256) {
return getUint(keccak256(abi.encodePacked(daoNameSpace, "member.proposal.lasttime", _nodeAddress)));
}
/**** Bootstrapping ***************/
// While bootstrap mode is engaged, RP can change settings alongside the DAO. When disabled, only DAO will be able to control settings
/// @notice Bootstrap mode - multi Setting
function bootstrapSettingMulti(string[] memory _settingContractNames, string[] memory _settingPaths, SettingType[] memory _types, bytes[] memory _values) override external onlyGuardian onlyBootstrapMode onlyLatestContract("rocketDAOProtocol", address(this)) {
RocketDAOProtocolProposalsInterface(getContractAddress("rocketDAOProtocolProposals")).proposalSettingMulti(_settingContractNames, _settingPaths, _types, _values);
emit BootstrapSettingMulti(_settingContractNames, _settingPaths, _types, _values, block.timestamp);
}
/// @notice Bootstrap mode - Uint Setting
function bootstrapSettingUint(string memory _settingContractName, string memory _settingPath, uint256 _value) override external onlyGuardian onlyBootstrapMode onlyLatestContract("rocketDAOProtocol", address(this)) {
RocketDAOProtocolProposalsInterface(getContractAddress("rocketDAOProtocolProposals")).proposalSettingUint(_settingContractName, _settingPath, _value);
emit BootstrapSettingUint(_settingContractName, _settingPath, _value, block.timestamp);
}
/// @notice Bootstrap mode - Bool Setting
function bootstrapSettingBool(string memory _settingContractName, string memory _settingPath, bool _value) override external onlyGuardian onlyBootstrapMode onlyLatestContract("rocketDAOProtocol", address(this)) {
RocketDAOProtocolProposalsInterface(getContractAddress("rocketDAOProtocolProposals")).proposalSettingBool(_settingContractName, _settingPath, _value);
emit BootstrapSettingBool(_settingContractName, _settingPath, _value, block.timestamp);
}
/// @notice Bootstrap mode - Address Setting
function bootstrapSettingAddress(string memory _settingContractName, string memory _settingPath, address _value) override external onlyGuardian onlyBootstrapMode onlyLatestContract("rocketDAOProtocol", address(this)) {
RocketDAOProtocolProposalsInterface(getContractAddress("rocketDAOProtocolProposals")).proposalSettingAddress(_settingContractName, _settingPath, _value);
emit BootstrapSettingAddress(_settingContractName, _settingPath, _value, block.timestamp);
}
/// @notice Bootstrap mode - Address list Setting
function bootstrapSettingAddressList(string memory _settingContractName, string memory _settingPath, address[] calldata _value) override external onlyGuardian onlyBootstrapMode onlyLatestContract("rocketDAOProtocol", address(this)) {
RocketDAOProtocolProposalsInterface(getContractAddress("rocketDAOProtocolProposals")).proposalSettingAddressList(_settingContractName, _settingPath, _value);
emit BootstrapSettingAddressList(_settingContractName, _settingPath, _value, block.timestamp);
}
/// @notice Bootstrap mode - Set a claiming contract to receive a % of RPL inflation rewards
function bootstrapSettingClaimers(uint256 _trustedNodePercent, uint256 _protocolPercent, uint256 _nodePercent) override external onlyGuardian onlyBootstrapMode onlyLatestContract("rocketDAOProtocol", address(this)) {
RocketDAOProtocolProposalsInterface(getContractAddress("rocketDAOProtocolProposals")).proposalSettingRewardsClaimers(_trustedNodePercent, _protocolPercent, _nodePercent);
emit BootstrapSettingClaimers(_trustedNodePercent, _protocolPercent, _nodePercent, block.timestamp);
}
/// @notice Bootstrap mode - Spend DAO treasury
function bootstrapSpendTreasury(string memory _invoiceID, address _recipientAddress, uint256 _amount) override external onlyGuardian onlyBootstrapMode onlyLatestContract("rocketDAOProtocol", address(this)) {
RocketDAOProtocolProposalsInterface(getContractAddress("rocketDAOProtocolProposals")).proposalTreasuryOneTimeSpend(_invoiceID, _recipientAddress, _amount);
emit BootstrapSpendTreasury(_invoiceID, _recipientAddress, _amount, block.timestamp);
}
/// @notice Bootstrap mode - New treasury contract
function bootstrapTreasuryNewContract(string memory _contractName, address _recipientAddress, uint256 _amountPerPeriod, uint256 _periodLength, uint256 _startTime, uint256 _numPeriods) override external onlyGuardian onlyBootstrapMode onlyLatestContract("rocketDAOProtocol", address(this)) {
RocketDAOProtocolProposalsInterface(getContractAddress("rocketDAOProtocolProposals")).proposalTreasuryNewContract(_contractName, _recipientAddress, _amountPerPeriod, _periodLength, _startTime, _numPeriods);
emit BootstrapTreasuryNewContract(_contractName, _recipientAddress, _amountPerPeriod, _periodLength, _startTime, _numPeriods, block.timestamp);
}
/// @notice Bootstrap mode - Update treasury contract
function bootstrapTreasuryUpdateContract(string memory _contractName, address _recipientAddress, uint256 _amountPerPeriod, uint256 _periodLength, uint256 _numPeriods) override external onlyGuardian onlyBootstrapMode onlyLatestContract("rocketDAOProtocol", address(this)) {
RocketDAOProtocolProposalsInterface(getContractAddress("rocketDAOProtocolProposals")).proposalTreasuryUpdateContract(_contractName, _recipientAddress, _amountPerPeriod, _periodLength, _numPeriods);
emit BootstrapTreasuryUpdateContract(_contractName, _recipientAddress, _amountPerPeriod, _periodLength, _numPeriods, block.timestamp);
}
/// @notice Bootstrap mode - Invite security council member
function bootstrapSecurityInvite(string memory _id, address _memberAddress) override external onlyGuardian onlyBootstrapMode onlyLatestContract("rocketDAOProtocol", address(this)) {
RocketDAOProtocolProposalsInterface(getContractAddress("rocketDAOProtocolProposals")).proposalSecurityInvite(_id, _memberAddress);
emit BootstrapSecurityInvite(_id, _memberAddress, block.timestamp);
}
/// @notice Bootstrap mode - Kick security council member
function bootstrapSecurityKick(address _memberAddress) override external onlyGuardian onlyBootstrapMode onlyLatestContract("rocketDAOProtocol", address(this)) {
RocketDAOProtocolProposalsInterface(getContractAddress("rocketDAOProtocolProposals")).proposalSecurityKick(_memberAddress);
emit BootstrapSecurityKick(_memberAddress, block.timestamp);
}
/// @notice Bootstrap mode - Disable RP Access (only RP can call this to hand over full control to the DAO)
function bootstrapDisable(bool _confirmDisableBootstrapMode) override external onlyGuardian onlyBootstrapMode onlyLatestContract("rocketDAOProtocol", address(this)) {
// Prevent disabling bootstrap if on-chain governance has not been enabled
require(getUint(keccak256(abi.encodePacked("protocol.dao.enabled.block"))) > 0, "On-chain governance must be enabled first");
// Disable bootstrap
require(_confirmDisableBootstrapMode == true, "You must confirm disabling bootstrap mode, it can only be done once!");
setBool(keccak256(abi.encodePacked(daoNameSpace, "bootstrapmode.disabled")), true);
emit BootstrapDisabled(block.timestamp);
}
/// @notice Bootstrap mode - Enables on-chain governance proposals
function bootstrapEnableGovernance() override external onlyGuardian onlyBootstrapMode onlyLatestContract("rocketDAOProtocol", address(this)) {
setUint(keccak256(abi.encodePacked("protocol.dao.enabled.block")), block.number);
emit BootstrapProtocolDAOEnabled(block.number, block.timestamp);
}
}
================================================
FILE: contracts/contract/dao/protocol/RocketDAOProtocolActions.sol
================================================
pragma solidity 0.7.6;
// SPDX-License-Identifier: GPL-3.0-only
import "../../RocketBase.sol";
import "../../../interface/RocketVaultInterface.sol";
import "../../../interface/dao/protocol/RocketDAOProtocolActionsInterface.sol";
import "../../../interface/util/IERC20Burnable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
// The Rocket Pool Network DAO Actions - This is a placeholder for the network DAO to come
contract RocketDAOProtocolActions is RocketBase, RocketDAOProtocolActionsInterface {
using SafeMath for uint;
// The namespace for any data stored in the network DAO (do not change)
string constant daoNameSpace = "dao.protocol.";
// Construct
constructor(RocketStorageInterface _rocketStorageAddress) RocketBase(_rocketStorageAddress) {
// Version
version = 1;
}
/*** Action Methods ************************/
}
================================================
FILE: contracts/contract/dao/protocol/RocketDAOProtocolProposal.sol
================================================
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.8.30;
import "../../RocketBase.sol";
import "../../../interface/dao/protocol/RocketDAOProtocolVerifierInterface.sol";
import "../../../interface/network/RocketNetworkVotingInterface.sol";
import "../../../interface/dao/protocol/settings/RocketDAOProtocolSettingsProposalsInterface.sol";
import "../../../interface/dao/security/RocketDAOSecurityInterface.sol";
import "../../../interface/dao/security/RocketDAOSecurityProposalsInterface.sol";
import "../../../interface/dao/protocol/RocketDAOProtocolProposalInterface.sol";
/// @notice Manages protocol DAO proposals
contract RocketDAOProtocolProposal is RocketBase, RocketDAOProtocolProposalInterface {
// Events
event ProposalAdded(address indexed proposer, uint256 indexed proposalID, bytes payload, uint256 time);
event ProposalVoted(uint256 indexed proposalID, address indexed voter, VoteDirection direction, uint256 votingPower, uint256 time);
event ProposalVoteOverridden(uint256 indexed proposalID, address indexed delegate, address indexed voter, uint256 votingPower, uint256 time);
event ProposalExecuted(uint256 indexed proposalID, address indexed executor, uint256 time);
event ProposalFinalised(uint256 indexed proposalID, address indexed executor, uint256 time);
event ProposalDestroyed(uint256 indexed proposalID, uint256 time);
// The namespace for any data stored in the protocol DAO (do not change)
string constant internal daoProposalNameSpace = "dao.protocol.proposal.";
constructor(RocketStorageInterface _rocketStorageAddress) RocketBase(_rocketStorageAddress) {
version = 2;
}
/*** Proposals **********************/
/// @notice Create a DAO proposal with calldata, if successful will be added to a queue where it can be executed
/// A general message can be passed by the proposer along with the calldata payload that can be executed
/// if the proposal passes
/// @param _proposalMessage A string explaining what the proposal does
/// @param _payload An ABI encoded payload which is executed on this contract if the proposal is successful
/// @param _blockNumber The block number the proposal is being made for
/// @param _treeNodes A merkle pollard generated at _blockNumber for the voting power state of the DAO
function propose(string memory _proposalMessage, bytes calldata _payload, uint32 _blockNumber, Types.Node[] calldata _treeNodes) override external onlyRegisteredNode(msg.sender) onlyLatestContract("rocketDAOProtocolProposal", address(this)) returns (uint256) {
// Check on-chain governance has been enabled
{
uint256 enabledBlock = getUint(keccak256(abi.encodePacked("protocol.dao.enabled.block")));
require(enabledBlock != 0 && _blockNumber >= enabledBlock, "DAO has not been enabled");
}
// Calculate total voting power by summing the pollard
uint256 totalVotingPower = 0;
uint256 treeNodesLength = _treeNodes.length;
for (uint256 i = 0; i < treeNodesLength; ++i) {
totalVotingPower += _treeNodes[i].sum;
}
// Create the proposal
uint256 proposalID = _propose(_proposalMessage, _blockNumber, totalVotingPower, _payload);
// Add root to verifier so it can be challenged if incorrect
RocketDAOProtocolVerifierInterface rocketDAOProtocolVerifier = RocketDAOProtocolVerifierInterface(getContractAddress("rocketDAOProtocolVerifier"));
rocketDAOProtocolVerifier.submitProposalRoot(proposalID, msg.sender, _blockNumber, _treeNodes);
return proposalID;
}
/// @notice Applies a vote during phase 1
/// @param _proposalID ID of the proposal to vote on
/// @param _voteDirection Direction of the vote
/// @param _votingPower Total delegated voting power for the voter at the proposal block
/// @param _nodeIndex The index of the node voting
/// @param _witness A merkle proof into the network voting power tree proving the supplied voting power is correct
function vote(uint256 _proposalID, VoteDirection _voteDirection, uint256 _votingPower, uint256 _nodeIndex, Types.Node[] calldata _witness) external onlyRegisteredNode(msg.sender) onlyLatestContract("rocketDAOProtocolProposal", address(this)) {
// Check valid vote
require(_voteDirection != VoteDirection.NoVote, "Invalid vote");
// Check the proposal is in a state that can be voted on
require(getState(_proposalID) == ProposalState.ActivePhase1, "Phase 1 voting is not active");
// Verify the voting power is correct
RocketDAOProtocolVerifierInterface rocketDAOProtocolVerifier = RocketDAOProtocolVerifierInterface(getContractAddress("rocketDAOProtocolVerifier"));
require(rocketDAOProtocolVerifier.verifyVote(msg.sender, _nodeIndex, _proposalID, _votingPower, _witness), "Invalid proof");
// Apply vote
_vote(msg.sender, _votingPower, _proposalID, _voteDirection, true);
}
/// @notice Applies a vote during phase 2 (can be used to override vote direction of delegate)
/// @param _proposalID ID of the proposal to vote on
/// @param _voteDirection Direction of the vote
function overrideVote(uint256 _proposalID, VoteDirection _voteDirection) override external onlyRegisteredNode(msg.sender) onlyLatestContract("rocketDAOProtocolProposal", address(this)) {
// Check valid vote
require(_voteDirection != VoteDirection.NoVote, "Invalid vote");
// Check the proposal is in a state that can be voted on
require(getState(_proposalID) == ProposalState.ActivePhase2, "Phase 2 voting is not active");
// Load contracts
RocketNetworkVotingInterface rocketNetworkVoting = RocketNetworkVotingInterface(getContractAddress("rocketNetworkVoting"));
// Get caller's voting power and direction of their delegate
uint32 blockNumber = uint32(getProposalBlock(_proposalID));
uint256 votingPower = rocketNetworkVoting.getVotingPower(msg.sender, blockNumber);
address delegate = rocketNetworkVoting.getDelegate(msg.sender, blockNumber);
// Check if delegate voted in phase 1
if (getReceiptHasVotedPhase1(_proposalID, delegate)) {
// Get the vote direction of their delegate
VoteDirection delegateVote = getReceiptDirection(_proposalID, delegate);
require (delegateVote != _voteDirection, "Vote direction is the same as delegate");
// Reverse the delegate's vote
_overrideVote(delegate, msg.sender, _proposalID, votingPower, delegateVote);
}
// Apply this voter's vote
_vote(msg.sender, votingPower, _proposalID, _voteDirection, false);
}
/// @notice Finalises a vetoed proposal by burning the proposer's bond
/// @param _proposalID ID of the proposal to finalise
function finalise(uint256 _proposalID) override external onlyLatestContract("rocketDAOProtocolProposal", address(this)) {
// Check state
require(getState(_proposalID) == ProposalState.Vetoed, "Proposal has not been vetoed");
bytes32 finalisedKey = keccak256(abi.encodePacked(daoProposalNameSpace, "finalised", _proposalID));
require(getBool(finalisedKey) == false, "Proposal already finalised");
setBool(finalisedKey, true);
// Burn the proposer's bond
RocketDAOProtocolVerifierInterface rocketDAOProtocolVerifier = RocketDAOProtocolVerifierInterface(getContractAddress("rocketDAOProtocolVerifier"));
rocketDAOProtocolVerifier.burnProposalBond(_proposalID);
// Log it
emit ProposalFinalised(_proposalID, tx.origin, block.timestamp);
}
/// @notice Executes a successful proposal
/// @param _proposalID ID of the proposal to execute
function execute(uint256 _proposalID) override external onlyLatestContract("rocketDAOProtocolProposal", address(this)) {
// Firstly make sure this proposal has passed
require(getState(_proposalID) == ProposalState.Succeeded, "Proposal has not succeeded, has expired or has already been executed");
// Set as executed now before running payload
setBool(keccak256(abi.encodePacked(daoProposalNameSpace, "executed", _proposalID)), true);
// Get the proposals contract
address daoProtocolProposalsAddress = getContractAddress("rocketDAOProtocolProposals");
// Ok all good, lets run the payload on the dao contract that the proposal relates too, it should execute one of the methods on this contract
(bool success, bytes memory response) = daoProtocolProposalsAddress.call(getPayload(_proposalID));
// Was there an error?
require(success, getRevertMsg(response));
// Log it
emit ProposalExecuted(_proposalID, tx.origin, block.timestamp);
}
/// @dev Called by the verifier contract to destroy a proven invalid proposal
function destroy(uint256 _proposalID) override external onlyLatestContract("rocketDAOProtocolProposal", address(this)) onlyLatestContract("rocketDAOProtocolVerifier", msg.sender) {
// Cancel the proposal
bytes32 destroyedKey = keccak256(abi.encodePacked(daoProposalNameSpace, "destroyed", _proposalID));
require(getBool(destroyedKey) == false, "Proposal already destroyed");
setBool(destroyedKey, true);
// Log it
emit ProposalDestroyed(_proposalID, block.timestamp);
}
/// @notice Gets the block used to generate a proposal
/// @param _proposalID The ID of the proposal to query
/// @return The block used to generated the requested proposal
function getProposalBlock(uint256 _proposalID) override public view returns (uint256) {
return getUint(keccak256(abi.encodePacked(daoProposalNameSpace, "proposal.block", _proposalID)));
}
/// @notice Gets the amount of vetos required to stop a proposal
/// @param _proposalID The ID of the proposal to veto
/// @return The amount of voting power required to veto a proposal
function getProposalVetoQuorum(uint256 _proposalID) override external view returns (uint256) {
return getUint(keccak256(abi.encodePacked(daoProposalNameSpace, "proposal.veto.quorum", _proposalID)));
}
/// @notice Get the current total proposals
function getTotal() override public view returns (uint256) {
return getUint(keccak256(abi.encodePacked(daoProposalNameSpace, "total")));
}
/// @notice Get the member who proposed
/// @param _proposalID The ID of the proposal to query
function getProposer(uint256 _proposalID) override public view returns (address) {
return getAddress(keccak256(abi.encodePacked(daoProposalNameSpace, "proposer", _proposalID)));
}
/// @notice Get the proposal message
/// @param _proposalID The ID of the proposal to query
function getMessage(uint256 _proposalID) override external view returns (string memory) {
return getString(keccak256(abi.encodePacked(daoProposalNameSpace, "message", _proposalID)));
}
/// @notice Get the start of this proposal as a timestamp
/// @param _proposalID The ID of the proposal to query
function getStart(uint256 _proposalID) override public view returns (uint256) {
return getUint(keccak256(abi.encodePacked(daoProposalNameSpace, "start", _proposalID)));
}
/// @notice Get the end of phase1 of this proposal as a timestamp
/// @param _proposalID The ID of the proposal to query
function getPhase1End(uint256 _proposalID) override public view returns (uint256) {
return getUint(keccak256(abi.encodePacked(daoProposalNameSpace, "phase1End", _proposalID)));
}
/// @notice Get the end of phase2 of this proposal as a timestamp
/// @param _proposalID The ID of the proposal to query
/// @return timestamp for the end of phase2
function getPhase2End(uint256 _proposalID) override public view returns (uint256) {
return getUint(keccak256(abi.encodePacked(daoProposalNameSpace, "phase2End", _proposalID)));
}
/// @notice The timestamp where the proposal expires and can no longer be executed if it is successful
/// @param _proposalID The ID of the proposal to query
function getExpires(uint256 _proposalID) override public view returns (uint256) {
return getUint(keccak256(abi.encodePacked(daoProposalNameSpace, "expires", _proposalID)));
}
/// @notice Get the created status of this proposal
/// @param _proposalID The ID of the proposal to query
function getCreated(uint256 _proposalID) override external view returns (uint256) {
return getUint(keccak256(abi.encodePacked(daoProposalNameSpace, "created", _proposalID)));
}
/// @notice Get the for voting power count of this proposal
/// @param _proposalID The ID of the proposal to query
function getVotingPowerFor(uint256 _proposalID) override public view returns (uint256) {
return getUint(keccak256(abi.encodePacked(daoProposalNameSpace, "votes.for", _proposalID)));
}
/// @notice Get the against voting power count of this proposal
/// @param _proposalID The ID of the proposal to query
function getVotingPowerAgainst(uint256 _proposalID) override public view returns (uint256) {
return getUint(keccak256(abi.encodePacked(daoProposalNameSpace, "votes.against", _proposalID)));
}
/// @notice Get the veto voting power count of this proposal
/// @param _proposalID The ID of the proposal to query
function getVotingPowerVeto(uint256 _proposalID) override public view returns (uint256) {
return getUint(keccak256(abi.encodePacked(daoProposalNameSpace, "votes.veto", _proposalID)));
}
/// @notice Get the against voteing power count of this proposal
/// @param _proposalID The ID of the proposal to query
function getVotingPowerAbstained(uint256 _proposalID) override public view returns (uint256) {
return getUint(keccak256(abi.encodePacked(daoProposalNameSpace, "votes.abstained", _proposalID)));
}
/// @notice How much voting power is required for the proposal to succeed
/// @param _proposalID The ID of the proposal to query
function getVotingPowerRequired(uint256 _proposalID) override public view returns (uint256) {
return getUint(keccak256(abi.encodePacked(daoProposalNameSpace, "votes.required", _proposalID)));
}
/// @notice Get the destroyed status of this proposal
/// @param _proposalID The ID of the proposal to query
function getDestroyed(uint256 _proposalID) override public view returns (bool) {
return getBool(keccak256(abi.encodePacked(daoProposalNameSpace, "destroyed", _proposalID)));
}
/// @notice Get the finalised status of this proposal
/// @param _proposalID The ID of the proposal to query
function getFinalised(uint256 _proposalID) override external view returns (bool) {
return getBool(keccak256(abi.encodePacked(daoProposalNameSpace, "finalised", _proposalID)));
}
/// @notice Get the executed status of this proposal
/// @param _proposalID The ID of the proposal to query
function getExecuted(uint256 _proposalID) override public view returns (bool) {
return getBool(keccak256(abi.encodePacked(daoProposalNameSpace, "executed", _proposalID)));
}
/// @notice Get the amount of veto votes required to veto this proposal
/// @param _proposalID The ID of the proposal to query
function getVetoQuorum(uint256 _proposalID) override public view returns (uint256) {
return getUint(keccak256(abi.encodePacked(daoProposalNameSpace, "proposal.veto.quorum", _proposalID)));
}
/// @notice Get the veto status of this proposal
/// @param _proposalID The ID of the proposal to query
function getVetoed(uint256 _proposalID) override public view returns (bool) {
uint256 votesVeto = getVotingPowerVeto(_proposalID);
uint256 quorum = getVetoQuorum(_proposalID);
return votesVeto >= quorum;
}
/// @notice Get the proposal payload
/// @param _proposalID The ID of the proposal to query
function getPayload(uint256 _proposalID) override public view returns (bytes memory) {
return getBytes(keccak256(abi.encodePacked(daoProposalNameSpace, "payload", _proposalID)));
}
/// @notice Returns true if this proposal has already been voted on by a node
/// @param _proposalID The ID of the proposal to query
/// @param _nodeAddress The node operator address to query
function getReceiptHasVoted(uint256 _proposalID, address _nodeAddress) override public view returns (bool) {
return getReceiptDirection(_proposalID, _nodeAddress) != VoteDirection.NoVote;
}
/// @notice Returns true if this proposal has been voted on in phase 1 by a node
/// @param _proposalID The ID of the proposal to query
/// @param _nodeAddress The node operator address to query
function getReceiptHasVotedPhase1(uint256 _proposalID, address _nodeAddress) override public view returns (bool) {
return getBool(keccak256(abi.encodePacked(daoProposalNameSpace, "receipt.phase1", _proposalID, _nodeAddress)));
}
/// @notice Returns the direction a node voted on a given proposal
/// @param _proposalID The ID of the proposal to query
/// @param _nodeAddress The node operator address to query
function getReceiptDirection(uint256 _proposalID, address _nodeAddress) override public view returns (VoteDirection) {
return VoteDirection(getUint(keccak256(abi.encodePacked(daoProposalNameSpace, "receipt.direction", _proposalID, _nodeAddress))));
}
/// @notice Return the state of the specified proposal
/// @param _proposalID The ID of the proposal to query
function getState(uint256 _proposalID) override public view returns (ProposalState) {
// Check the proposal ID is legit
require(getTotal() >= _proposalID && _proposalID > 0, "Invalid proposal ID");
// Destroyed?
if (getDestroyed(_proposalID)) {
return ProposalState.Destroyed;
}
// Has it been executed?
else if (getExecuted(_proposalID)) {
return ProposalState.Executed;
} else {
uint256 start = getStart(_proposalID);
// Is the proposal pending?
if (block.timestamp < start) {
return ProposalState.Pending;
} else {
// The proposal is active and can be voted on
uint256 phase1End = getPhase1End(_proposalID);
uint256 phase2End = getPhase2E
gitextract_0qumgsk9/
├── .gitattributes
├── .github/
│ └── workflows/
│ └── CI.yml
├── .gitignore
├── .mocharc.json
├── LICENSE
├── README.md
├── contracts/
│ ├── .gitattributes
│ ├── contract/
│ │ ├── RocketBase.sol
│ │ ├── RocketStorage.sol
│ │ ├── RocketVault.sol
│ │ ├── auction/
│ │ │ └── RocketAuctionManager.sol
│ │ ├── casper/
│ │ │ └── compiled/
│ │ │ └── Deposit.abi
│ │ ├── dao/
│ │ │ ├── RocketDAOProposal.sol
│ │ │ ├── node/
│ │ │ │ ├── RocketDAONodeTrusted.sol
│ │ │ │ ├── RocketDAONodeTrustedActions.sol
│ │ │ │ ├── RocketDAONodeTrustedProposals.sol
│ │ │ │ ├── RocketDAONodeTrustedUpgrade.sol
│ │ │ │ └── settings/
│ │ │ │ ├── RocketDAONodeTrustedSettings.sol
│ │ │ │ ├── RocketDAONodeTrustedSettingsMembers.sol
│ │ │ │ ├── RocketDAONodeTrustedSettingsMinipool.sol
│ │ │ │ ├── RocketDAONodeTrustedSettingsProposals.sol
│ │ │ │ └── RocketDAONodeTrustedSettingsRewards.sol
│ │ │ ├── protocol/
│ │ │ │ ├── RocketDAOProtocol.sol
│ │ │ │ ├── RocketDAOProtocolActions.sol
│ │ │ │ ├── RocketDAOProtocolProposal.sol
│ │ │ │ ├── RocketDAOProtocolProposals.sol
│ │ │ │ ├── RocketDAOProtocolVerifier.sol
│ │ │ │ └── settings/
│ │ │ │ ├── RocketDAOProtocolSettings.sol
│ │ │ │ ├── RocketDAOProtocolSettingsAuction.sol
│ │ │ │ ├── RocketDAOProtocolSettingsDeposit.sol
│ │ │ │ ├── RocketDAOProtocolSettingsInflation.sol
│ │ │ │ ├── RocketDAOProtocolSettingsMegapool.sol
│ │ │ │ ├── RocketDAOProtocolSettingsMinipool.sol
│ │ │ │ ├── RocketDAOProtocolSettingsNetwork.sol
│ │ │ │ ├── RocketDAOProtocolSettingsNode.sol
│ │ │ │ ├── RocketDAOProtocolSettingsProposals.sol
│ │ │ │ ├── RocketDAOProtocolSettingsRewards.sol
│ │ │ │ └── RocketDAOProtocolSettingsSecurity.sol
│ │ │ └── security/
│ │ │ ├── RocketDAOSecurity.sol
│ │ │ ├── RocketDAOSecurityActions.sol
│ │ │ ├── RocketDAOSecurityProposals.sol
│ │ │ └── RocketDAOSecurityUpgrade.sol
│ │ ├── deposit/
│ │ │ └── RocketDepositPool.sol
│ │ ├── helper/
│ │ │ ├── BeaconStateVerifierMock.sol
│ │ │ ├── MegapoolUpgradeHelper.sol
│ │ │ ├── PenaltyTest.sol
│ │ │ ├── RevertOnTransfer.sol
│ │ │ ├── SnapshotTest.sol
│ │ │ ├── SnapshotTimeTest.sol
│ │ │ ├── StakeHelper.sol
│ │ │ └── StorageHelper.sol
│ │ ├── megapool/
│ │ │ ├── RocketMegapoolDelegate.sol
│ │ │ ├── RocketMegapoolDelegateBase.sol
│ │ │ ├── RocketMegapoolFactory.sol
│ │ │ ├── RocketMegapoolManager.sol
│ │ │ ├── RocketMegapoolPenalties.sol
│ │ │ ├── RocketMegapoolProxy.sol
│ │ │ └── RocketMegapoolStorageLayout.sol
│ │ ├── minipool/
│ │ │ ├── RocketMinipoolBase.sol
│ │ │ ├── RocketMinipoolBondReducer.sol
│ │ │ ├── RocketMinipoolDelegate.sol
│ │ │ ├── RocketMinipoolFactory.sol
│ │ │ ├── RocketMinipoolManager.sol
│ │ │ ├── RocketMinipoolPenalty.sol
│ │ │ ├── RocketMinipoolQueue.sol
│ │ │ └── RocketMinipoolStorageLayout.sol
│ │ ├── network/
│ │ │ ├── RocketNetworkBalances.sol
│ │ │ ├── RocketNetworkFees.sol
│ │ │ ├── RocketNetworkPenalties.sol
│ │ │ ├── RocketNetworkPrices.sol
│ │ │ ├── RocketNetworkRevenues.sol
│ │ │ ├── RocketNetworkSnapshots.sol
│ │ │ ├── RocketNetworkSnapshotsTime.sol
│ │ │ └── RocketNetworkVoting.sol
│ │ ├── node/
│ │ │ ├── RocketNodeDeposit.sol
│ │ │ ├── RocketNodeDistributor.sol
│ │ │ ├── RocketNodeDistributorDelegate.sol
│ │ │ ├── RocketNodeDistributorFactory.sol
│ │ │ ├── RocketNodeDistributorStorageLayout.sol
│ │ │ ├── RocketNodeManager.sol
│ │ │ └── RocketNodeStaking.sol
│ │ ├── rewards/
│ │ │ ├── RocketClaimDAO.sol
│ │ │ ├── RocketMerkleDistributorMainnet.sol
│ │ │ ├── RocketRewardsPool.sol
│ │ │ └── RocketSmoothingPool.sol
│ │ ├── token/
│ │ │ ├── RocketTokenRETH.sol
│ │ │ ├── RocketTokenRPL.sol
│ │ │ └── temp/
│ │ │ └── RocketTokenDummyRPL.sol
│ │ └── util/
│ │ ├── AddressQueueStorage.sol
│ │ ├── AddressSetStorage.sol
│ │ ├── BeaconStateVerifier.sol
│ │ ├── Context.sol
│ │ ├── ERC20.sol
│ │ ├── ERC20Burnable.sol
│ │ ├── LinkedListStorage.sol
│ │ ├── LinkedListStorageHelper.sol
│ │ ├── SSZ.sol
│ │ ├── SafeERC20.sol
│ │ └── SafeMath.sol
│ ├── interface/
│ │ ├── RocketStorageInterface.sol
│ │ ├── RocketVaultInterface.sol
│ │ ├── RocketVaultWithdrawerInterface.sol
│ │ ├── auction/
│ │ │ └── RocketAuctionManagerInterface.sol
│ │ ├── casper/
│ │ │ └── DepositInterface.sol
│ │ ├── dao/
│ │ │ ├── RocketDAOProposalInterface.sol
│ │ │ ├── node/
│ │ │ │ ├── RocketDAONodeTrustedActionsInterface.sol
│ │ │ │ ├── RocketDAONodeTrustedInterface.sol
│ │ │ │ ├── RocketDAONodeTrustedProposalsInterface.sol
│ │ │ │ ├── RocketDAONodeTrustedUpgradeInterface.sol
│ │ │ │ └── settings/
│ │ │ │ ├── RocketDAONodeTrustedSettingsInterface.sol
│ │ │ │ ├── RocketDAONodeTrustedSettingsMembersInterface.sol
│ │ │ │ ├── RocketDAONodeTrustedSettingsMinipoolInterface.sol
│ │ │ │ ├── RocketDAONodeTrustedSettingsProposalsInterface.sol
│ │ │ │ └── RocketDAONodeTrustedSettingsRewardsInterface.sol
│ │ │ ├── protocol/
│ │ │ │ ├── RocketDAOProtocolActionsInterface.sol
│ │ │ │ ├── RocketDAOProtocolInterface.sol
│ │ │ │ ├── RocketDAOProtocolProposalInterface.sol
│ │ │ │ ├── RocketDAOProtocolProposalsInterface.sol
│ │ │ │ ├── RocketDAOProtocolVerifierInterface.sol
│ │ │ │ └── settings/
│ │ │ │ ├── RocketDAOProtocolSettingsAuctionInterface.sol
│ │ │ │ ├── RocketDAOProtocolSettingsDepositInterface.sol
│ │ │ │ ├── RocketDAOProtocolSettingsInflationInterface.sol
│ │ │ │ ├── RocketDAOProtocolSettingsInterface.sol
│ │ │ │ ├── RocketDAOProtocolSettingsMegapoolInterface.sol
│ │ │ │ ├── RocketDAOProtocolSettingsMinipoolInterface.sol
│ │ │ │ ├── RocketDAOProtocolSettingsNetworkInterface.sol
│ │ │ │ ├── RocketDAOProtocolSettingsNodeInterface.sol
│ │ │ │ ├── RocketDAOProtocolSettingsProposalsInterface.sol
│ │ │ │ ├── RocketDAOProtocolSettingsRewardsInterface.sol
│ │ │ │ └── RocketDAOProtocolSettingsSecurityInterface.sol
│ │ │ └── security/
│ │ │ ├── RocketDAOSecurityActionsInterface.sol
│ │ │ ├── RocketDAOSecurityInterface.sol
│ │ │ ├── RocketDAOSecurityProposalsInterface.sol
│ │ │ └── RocketDAOSecurityUpgradeInterface.sol
│ │ ├── deposit/
│ │ │ └── RocketDepositPoolInterface.sol
│ │ ├── megapool/
│ │ │ ├── RocketMegapoolDelegateBaseInterface.sol
│ │ │ ├── RocketMegapoolDelegateInterface.sol
│ │ │ ├── RocketMegapoolFactoryInterface.sol
│ │ │ ├── RocketMegapoolInterface.sol
│ │ │ ├── RocketMegapoolManagerInterface.sol
│ │ │ ├── RocketMegapoolPenaltiesInterface.sol
│ │ │ └── RocketMegapoolProxyInterface.sol
│ │ ├── minipool/
│ │ │ ├── RocketMinipoolBaseInterface.sol
│ │ │ ├── RocketMinipoolBondReducerInterface.sol
│ │ │ ├── RocketMinipoolFactoryInterface.sol
│ │ │ ├── RocketMinipoolInterface.sol
│ │ │ ├── RocketMinipoolManagerInterface.sol
│ │ │ ├── RocketMinipoolPenaltyInterface.sol
│ │ │ └── RocketMinipoolQueueInterface.sol
│ │ ├── network/
│ │ │ ├── RocketNetworkBalancesInterface.sol
│ │ │ ├── RocketNetworkFeesInterface.sol
│ │ │ ├── RocketNetworkPenaltiesInterface.sol
│ │ │ ├── RocketNetworkPricesInterface.sol
│ │ │ ├── RocketNetworkRevenuesInterface.sol
│ │ │ ├── RocketNetworkSnapshotsInterface.sol
│ │ │ ├── RocketNetworkSnapshotsTimeInterface.sol
│ │ │ └── RocketNetworkVotingInterface.sol
│ │ ├── node/
│ │ │ ├── RocketNodeDepositInterface.sol
│ │ │ ├── RocketNodeDistributorFactoryInterface.sol
│ │ │ ├── RocketNodeDistributorInterface.sol
│ │ │ ├── RocketNodeManagerInterface.sol
│ │ │ └── RocketNodeStakingInterface.sol
│ │ ├── rewards/
│ │ │ ├── RocketMerkleDistributorMainnetInterface.sol
│ │ │ ├── RocketRewardsPoolInterface.sol
│ │ │ ├── RocketRewardsRelayInterface.sol
│ │ │ ├── RocketSmoothingPoolInterface.sol
│ │ │ └── claims/
│ │ │ ├── RocketClaimDAOInterface.sol
│ │ │ ├── RocketClaimNodeInterface.sol
│ │ │ └── RocketClaimTrustedNodeInterface.sol
│ │ ├── token/
│ │ │ ├── RocketTokenRETHInterface.sol
│ │ │ └── RocketTokenRPLInterface.sol
│ │ └── util/
│ │ ├── AddressQueueStorageInterface.sol
│ │ ├── AddressSetStorageInterface.sol
│ │ ├── BeaconStateVerifierInterface.sol
│ │ ├── IERC20.sol
│ │ ├── IERC20Burnable.sol
│ │ └── LinkedListStorageInterface.sol
│ ├── thirdparty/
│ │ ├── EthBalanceChecker/
│ │ │ └── EthBalanceChecker.sol
│ │ ├── Multicall2/
│ │ │ └── Multicall2.sol
│ │ ├── RocketSignerRegistry/
│ │ │ ├── RocketSignerRegistry.sol
│ │ │ └── interface/
│ │ │ └── RocketSignerRegistryInterface.sol
│ │ └── UniswapOracleMock/
│ │ └── UniswapOracleMock.sol
│ └── types/
│ ├── MinipoolDeposit.sol
│ ├── MinipoolDetails.sol
│ ├── MinipoolStatus.sol
│ ├── NodeDetails.sol
│ ├── RewardSubmission.sol
│ └── SettingType.sol
├── hardhat-common.config.js
├── hardhat-deploy.config.js
├── hardhat.config.js
├── package.json
├── remapping.json
├── scripts/
│ ├── console.js
│ ├── deploy-upgrade.v1.4.js
│ ├── deploy.js
│ ├── etherscan-verify.js
│ ├── preamble.sol
│ └── upgrade-test.sh
└── test/
├── _helpers/
│ ├── auction.js
│ ├── beaconchain.js
│ ├── bigmath.js
│ ├── bn.js
│ ├── console.js
│ ├── dao.js
│ ├── defaults.js
│ ├── deployer.js
│ ├── deployment.js
│ ├── deposit.js
│ ├── invariants.js
│ ├── megapool.js
│ ├── minipool.js
│ ├── network.js
│ ├── node.js
│ ├── settings.js
│ ├── tokens.js
│ └── verify.js
├── _utils/
│ ├── artifacts.js
│ ├── beacon.js
│ ├── contract.js
│ ├── evm.js
│ ├── formatting.js
│ ├── merkle-tree.js
│ ├── snapshotting.js
│ ├── testing.js
│ └── upgrade.js
├── auction/
│ ├── auction-tests.js
│ ├── scenario-claim-bid.js
│ ├── scenario-create-lot.js
│ ├── scenario-place-bid.js
│ └── scenario-recover-rpl.js
├── dao/
│ ├── dao-node-trusted-tests.js
│ ├── dao-protocol-tests.js
│ ├── dao-protocol-treasury-tests.js
│ ├── dao-security-tests.js
│ ├── scenario-dao-node-trusted-bootstrap.js
│ ├── scenario-dao-node-trusted.js
│ ├── scenario-dao-proposal.js
│ ├── scenario-dao-protocol-bootstrap.js
│ ├── scenario-dao-protocol-treasury.js
│ ├── scenario-dao-protocol.js
│ ├── scenario-dao-security-upgrade.js
│ └── scenario-dao-security.js
├── deposit/
│ ├── deposit-pool-tests.js
│ ├── scenario-assign-deposits.js
│ └── scenario-deposit.js
├── megapool/
│ ├── megapool-tests.js
│ ├── scenario-apply-penalty.js
│ ├── scenario-challenge.js
│ ├── scenario-dissolve.js
│ ├── scenario-distribute.js
│ ├── scenario-exit-queue.js
│ ├── scenario-exit.js
│ ├── scenario-reduce-bond.js
│ ├── scenario-repay-debt.js
│ ├── scenario-stake.js
│ └── scenario-withdraw-credit.js
├── minipool/
│ ├── minipool-scrub-tests.js
│ ├── minipool-status-tests.js
│ ├── minipool-tests.js
│ ├── minipool-vacant-tests.js
│ ├── minipool-withdrawal-tests.js
│ ├── scenario-close.js
│ ├── scenario-dissolve.js
│ ├── scenario-reduce-bond.js
│ ├── scenario-refund.js
│ ├── scenario-scrub.js
│ ├── scenario-skim-rewards.js
│ ├── scenario-stake.js
│ └── scenario-withdraw-validator-balance.js
├── network/
│ ├── network-balances-tests.js
│ ├── network-fees-tests.js
│ ├── network-prices-tests.js
│ ├── network-revenues-tests.js
│ ├── network-snapshots-tests.js
│ ├── network-voting-tests.js
│ ├── scenario-submit-balances.js
│ ├── scenario-submit-penalties.js
│ └── scenario-submit-prices.js
├── node/
│ ├── node-distributor-tests.js
│ ├── node-manager-tests.js
│ ├── node-staking-tests.js
│ ├── scenario-deposit-v2.js
│ ├── scenario-distribute-rewards.js
│ ├── scenario-register-smoothing-pool.js
│ ├── scenario-register.js
│ ├── scenario-set-timezone.js
│ ├── scenario-set-withdrawal-address.js
│ ├── scenario-stake-rpl.js
│ ├── scenario-unstake-legacy-rpl.js
│ ├── scenario-unstake-rpl.js
│ └── scenario-withdraw-rpl.js
├── rewards/
│ ├── rewards-tests.js
│ ├── scenario-claim-and-stake-rewards.js
│ ├── scenario-claim-rewards.js
│ ├── scenario-rewards-claim.js
│ └── scenario-submit-rewards.js
├── rocket-pool-tests.js
├── token/
│ ├── reth-tests.js
│ ├── rpl-tests.js
│ ├── scenario-reth-burn.js
│ ├── scenario-reth-transfer.js
│ ├── scenario-rpl-allow-fixed.js
│ ├── scenario-rpl-burn-fixed.js
│ ├── scenario-rpl-inflation.js
│ └── scenario-rpl-mint-fixed.js
└── util/
├── util-tests.js
└── verifier-tests.js
SYMBOL INDEX (374 symbols across 95 files)
FILE: scripts/console.js
function compressABI (line 26) | function compressABI(abi) {
function decompressABI (line 30) | function decompressABI(abi) {
function loadABI (line 34) | function loadABI(abiFilePath) {
function findInQueue (line 45) | async function findInQueue(megapoolAddress, validatorId, queueKey, index...
function calculatePositionInQueue (line 72) | async function calculatePositionInQueue(megapool, validatorId) {
function bootstrapUpgrade (line 108) | async function bootstrapUpgrade(type, name, abi, target, { from }) {
function go (line 114) | async function go() {
function old (line 126) | function old() {
function stuff (line 166) | async function stuff() {
FILE: scripts/deploy-upgrade.v1.4.js
function compressABI (line 9) | function compressABI(abi) {
function formatConstructorArgs (line 13) | function formatConstructorArgs(args) {
constant CHAINS (line 24) | const CHAINS = {
function deployUpgrade (line 104) | async function deployUpgrade(rocketStorageAddress) {
function deploy (line 288) | async function deploy() {
function bootstrap (line 348) | async function bootstrap() {
function execute (line 359) | async function execute() {
function verify (line 369) | async function verify() {
function go (line 399) | async function go() {
FILE: scripts/deploy.js
function deploy (line 91) | async function deploy() {
FILE: scripts/etherscan-verify.js
function verify (line 9) | async function verify() {
FILE: test/_helpers/auction.js
function getLotStartBlock (line 4) | async function getLotStartBlock(lotIndex) {
function getLotEndBlock (line 9) | async function getLotEndBlock(lotIndex) {
function getLotPriceAtBlock (line 15) | async function getLotPriceAtBlock(lotIndex, block) {
function auctionCreateLot (line 21) | async function auctionCreateLot(txOptions) {
function auctionPlaceBid (line 27) | async function auctionPlaceBid(lotIndex, txOptions) {
FILE: test/_helpers/beaconchain.js
function getSlotForBlock (line 8) | async function getSlotForBlock(blockNumber = null) {
function getCurrentEpoch (line 15) | async function getCurrentEpoch() {
FILE: test/_helpers/bigmath.js
function BigMin (line 1) | function BigMin(...args) {
function BigSqrt (line 13) | function BigSqrt(value) {
FILE: test/_helpers/bn.js
function injectBNHelpers (line 37) | function injectBNHelpers() {
FILE: test/_helpers/console.js
function suppressLog (line 2) | async function suppressLog(func) {
FILE: test/_helpers/dao.js
function mintRPLBond (line 11) | async function mintRPLBond(owner, node) {
function bootstrapMember (line 29) | async function bootstrapMember(address, id, url, txOptions) {
function memberJoin (line 34) | async function memberJoin(txOptions) {
function getDaoProtocolChallenge (line 39) | async function getDaoProtocolChallenge(proposalID, challengeID) {
function getDaoProtocolVotePhase1Time (line 45) | async function getDaoProtocolVotePhase1Time() {
function getDaoProtocolVotePhase2Time (line 51) | async function getDaoProtocolVotePhase2Time() {
function getDaoProtocolVoteDelayTime (line 57) | async function getDaoProtocolVoteDelayTime() {
function getDaoProtocolSecurityLeaveTime (line 63) | async function getDaoProtocolSecurityLeaveTime() {
function getDaoProtocolDepthPerRound (line 69) | async function getDaoProtocolDepthPerRound() {
function getDaoProtocolChallengeBond (line 75) | async function getDaoProtocolChallengeBond() {
function getDaoProtocolProposalBond (line 81) | async function getDaoProtocolProposalBond() {
function getDaoProtocolChallengePeriod (line 87) | async function getDaoProtocolChallengePeriod() {
FILE: test/_helpers/defaults.js
function setDefaultParameters (line 11) | async function setDefaultParameters() {
FILE: test/_helpers/deployer.js
function compressABI (line 11) | function compressABI(abi) {
function loadABI (line 15) | function loadABI(abiFilePath) {
function formatConstructorArgs (line 19) | function formatConstructorArgs(args) {
class RocketPoolDeployer (line 119) | class RocketPoolDeployer {
method constructor (line 133) | constructor(signer, opts = {}) {
method log (line 239) | log(string = '\n', color = 'gray') {
method addStage (line 252) | addStage(name, priority, steps) {
method defaultConstructorArgs (line 260) | defaultConstructorArgs() {
method getMinipoolAbi (line 264) | getMinipoolAbi() {
method getMegapoolAbi (line 277) | getMegapoolAbi() {
method setDeploymentStatus (line 290) | async setDeploymentStatus() {
method setString (line 297) | async setString(name, value) {
method setUint (line 306) | async setUint(name, value) {
method deployDepositContract (line 315) | async deployDepositContract() {
method setNetworkContractAddress (line 328) | async setNetworkContractAddress(name, address) {
method setNetworkContractAbi (line 351) | async setNetworkContractAbi(name, abi) {
method deployRemainingContracts (line 366) | async deployRemainingContracts() {
method deployNetworkContract (line 383) | async deployNetworkContract(name) {
method bootstrapProtocolDAOSetting (line 434) | async bootstrapProtocolDAOSetting(contractName, settingPath, value) {
method bootstrapProtocolDAOClaimers (line 454) | async bootstrapProtocolDAOClaimers(trustedNodePerc, protocolPerc, node...
method deploy (line 461) | async deploy() {
method deployThirdPartyContract (line 495) | async deployThirdPartyContract(artifactName, constructorArgs = []) {
method deployThirdPartyContracts (line 506) | async deployThirdPartyContracts() {
FILE: test/_helpers/deployment.js
function deployRocketPool (line 10) | async function deployRocketPool() {
FILE: test/_helpers/deposit.js
function getDepositExcessBalance (line 4) | async function getDepositExcessBalance() {
function userDeposit (line 10) | async function userDeposit(txOptions) {
function assignDeposits (line 16) | async function assignDeposits(txOptions) {
FILE: test/_helpers/invariants.js
function checkInvariants (line 7) | async function checkInvariants() {
function checkMegapoolInvariants (line 18) | async function checkMegapoolInvariants() {
function getNodeAddresses (line 50) | async function getNodeAddresses() {
function getMinipoolDetails (line 55) | async function getMinipoolDetails(address) {
function getMinipoolsByNode (line 75) | async function getMinipoolsByNode(nodeAddress) {
function checkNodeInvariants (line 86) | async function checkNodeInvariants(nodeAddress, minipools) {
function weightedAverage (line 121) | function weightedAverage(nums, weights) {
FILE: test/_helpers/megapool.js
function getValidatorInfo (line 22) | async function getValidatorInfo(megapool, index) {
function deployMegapool (line 47) | async function deployMegapool(txOptions) {
function nodeDeposit (line 59) | async function nodeDeposit(node, bondAmount = '4'.ether, useExpressTicke...
function nodeDepositMulti (line 302) | async function nodeDepositMulti(node, deposits, creditAmount = 0n, value...
function getMegapoolWithdrawalCredentials (line 495) | async function getMegapoolWithdrawalCredentials(nodeAddress) {
function getMegapoolForNode (line 501) | async function getMegapoolForNode(node) {
function getMegapoolForNodeAddress (line 513) | async function getMegapoolForNodeAddress(nodeAddress) {
function findInQueue (line 530) | async function findInQueue(megapoolAddress, validatorId, queueKey, index...
function calculatePositionInQueue (line 557) | async function calculatePositionInQueue(megapool, validatorId) {
FILE: test/_helpers/minipool.js
function getNodeMinipoolCount (line 25) | async function getNodeMinipoolCount(nodeAddress) {
function getNodeStakingMinipoolCount (line 31) | async function getNodeStakingMinipoolCount(nodeAddress) {
function getNodeActiveMinipoolCount (line 37) | async function getNodeActiveMinipoolCount(nodeAddress) {
function getMinipoolMinimumRPLStake (line 43) | async function getMinipoolMinimumRPLStake() {
function getMinipoolMaximumRPLStake (line 68) | async function getMinipoolMaximumRPLStake() {
function createMinipool (line 96) | async function createMinipool(txOptions, salt = null) {
function createMinipoolWithBondAmount (line 100) | async function createMinipoolWithBondAmount(bondAmount, txOptions, salt ...
function createVacantMinipool (line 151) | async function createVacantMinipool(bondAmount, txOptions, salt = null, ...
function refundMinipoolNodeETH (line 184) | async function refundMinipoolNodeETH(minipool, txOptions) {
function stakeMinipool (line 189) | async function stakeMinipool(minipool, txOptions) {
function promoteMinipool (line 229) | async function promoteMinipool(minipool, txOptions) {
function dissolveMinipool (line 239) | async function dissolveMinipool(minipool, txOptions) {
function closeMinipool (line 244) | async function closeMinipool(minipool, txOptions) {
FILE: test/_helpers/network.js
function getTotalETHBalance (line 9) | async function getTotalETHBalance() {
function getStakingETHBalance (line 15) | async function getStakingETHBalance() {
function getETHUtilizationRate (line 21) | async function getETHUtilizationRate() {
function submitBalances (line 27) | async function submitBalances(block, slotTimestamp, totalEth, stakingEth...
function submitPrices (line 33) | async function submitPrices(block, slotTimestamp, rplPrice, txOptions) {
function getRPLPrice (line 39) | async function getRPLPrice() {
function getNodeDemand (line 45) | async function getNodeDemand() {
function getNodeFee (line 51) | async function getNodeFee() {
function getNodeFeeByDemand (line 57) | async function getNodeFeeByDemand(nodeDemand) {
function setDelegate (line 62) | async function setDelegate(nodeAddress, txOptions) {
FILE: test/_helpers/node.js
function getNodeStakedRPL (line 23) | async function getNodeStakedRPL(nodeAddress) {
function getNodeEffectiveRPLStake (line 29) | async function getNodeEffectiveRPLStake(nodeAddress) {
function getNodeMinimumRPLStake (line 35) | async function getNodeMinimumRPLStake(nodeAddress) {
function registerNode (line 41) | async function registerNode(txOptions) {
function getNodeCount (line 47) | async function getNodeCount() {
function setNodeTrusted (line 53) | async function setNodeTrusted(_account, _id, _url, owner) {
function setNodeWithdrawalAddress (line 100) | async function setNodeWithdrawalAddress(nodeAddress, withdrawalAddress, ...
function setNodeRPLWithdrawalAddress (line 106) | async function setNodeRPLWithdrawalAddress(nodeAddress, rplWithdrawalAdd...
function nodeStakeRPL (line 112) | async function nodeStakeRPL(amount, txOptions) {
function nodeSetDelegate (line 125) | async function nodeSetDelegate(to, txOptions) {
function nodeStakeRPLFor (line 133) | async function nodeStakeRPLFor(nodeAddress, amount, txOptions) {
function nodeDepositEthFor (line 146) | async function nodeDepositEthFor(nodeAddress, txOptions) {
function setStakeRPLForAllowed (line 157) | async function setStakeRPLForAllowed(caller, state, txOptions) {
function setStakeRPLForAllowedWithNodeAddress (line 165) | async function setStakeRPLForAllowedWithNodeAddress(nodeAddress, caller,...
function nodeWithdrawRPL (line 171) | async function nodeWithdrawRPL(amount, txOptions) {
function setRPLLockingAllowed (line 177) | async function setRPLLockingAllowed(node, state, txOptions) {
function nodeDeposit (line 185) | async function nodeDeposit(txOptions) {
function getNodeDepositCredit (line 216) | async function getNodeDepositCredit(nodeAddress) {
function getNodeAverageFee (line 222) | async function getNodeAverageFee(nodeAddress) {
FILE: test/_helpers/settings.js
function getAuctionSetting (line 10) | async function getAuctionSetting(setting) {
function getDepositSetting (line 16) | async function getDepositSetting(setting) {
function getMinipoolSetting (line 22) | async function getMinipoolSetting(setting) {
function getNetworkSetting (line 28) | async function getNetworkSetting(setting) {
function getNodeSetting (line 34) | async function getNodeSetting(setting) {
FILE: test/_helpers/tokens.js
function getRplBalance (line 4) | async function getRplBalance(address) {
function getRethBalance (line 10) | async function getRethBalance(address) {
function getRethExchangeRate (line 16) | async function getRethExchangeRate() {
function getRethCollateralRate (line 22) | async function getRethCollateralRate() {
function getRethTotalSupply (line 28) | async function getRethTotalSupply() {
function mintRPL (line 34) | async function mintRPL(owner, to, amount) {
function approveRPL (line 50) | async function approveRPL(spender, amount, txOptions) {
function depositExcessCollateral (line 55) | async function depositExcessCollateral(txOptions) {
FILE: test/_helpers/verify.js
function treeShake (line 6) | function treeShake(sources, file) {
class EtherscanVerifier (line 53) | class EtherscanVerifier {
method constructor (line 54) | constructor(buildInfos, opts = {}) {
method log (line 59) | log(string = '\n', color = 'gray') {
method verifyAll (line 72) | async verifyAll(contracts) {
method verify (line 86) | async verify(buildInfoId, sourceName, contractName, address, construct...
method getStandardJsonInput (line 121) | getStandardJsonInput(buildInfoId, contractName, sourceName) {
method applyPreamble (line 138) | applyPreamble(sources) {
method getVerificationStatus (line 155) | async getVerificationStatus(guid) {
method isVerified (line 160) | async isVerified(address) {
method submitVerification (line 165) | async submitVerification(inputJSON, contractName, address, compilerVer...
FILE: test/_utils/artifacts.js
class Artifact (line 6) | class Artifact {
method constructor (line 7) | constructor(name) {
method deployed (line 16) | async deployed() {
method setAsDeployed (line 20) | setAsDeployed(instance) {
method newImmediate (line 24) | async newImmediate(...args) {
method new (line 29) | async new(...args) {
method clone (line 35) | async clone(...args) {
method at (line 41) | at(address) {
method fromDeployment (line 45) | async fromDeployment(rocketStorage, contractName = null) {
class Artifacts (line 66) | class Artifacts {
method constructor (line 67) | constructor() {
method require (line 71) | require(name) {
method loadFromDeployment (line 78) | async loadFromDeployment(rocketStorageAddress) {
FILE: test/_utils/beacon.js
function getValidatorPubkey (line 10) | function getValidatorPubkey() {
function getValidatorSignature (line 18) | function getValidatorSignature() {
function getDepositDataRoot (line 28) | function getDepositDataRoot(depositData) {
FILE: test/_utils/contract.js
function getTxContractEvents (line 10) | function getTxContractEvents(txReceipt, contractAddress, eventName, even...
function compressABI (line 23) | function compressABI(abi) {
function decompressABI (line 26) | function decompressABI(abi) {
FILE: test/_utils/evm.js
function takeSnapshot (line 2) | function takeSnapshot(web3) {
function revertSnapshot (line 18) | function revertSnapshot(web3, snapshotId) {
function mineBlocks (line 34) | async function mineBlocks(web3, numBlocks) {
function increaseTime (line 50) | async function increaseTime(web3, seconds) {
function getCurrentTime (line 67) | async function getCurrentTime(web3) {
FILE: test/_utils/formatting.js
function printTitle (line 2) | function printTitle(user, desc) {
FILE: test/_utils/merkle-tree.js
function bufferToHex (line 8) | function bufferToHex(buffer) {
function keccak256 (line 12) | function keccak256(data) {
class MerkleTree (line 16) | class MerkleTree {
method constructor (line 17) | constructor(elements) {
method getLayers (line 38) | getLayers(elements) {
method getNextLayer (line 54) | getNextLayer(elements) {
method combinedHash (line 65) | static combinedHash(first, second) {
method getRoot (line 69) | getRoot() {
method getHexRoot (line 73) | getHexRoot() {
method getProof (line 77) | getProof(el) {
method getHexProof (line 102) | getHexProof(el) {
method getPairElement (line 108) | static getPairElement(idx, layer) {
method bufDedup (line 118) | static bufDedup(elements) {
method bufArrToHexArr (line 124) | static bufArrToHexArr(arr) {
method sortAndConcat (line 132) | static sortAndConcat(...args) {
class RewardClaimTree (line 137) | class RewardClaimTree {
method constructor (line 138) | constructor(balances) {
method verifyProof (line 146) | static verifyProof(address, network, amountRPL, amountSmoothingPoolETH...
method toNode (line 156) | static toNode(nodeAddress, network, amountRPL, amountSmoothingPoolETH,...
method getHexRoot (line 164) | getHexRoot() {
method getProof (line 169) | getProof(address, network, amountRPL, amountSmoothingPoolETH, amountVo...
function parseRewardsMap (line 175) | function parseRewardsMap(rewards) {
FILE: test/_utils/snapshotting.js
function startSnapShot (line 7) | async function startSnapShot() {
function endSnapShot (line 11) | async function endSnapShot() {
function globalSnapShot (line 15) | async function globalSnapShot() {
FILE: test/_utils/testing.js
function shouldRevert (line 4) | async function shouldRevert(txPromise, message, expectedErrorMessage = n...
function asyncDescribe (line 22) | async function asyncDescribe(desc, run) {
FILE: test/auction/scenario-claim-bid.js
function claimBid (line 5) | async function claimBid(lotIndex, txOptions) {
FILE: test/auction/scenario-create-lot.js
function createLot (line 6) | async function createLot(txOptions) {
FILE: test/auction/scenario-place-bid.js
function placeBid (line 8) | async function placeBid(lotIndex, txOptions) {
FILE: test/auction/scenario-recover-rpl.js
function recoverUnclaimedRPL (line 6) | async function recoverUnclaimedRPL(lotIndex, txOptions) {
FILE: test/dao/dao-protocol-tests.js
function burnAmount (line 127) | function burnAmount(bond) {
function bondAfterBurn (line 131) | function bondAfterBurn(bond) {
function createNode (line 311) | async function createNode(validatorCount, node) {
function createValidProposal (line 329) | async function createValidProposal(name = 'Test proposal', payload = '0x...
function mockNodeSet (line 349) | async function mockNodeSet() {
function voteAll (line 362) | async function voteAll(proposalId, leaves, direction) {
function getRoundCount (line 384) | function getRoundCount(leafCount) {
function getMaxDepth (line 396) | function getMaxDepth(leafCount) {
function getChallengeIndices (line 400) | function getChallengeIndices(finalIndex, leafCount) {
FILE: test/dao/dao-protocol-treasury-tests.js
function fundTreasury (line 30) | async function fundTreasury(amount) {
FILE: test/dao/scenario-dao-node-trusted-bootstrap.js
function setDaoNodeTrustedBootstrapMember (line 17) | async function setDaoNodeTrustedBootstrapMember(_id, _url, _nodeAddress,...
function setDAONodeTrustedBootstrapSetting (line 42) | async function setDAONodeTrustedBootstrapSetting(_settingContractInstanc...
function setDaoNodeTrustedBootstrapModeDisabled (line 84) | async function setDaoNodeTrustedBootstrapModeDisabled(txOptions) {
function setDaoNodeTrustedBootstrapUpgrade (line 109) | async function setDaoNodeTrustedBootstrapUpgrade(_type, _name, _abi, _co...
function setDaoNodeTrustedMemberRequired (line 181) | async function setDaoNodeTrustedMemberRequired(_id, _url, txOptions) {
FILE: test/dao/scenario-dao-node-trusted.js
function getDAOMemberIsValid (line 14) | async function getDAOMemberIsValid(_nodeAddress, txOptions) {
function getDAONodeMemberCount (line 21) | async function getDAONodeMemberCount(txOptions) {
function getDAONodeProposalQuorumVotesRequired (line 28) | async function getDAONodeProposalQuorumVotesRequired(proposalID, txOptio...
function daoNodeTrustedPropose (line 35) | async function daoNodeTrustedPropose(_proposalMessage, _payload, txOptio...
function daoNodeTrustedVote (line 72) | async function daoNodeTrustedVote(_proposalID, _vote, txOptions) {
function daoNodeTrustedCancel (line 106) | async function daoNodeTrustedCancel(_proposalID, txOptions) {
function daoNodeTrustedExecute (line 121) | async function daoNodeTrustedExecute(_proposalID, txOptions) {
function daoNodeTrustedMemberJoin (line 147) | async function daoNodeTrustedMemberJoin(txOptions) {
function daoNodeTrustedMemberLeave (line 181) | async function daoNodeTrustedMemberLeave(_rplRefundAddress, txOptions) {
function daoNodeTrustedMemberChallengeMake (line 215) | async function daoNodeTrustedMemberChallengeMake(_nodeAddress, txOptions) {
function daoNodeTrustedMemberChallengeDecide (line 247) | async function daoNodeTrustedMemberChallengeDecide(_nodeAddress, _expect...
FILE: test/dao/scenario-dao-proposal.js
function getDAOProposalState (line 24) | async function getDAOProposalState(proposalID, txOptions) {
function getDAOProposalStartTime (line 31) | async function getDAOProposalStartTime(proposalID, txOptions) {
function getDAOProposalEndTime (line 38) | async function getDAOProposalEndTime(proposalID, txOptions) {
function getDAOProposalExpires (line 45) | async function getDAOProposalExpires(proposalID, txOptions) {
function getDAOProposalVotesFor (line 52) | async function getDAOProposalVotesFor(proposalID, txOptions) {
function getDAOProposalVotesAgainst (line 59) | async function getDAOProposalVotesAgainst(proposalID, txOptions) {
function getDAOProposalVotesRequired (line 66) | async function getDAOProposalVotesRequired(proposalID, txOptions) {
FILE: test/dao/scenario-dao-protocol-bootstrap.js
function setDAOProtocolBootstrapSetting (line 16) | async function setDAOProtocolBootstrapSetting(_settingContractInstance, ...
function setDAONetworkBootstrapRewardsClaimers (line 69) | async function setDAONetworkBootstrapRewardsClaimers(_trustedNodePerc, _...
function setDAOProtocolBootstrapSettingAddressList (line 95) | async function setDAOProtocolBootstrapSettingAddressList(_settingContrac...
function setRewardsClaimIntervalTime (line 120) | async function setRewardsClaimIntervalTime(intervalTime, txOptions) {
function spendRewardsClaimTreasury (line 126) | async function spendRewardsClaimTreasury(_invoiceID, _recipientAddress, ...
function bootstrapTreasuryNewContract (line 161) | async function bootstrapTreasuryNewContract(_contractName, _recipientAdd...
function bootstrapTreasuryUpdateContract (line 179) | async function bootstrapTreasuryUpdateContract(_contractName, _recipient...
function setRPLInflationIntervalRate (line 198) | async function setRPLInflationIntervalRate(yearlyInflationPerc, txOption...
function setRPLInflationStartTime (line 206) | async function setRPLInflationStartTime(startTime, txOptions) {
function setDaoProtocolBootstrapModeDisabled (line 212) | async function setDaoProtocolBootstrapModeDisabled(txOptions) {
function setDAOProtocolBootstrapSettingMulti (line 240) | async function setDAOProtocolBootstrapSettingMulti(_settingContractInsta...
function setDAOProtocolBootstrapEnableGovernance (line 312) | async function setDAOProtocolBootstrapEnableGovernance(txOptions) {
function setDAOProtocolBootstrapSecurityInvite (line 322) | async function setDAOProtocolBootstrapSecurityInvite(_id, _memberAddress...
function setDAOProtocolBootstrapSecurityKick (line 330) | async function setDAOProtocolBootstrapSecurityKick(_id, _memberAddress, ...
FILE: test/dao/scenario-dao-protocol-treasury.js
function payOutContracts (line 6) | async function payOutContracts(_contractNames, txOptions) {
function withdrawBalance (line 61) | async function withdrawBalance(recipient, txOptions) {
FILE: test/dao/scenario-dao-protocol.js
function getDAOProposalState (line 34) | async function getDAOProposalState(proposalID) {
function getDAOProposalVotesRequired (line 41) | async function getDAOProposalVotesRequired(proposalID, txOptions) {
function getDelegatedVotingPower (line 50) | async function getDelegatedVotingPower(block) {
function getPhase2VotingPower (line 95) | async function getPhase2VotingPower(block, nodeIndex) {
function constructTreeLeaves (line 137) | function constructTreeLeaves(votingPower) {
function getDepthFromIndex (line 164) | function getDepthFromIndex(index) {
function cloneLeaves (line 168) | function cloneLeaves(leaves) {
function daoProtocolGenerateVoteProof (line 179) | function daoProtocolGenerateVoteProof(leaves, index) {
function daoProtocolGenerateChallengeProof (line 224) | function daoProtocolGenerateChallengeProof(leaves, order, index = 1) {
function daoProtocolGeneratePollard (line 302) | async function daoProtocolGeneratePollard(leaves, order, index = 1) {
function getSubIndex (line 348) | function getSubIndex(globalIndex, leaves) {
function daoProtocolPropose (line 365) | async function daoProtocolPropose(_proposalMessage, _payload, _block, _t...
function daoProtocolCreateChallenge (line 419) | async function daoProtocolCreateChallenge(_proposalID, _index, _node, _w...
function daoProtocolDefeatProposal (line 431) | async function daoProtocolDefeatProposal(_proposalID, _index, txOptions) {
function daoProtocolSubmitRoot (line 438) | async function daoProtocolSubmitRoot(_proposalID, _index, _treeNodes, tx...
function daoProtocolVote (line 452) | async function daoProtocolVote(_proposalID, _vote, _votingPower, _nodeIn...
function daoProtocolOverrideVote (line 526) | async function daoProtocolOverrideVote(_proposalID, _vote, txOptions) {
function daoProtocolCancel (line 636) | async function daoProtocolCancel(_proposalID, txOptions) {
function daoProtocolExecute (line 651) | async function daoProtocolExecute(_proposalID, txOptions) {
function daoProtocolFinalise (line 676) | async function daoProtocolFinalise(_proposalID, txOptions) {
function daoProtocolClaimBondProposer (line 715) | async function daoProtocolClaimBondProposer(_proposalID, _indices, txOpt...
function daoProtocolClaimBondChallenger (line 737) | async function daoProtocolClaimBondChallenger(_proposalID, _indices, txO...
function setDaoProtocolNodeShareSecurityCouncilAdder (line 759) | async function setDaoProtocolNodeShareSecurityCouncilAdder(_value, txOpt...
function setDaoProtocolNodeCommissionShare (line 768) | async function setDaoProtocolNodeCommissionShare(_value, txOptions) {
function setDaoProtocolVoterShare (line 777) | async function setDaoProtocolVoterShare(_value, txOptions) {
FILE: test/dao/scenario-dao-security-upgrade.js
function daoSecurityProposeVeto (line 12) | async function daoSecurityProposeVeto(_proposalMessage, _proposalId, txO...
function daoSecurityUpgradeVote (line 49) | async function daoSecurityUpgradeVote(_proposalID, _vote, txOptions) {
function daoSecurityUpgradeExecute (line 83) | async function daoSecurityUpgradeExecute(_proposalID, txOptions) {
FILE: test/dao/scenario-dao-security.js
function getDAOSecurityMemberIsValid (line 12) | async function getDAOSecurityMemberIsValid(_nodeAddress) {
function getDAOSecurityMemberCount (line 19) | async function getDAOSecurityMemberCount() {
function getDAOSecurityProposalQuorumVotesRequired (line 26) | async function getDAOSecurityProposalQuorumVotesRequired(proposalID) {
function daoSecurityPropose (line 33) | async function daoSecurityPropose(_proposalMessage, _payload, txOptions) {
function daoSecurityVote (line 70) | async function daoSecurityVote(_proposalID, _vote, txOptions) {
function daoSecurityExecute (line 104) | async function daoSecurityExecute(_proposalID, txOptions) {
function daoSecurityMemberJoin (line 130) | async function daoSecurityMemberJoin(txOptions) {
function daoSecurityMemberLeave (line 159) | async function daoSecurityMemberLeave(txOptions) {
function daoSecurityMemberRequestLeave (line 188) | async function daoSecurityMemberRequestLeave(txOptions) {
FILE: test/deposit/scenario-assign-deposits.js
function assignDeposits (line 5) | async function assignDeposits(max = 1n, txOptions) {
FILE: test/deposit/scenario-deposit.js
function deposit (line 13) | async function deposit(txOptions) {
FILE: test/megapool/megapool-tests.js
function getCurrentTime (line 56) | async function getCurrentTime() {
function getValidPrestakeValidator (line 61) | async function getValidPrestakeValidator(megapool, index) {
function mockExpressTickets (line 76) | async function mockExpressTickets(nodeAddress, count) {
function mockRewards (line 101) | async function mockRewards(megapool, amount = '1'.ether) {
function getSlotForBlock (line 108) | async function getSlotForBlock(blockNumber = null) {
function getCurrentEpoch (line 115) | async function getCurrentEpoch() {
function waitEpochs (line 120) | async function waitEpochs(count) {
function exitValidator (line 125) | async function exitValidator(megapool, index, finalBalance) {
function getData (line 2221) | async function getData() {
FILE: test/megapool/scenario-apply-penalty.js
function votePenalty (line 8) | async function votePenalty(megapool, slot, amount, trustedNode) {
FILE: test/megapool/scenario-challenge.js
function challengeValidator (line 6) | async function challengeValidator(megapool, validatorIds, challenger) {
FILE: test/megapool/scenario-dissolve.js
function dissolveValidator (line 16) | async function dissolveValidator(node, validatorIndex, from = node, proo...
FILE: test/megapool/scenario-distribute.js
function distributeMegapool (line 15) | async function distributeMegapool(megapool) {
FILE: test/megapool/scenario-exit-queue.js
function exitQueue (line 10) | async function exitQueue(nodeAddress, validatorIndex) {
FILE: test/megapool/scenario-exit.js
function notifyExitValidator (line 19) | async function notifyExitValidator(megapool, validatorId, withdrawalEpoc...
function notifyFinalBalanceValidator (line 79) | async function notifyFinalBalanceValidator(megapool, validatorId, finalB...
FILE: test/megapool/scenario-reduce-bond.js
function reduceBond (line 6) | async function reduceBond(megapool, amount) {
FILE: test/megapool/scenario-repay-debt.js
function repayDebt (line 7) | async function repayDebt(megapool, amount) {
FILE: test/megapool/scenario-stake.js
function stakeMegapoolValidator (line 18) | async function stakeMegapoolValidator(megapool, index) {
FILE: test/megapool/scenario-withdraw-credit.js
function withdrawCredit (line 10) | async function withdrawCredit(node, amount, from = node) {
FILE: test/minipool/minipool-status-tests.js
function trustedNode4JoinDao (line 113) | async function trustedNode4JoinDao() {
function trustedNode4LeaveDao (line 118) | async function trustedNode4LeaveDao() {
FILE: test/minipool/minipool-tests.js
function upgradeNetworkDelegateContract (line 170) | async function upgradeNetworkDelegateContract() {
function resetNetworkDelegateContract (line 182) | async function resetNetworkDelegateContract() {
function setNetworkNodeFee (line 918) | async function setNetworkNodeFee(fee) {
FILE: test/minipool/minipool-withdrawal-tests.js
function withdrawAndCheck (line 121) | async function withdrawAndCheck(minipool, withdrawalBalance, from, final...
function slashAndCheck (line 150) | async function slashAndCheck(from, expectedSlash) {
FILE: test/minipool/scenario-close.js
function close (line 8) | async function close(minipool, txOptions) {
FILE: test/minipool/scenario-dissolve.js
function dissolve (line 5) | async function dissolve(minipool, txOptions) {
FILE: test/minipool/scenario-reduce-bond.js
function reduceBond (line 10) | async function reduceBond(minipool, txOptions = null) {
FILE: test/minipool/scenario-refund.js
function refund (line 8) | async function refund(minipool, txOptions) {
FILE: test/minipool/scenario-scrub.js
function voteScrub (line 14) | async function voteScrub(minipool, txOptions) {
FILE: test/minipool/scenario-skim-rewards.js
function skimRewards (line 7) | async function skimRewards(minipool, txOptions) {
FILE: test/minipool/scenario-stake.js
function stake (line 11) | async function stake(minipool, withdrawalCredentials, txOptions, validat...
FILE: test/minipool/scenario-withdraw-validator-balance.js
function withdrawValidatorBalance (line 12) | async function withdrawValidatorBalance(minipool, withdrawalBalance, fro...
function beginUserDistribute (line 164) | async function beginUserDistribute(minipool, txOptions) {
FILE: test/network/network-balances-tests.js
function submitAll (line 75) | async function submitAll(block, slotTimestamp, totalBalance, stakingBala...
function trustedNode4JoinDao (line 81) | async function trustedNode4JoinDao() {
function trustedNode4LeaveDao (line 86) | async function trustedNode4LeaveDao() {
FILE: test/network/network-prices-tests.js
function trustedNode4JoinDao (line 74) | async function trustedNode4JoinDao() {
function trustedNode4LeaveDao (line 79) | async function trustedNode4LeaveDao() {
FILE: test/network/scenario-submit-balances.js
function submitBalances (line 15) | async function submitBalances(block, slotTimestamp, totalEth, stakingEth...
function executeUpdateBalances (line 122) | async function executeUpdateBalances(block, slotTimestamp, totalEth, sta...
FILE: test/network/scenario-submit-penalties.js
function submitPenalty (line 16) | async function submitPenalty(minipoolAddress, block, txOptions) {
FILE: test/network/scenario-submit-prices.js
function submitPrices (line 9) | async function submitPrices(block, slotTimestamp, rplPrice, txOptions) {
function executeUpdatePrices (line 87) | async function executeUpdatePrices(block, slotTimestamp, rplPrice, txOpt...
FILE: test/node/node-staking-tests.js
function assertBalances (line 82) | async function assertBalances(node, legacy, megapool) {
function assertUnstakingBalance (line 91) | async function assertUnstakingBalance(node, amount) {
FILE: test/node/scenario-deposit-v2.js
function depositV2 (line 13) | async function depositV2(minimumNodeFee, bondAmount, txOptions) {
FILE: test/node/scenario-distribute-rewards.js
function distributeRewards (line 15) | async function distributeRewards(nodeAddress, txOptions) {
FILE: test/node/scenario-register-smoothing-pool.js
function setSmoothingPoolRegistrationState (line 5) | async function setSmoothingPoolRegistrationState(state, txOptions) {
FILE: test/node/scenario-register.js
function register (line 6) | async function register(timezoneLocation, txOptions) {
FILE: test/node/scenario-set-timezone.js
function setTimezoneLocation (line 5) | async function setTimezoneLocation(timezoneLocation, txOptions) {
FILE: test/node/scenario-set-withdrawal-address.js
function setWithdrawalAddress (line 5) | async function setWithdrawalAddress(nodeAddress, withdrawalAddress, conf...
function confirmWithdrawalAddress (line 28) | async function confirmWithdrawalAddress(nodeAddress, txOptions) {
FILE: test/node/scenario-stake-rpl.js
function stakeRpl (line 9) | async function stakeRpl(amount, txOptions) {
FILE: test/node/scenario-unstake-legacy-rpl.js
function unstakeLegacyRpl (line 13) | async function unstakeLegacyRpl(amount, txOptions) {
function unstakeLegacyRplFor (line 18) | async function unstakeLegacyRplFor(amount, nodeAddress, from) {
FILE: test/node/scenario-unstake-rpl.js
function unstakeRpl (line 12) | async function unstakeRpl(amount, txOptions) {
function unstakeRplFor (line 17) | async function unstakeRplFor(amount, nodeAddress, from) {
FILE: test/node/scenario-withdraw-rpl.js
function withdrawRpl (line 9) | async function withdrawRpl(txOptions) {
function withdrawRplFor (line 14) | async function withdrawRplFor(nodeAddress, from) {
FILE: test/rewards/rewards-tests.js
function kickTrustedNode (line 91) | async function kickTrustedNode(nodeAddress, voters) {
FILE: test/rewards/scenario-claim-and-stake-rewards.js
function claimAndStakeRewards (line 14) | async function claimAndStakeRewards(nodeAddress, indices, rewards, stake...
FILE: test/rewards/scenario-claim-rewards.js
function claimRewards (line 14) | async function claimRewards(nodeAddress, indices, rewards, txOptions) {
FILE: test/rewards/scenario-rewards-claim.js
function rewardsClaimIntervalTimeGet (line 5) | async function rewardsClaimIntervalTimeGet(txOptions) {
function rewardsClaimersPercTotalGet (line 13) | async function rewardsClaimersPercTotalGet(txOptions) {
function rewardsClaimIntervalsPassedGet (line 21) | async function rewardsClaimIntervalsPassedGet(txOptions) {
FILE: test/rewards/scenario-submit-rewards.js
function submitRewards (line 16) | async function submitRewards(index, rewards, treasuryRPL, userETH, treas...
function executeRewards (line 165) | async function executeRewards(index, rewards, treasuryRPL, userETH, txOp...
FILE: test/token/scenario-reth-burn.js
function burnReth (line 5) | async function burnReth(amount, txOptions) {
FILE: test/token/scenario-reth-transfer.js
function transferReth (line 5) | async function transferReth(to, amount, txOptions) {
FILE: test/token/scenario-rpl-allow-fixed.js
function allowDummyRPL (line 5) | async function allowDummyRPL(to, amount, txOptions) {
FILE: test/token/scenario-rpl-burn-fixed.js
function burnFixedRPL (line 5) | async function burnFixedRPL(amount, txOptions) {
FILE: test/token/scenario-rpl-inflation.js
function rplSetInflationConfig (line 8) | async function rplSetInflationConfig(config, txOptions) {
function rplClaimInflation (line 16) | async function rplClaimInflation(config, txOptions, tokenAmountToMatch =...
FILE: test/token/scenario-rpl-mint-fixed.js
function mintDummyRPL (line 5) | async function mintDummyRPL(to, amount, txOptions) {
Condensed preview — 308 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (2,126K chars).
[
{
"path": ".gitattributes",
"chars": 33,
"preview": "*.sol linguist-language=Solidity\n"
},
{
"path": ".github/workflows/CI.yml",
"chars": 349,
"preview": "name: CI\non: [push]\n\njobs:\n run-ci:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/setup-node@v3\n w"
},
{
"path": ".gitignore",
"chars": 96,
"preview": "node_modules/\r\n.vscode\r\n.idea/\r\ncache/\r\nartifacts/\r\n.env\r\ncoverage/\r\ncoverage.json\r\ndeployments/"
},
{
"path": ".mocharc.json",
"chars": 51,
"preview": "{\n \"require\": \"hardhat/register\",\n \"timeout\": 0\n}"
},
{
"path": "LICENSE",
"chars": 35147,
"preview": " GNU GENERAL PUBLIC LICENSE\n Version 3, 29 June 2007\n\n Copyright (C) 2007 Free "
},
{
"path": "README.md",
"chars": 2232,
"preview": "<picture>\n <img alt=\"Rocket Pool - Decentralised Ethereum Liquid Staking Protocol\" src=\"https://raw.githubusercontent.c"
},
{
"path": "contracts/.gitattributes",
"chars": 33,
"preview": "*.sol linguist-language=Solidity\n"
},
{
"path": "contracts/contract/RocketBase.sol",
"chars": 7943,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\nimport \"../interface/RocketStorageInterface.so"
},
{
"path": "contracts/contract/RocketStorage.sol",
"chars": 10422,
"preview": "pragma solidity 0.7.6;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\nimport \"../interface/RocketStorageInterface.sol\";\nimpo"
},
{
"path": "contracts/contract/RocketVault.sol",
"chars": 7594,
"preview": "pragma solidity 0.7.6;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\nimport \"./RocketBase.sol\";\nimport \"./util/SafeERC20.so"
},
{
"path": "contracts/contract/auction/RocketAuctionManager.sol",
"chars": 14887,
"preview": "pragma solidity 0.7.6;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\nimport \"@openzeppelin/contracts/math/SafeMath.sol\";\n\ni"
},
{
"path": "contracts/contract/casper/compiled/Deposit.abi",
"chars": 1084,
"preview": "[{\"name\": \"DepositEvent\", \"inputs\": [{\"type\": \"bytes\", \"name\": \"pubkey\", \"indexed\": false}, {\"type\": \"bytes\", \"name\": \"w"
},
{
"path": "contracts/contract/dao/RocketDAOProposal.sol",
"chars": 14074,
"preview": "pragma solidity 0.7.6;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\nimport \"../RocketBase.sol\";\nimport \"../../interface/da"
},
{
"path": "contracts/contract/dao/node/RocketDAONodeTrusted.sol",
"chars": 10384,
"preview": "pragma solidity 0.7.6;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\nimport \"../../RocketBase.sol\";\nimport \"../../../interf"
},
{
"path": "contracts/contract/dao/node/RocketDAONodeTrustedActions.sol",
"chars": 17316,
"preview": "pragma solidity 0.7.6;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\nimport \"../../RocketBase.sol\";\nimport \"../../../interf"
},
{
"path": "contracts/contract/dao/node/RocketDAONodeTrustedProposals.sol",
"chars": 11449,
"preview": "pragma solidity 0.7.6;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\nimport \"../../RocketBase.sol\";\nimport \"../../../interf"
},
{
"path": "contracts/contract/dao/node/RocketDAONodeTrustedUpgrade.sol",
"chars": 16201,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\nimport {RocketStorageInterface} from \"../../../interfa"
},
{
"path": "contracts/contract/dao/node/settings/RocketDAONodeTrustedSettings.sol",
"chars": 2712,
"preview": "pragma solidity 0.7.6;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\nimport \"../../../RocketBase.sol\";\nimport \"../../../../"
},
{
"path": "contracts/contract/dao/node/settings/RocketDAONodeTrustedSettingsMembers.sol",
"chars": 4352,
"preview": "pragma solidity 0.7.6;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\nimport \"./RocketDAONodeTrustedSettings.sol\";\nimport \"."
},
{
"path": "contracts/contract/dao/node/settings/RocketDAONodeTrustedSettingsMinipool.sol",
"chars": 4804,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.7.6;\n\nimport \"@openzeppelin/contracts/math/SafeMath.sol\";\n\nim"
},
{
"path": "contracts/contract/dao/node/settings/RocketDAONodeTrustedSettingsProposals.sol",
"chars": 2755,
"preview": "pragma solidity 0.7.6;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\nimport \"./RocketDAONodeTrustedSettings.sol\";\nimport \"."
},
{
"path": "contracts/contract/dao/node/settings/RocketDAONodeTrustedSettingsRewards.sol",
"chars": 2058,
"preview": "pragma solidity 0.7.6;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\nimport \"@openzeppelin/contracts/math/SafeMath.sol\";\n\ni"
},
{
"path": "contracts/contract/dao/protocol/RocketDAOProtocol.sol",
"chars": 10665,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\nimport {RocketStorageInterface} from \"../../../interfa"
},
{
"path": "contracts/contract/dao/protocol/RocketDAOProtocolActions.sol",
"chars": 897,
"preview": "pragma solidity 0.7.6;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\nimport \"../../RocketBase.sol\";\nimport \"../../../interf"
},
{
"path": "contracts/contract/dao/protocol/RocketDAOProtocolProposal.sol",
"chars": 28644,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\nimport \"../../RocketBase.sol\";\nimport \"../../../interf"
},
{
"path": "contracts/contract/dao/protocol/RocketDAOProtocolProposals.sol",
"chars": 13431,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\nimport \"../../RocketBase.sol\";\nimport \"../../../interf"
},
{
"path": "contracts/contract/dao/protocol/RocketDAOProtocolVerifier.sol",
"chars": 40397,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\nimport \"../../RocketBase.sol\";\nimport \"../../../interf"
},
{
"path": "contracts/contract/dao/protocol/settings/RocketDAOProtocolSettings.sol",
"chars": 4707,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >0.5.0 <0.9.0;\n\nimport {RocketStorageInterface} from \"../../../"
},
{
"path": "contracts/contract/dao/protocol/settings/RocketDAOProtocolSettingsAuction.sol",
"chars": 4330,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\nimport \"./RocketDAOProtocolSettings.sol\";\nimport \"../."
},
{
"path": "contracts/contract/dao/protocol/settings/RocketDAOProtocolSettingsDeposit.sol",
"chars": 4842,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\nimport {RocketStorageInterface} from \"../../../../inte"
},
{
"path": "contracts/contract/dao/protocol/settings/RocketDAOProtocolSettingsInflation.sol",
"chars": 4161,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\nimport \"./RocketDAOProtocolSettings.sol\";\nimport \"../."
},
{
"path": "contracts/contract/dao/protocol/settings/RocketDAOProtocolSettingsMegapool.sol",
"chars": 7281,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\nimport {RocketStorageInterface} from \"../../../../inte"
},
{
"path": "contracts/contract/dao/protocol/settings/RocketDAOProtocolSettingsMinipool.sol",
"chars": 6660,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\nimport \"./RocketDAOProtocolSettings.sol\";\nimport \"../."
},
{
"path": "contracts/contract/dao/protocol/settings/RocketDAOProtocolSettingsNetwork.sol",
"chars": 16286,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\nimport {RocketStorageInterface} from \"../../../../inte"
},
{
"path": "contracts/contract/dao/protocol/settings/RocketDAOProtocolSettingsNode.sol",
"chars": 6275,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\nimport {RocketStorageInterface} from \"../../../../inte"
},
{
"path": "contracts/contract/dao/protocol/settings/RocketDAOProtocolSettingsProposals.sol",
"chars": 7006,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\nimport \"./RocketDAOProtocolSettings.sol\";\nimport \"../."
},
{
"path": "contracts/contract/dao/protocol/settings/RocketDAOProtocolSettingsRewards.sol",
"chars": 6201,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\nimport \"./RocketDAOProtocolSettings.sol\";\nimport \"../."
},
{
"path": "contracts/contract/dao/protocol/settings/RocketDAOProtocolSettingsSecurity.sol",
"chars": 7372,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\nimport {RocketStorageInterface} from \"../../../../inte"
},
{
"path": "contracts/contract/dao/security/RocketDAOSecurity.sol",
"chars": 4006,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\nimport \"../../RocketBase.sol\";\nimport \"../../../interf"
},
{
"path": "contracts/contract/dao/security/RocketDAOSecurityActions.sol",
"chars": 7862,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\nimport \"../../RocketBase.sol\";\nimport \"../../../interf"
},
{
"path": "contracts/contract/dao/security/RocketDAOSecurityProposals.sol",
"chars": 14354,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\nimport {RocketBase} from \"../../RocketBase.sol\";\nimpor"
},
{
"path": "contracts/contract/dao/security/RocketDAOSecurityUpgrade.sol",
"chars": 6680,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\nimport {RocketBase} from \"../../RocketBase.sol\";\nimpor"
},
{
"path": "contracts/contract/deposit/RocketDepositPool.sol",
"chars": 41906,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\nimport {SafeCast} from \"@openzeppelin4/contracts/utils"
},
{
"path": "contracts/contract/helper/BeaconStateVerifierMock.sol",
"chars": 2371,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\nimport \"../../interface/RocketStorageInterface.sol\";\ni"
},
{
"path": "contracts/contract/helper/MegapoolUpgradeHelper.sol",
"chars": 775,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity 0.8.30;\r\n\r\nimport \"../RocketBase.sol\";\r\nimport {RocketMegapool"
},
{
"path": "contracts/contract/helper/PenaltyTest.sol",
"chars": 876,
"preview": "pragma solidity 0.7.6;\r\n\r\n// SPDX-License-Identifier: GPL-3.0-only\r\n\r\nimport \"../RocketBase.sol\";\r\nimport \"../../interfa"
},
{
"path": "contracts/contract/helper/RevertOnTransfer.sol",
"chars": 598,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity 0.8.30;\r\n\r\n/// @notice Helper contract to simulate malicious n"
},
{
"path": "contracts/contract/helper/SnapshotTest.sol",
"chars": 1836,
"preview": "pragma solidity 0.8.30;\r\n\r\n// SPDX-License-Identifier: GPL-3.0-only\r\n\r\nimport \"../RocketBase.sol\";\r\nimport \"../../interf"
},
{
"path": "contracts/contract/helper/SnapshotTimeTest.sol",
"chars": 1848,
"preview": "pragma solidity 0.8.30;\r\n\r\n// SPDX-License-Identifier: GPL-3.0-only\r\n\r\nimport \"../RocketBase.sol\";\r\nimport \"../../interf"
},
{
"path": "contracts/contract/helper/StakeHelper.sol",
"chars": 3326,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity 0.8.30;\r\n\r\nimport \"../../interface/RocketVaultInterface.sol\";\r"
},
{
"path": "contracts/contract/helper/StorageHelper.sol",
"chars": 3556,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity 0.8.30;\r\n\r\nimport {RocketStorageInterface} from \"../../interfa"
},
{
"path": "contracts/contract/megapool/RocketMegapoolDelegate.sol",
"chars": 43999,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\nimport {RocketStorageInterface} from \"../../interface/"
},
{
"path": "contracts/contract/megapool/RocketMegapoolDelegateBase.sol",
"chars": 3653,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\nimport {RocketBase} from \"../RocketBase.sol\";\nimport {"
},
{
"path": "contracts/contract/megapool/RocketMegapoolFactory.sol",
"chars": 8320,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\nimport {RocketStorageInterface} from \"../../interface/"
},
{
"path": "contracts/contract/megapool/RocketMegapoolManager.sol",
"chars": 15858,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\nimport {RocketMegapoolStorageLayout} from \"./RocketMeg"
},
{
"path": "contracts/contract/megapool/RocketMegapoolPenalties.sol",
"chars": 10013,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\nimport {SafeCast} from \"@openzeppelin4/contracts/utils"
},
{
"path": "contracts/contract/megapool/RocketMegapoolProxy.sol",
"chars": 8045,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\nimport {RocketStorageInterface} from \"../../interface/"
},
{
"path": "contracts/contract/megapool/RocketMegapoolStorageLayout.sol",
"chars": 4256,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\nimport {RocketStorageInterface} from \"../../interface/"
},
{
"path": "contracts/contract/minipool/RocketMinipoolBase.sol",
"chars": 7017,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.7.6;\n\nimport \"./RocketMinipoolStorageLayout.sol\";\nimport \"../"
},
{
"path": "contracts/contract/minipool/RocketMinipoolBondReducer.sol",
"chars": 5204,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\npragma abicoder v2;\n\nimport {RocketBase} from \"../Rocke"
},
{
"path": "contracts/contract/minipool/RocketMinipoolDelegate.sol",
"chars": 42225,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.7.6;\n\nimport \"@openzeppelin/contracts/math/SafeMath.sol\";\n\nim"
},
{
"path": "contracts/contract/minipool/RocketMinipoolFactory.sol",
"chars": 2436,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.7.6;\n\nimport \"@openzeppelin/contracts/math/SafeMath.sol\";\nimp"
},
{
"path": "contracts/contract/minipool/RocketMinipoolManager.sol",
"chars": 34531,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\npragma abicoder v2;\n\nimport \"../RocketBase.sol\";\nimport"
},
{
"path": "contracts/contract/minipool/RocketMinipoolPenalty.sol",
"chars": 2115,
"preview": "pragma solidity 0.7.6;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\nimport \"@openzeppelin/contracts/math/SafeMath.sol\";\n\ni"
},
{
"path": "contracts/contract/minipool/RocketMinipoolQueue.sol",
"chars": 12690,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.7.6;\n\nimport \"@openzeppelin/contracts/math/SafeMath.sol\";\nimp"
},
{
"path": "contracts/contract/minipool/RocketMinipoolStorageLayout.sol",
"chars": 2456,
"preview": "pragma solidity 0.7.6;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\nimport \"../../interface/RocketStorageInterface.sol\";\ni"
},
{
"path": "contracts/contract/network/RocketNetworkBalances.sol",
"chars": 9799,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\nimport \"../RocketBase.sol\";\nimport \"../../interface/da"
},
{
"path": "contracts/contract/network/RocketNetworkFees.sol",
"chars": 3663,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.7.6;\n\nimport \"@openzeppelin/contracts/math/SafeMath.sol\";\nimp"
},
{
"path": "contracts/contract/network/RocketNetworkPenalties.sol",
"chars": 10992,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\nimport {SafeCast} from \"@openzeppelin4/contracts/utils"
},
{
"path": "contracts/contract/network/RocketNetworkPrices.sol",
"chars": 7087,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\nimport \"../RocketBase.sol\";\nimport \"../../interface/da"
},
{
"path": "contracts/contract/network/RocketNetworkRevenues.sol",
"chars": 14037,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\nimport {SafeCast} from \"@openzeppelin4/contracts/utils"
},
{
"path": "contracts/contract/network/RocketNetworkSnapshots.sol",
"chars": 7827,
"preview": "// SPDX-License-Identifier: MIT\n// Copyright (c) 2016-2023 zOS Global Limited and contributors\n// Adapted from OpenZeppe"
},
{
"path": "contracts/contract/network/RocketNetworkSnapshotsTime.sol",
"chars": 7540,
"preview": "// SPDX-License-Identifier: MIT\n// Copyright (c) 2016-2023 zOS Global Limited and contributors\n// Adapted from OpenZeppe"
},
{
"path": "contracts/contract/network/RocketNetworkVoting.sol",
"chars": 7385,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\nimport \"@openzeppelin4/contracts/utils/math/Math.sol\";"
},
{
"path": "contracts/contract/node/RocketNodeDeposit.sol",
"chars": 17301,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\nimport {RocketStorageInterface} from \"../../interface/"
},
{
"path": "contracts/contract/node/RocketNodeDistributor.sol",
"chars": 1264,
"preview": "pragma solidity 0.7.6;\r\n\r\n// SPDX-License-Identifier: GPL-3.0-only\r\n\r\nimport \"../RocketBase.sol\";\r\nimport \"./RocketNodeD"
},
{
"path": "contracts/contract/node/RocketNodeDistributorDelegate.sol",
"chars": 4404,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity 0.8.30;\r\n\r\nimport {RocketStorageInterface} from \"../../interfa"
},
{
"path": "contracts/contract/node/RocketNodeDistributorFactory.sol",
"chars": 1724,
"preview": "pragma solidity 0.7.6;\r\n\r\n// SPDX-License-Identifier: GPL-3.0-only\r\n\r\nimport \"../RocketBase.sol\";\r\nimport \"./RocketNodeD"
},
{
"path": "contracts/contract/node/RocketNodeDistributorStorageLayout.sol",
"chars": 356,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity >0.5.0 <0.9.0;\r\n\r\nimport {RocketStorageInterface} from \"../../"
},
{
"path": "contracts/contract/node/RocketNodeManager.sol",
"chars": 34486,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\nimport {RocketStorageInterface} from \"../../interface/"
},
{
"path": "contracts/contract/node/RocketNodeStaking.sol",
"chars": 34587,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\nimport {RocketStorageInterface} from \"../../interface/"
},
{
"path": "contracts/contract/rewards/RocketClaimDAO.sol",
"chars": 13811,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\nimport {RocketBase} from \"../RocketBase.sol\";\nimport {"
},
{
"path": "contracts/contract/rewards/RocketMerkleDistributorMainnet.sol",
"chars": 15330,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity 0.8.30;\r\n\r\nimport {RocketStorageInterface} from \"../../interfa"
},
{
"path": "contracts/contract/rewards/RocketRewardsPool.sol",
"chars": 19205,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\nimport {RocketStorageInterface} from \"../../interface/"
},
{
"path": "contracts/contract/rewards/RocketSmoothingPool.sol",
"chars": 1678,
"preview": "pragma solidity 0.7.6;\npragma abicoder v2;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\nimport \"../RocketBase.sol\";\nimport"
},
{
"path": "contracts/contract/token/RocketTokenRETH.sol",
"chars": 8535,
"preview": "pragma solidity 0.7.6;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\nimport \"../util/ERC20.sol\";\n\nimport \"../RocketBase.sol"
},
{
"path": "contracts/contract/token/RocketTokenRPL.sol",
"chars": 10001,
"preview": "pragma solidity 0.7.6;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\nimport \"../RocketBase.sol\";\nimport \"../../interface/da"
},
{
"path": "contracts/contract/token/temp/RocketTokenDummyRPL.sol",
"chars": 1838,
"preview": "pragma solidity 0.7.6;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\""
},
{
"path": "contracts/contract/util/AddressQueueStorage.sol",
"chars": 4645,
"preview": "pragma solidity 0.7.6;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\nimport \"@openzeppelin/contracts/math/SafeMath.sol\";\n\ni"
},
{
"path": "contracts/contract/util/AddressSetStorage.sol",
"chars": 2926,
"preview": "pragma solidity 0.7.6;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\nimport \"../RocketBase.sol\";\nimport \"../../interface/ut"
},
{
"path": "contracts/contract/util/BeaconStateVerifier.sol",
"chars": 11924,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\nimport {RocketBase} from \"../RocketBase.sol\";\nimport {"
},
{
"path": "contracts/contract/util/Context.sol",
"chars": 949,
"preview": "// SPDX-License-Identifier: MIT\n\npragma solidity >0.5.0 <0.9.0;\n\n/*\n * @dev Provides information about the current execu"
},
{
"path": "contracts/contract/util/ERC20.sol",
"chars": 10788,
"preview": "// SPDX-License-Identifier: MIT\n\npragma solidity >0.5.0 <0.9.0;\n\nimport \"./SafeMath.sol\";\nimport \"./Context.sol\";\nimport"
},
{
"path": "contracts/contract/util/ERC20Burnable.sol",
"chars": 1201,
"preview": "// SPDX-License-Identifier: MIT\n\npragma solidity >0.5.0 <0.9.0;\n\nimport \"./ERC20.sol\";\nimport \"./Context.sol\";\n\n/**\n * @"
},
{
"path": "contracts/contract/util/LinkedListStorage.sol",
"chars": 13987,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\npragma abicoder v2;\n\nimport {LinkedListStorageInterface"
},
{
"path": "contracts/contract/util/LinkedListStorageHelper.sol",
"chars": 1772,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\npragma abicoder v2;\n\nimport {RocketStorageInterface} fr"
},
{
"path": "contracts/contract/util/SSZ.sol",
"chars": 4945,
"preview": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\n/// @dev Set of utilities for working with SSZ serialis"
},
{
"path": "contracts/contract/util/SafeERC20.sol",
"chars": 3775,
"preview": "// SPDX-License-Identifier: MIT\n\npragma solidity >0.5.0 <0.9.0;\n\nimport \"../../interface/util/IERC20.sol\";\nimport \"@open"
},
{
"path": "contracts/contract/util/SafeMath.sol",
"chars": 7224,
"preview": "// SPDX-License-Identifier: MIT\n\npragma solidity >0.5.0 <0.9.0;\n\n/**\n * @dev Wrappers over Solidity's arithmetic operati"
},
{
"path": "contracts/interface/RocketStorageInterface.sol",
"chars": 2230,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >0.5.0 <0.9.0;\n\ninterface RocketStorageInterface {\n\n // Depl"
},
{
"path": "contracts/interface/RocketVaultInterface.sol",
"chars": 863,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\nimport \"./util/IERC20Burnable.sol\";\n\ninterface "
},
{
"path": "contracts/interface/RocketVaultWithdrawerInterface.sol",
"chars": 179,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\ninterface RocketVaultWithdrawerInterface {\n "
},
{
"path": "contracts/interface/auction/RocketAuctionManagerInterface.sol",
"chars": 1925,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\ninterface RocketAuctionManagerInterface {\n "
},
{
"path": "contracts/interface/casper/DepositInterface.sol",
"chars": 260,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\ninterface DepositInterface {\n function depo"
},
{
"path": "contracts/interface/dao/RocketDAOProposalInterface.sol",
"chars": 2146,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\ninterface RocketDAOProposalInterface {\n\n //"
},
{
"path": "contracts/interface/dao/node/RocketDAONodeTrustedActionsInterface.sol",
"chars": 505,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\ninterface RocketDAONodeTrustedActionsInterface"
},
{
"path": "contracts/interface/dao/node/RocketDAONodeTrustedInterface.sol",
"chars": 2116,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\ninterface RocketDAONodeTrustedInterface {\n "
},
{
"path": "contracts/interface/dao/node/RocketDAONodeTrustedProposalsInterface.sol",
"chars": 1010,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\ninterface RocketDAONodeTrustedProposalsInterfa"
},
{
"path": "contracts/interface/dao/node/RocketDAONodeTrustedUpgradeInterface.sol",
"chars": 1553,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >0.5.0 <0.9.0;\n\ninterface RocketDAONodeTrustedUpgradeInterface "
},
{
"path": "contracts/interface/dao/node/settings/RocketDAONodeTrustedSettingsInterface.sol",
"chars": 462,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\ninterface RocketDAONodeTrustedSettingsInterfac"
},
{
"path": "contracts/interface/dao/node/settings/RocketDAONodeTrustedSettingsMembersInterface.sol",
"chars": 590,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\ninterface RocketDAONodeTrustedSettingsMembersI"
},
{
"path": "contracts/interface/dao/node/settings/RocketDAONodeTrustedSettingsMinipoolInterface.sol",
"chars": 711,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\ninterface RocketDAONodeTrustedSettingsMinipool"
},
{
"path": "contracts/interface/dao/node/settings/RocketDAONodeTrustedSettingsProposalsInterface.sol",
"chars": 444,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\ninterface RocketDAONodeTrustedSettingsProposal"
},
{
"path": "contracts/interface/dao/node/settings/RocketDAONodeTrustedSettingsRewardsInterface.sol",
"chars": 211,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >0.5.0 <0.9.0;\n\ninterface RocketDAONodeTrustedSettingsRewardsIn"
},
{
"path": "contracts/interface/dao/protocol/RocketDAOProtocolActionsInterface.sol",
"chars": 123,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\ninterface RocketDAOProtocolActionsInterface {\n"
},
{
"path": "contracts/interface/dao/protocol/RocketDAOProtocolInterface.sol",
"chars": 1919,
"preview": "pragma solidity >0.5.0 <0.9.0;\npragma abicoder v2;\n\nimport \"../../../types/SettingType.sol\";\n\n// SPDX-License-Identifier"
},
{
"path": "contracts/interface/dao/protocol/RocketDAOProtocolProposalInterface.sol",
"chars": 3280,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >0.5.0 <0.9.0;\npragma abicoder v2;\n\nimport \"../../../types/Sett"
},
{
"path": "contracts/interface/dao/protocol/RocketDAOProtocolProposalsInterface.sol",
"chars": 1862,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >0.5.0 <0.9.0;\npragma abicoder v2;\n\nimport \"../../../types/Sett"
},
{
"path": "contracts/interface/dao/protocol/RocketDAOProtocolVerifierInterface.sol",
"chars": 1676,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >0.5.0 <0.9.0;\npragma abicoder v2;\n\ninterface Types {\n enum "
},
{
"path": "contracts/interface/dao/protocol/settings/RocketDAOProtocolSettingsAuctionInterface.sol",
"chars": 601,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\ninterface RocketDAOProtocolSettingsAuctionInte"
},
{
"path": "contracts/interface/dao/protocol/settings/RocketDAOProtocolSettingsDepositInterface.sol",
"chars": 781,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\ninterface RocketDAOProtocolSettingsDepositInte"
},
{
"path": "contracts/interface/dao/protocol/settings/RocketDAOProtocolSettingsInflationInterface.sol",
"chars": 283,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\ninterface RocketDAOProtocolSettingsInflationIn"
},
{
"path": "contracts/interface/dao/protocol/settings/RocketDAOProtocolSettingsInterface.sol",
"chars": 841,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\ninterface RocketDAOProtocolSettingsInterface {"
},
{
"path": "contracts/interface/dao/protocol/settings/RocketDAOProtocolSettingsMegapoolInterface.sol",
"chars": 728,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >0.5.0 <0.9.0;\n\ninterface RocketDAOProtocolSettingsMegapoolInte"
},
{
"path": "contracts/interface/dao/protocol/settings/RocketDAOProtocolSettingsMinipoolInterface.sol",
"chars": 1300,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\nimport \"../../../../types/MinipoolDeposit.sol\""
},
{
"path": "contracts/interface/dao/protocol/settings/RocketDAOProtocolSettingsNetworkInterface.sol",
"chars": 2149,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\ninterface RocketDAOProtocolSettingsNetworkInte"
},
{
"path": "contracts/interface/dao/protocol/settings/RocketDAOProtocolSettingsNodeInterface.sol",
"chars": 835,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\ninterface RocketDAOProtocolSettingsNodeInterfa"
},
{
"path": "contracts/interface/dao/protocol/settings/RocketDAOProtocolSettingsProposalsInterface.sol",
"chars": 788,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\ninterface RocketDAOProtocolSettingsProposalsIn"
},
{
"path": "contracts/interface/dao/protocol/settings/RocketDAOProtocolSettingsRewardsInterface.sol",
"chars": 960,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >0.5.0 <0.9.0;\n\ninterface RocketDAOProtocolSettingsRewardsInter"
},
{
"path": "contracts/interface/dao/protocol/settings/RocketDAOProtocolSettingsSecurityInterface.sol",
"chars": 565,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >0.5.0 <0.9.0;\n\ninterface RocketDAOProtocolSettingsSecurityInte"
},
{
"path": "contracts/interface/dao/security/RocketDAOSecurityActionsInterface.sol",
"chars": 368,
"preview": "pragma solidity >0.5.0 <0.9.0;\n// SPDX-License-Identifier: GPL-3.0-only\n\ninterface RocketDAOSecurityActionsInterface {\n "
},
{
"path": "contracts/interface/dao/security/RocketDAOSecurityInterface.sol",
"chars": 711,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >0.5.0 <0.9.0;\n\ninterface RocketDAOSecurityInterface {\n func"
},
{
"path": "contracts/interface/dao/security/RocketDAOSecurityProposalsInterface.sol",
"chars": 1174,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >0.5.0 <0.9.0;\npragma abicoder v2;\n\nimport \"../../../types/Sett"
},
{
"path": "contracts/interface/dao/security/RocketDAOSecurityUpgradeInterface.sol",
"chars": 528,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >0.5.0 <0.9.0;\npragma abicoder v2;\n\nimport \"../../../types/Sett"
},
{
"path": "contracts/interface/deposit/RocketDepositPoolInterface.sol",
"chars": 2030,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\ninterface RocketDepositPoolInterface {\n fun"
},
{
"path": "contracts/interface/megapool/RocketMegapoolDelegateBaseInterface.sol",
"chars": 278,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >0.5.0 <0.9.0;\n\nimport \"../../interface/RocketStorageInterface."
},
{
"path": "contracts/interface/megapool/RocketMegapoolDelegateInterface.sol",
"chars": 3230,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >0.5.0 <0.9.0;\n\nimport \"../util/BeaconStateVerifierInterface.so"
},
{
"path": "contracts/interface/megapool/RocketMegapoolFactoryInterface.sol",
"chars": 646,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >0.5.0 <0.9.0;\n\ninterface RocketMegapoolFactoryInterface {\n "
},
{
"path": "contracts/interface/megapool/RocketMegapoolInterface.sol",
"chars": 344,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >0.5.0 <0.9.0;\n\nimport {RocketMegapoolDelegateInterface} from \""
},
{
"path": "contracts/interface/megapool/RocketMegapoolManagerInterface.sol",
"chars": 1913,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >0.5.0 <0.9.0;\n\nimport \"../../contract/megapool/RocketMegapoolS"
},
{
"path": "contracts/interface/megapool/RocketMegapoolPenaltiesInterface.sol",
"chars": 641,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >0.5.0 <0.9.0;\n\ninterface RocketMegapoolPenaltiesInterface {\n "
},
{
"path": "contracts/interface/megapool/RocketMegapoolProxyInterface.sol",
"chars": 583,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >0.5.0 <0.9.0;\n\nimport \"../../interface/RocketStorageInterface."
},
{
"path": "contracts/interface/minipool/RocketMinipoolBaseInterface.sol",
"chars": 601,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\ninterface RocketMinipoolBaseInterface {\n fu"
},
{
"path": "contracts/interface/minipool/RocketMinipoolBondReducerInterface.sol",
"chars": 1031,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >0.5.0 <0.9.0;\npragma abicoder v2;\n\ninterface RocketMinipoolBon"
},
{
"path": "contracts/interface/minipool/RocketMinipoolFactoryInterface.sol",
"chars": 357,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\nimport \"../../types/MinipoolDeposit.sol\";\n\nint"
},
{
"path": "contracts/interface/minipool/RocketMinipoolInterface.sol",
"chars": 2811,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\nimport \"../../types/MinipoolDeposit.sol\";\nimpo"
},
{
"path": "contracts/interface/minipool/RocketMinipoolManagerInterface.sol",
"chars": 3390,
"preview": "pragma solidity >0.5.0 <0.9.0;\npragma abicoder v2;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\nimport \"../../types/Minipo"
},
{
"path": "contracts/interface/minipool/RocketMinipoolPenaltyInterface.sol",
"chars": 451,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\ninterface RocketMinipoolPenaltyInterface {\n "
},
{
"path": "contracts/interface/minipool/RocketMinipoolQueueInterface.sol",
"chars": 1235,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\nimport \"../../types/MinipoolDeposit.sol\";\n\nint"
},
{
"path": "contracts/interface/network/RocketNetworkBalancesInterface.sol",
"chars": 824,
"preview": "pragma solidity >0.5.0 <0.9.0;\npragma abicoder v2;\n// SPDX-License-Identifier: GPL-3.0-only\n\ninterface RocketNetworkBala"
},
{
"path": "contracts/interface/network/RocketNetworkFeesInterface.sol",
"chars": 320,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\ninterface RocketNetworkFeesInterface {\n fun"
},
{
"path": "contracts/interface/network/RocketNetworkPenaltiesInterface.sol",
"chars": 689,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\ninterface RocketNetworkPenaltiesInterface {\n "
},
{
"path": "contracts/interface/network/RocketNetworkPricesInterface.sol",
"chars": 436,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\ninterface RocketNetworkPricesInterface {\n fu"
},
{
"path": "contracts/interface/network/RocketNetworkRevenuesInterface.sol",
"chars": 1062,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\ninterface RocketNetworkRevenuesInterface {\n functio"
},
{
"path": "contracts/interface/network/RocketNetworkSnapshotsInterface.sol",
"chars": 954,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >0.5.0 <0.9.0;\n\n/// @notice Accounting for snapshotting of valu"
},
{
"path": "contracts/interface/network/RocketNetworkSnapshotsTimeInterface.sol",
"chars": 954,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >0.5.0 <0.9.0;\n\n/// @notice Accounting for snapshotting of valu"
},
{
"path": "contracts/interface/network/RocketNetworkVotingInterface.sol",
"chars": 526,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >0.5.0 <0.9.0;\n\ninterface RocketNetworkVotingInterface {\n fu"
},
{
"path": "contracts/interface/node/RocketNodeDepositInterface.sol",
"chars": 1593,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >0.5.0 <0.9.0;\npragma abicoder v2;\n\nimport \"../../types/Minipoo"
},
{
"path": "contracts/interface/node/RocketNodeDistributorFactoryInterface.sol",
"chars": 345,
"preview": "pragma solidity >0.5.0 <0.9.0;\r\n\r\n// SPDX-License-Identifier: GPL-3.0-only\r\n\r\ninterface RocketNodeDistributorFactoryInte"
},
{
"path": "contracts/interface/node/RocketNodeDistributorInterface.sol",
"chars": 286,
"preview": "pragma solidity >0.5.0 <0.9.0;\r\n\r\n// SPDX-License-Identifier: GPL-3.0-only\r\n\r\ninterface RocketNodeDistributorInterface {"
},
{
"path": "contracts/interface/node/RocketNodeManagerInterface.sol",
"chars": 3320,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >0.5.0 <0.9.0;\npragma abicoder v2;\n\nimport \"../../types/NodeDet"
},
{
"path": "contracts/interface/node/RocketNodeStakingInterface.sol",
"chars": 2936,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >0.5.0 <0.9.0;\n\ninterface RocketNodeStakingInterface {\n func"
},
{
"path": "contracts/interface/rewards/RocketMerkleDistributorMainnetInterface.sol",
"chars": 366,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >0.5.0 <0.9.0;\n\nimport \"./RocketRewardsRelayInterface.sol\";\n\nin"
},
{
"path": "contracts/interface/rewards/RocketRewardsPoolInterface.sol",
"chars": 1772,
"preview": "pragma solidity >0.5.0 <0.9.0;\npragma abicoder v2;\n\nimport \"../../types/RewardSubmission.sol\";\n\n// SPDX-License-Identifi"
},
{
"path": "contracts/interface/rewards/RocketRewardsRelayInterface.sol",
"chars": 716,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >0.5.0 <0.9.0;\npragma abicoder v2;\n\nstruct Claim {\n uint256 "
},
{
"path": "contracts/interface/rewards/RocketSmoothingPoolInterface.sol",
"chars": 203,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >0.5.0 <0.9.0;\npragma abicoder v2;\n\ninterface RocketSmoothingPo"
},
{
"path": "contracts/interface/rewards/claims/RocketClaimDAOInterface.sol",
"chars": 1352,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >0.5.0 <0.9.0;\npragma abicoder v2;\n\ninterface RocketClaimDAOInt"
},
{
"path": "contracts/interface/rewards/claims/RocketClaimNodeInterface.sol",
"chars": 528,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\ninterface RocketClaimNodeInterface {\n funct"
},
{
"path": "contracts/interface/rewards/claims/RocketClaimTrustedNodeInterface.sol",
"chars": 556,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\ninterface RocketClaimTrustedNodeInterface {\n "
},
{
"path": "contracts/interface/token/RocketTokenRETHInterface.sol",
"chars": 714,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\nimport \"../util/IERC20.sol\";\n\ninterface Rocket"
},
{
"path": "contracts/interface/token/RocketTokenRPLInterface.sol",
"chars": 779,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\nimport \"../util/IERC20.sol\";\n\ninterface Rocket"
},
{
"path": "contracts/interface/util/AddressQueueStorageInterface.sol",
"chars": 544,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\ninterface AddressQueueStorageInterface {\n f"
},
{
"path": "contracts/interface/util/AddressSetStorageInterface.sol",
"chars": 470,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\ninterface AddressSetStorageInterface {\n fun"
},
{
"path": "contracts/interface/util/BeaconStateVerifierInterface.sol",
"chars": 1272,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >0.5.0 <0.9.0;\n\n struct Withdrawal {\n uint64 index;\n "
},
{
"path": "contracts/interface/util/IERC20.sol",
"chars": 2744,
"preview": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidit"
},
{
"path": "contracts/interface/util/IERC20Burnable.sol",
"chars": 310,
"preview": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\nimport \"./IERC"
},
{
"path": "contracts/interface/util/LinkedListStorageInterface.sol",
"chars": 1459,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >0.5.0 <0.9.0;\npragma abicoder v2;\n\ninterface LinkedListStorage"
},
{
"path": "contracts/thirdparty/EthBalanceChecker/EthBalanceChecker.sol",
"chars": 2504,
"preview": "// https://github.com/wbobeirne/eth-balance-checker/blob/master/contracts/BalanceChecker.sol\n// Built off of https://git"
},
{
"path": "contracts/thirdparty/Multicall2/Multicall2.sol",
"chars": 2967,
"preview": "// https://github.com/sky-ecosystem/multicall/blob/master/src/Multicall2.sol\npragma solidity 0.8.30;\n\n/// @title Multica"
},
{
"path": "contracts/thirdparty/RocketSignerRegistry/RocketSignerRegistry.sol",
"chars": 2800,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity 0.8.30;\n\nimport {Strings} from \"@openzeppelin4/contracts/utils/"
},
{
"path": "contracts/thirdparty/RocketSignerRegistry/interface/RocketSignerRegistryInterface.sol",
"chars": 367,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.13;\n\ninterface RocketSignerRegistryInterface {\n functio"
},
{
"path": "contracts/thirdparty/UniswapOracleMock/UniswapOracleMock.sol",
"chars": 633,
"preview": "// SPDX-License-Identifier: GPL-3.0\npragma solidity 0.8.30;\n\n/**\n @dev Mock contract to return some valid values for "
},
{
"path": "contracts/types/MinipoolDeposit.sol",
"chars": 693,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\n// Represents the type of deposits required by"
},
{
"path": "contracts/types/MinipoolDetails.sol",
"chars": 806,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\nimport \"./MinipoolDeposit.sol\";\nimport \"./Mini"
},
{
"path": "contracts/types/MinipoolStatus.sol",
"chars": 574,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\n// Represents a minipool's status within the n"
},
{
"path": "contracts/types/NodeDetails.sol",
"chars": 930,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\n// A struct containing all the information on-"
},
{
"path": "contracts/types/RewardSubmission.sol",
"chars": 1198,
"preview": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity >0.5.0 <0.9.0;\r\n\r\nstruct RewardSubmission {\r\n uint256 rewar"
},
{
"path": "contracts/types/SettingType.sol",
"chars": 164,
"preview": "pragma solidity >0.5.0 <0.9.0;\n\n// SPDX-License-Identifier: GPL-3.0-only\n\nenum SettingType {\n UINT256,\n BOOL,\n ADDRES"
},
{
"path": "hardhat-common.config.js",
"chars": 1112,
"preview": "require('dotenv').config();\nrequire('@nomicfoundation/hardhat-ethers');\n\n// Importing babel to be able to use ES6 import"
},
{
"path": "hardhat-deploy.config.js",
"chars": 1642,
"preview": "require('hardhat-gas-reporter');\nrequire('solidity-coverage');\nrequire('hardhat-ignore-warnings');\n\nlet common = require"
},
{
"path": "hardhat.config.js",
"chars": 1390,
"preview": "require('hardhat-gas-reporter');\nrequire('solidity-coverage');\nrequire('hardhat-ignore-warnings');\n\nlet common = require"
},
{
"path": "package.json",
"chars": 1617,
"preview": "{\n \"name\": \"rocketpool\",\n \"version\": \"3.0.0\",\n \"description\": \"A next generation decentralised Ethereum 2.0 proof of "
},
{
"path": "remapping.json",
"chars": 166,
"preview": "{\n \"remappings\": [\n \"@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/\",\n \"@openzeppelin4/contracts/"
},
{
"path": "scripts/console.js",
"chars": 38236,
"preview": "import {\n artifacts, RocketDAONodeTrusted, RocketDAONodeTrustedSettingsProposals,\n RocketDAONodeTrustedUpgrade, Ro"
},
{
"path": "scripts/deploy-upgrade.v1.4.js",
"chars": 17704,
"preview": "const pako = require('pako');\nconst { RocketDAONodeTrusted, RocketUpgradeOneDotFour, artifacts } = require('../test/_uti"
},
{
"path": "scripts/deploy.js",
"chars": 9423,
"preview": "import { RocketPoolDeployer } from '../test/_helpers/deployer';\nimport { artifacts } from '../test/_utils/artifacts';\nim"
},
{
"path": "scripts/etherscan-verify.js",
"chars": 1497,
"preview": "import { EtherscanVerifier } from '../test/_helpers/verify';\r\nimport fs from 'fs';\r\nimport path from 'path';\r\n\r\nconst pr"
},
{
"path": "scripts/preamble.sol",
"chars": 1112,
"preview": "/**\r\n * .\r\n * / \\\r\n * |.'.|\r\n * |'.'|\r\n * ,'| |'.\r\n * |,-'-|-'-.|\r\n * __|_| | "
},
{
"path": "scripts/upgrade-test.sh",
"chars": 700,
"preview": "#!/bin/bash\n\n# Point hardhat at local node\nexport PROVIDER_URL=http://localhost:8545\nexport MNEMONIC=\"test test test tes"
},
{
"path": "test/_helpers/auction.js",
"chars": 1171,
"preview": "import { RocketAuctionManager } from '../_utils/artifacts';\n\n// Get lot start/end blocks\nexport async function getLotSta"
}
]
// ... and 108 more files (download for full content)
About this extraction
This page contains the full source code of the darcius/rocketpool GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 308 files (2.0 MB), approximately 530.0k tokens, and a symbol index with 374 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.