Unverified Commit 6f50f6e1 by Hadrien Croubois Committed by GitHub

Remove repeated code from ERC1967Upgrade (#2720)

parent fd111df1
...@@ -65,8 +65,7 @@ abstract contract ERC1967Upgrade { ...@@ -65,8 +65,7 @@ abstract contract ERC1967Upgrade {
bytes memory data, bytes memory data,
bool forceCall bool forceCall
) internal { ) internal {
_setImplementation(newImplementation); _upgradeTo(newImplementation);
emit Upgraded(newImplementation);
if (data.length > 0 || forceCall) { if (data.length > 0 || forceCall) {
Address.functionDelegateCall(newImplementation, data); Address.functionDelegateCall(newImplementation, data);
} }
...@@ -103,8 +102,7 @@ abstract contract ERC1967Upgrade { ...@@ -103,8 +102,7 @@ abstract contract ERC1967Upgrade {
// Check rollback was effective // Check rollback was effective
require(oldImplementation == _getImplementation(), "ERC1967Upgrade: upgrade breaks further upgrades"); require(oldImplementation == _getImplementation(), "ERC1967Upgrade: upgrade breaks further upgrades");
// Finally reset to the new implementation and log the upgrade // Finally reset to the new implementation and log the upgrade
_setImplementation(newImplementation); _upgradeTo(newImplementation);
emit Upgraded(newImplementation);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment