@@ -206,6 +206,7 @@ def deploy(
206206 initialization_payable_value : int = 0 ,
207207 sender_protection : bool = True ,
208208 redeploy_protection : bool = True ,
209+ init_args : bytes | None = None ,
209210 ** txn_args ,
210211 ) -> "ContractInstance" :
211212 if not isinstance (create_type , CreationType ):
@@ -216,13 +217,13 @@ def deploy(
216217 if salt is not None :
217218 raise RuntimeError ("`salt=` is not supported for CREATE" )
218219
219- if deployment_payable_value or initialization_payable_value :
220+ if init_args or deployment_payable_value or initialization_payable_value :
220221 deployment_fn = self .contract .deployCreateAndInit
221222 args = [
222223 # Initcode for contract
223224 Contract .constructor .serialize_transaction (* constructor_args ).data ,
224225 # Post-deploy init args for contract
225- b"" ,
226+ init_args or b"" ,
226227 # Payable values to use for deployment and initialization
227228 (deployment_payable_value , initialization_payable_value ),
228229 ]
@@ -235,13 +236,13 @@ def deploy(
235236 ]
236237
237238 case CreationType .CREATE2 :
238- if deployment_payable_value or initialization_payable_value :
239+ if init_args or deployment_payable_value or initialization_payable_value :
239240 deployment_fn = self .contract .deployCreate2AndInit
240241 args = [
241242 # Initcode for contract
242243 Contract .constructor .serialize_transaction (* constructor_args ).data ,
243244 # Post-deploy init args for contract
244- b"" ,
245+ init_args or b"" ,
245246 # Payable values to use for deployment and initialization
246247 (deployment_payable_value , initialization_payable_value ),
247248 ]
0 commit comments