Make upgradeTo and upgradeToAndCall public (#3959)

Co-authored-by: Francisco <fg@frang.io>
This commit is contained in:
blockeater
2023-01-26 00:46:34 +05:00
committed by GitHub
parent a284569a7c
commit 69c8d1010e
4 changed files with 11 additions and 6 deletions

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': patch
---
`UUPSUpgradeable.sol`: Change visibility to the functions `upgradeTo ` and `upgradeToAndCall ` from `external` to `public`.

View File

@ -44,11 +44,11 @@ contract UUPSUpgradeableLegacyMock is UUPSUpgradeableMock {
} }
// hooking into the old mechanism // hooking into the old mechanism
function upgradeTo(address newImplementation) external override { function upgradeTo(address newImplementation) public override {
_upgradeToAndCallSecureLegacyV1(newImplementation, bytes(""), false); _upgradeToAndCallSecureLegacyV1(newImplementation, bytes(""), false);
} }
function upgradeToAndCall(address newImplementation, bytes memory data) external payable override { function upgradeToAndCall(address newImplementation, bytes memory data) public payable override {
_upgradeToAndCallSecureLegacyV1(newImplementation, data, false); _upgradeToAndCallSecureLegacyV1(newImplementation, data, false);
} }
} }

View File

@ -23,11 +23,11 @@ contract UUPSUpgradeableMock is NonUpgradeableMock, UUPSUpgradeable {
} }
contract UUPSUpgradeableUnsafeMock is UUPSUpgradeableMock { contract UUPSUpgradeableUnsafeMock is UUPSUpgradeableMock {
function upgradeTo(address newImplementation) external override { function upgradeTo(address newImplementation) public override {
ERC1967Upgrade._upgradeToAndCall(newImplementation, bytes(""), false); ERC1967Upgrade._upgradeToAndCall(newImplementation, bytes(""), false);
} }
function upgradeToAndCall(address newImplementation, bytes memory data) external payable override { function upgradeToAndCall(address newImplementation, bytes memory data) public payable override {
ERC1967Upgrade._upgradeToAndCall(newImplementation, data, false); ERC1967Upgrade._upgradeToAndCall(newImplementation, data, false);
} }
} }

View File

@ -65,7 +65,7 @@ abstract contract UUPSUpgradeable is IERC1822Proxiable, ERC1967Upgrade {
* *
* @custom:oz-upgrades-unsafe-allow-reachable delegatecall * @custom:oz-upgrades-unsafe-allow-reachable delegatecall
*/ */
function upgradeTo(address newImplementation) external virtual onlyProxy { function upgradeTo(address newImplementation) public virtual onlyProxy {
_authorizeUpgrade(newImplementation); _authorizeUpgrade(newImplementation);
_upgradeToAndCallUUPS(newImplementation, new bytes(0), false); _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);
} }
@ -80,7 +80,7 @@ abstract contract UUPSUpgradeable is IERC1822Proxiable, ERC1967Upgrade {
* *
* @custom:oz-upgrades-unsafe-allow-reachable delegatecall * @custom:oz-upgrades-unsafe-allow-reachable delegatecall
*/ */
function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy { function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy {
_authorizeUpgrade(newImplementation); _authorizeUpgrade(newImplementation);
_upgradeToAndCallUUPS(newImplementation, data, true); _upgradeToAndCallUUPS(newImplementation, data, true);
} }