-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7e1f108
commit 2688545
Showing
2 changed files
with
38 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,21 +10,6 @@ import {Dashboard} from "./Dashboard.sol"; | |
/** | ||
* @title Delegation | ||
* @notice This contract is a contract-owner of StakingVault and includes an additional delegation layer. | ||
* | ||
* The delegation hierarchy is as follows: | ||
* - DEFAULT_ADMIN_ROLE is the underlying owner of StakingVault; | ||
* - NODE_OPERATOR_MANAGER_ROLE is the node operator manager of StakingVault; and itself is the role admin, | ||
* and the DEFAULT_ADMIN_ROLE cannot assign NODE_OPERATOR_MANAGER_ROLE; | ||
* - NODE_OPERATOR_FEE_CLAIMER_ROLE is the role that can claim node operator fee; is assigned by NODE_OPERATOR_MANAGER_ROLE; | ||
* | ||
* Additionally, the following roles are assigned by DEFAULT_ADMIN_ROLE: | ||
* - CURATOR_ROLE is the curator of StakingVault and perfoms some operations on behalf of DEFAULT_ADMIN_ROLE; | ||
* - FUND_WITHDRAW_ROLE funds and withdraws from the StakingVault; | ||
* - MINT_BURN_ROLE mints and burns shares of stETH backed by the StakingVault; | ||
* | ||
* The curator and node operator have their respective fees. | ||
* The feeBP is the percentage (in basis points) of the StakingVault rewards. | ||
* The unclaimed fee is the amount of ether that is owed to the curator or node operator based on the feeBP. | ||
*/ | ||
contract Delegation is Dashboard { | ||
/** | ||
|
@@ -33,31 +18,33 @@ contract Delegation is Dashboard { | |
uint256 private constant MAX_FEE_BP = TOTAL_BASIS_POINTS; | ||
|
||
/** | ||
* @notice Curator role: | ||
* - sets curator fee; | ||
* - claims curator fee; | ||
* - confirms confirm lifetime; | ||
* - confirms node operator fee; | ||
* - confirms ownership transfer; | ||
* - pauses deposits to beacon chain; | ||
* - resumes deposits to beacon chain. | ||
* @notice Sets curator fee. | ||
*/ | ||
bytes32 public constant CURATOR_FEE_SET_ROLE = keccak256("vaults.Delegation.CuratorFeeSetRole"); | ||
|
||
/** | ||
* @notice Claims curator fee. | ||
*/ | ||
bytes32 public constant CURATOR_ROLE = keccak256("vaults.Delegation.CuratorRole"); | ||
bytes32 public constant CURATOR_FEE_CLAIM_ROLE = keccak256("vaults.Delegation.CuratorFeeClaimRole"); | ||
|
||
/** | ||
* @notice Node operator manager role: | ||
* - confirms confirm lifetime; | ||
* - confirms node operator fee; | ||
* - confirms ownership transfer; | ||
* - assigns NODE_OPERATOR_FEE_CLAIMER_ROLE. | ||
* - assigns NODE_OPERATOR_FEE_CONFIRM_ROLE; | ||
* - assigns NODE_OPERATOR_FEE_CLAIM_ROLE. | ||
*/ | ||
bytes32 public constant NODE_OPERATOR_MANAGER_ROLE = keccak256("vaults.Delegation.NodeOperatorManagerRole"); | ||
|
||
/** | ||
* @notice Node operator fee claimer role: | ||
* - claims node operator fee. | ||
* @notice Confirms node operator fee. | ||
*/ | ||
bytes32 public constant NODE_OPERATOR_FEE_CONFIRM_ROLE = keccak256("vaults.Delegation.NodeOperatorFeeConfirmRole"); | ||
|
||
/** | ||
* @notice Claims node operator fee. | ||
*/ | ||
bytes32 public constant NODE_OPERATOR_FEE_CLAIMER_ROLE = keccak256("vaults.Delegation.NodeOperatorFeeClaimerRole"); | ||
bytes32 public constant NODE_OPERATOR_FEE_CLAIM_ROLE = keccak256("vaults.Delegation.NodeOperatorFeeClaimRole"); | ||
|
||
/** | ||
* @notice Curator fee in basis points; combined with node operator fee cannot exceed 100%. | ||
|
@@ -105,7 +92,8 @@ contract Delegation is Dashboard { | |
// at the end of the initialization | ||
_grantRole(NODE_OPERATOR_MANAGER_ROLE, _defaultAdmin); | ||
_setRoleAdmin(NODE_OPERATOR_MANAGER_ROLE, NODE_OPERATOR_MANAGER_ROLE); | ||
_setRoleAdmin(NODE_OPERATOR_FEE_CLAIMER_ROLE, NODE_OPERATOR_MANAGER_ROLE); | ||
_setRoleAdmin(NODE_OPERATOR_FEE_CONFIRM_ROLE, NODE_OPERATOR_MANAGER_ROLE); | ||
_setRoleAdmin(NODE_OPERATOR_FEE_CLAIM_ROLE, NODE_OPERATOR_MANAGER_ROLE); | ||
} | ||
Check failure Code scanning / Slither Unprotected Initialize High
Function Delegation.initialize(address,uint256) is an unprotected initializer.
|
||
|
||
/** | ||
|
@@ -168,7 +156,7 @@ contract Delegation is Dashboard { | |
* The function will revert if the curator fee is unclaimed. | ||
* @param _newCuratorFeeBP The new curator fee in basis points. | ||
*/ | ||
function setCuratorFeeBP(uint256 _newCuratorFeeBP) external onlyRole(DEFAULT_ADMIN_ROLE) { | ||
function setCuratorFeeBP(uint256 _newCuratorFeeBP) external onlyRole(CURATOR_FEE_SET_ROLE) { | ||
if (_newCuratorFeeBP + nodeOperatorFeeBP > MAX_FEE_BP) revert CombinedFeesExceed100Percent(); | ||
if (curatorUnclaimedFee() > 0) revert CuratorFeeUnclaimed(); | ||
uint256 oldCuratorFeeBP = curatorFeeBP; | ||
|
@@ -198,7 +186,7 @@ contract Delegation is Dashboard { | |
* @notice Claims the curator fee. | ||
* @param _recipient The address to which the curator fee will be sent. | ||
*/ | ||
function claimCuratorFee(address _recipient) external onlyRole(CURATOR_ROLE) { | ||
function claimCuratorFee(address _recipient) external onlyRole(CURATOR_FEE_CLAIM_ROLE) { | ||
uint256 fee = curatorUnclaimedFee(); | ||
curatorFeeClaimedReport = stakingVault().latestReport(); | ||
_claimFee(_recipient, fee); | ||
|
@@ -210,7 +198,7 @@ contract Delegation is Dashboard { | |
* although NODE_OPERATOR_MANAGER_ROLE is the admin role for NODE_OPERATOR_FEE_CLAIMER_ROLE. | ||
* @param _recipient The address to which the node operator fee will be sent. | ||
*/ | ||
function claimNodeOperatorFee(address _recipient) external onlyRole(NODE_OPERATOR_FEE_CLAIMER_ROLE) { | ||
function claimNodeOperatorFee(address _recipient) external onlyRole(NODE_OPERATOR_FEE_CLAIM_ROLE) { | ||
uint256 fee = nodeOperatorUnclaimedFee(); | ||
nodeOperatorFeeClaimedReport = stakingVault().latestReport(); | ||
_claimFee(_recipient, fee); | ||
|
@@ -267,7 +255,7 @@ contract Delegation is Dashboard { | |
*/ | ||
function _confirmingRoles() internal pure override returns (bytes32[] memory roles) { | ||
roles = new bytes32[](2); | ||
roles[0] = CURATOR_ROLE; | ||
roles[0] = DEFAULT_ADMIN_ROLE; | ||
roles[1] = NODE_OPERATOR_MANAGER_ROLE; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters