-
Notifications
You must be signed in to change notification settings - Fork 88
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
[Upgrade] Add owner getter and setter to Asset and Catalyst #1345
base: feat/hardhat-updates-verification
Are you sure you want to change the base?
Conversation
[Upgrade] Add owner getter and setter to Asset and Catalyst
🚨 Report Summary
For more details view the full report in OpenZeppelin Code Inspector |
packages/asset/contracts/Asset.sol
Outdated
@@ -384,5 +384,21 @@ contract Asset is | |||
return "ASSET"; | |||
} | |||
|
|||
uint256[49] private __gap; | |||
address private _owner; |
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.
Move to line 59?
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 I have declared it there so its all close together, but yeah will move it up
@@ -324,5 +324,21 @@ contract Catalyst is | |||
return "CATALYST"; | |||
} | |||
|
|||
uint256[49] private __gap; | |||
address private _owner; |
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.
Move to line 52?
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.
Same
|
||
/// @notice Sets the owner of the contract | ||
/// @param newOwner address of the new owner | ||
function transferOwnership(address newOwner) external { |
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 onlyRole(DEFAULT_ADMIN_ROLE)
?
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 think the main reason is to be able to provide custom revert message.
Otherwise we could switch to using the modifier.
/// @notice Sets the owner of the contract | ||
/// @param newOwner address of the new owner | ||
function transferOwnership(address newOwner) external { | ||
require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "Asset: Unauthorized"); |
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.
same
if ((await read('Asset', 'owner')) === ethers.constants.AddressZero) { | ||
await catchUnknownSigner( | ||
execute( | ||
'Asset', | ||
{from: assetAdmin, log: true}, | ||
'transferOwnership', | ||
assetAdmin | ||
) | ||
); | ||
} | ||
}; |
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.
is better to split this in a separated step, because if something goes wrong it is easier to re-run it separately
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.
If the deployment of the upgrade fails this won't be called, and its a function that we likely call only once during the upgrade process.
I feel like its integral to this upgrade.
if ((await read('Catalyst', 'owner')) === ethers.constants.AddressZero) { | ||
await catchUnknownSigner( | ||
execute( | ||
'Catalyst', | ||
{from: catalystAdmin, log: true}, | ||
'transferOwnership', | ||
catalystAdmin | ||
) | ||
); | ||
} | ||
}; |
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.
is better to split this in a separated step, because if something goes wrong it is easier to re-run it separately
Description
This PR builds on top of #1342 and requires that PR to be merged before this one.
owner
andtransferOwnership
that sets the private variable_owner
.Testing
Run the deployment process in the deploy package by calling
yarn void:deploy