-
Notifications
You must be signed in to change notification settings - Fork 10
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
[PDE-691] staking contract for nYIELD #159
base: main
Are you sure you want to change the base?
Conversation
…some optimizations
PTAL @qubitcrypto @eyqs |
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.
lgtm, I provided some minor optimizations, feel free to take them or leave them.
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'm concerned with the initialize() and reinitialize() functions, see my comments. Therefore I'm changing the status to "Request changes".
/** | ||
* @notice Initialize the contract. | ||
* @param timelock The timelock contract address. | ||
* @param owner The owner address. |
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.
Be explicit who the owner is? the deployer? a multisig contract address?
function reinitialize(address multisig, TimelockController timelock) public reinitializer(2) onlyRole(ADMIN_ROLE) { | ||
BoringVaultPredepositStorage storage $ = _getBoringVaultPredepositStorage(); | ||
$.multisig = multisig; | ||
$.timelock = timelock; |
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.
At this point, the contract's super admin role and admin role is still the "owner", potentially the deployer.
All the following functions requires "ADMIN_ROLE" which has nothing to do with this multisig we set here.
If I understand our intention correctly, we must revoke and grant roles with reinitialize(), and emitting events accordingly:
// Transfer administrative roles
address oldAdmin = getRoleMember(DEFAULT_ADMIN_ROLE, 0);
_revokeRole(DEFAULT_ADMIN_ROLE, oldAdmin);
_revokeRole(ADMIN_ROLE, oldAdmin);
_grantRole(DEFAULT_ADMIN_ROLE, multisig);
_grantRole(ADMIN_ROLE, multisig);
emit MultisigSet(multisig);
emit TimelockSet(address(timelock));
What's new in this PR?
add nYield pre-deposit contract