Skip to content

Commit bbc6ef9

Browse files
authored
Get ERC-1967 event from interface (#4987)
1 parent b6e0791 commit bbc6ef9

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

contracts/proxy/ERC1967/ERC1967Utils.sol

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
pragma solidity ^0.8.20;
55

66
import {IBeacon} from "../beacon/IBeacon.sol";
7+
import {IERC1967} from "../../interfaces/IERC1967.sol";
78
import {Address} from "../../utils/Address.sol";
89
import {StorageSlot} from "../../utils/StorageSlot.sol";
910

@@ -12,21 +13,6 @@ import {StorageSlot} from "../../utils/StorageSlot.sol";
1213
* https://eips.ethereum.org/EIPS/eip-1967[ERC-1967] slots.
1314
*/
1415
library ERC1967Utils {
15-
/**
16-
* @dev Emitted when the implementation is upgraded.
17-
*/
18-
event Upgraded(address indexed implementation);
19-
20-
/**
21-
* @dev Emitted when the admin account has changed.
22-
*/
23-
event AdminChanged(address previousAdmin, address newAdmin);
24-
25-
/**
26-
* @dev Emitted when the beacon is changed.
27-
*/
28-
event BeaconUpgraded(address indexed beacon);
29-
3016
/**
3117
* @dev Storage slot with the address of the current implementation.
3218
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1.
@@ -80,7 +66,7 @@ library ERC1967Utils {
8066
*/
8167
function upgradeToAndCall(address newImplementation, bytes memory data) internal {
8268
_setImplementation(newImplementation);
83-
emit Upgraded(newImplementation);
69+
emit IERC1967.Upgraded(newImplementation);
8470

8571
if (data.length > 0) {
8672
Address.functionDelegateCall(newImplementation, data);
@@ -123,7 +109,7 @@ library ERC1967Utils {
123109
* Emits an {IERC1967-AdminChanged} event.
124110
*/
125111
function changeAdmin(address newAdmin) internal {
126-
emit AdminChanged(getAdmin(), newAdmin);
112+
emit IERC1967.AdminChanged(getAdmin(), newAdmin);
127113
_setAdmin(newAdmin);
128114
}
129115

@@ -170,7 +156,7 @@ library ERC1967Utils {
170156
*/
171157
function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal {
172158
_setBeacon(newBeacon);
173-
emit BeaconUpgraded(newBeacon);
159+
emit IERC1967.BeaconUpgraded(newBeacon);
174160

175161
if (data.length > 0) {
176162
Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);

0 commit comments

Comments
 (0)