plan_multicall_batches

Documentation for eth_defi.event_reader.multicall_batcher.plan_multicall_batches function.

plan_multicall_batches(encoded_calls, batch_size, greylist_batch_size=1, greylist=frozenset({}))

Plan normal requests before contract-isolated greylisted requests.

The shared reader uses positions rather than addresses as result keys so duplicate inputs retain identity. Reviewed targets never share a physical request with robust targets or another greylisted contract. The caller supplies a policy for the selected chain; no chain-specific list is imported.

Parameters
  • encoded_calls (list[tuple[eth_typing.evm.HexAddress, bytes]]) – Ordered (target_address, encoded_calldata) tuples.

  • batch_size (int) – Positive normal maximum encoded subcalls per request.

  • greylist (frozenset[eth_typing.evm.HexAddress]) – Caller-selected target addresses for this chain, matched case-insensitively. Defaults to empty: readers never import or select chain-specific policies.

  • greylist_batch_size (int) – Positive isolated maximum subcalls; default one.

Returns

(greylisted, input_indexes) pairs in execution order. The boolean identifies the lane; indexes map outputs back to the original input.

Return type

Iterator[tuple[bool, list[int]]]