Skip to content

Commit

Permalink
Fix function ordering in ERC1967Upgrades (#2722)
Browse files Browse the repository at this point in the history
  • Loading branch information
Amxx committed Jun 14, 2021
1 parent f710baf commit 00128bd
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions contracts/proxy/ERC1967/ERC1967Upgrade.sol
Expand Up @@ -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
Expand Down Expand Up @@ -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);
}
}
}

0 comments on commit 00128bd

Please sign in to comment.