1
1
import copy
2
2
from importlib .resources import files
3
- from time import sleep
4
3
from typing import Optional
5
4
6
5
import eth_abi
@@ -70,7 +69,7 @@ def add_undeployed_contract(self, contract_constructor: ContractConstructor):
70
69
def add_undeployed_contract_call (self , contract_func : ContractFunction ):
71
70
assert self .undeployed_contract_constructor is not None , "No undeployed contract added yet"
72
71
contract_func = copy .copy (contract_func )
73
- contract_func .address = self .undeployed_contract_address
72
+ contract_func .address = 0 # self.undeployed_contract_address
74
73
self .calls .append (contract_func )
75
74
76
75
def call (self , use_revert : Optional [bool ] = None , batch_size : int = 1_000 ):
@@ -122,9 +121,9 @@ def _inner_call(
122
121
try :
123
122
raw_returns , gas_usages = self ._call_multicall (
124
123
multicall_call = multicall_call ,
125
- retry = len ( calls_with_calldata ) == 1
124
+ retry = False
126
125
)
127
- except Exception :
126
+ except Exception as e :
128
127
if len (calls_with_calldata ) == 1 :
129
128
try :
130
129
raw_returns , gas_usages = self ._call_multicall (
@@ -201,7 +200,8 @@ def _build_calldata(self, calls_with_calldata: list[tuple[ContractFunction, byte
201
200
202
201
encoded_calls = []
203
202
for call , call_data in calls_with_calldata :
204
- encoded_calls .append ((call .address , 100_000_000 , call_data )) # target, gasLimit, callData
203
+ to_address = call .address if call .address != 0 else self .address
204
+ encoded_calls .append ((to_address , 100_000_000 , call_data )) # target, gasLimit, callData
205
205
206
206
# build multicall transaction
207
207
multicall_call = self .multicall .functions .multicallWithGasLimitation (
@@ -227,7 +227,7 @@ def _build_constructor_calldata(
227
227
previous_call_data = None
228
228
229
229
for call , call_data in calls_with_calldata :
230
- target = call .address
230
+ target = call .address if call . address != 0 else "0x0000000000000000000000000000000000000000"
231
231
232
232
# Determine the flags
233
233
flags = 0
0 commit comments