MulticallTarget

Git Source

Inherits: IMulticallTarget

Template for a contract that supports batched calls (preserving the msg.sender). Only calls with zero msg.value could be batched.

Functions

multicallNoResults

Perform a batched call to this contract, preserving the msg.sender. The return data from each call is discarded.

The method is non-payable, so only calls with msg.value == 0 could be batched. It's possible to ignore the reverts from the calls by setting the ignoreReverts flag. Otherwise, the whole batch call will be reverted with the original revert reason.

function multicallNoResults(bytes[] calldata data, bool ignoreReverts) external;

Parameters

NameTypeDescription
databytes[]List of abi-encoded calldata for the calls to perform.
ignoreRevertsboolWhether to ignore the revert errors from the calls.

multicallWithResults

Perform a batched call to this contract, preserving the msg.sender. The return data from each call is preserved.

The method is non-payable, so only calls with msg.value == 0 could be batched. It's possible to ignore the reverts from the calls by setting the ignoreReverts flag. Otherwise, the whole batch call will be reverted with the original revert reason.

function multicallWithResults(bytes[] calldata data, bool ignoreReverts) external returns (Result[] memory results);

Parameters

NameTypeDescription
databytes[]List of abi-encoded calldata for the calls to perform.
ignoreRevertsboolWhether to ignore the revert errors from the calls.

Returns

NameTypeDescription
resultsResult[]List of results from the calls: (success, returnData).

_bubbleRevert

Bubbles the revert message from the underlying call. Note: preserves the same custom error or revert string, if one was used. Source: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.2/contracts/utils/Address.sol#L143-L158

function _bubbleRevert(bytes memory returnData) internal pure;

Errors

MulticallTarget__UndeterminedRevert

error MulticallTarget__UndeterminedRevert();