Skip to content
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

Draft
wants to merge 4 commits into
base: feat/vaults
Choose a base branch
from

Conversation

failingtwice
Copy link
Contributor

This PR introduces granular permissions for each operation in Dashboard/Delegation to allow flexible role setups.

/**
* @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 {
Copy link
Member

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to @folkyatina

Copy link
Contributor Author

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

Copy link
Member

@folkyatina folkyatina left a 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();
Copy link
Member

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?

Copy link
Contributor Author

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 {
Copy link
Member

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?

Copy link
Contributor Author

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 {
Copy link
Member

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

Copy link
Contributor Author

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 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rebalance role can fund

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants