@@ -24,6 +24,10 @@ library Clones {
2424 * @dev Deploys and returns the address of a clone that mimics the behavior of `implementation`.
2525 *
2626 * This function uses the create opcode, which should never revert.
27+ *
28+ * WARNING: This function does not check if `implementation` has code. A clone that points to an address
29+ * without code cannot be initialized. Initialization calls may appear to be successful when, in reality, they
30+ * have no effect and leave the clone uninitialized, allowing a third party to initialize it later.
2731 */
2832 function clone (address implementation ) internal returns (address instance ) {
2933 return clone (implementation, 0 );
@@ -33,6 +37,10 @@ library Clones {
3337 * @dev Same as {xref-Clones-clone-address-}[clone], but with a `value` parameter to send native currency
3438 * to the new contract.
3539 *
40+ * WARNING: This function does not check if `implementation` has code. A clone that points to an address
41+ * without code cannot be initialized. Initialization calls may appear to be successful when, in reality, they
42+ * have no effect and leave the clone uninitialized, allowing a third party to initialize it later.
43+ *
3644 * NOTE: Using a non-zero value at creation will require the contract using this function (e.g. a factory)
3745 * to always have enough balance for new deployments. Consider exposing this function under a payable method.
3846 */
@@ -59,6 +67,10 @@ library Clones {
5967 * This function uses the create2 opcode and a `salt` to deterministically deploy
6068 * the clone. Using the same `implementation` and `salt` multiple times will revert, since
6169 * the clones cannot be deployed twice at the same address.
70+ *
71+ * WARNING: This function does not check if `implementation` has code. A clone that points to an address
72+ * without code cannot be initialized. Initialization calls may appear to be successful when, in reality, they
73+ * have no effect and leave the clone uninitialized, allowing a third party to initialize it later.
6274 */
6375 function cloneDeterministic (address implementation , bytes32 salt ) internal returns (address instance ) {
6476 return cloneDeterministic (implementation, salt, 0 );
@@ -68,6 +80,10 @@ library Clones {
6880 * @dev Same as {xref-Clones-cloneDeterministic-address-bytes32-}[cloneDeterministic], but with
6981 * a `value` parameter to send native currency to the new contract.
7082 *
83+ * WARNING: This function does not check if `implementation` has code. A clone that points to an address
84+ * without code cannot be initialized. Initialization calls may appear to be successful when, in reality, they
85+ * have no effect and leave the clone uninitialized, allowing a third party to initialize it later.
86+ *
7187 * NOTE: Using a non-zero value at creation will require the contract using this function (e.g. a factory)
7288 * to always have enough balance for new deployments. Consider exposing this function under a payable method.
7389 */
@@ -128,6 +144,10 @@ library Clones {
128144 * access the arguments within the implementation, use {fetchCloneArgs}.
129145 *
130146 * This function uses the create opcode, which should never revert.
147+ *
148+ * WARNING: This function does not check if `implementation` has code. A clone that points to an address
149+ * without code cannot be initialized. Initialization calls may appear to be successful when, in reality, they
150+ * have no effect and leave the clone uninitialized, allowing a third party to initialize it later.
131151 */
132152 function cloneWithImmutableArgs (address implementation , bytes memory args ) internal returns (address instance ) {
133153 return cloneWithImmutableArgs (implementation, args, 0 );
@@ -137,6 +157,10 @@ library Clones {
137157 * @dev Same as {xref-Clones-cloneWithImmutableArgs-address-bytes-}[cloneWithImmutableArgs], but with a `value`
138158 * parameter to send native currency to the new contract.
139159 *
160+ * WARNING: This function does not check if `implementation` has code. A clone that points to an address
161+ * without code cannot be initialized. Initialization calls may appear to be successful when, in reality, they
162+ * have no effect and leave the clone uninitialized, allowing a third party to initialize it later.
163+ *
140164 * NOTE: Using a non-zero value at creation will require the contract using this function (e.g. a factory)
141165 * to always have enough balance for new deployments. Consider exposing this function under a payable method.
142166 */
@@ -165,6 +189,10 @@ library Clones {
165189 * This function uses the create2 opcode and a `salt` to deterministically deploy the clone. Using the same
166190 * `implementation`, `args` and `salt` multiple times will revert, since the clones cannot be deployed twice
167191 * at the same address.
192+ *
193+ * WARNING: This function does not check if `implementation` has code. A clone that points to an address
194+ * without code cannot be initialized. Initialization calls may appear to be successful when, in reality, they
195+ * have no effect and leave the clone uninitialized, allowing a third party to initialize it later.
168196 */
169197 function cloneDeterministicWithImmutableArgs (
170198 address implementation ,
@@ -178,6 +206,10 @@ library Clones {
178206 * @dev Same as {xref-Clones-cloneDeterministicWithImmutableArgs-address-bytes-bytes32-}[cloneDeterministicWithImmutableArgs],
179207 * but with a `value` parameter to send native currency to the new contract.
180208 *
209+ * WARNING: This function does not check if `implementation` has code. A clone that points to an address
210+ * without code cannot be initialized. Initialization calls may appear to be successful when, in reality, they
211+ * have no effect and leave the clone uninitialized, allowing a third party to initialize it later.
212+ *
181213 * NOTE: Using a non-zero value at creation will require the contract using this function (e.g. a factory)
182214 * to always have enough balance for new deployments. Consider exposing this function under a payable method.
183215 */
0 commit comments