File tree Expand file tree Collapse file tree 2 files changed +26
-8
lines changed
Expand file tree Collapse file tree 2 files changed +26
-8
lines changed Original file line number Diff line number Diff line change @@ -278,7 +278,12 @@ def deploy_contract(
278278 """
279279 raise NotImplementedError ("deploy_contract is not implemented in the base class" )
280280
281- def fund_eoa (self , amount : NumberConvertible = 10 ** 21 , label : str | None = None ) -> EOA :
281+ def fund_eoa (
282+ self ,
283+ amount : NumberConvertible = 10 ** 21 ,
284+ label : str | None = None ,
285+ storage : Storage | None = None ,
286+ ) -> EOA :
282287 """
283288 Add a previously unused EOA to the pre-alloc with the balance specified by `amount`.
284289 """
Original file line number Diff line number Diff line change @@ -188,22 +188,35 @@ def deploy_contract(
188188 contract_address .label = label
189189 return contract_address
190190
191- def fund_eoa (self , amount : NumberConvertible = 10 ** 21 , label : str | None = None ) -> EOA :
191+ def fund_eoa (
192+ self ,
193+ amount : NumberConvertible = 10 ** 21 ,
194+ label : str | None = None ,
195+ storage : Storage | None = None ,
196+ ) -> EOA :
192197 """
193198 Add a previously unused EOA to the pre-alloc with the balance specified by `amount`.
194199
195200 If amount is 0, nothing will be added to the pre-alloc but a new and unique EOA will be
196201 returned.
197202 """
198203 eoa = next (self ._eoa_iterator )
199- if Number (amount ) > 0 :
200- super ().__setitem__ (
201- eoa ,
202- Account (
204+ if Number (amount ) > 0 or storage is not None :
205+ if storage is None :
206+ account = Account (
203207 nonce = 0 ,
204208 balance = amount ,
205- ),
206- )
209+ )
210+ else :
211+ # Type-4 transaction is sent to the EOA to set the storage, so the nonce must be 1
212+ account = Account (
213+ nonce = 1 ,
214+ balance = amount ,
215+ storage = storage ,
216+ )
217+ eoa .nonce = 1
218+
219+ super ().__setitem__ (eoa , account )
207220 return eoa
208221
209222 def fund_address (self , address : Address , amount : NumberConvertible ):
You can’t perform that action at this time.
0 commit comments