Add internal functions _getInitializedVersion and _isInitializing (#3598)
This commit is contained in:
committed by
GitHub
parent
397c946141
commit
26cf47a2be
@ -13,6 +13,10 @@ contract InitializableMock is Initializable {
|
||||
bool public onlyInitializingRan;
|
||||
uint256 public x;
|
||||
|
||||
function isInitializing() public view returns (bool) {
|
||||
return _isInitializing();
|
||||
}
|
||||
|
||||
function initialize() public initializer {
|
||||
initializerRan = true;
|
||||
}
|
||||
@ -75,6 +79,10 @@ contract ChildConstructorInitializableMock is ConstructorInitializableMock {
|
||||
contract ReinitializerMock is Initializable {
|
||||
uint256 public counter;
|
||||
|
||||
function getInitializedVersion() public view returns (uint8) {
|
||||
return _getInitializedVersion();
|
||||
}
|
||||
|
||||
function initialize() public initializer {
|
||||
doStuff();
|
||||
}
|
||||
|
||||
@ -135,4 +135,18 @@ abstract contract Initializable {
|
||||
emit Initialized(type(uint8).max);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Internal function that returns the initialized version. Returns `_initialized`
|
||||
*/
|
||||
function _getInitializedVersion() internal view returns (uint8) {
|
||||
return _initialized;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Internal function that returns the initialized version. Returns `_initializing`
|
||||
*/
|
||||
function _isInitializing() internal view returns (bool) {
|
||||
return _initializing;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user