Add Initialized event (#3294)

Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
This commit is contained in:
Hadrien Croubois
2022-03-28 20:36:30 +02:00
committed by GitHub
parent 76eee35971
commit e029096ca4
3 changed files with 46 additions and 4 deletions

View File

@ -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);
}
}