Fix function ordering in ERC1967Upgrades (#2722)
This commit is contained in:
@ -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.
|
* @dev Storage slot with the admin of the contract.
|
||||||
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
|
* 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;
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user