Skip to content

Commit 968efeb

Browse files
committed
chore: update multicall address
1 parent 016bb79 commit 968efeb

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

utils/web3_utils.py

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@
138138
]
139139

140140
MULTICALL_ADDRESS = (
141-
"0x5BA1e12693Dc8F9c48aAD8770482f4739bEeD696" # Ethereum mainnet address
141+
"0xcA11bde05977b3631167028862bE2a173976CA11" # Ethereum mainnet address
142142
)
143143
MULTICALL_ADDRESS_BY_CHAIN = {
144144
Chain.SWELL: "0xcA11bde05977b3631167028862bE2a173976CA11",
@@ -245,12 +245,28 @@ def multicall_by_address(
245245
result = []
246246
for i in range(0, len(aggregate_calls), batch_size):
247247
batch = aggregate_calls[i : i + batch_size]
248-
result.extend(
249-
call_with_retry(
250-
multicall_contract.functions.aggregate3(batch),
251-
block=block_identifier,
248+
249+
if allow_failure:
250+
# When allowing failures, catch contract reverts and return None for failed batches
251+
try:
252+
batch_result = call_with_retry(
253+
multicall_contract.functions.aggregate3(batch),
254+
block=block_identifier,
255+
)
256+
result.extend(batch_result)
257+
except Exception as e:
258+
print(
259+
f"Multicall batch failed, returning None for {len(batch)} calls: {e}"
260+
)
261+
# Return None for each call in the failed batch
262+
result.extend([(False, b"")] * len(batch))
263+
else:
264+
result.extend(
265+
call_with_retry(
266+
multicall_contract.functions.aggregate3(batch),
267+
block=block_identifier,
268+
)
252269
)
253-
)
254270

255271
decoded_results: List[Union[Tuple, None]] = []
256272
for i, call in enumerate(calls):

0 commit comments

Comments
 (0)