Skip to content

Commit 8e4b683

Browse files
committed
explicitly marking calls to undeployed contract in Multicall.py with integers as contract function address.
1 parent 60e4190 commit 8e4b683

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

IceCreamSwapWeb3/Multicall.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import copy
22
from importlib.resources import files
3-
from time import sleep
43
from typing import Optional
54

65
import eth_abi
@@ -70,7 +69,7 @@ def add_undeployed_contract(self, contract_constructor: ContractConstructor):
7069
def add_undeployed_contract_call(self, contract_func: ContractFunction):
7170
assert self.undeployed_contract_constructor is not None, "No undeployed contract added yet"
7271
contract_func = copy.copy(contract_func)
73-
contract_func.address = self.undeployed_contract_address
72+
contract_func.address = 0 # self.undeployed_contract_address
7473
self.calls.append(contract_func)
7574

7675
def call(self, use_revert: Optional[bool] = None, batch_size: int = 1_000):
@@ -122,9 +121,9 @@ def _inner_call(
122121
try:
123122
raw_returns, gas_usages = self._call_multicall(
124123
multicall_call=multicall_call,
125-
retry=len(calls_with_calldata) == 1
124+
retry=False
126125
)
127-
except Exception:
126+
except Exception as e:
128127
if len(calls_with_calldata) == 1:
129128
try:
130129
raw_returns, gas_usages = self._call_multicall(
@@ -201,7 +200,8 @@ def _build_calldata(self, calls_with_calldata: list[tuple[ContractFunction, byte
201200

202201
encoded_calls = []
203202
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
205205

206206
# build multicall transaction
207207
multicall_call = self.multicall.functions.multicallWithGasLimitation(
@@ -227,7 +227,7 @@ def _build_constructor_calldata(
227227
previous_call_data = None
228228

229229
for call, call_data in calls_with_calldata:
230-
target = call.address
230+
target = call.address if call.address != 0 else "0x0000000000000000000000000000000000000000"
231231

232232
# Determine the flags
233233
flags = 0

0 commit comments

Comments
 (0)