-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[VAULTS]: Granular permissions for operations in Dashboard/Delegation #929
base: feat/vaults
Are you sure you want to change the base?
Conversation
/** | ||
* @notice Transfers ownership of the staking vault to a new owner. | ||
* @param _newOwner Address of the new owner. | ||
*/ | ||
function transferStVaultOwnership(address _newOwner) external virtual onlyRole(DEFAULT_ADMIN_ROLE) { | ||
_transferStVaultOwnership(_newOwner); | ||
function transferOwnership(address _newOwner) external virtual { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StVault was there for a reason. Without it, you may think that Dashboard has some ownership, which can be transferred.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to @folkyatina
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought we rejected the "StVault" term
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rough idea is right, but I think we can make better.
WDYT about having granular permissions on a separate layer in separate internal function.
Like,
mintWstETH -> _mintWithAuth -> _mint -> stakingVault.mint`
And with minimal method overriding
function transferStVaultOwnership(address _newOwner) external virtual onlyRole(DEFAULT_ADMIN_ROLE) { | ||
_transferStVaultOwnership(_newOwner); | ||
function transferOwnership(address _newOwner) external virtual { | ||
_authTransferOwnership(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not a modifier from the start?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because then, we'll have to reimplement the function with a different modifier. In this current impl, we only need to override the auth function.
} | ||
|
||
/** | ||
* @notice Disconnects the staking vault from the vault hub. | ||
*/ | ||
function voluntaryDisconnect() external payable virtual onlyRole(DEFAULT_ADMIN_ROLE) fundAndProceed { | ||
_voluntaryDisconnect(); | ||
function voluntaryDisconnect() external payable virtual onlyRole(VOLUNTARY_DISCONNECT_ROLE) fundAndProceed { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need a virtual here and generally everywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, will remove it.
@@ -290,7 +365,7 @@ contract Dashboard is AccessControlEnumerable { | |||
function mintWstETH( | |||
address _recipient, | |||
uint256 _tokens | |||
) external payable virtual onlyRole(DEFAULT_ADMIN_ROLE) fundAndProceed { | |||
) external payable virtual onlyRole(MINT_ROLE) fundAndProceed { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we break permission model. Mint role can fund, because of fundAndProceed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's get rid of fundAndProceed
maybe?
@@ -400,7 +465,7 @@ contract Dashboard is AccessControlEnumerable { | |||
* @notice Rebalances the vault by transferring ether | |||
* @param _ether Amount of ether to rebalance | |||
*/ | |||
function rebalanceVault(uint256 _ether) external payable virtual onlyRole(DEFAULT_ADMIN_ROLE) fundAndProceed { | |||
function rebalanceVault(uint256 _ether) external payable virtual onlyRole(REBALANCE_ROLE) fundAndProceed { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rebalance role can fund
This PR introduces granular permissions for each operation in Dashboard/Delegation to allow flexible role setups.