MulticallLib
Title: Multicall Library
Authors: David Dada <daveproxy80@gmail.com> (https://github.com/dadadave80), Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Multicall.sol)
Utility library for batching multiple calls to the same contract in one transaction.
Stateless utility library (no ERC-7201 storage slot, no initializer). Each call is executed
as a delegatecall from the calling contract's context, so it runs with the same storage, value,
and msg.sender as the outer call, and is routed through the Diamond's fallback dispatcher
(enabling cross-facet batching). Because every sub-call is a delegatecall, all batched calls are
attributed to the outer msg.sender.
Functions
multicall
Executes a batch of calls on the calling contract via delegatecall.
If any individual call reverts, the whole batch reverts with the same revert data.
function multicall(bytes[] calldata data) internal returns (bytes[] memory results);Parameters
| Name | Type | Description |
|---|---|---|
| data | bytes[] | An array of ABI-encoded calldata payloads to execute. |
Returns
| Name | Type | Description |
|---|---|---|
| results | bytes[] | An array of raw return bytes from each call, in the same order as data. |