docs: clarify the interplay between inheritance and the Initializable contract

pull/4266/head
Atis Elsts 2 years ago
parent dfef6a68ee
commit ae786f7be7
  1. 7
      contracts/proxy/utils/Initializable.sol

@ -35,8 +35,11 @@ import "../../utils/Address.sol";
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
* CAUTION: while Solidity takes care of automatically invoking the constructors of all ancestors of a contract and
* doing it just once, the same does not apply to initializer functions. Instead, you need to take special care to
* manually call the initializer functions of all parent contracts and ensure they are either called no more than once
* or designed to be idempotent. Additionally, please note that the initializer modifier can only be called once, even
* when utilizing inheritance. Therefore, parent contracts should utilize the onlyInitializing modifier.
*
* [CAUTION]
* ====

Loading…
Cancel
Save