Sfoglia il codice sorgente

Fix function ordering in ERC1967Upgrades (#2722)

Hadrien Croubois 4 anni fa
parent
commit
00128bd260
1 ha cambiato i file con 18 aggiunte e 18 eliminazioni
  1. 18 18
      contracts/proxy/ERC1967/ERC1967Upgrade.sol

+ 18 - 18
contracts/proxy/ERC1967/ERC1967Upgrade.sol

@@ -106,24 +106,6 @@ abstract contract ERC1967Upgrade {
         }
     }
 
-    /**
-     * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does
-     * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).
-     *
-     * Emits a {BeaconUpgraded} event.
-     */
-    function _upgradeBeaconToAndCall(
-        address newBeacon,
-        bytes memory data,
-        bool forceCall
-    ) internal {
-        _setBeacon(newBeacon);
-        emit BeaconUpgraded(newBeacon);
-        if (data.length > 0 || forceCall) {
-            Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);
-        }
-    }
-
     /**
      * @dev Storage slot with the admin of the contract.
      * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
@@ -190,4 +172,22 @@ abstract contract ERC1967Upgrade {
         );
         StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;
     }
+
+    /**
+     * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does
+     * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).
+     *
+     * Emits a {BeaconUpgraded} event.
+     */
+    function _upgradeBeaconToAndCall(
+        address newBeacon,
+        bytes memory data,
+        bool forceCall
+    ) internal {
+        _setBeacon(newBeacon);
+        emit BeaconUpgraded(newBeacon);
+        if (data.length > 0 || forceCall) {
+            Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);
+        }
+    }
 }