-
Notifications
You must be signed in to change notification settings - Fork 12.2k
Open
Milestone
Description
🧐 Motivation
We want a more flexible way to be able to make upgrades and at the same time, maintain consistency on the approach used on UUPS pattern
📝 Details
Now, we cannot inherit from UpgradeableBeacon.sol and override the upgradeTo function removing the OnlyOwner
modifier beacause _setImplementation is a private function.
function upgradeTo(address newImplementation) public virtual onlyOwner {
_setImplementation(newImplementation);
}
function _setImplementation(address newImplementation) private {
if (newImplementation.code.length == 0) {
revert BeaconInvalidImplementation(newImplementation);
}
_implementation = newImplementation;
emit Upgraded(newImplementation);
}
Suggestion: Use the _authorizeUpgrade like UUPSUpgradeable.sol to override it with the protected method you want
function upgradeTo(address newImplementation) public virtual {
_authorizeUpgrade(newImplementation);
_setImplementation(newImplementation);
}
function _authorizeUpgrade(address newImplementation) internal virtual;
franciscotobar and jmendiola222
Metadata
Metadata
Assignees
Labels
No labels