-
Notifications
You must be signed in to change notification settings - Fork 212
[VAULTS] Revamp Delegation (for the last time) #1011
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
Conversation
Hardhat Unit Tests Coverage Summary
Diff against master
Results for commit: 7f91994 Minimum allowed coverage is ♻️ This comment has been updated with latest results |
/** | ||
* @notice Returns the roles that can: | ||
* - change the confirm expiry; | ||
* - set the curator fee; |
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.
curator??
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.
🪄 Looks good, no major blockers...
ofc need to update tests and sync
emit VaultCreated(address(dashboard), address(vault)); | ||
emit DashboardCreated(_defaultAdmin, address(dashboard)); |
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.
💭 maybe move the contract address to the first place; it looks confusing when admin comes first, or is this a common scenario for creation events?
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.
Yeah, makes sense. We can also combine the two events into one, since they don't emit separately.
uint256 private constant TOTAL_BASIS_POINTS = 100_00; | ||
|
||
/** | ||
* @notice Maximum fee value; equals to 100.00%. | ||
*/ | ||
uint256 private constant MAX_FEE_BP = TOTAL_BASIS_POINTS; |
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 do we need separate private const? maybe use TOTAL_BASIS_POINTS instead?
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.
Yes, it's arguable but they are semantically different. One is used for fee calculations, the other to revert when new fee is over 100%. Idk, just reads better in code but not a strong preference
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.
import {Dashboard} from "./Dashboard.sol"; | ||
import {IStakingVault} from "../interfaces/IStakingVault.sol"; | ||
import {Permissions} from "./Permissions.sol"; | ||
import {VaultHub} from "../VaultHub.sol"; |
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.
import {VaultHub} from "../VaultHub.sol"; |
unused
* @notice Maximum combined feeBP value; equals to 100%. | ||
* @notice Total basis points; 1bp = 0.01%, 100_00bp = 100.00%. | ||
*/ | ||
uint256 private constant TOTAL_BASIS_POINTS = 100_00; |
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.
uint256 private constant TOTAL_BASIS_POINTS = 100_00; | |
uint256 internal constant TOTAL_BASIS_POINTS = 100_00; |
So can it can be used in UXLayer without definition there?
* @notice This contract is a UX-layer for StakingVault and meant to be used as its owner. | ||
* This contract improves the vault UX by bundling all functions from the StakingVault and VaultHub | ||
* in this single contract. It provides administrative functions for managing the StakingVault, | ||
* including funding, withdrawing, minting, burning, and rebalancing operations. | ||
*/ | ||
contract Dashboard is Permissions { | ||
abstract contract UXLayer is NodeOperatorFee { |
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.
TOTAL_BASIS_POINTS
may be taken from NodeOperatorFee
@@ -508,15 +492,28 @@ contract Dashboard is Permissions { | |||
revert InvalidPermit(token); | |||
} | |||
|
|||
/** | |||
function _mintableValuation() internal view returns (uint256) { |
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.
💭 natspec?
return stakingVault().valuation() - nodeOperatorUnclaimedFee(); | ||
} | ||
|
||
function _mintSharesWithinMintableValuation(address _recipient, uint256 _amountOfShares) internal { |
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.
💭 natspec?
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 like this PR conceptually, the things that are not in sync yet:
- latest PDG changes and shortcut accounting change
- new permissions due to the authorize/deauthorize base fns
- merge conflicts 🤒
Seems we might not need Dashboard contract though and can have it merged with UXLayer, but not sure
to have smth like:
Permissions ← NodeOperatorFee ← InitializableUtils ← UXLayer
* @notice Creates a new StakingVault and Dashboard contracts | ||
* @param _defaultAdmin The address of the default admin | ||
* @param _nodeOperator The address of the node operator | ||
* @param _extraParams The params of vault creation |
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.
* @param _extraParams The params of vault creation |
dup (see below)
return IStakingVault(_loadStakingVaultAddress()); | ||
} | ||
|
||
function vaultHub() public view override returns (VaultHub) { |
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.
function vaultHub() public view override returns (VaultHub) { | |
function vaultHub() public view override returns (IVaultHub) { |
error AlreadyInitialized(); | ||
|
||
/** | ||
* @dev Error emitted when the contract is called as a proxy. |
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.
* @dev Error emitted when the contract is called as a proxy. | |
* @dev Error emitted when the contract is called not through a proxy. |
* It reserves a portion of the staking rewards for the node operator, and allows | ||
* the node operator to claim their fee. | ||
* | ||
* Key features: |
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.
and negotiation sidecar for the fee adjustment (e.g. PDG unguaranteed deposits)
/** | ||
* @notice Returns the address of the VaultHub | ||
*/ | ||
function vaultHub() public view virtual returns (VaultHub); |
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.
function vaultHub() public view virtual returns (VaultHub); | |
function vaultHub() public view virtual returns (IVaultHub); |
Closed in favor of #1031 |
This PR proposes a revamp Delegation contract.
Context
Delegation provides reward share accounting for node operator
Problem
The old Delegation is clunky and poorly designed
Solution
Change inheritance structure, refactor and improve