Add Initialized event (#3294)
Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
This commit is contained in:
@ -66,6 +66,11 @@ abstract contract Initializable {
|
||||
*/
|
||||
bool private _initializing;
|
||||
|
||||
/**
|
||||
* @dev Triggered when the contract has been initialized or reinitialized.
|
||||
*/
|
||||
event Initialized(uint8 version);
|
||||
|
||||
/**
|
||||
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
|
||||
* `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.
|
||||
@ -78,6 +83,7 @@ abstract contract Initializable {
|
||||
_;
|
||||
if (isTopLevelCall) {
|
||||
_initializing = false;
|
||||
emit Initialized(1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,6 +107,7 @@ abstract contract Initializable {
|
||||
_;
|
||||
if (isTopLevelCall) {
|
||||
_initializing = false;
|
||||
emit Initialized(version);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user