// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import "@openzeppelin/contracts/utils/StorageSlot.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "../../../warper/utils/InitializationContext.sol"; abstract contract TestPurposeInitializationContext is InitializationContext { // @dev For well for nested functions with warperInitializer and onlyInitializingWarper. // They should be idempotent. modifier testWarperInitializer() { bool initialCaller = !StorageSlot.getBooleanSlot(_INITIALIZING_SLOT).value; if (!_isConstructor() && StorageSlot.getBooleanSlot(_INITIALIZED_SLOT).value) { revert ContractIsAlreadyInitialized(); } if (initialCaller) { StorageSlot.getBooleanSlot(_INITIALIZING_SLOT).value = true; } _; if (initialCaller) { StorageSlot.getBooleanSlot(_INITIALIZING_SLOT).value = false; StorageSlot.getBooleanSlot(_INITIALIZED_SLOT).value = false; } } }