1

The OpenZeppelin Initializable.sol contract includes a modifier initializer() that shows:

modifier initializer() {
    require(initializing || isConstructor() || !initialized, "Contract instance has already been initialized");

    bool wasInitializing = initializing;
    initializing = true;
    initialized = true;

    _;

    initializing = wasInitializing;
}
  1. Why is the point of introducing initializing?
  2. Why is initialized placed before the body of the inserted code? Shouldn't it be only set to true at the very last step?
1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.