Skip to main content

Multicall

import "@thirdweb-dev/contracts/extension/Multicall.sol";

The Multicall smart contract is an extension usable with any base smart contract. It provides a function multicall to batch together multiple calls in a single external call.

Availability in base contracts

The Multicall extension is already available in the following base contracts:

  • All ERC20, ERC721 and ERC1155 base contracts.

Implementing the Contract

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@thirdweb-dev/contracts/extension/Multicall.sol";

contract MyContract is Multicall { ... }

Full API reference

multicall

function multicall(bytes[] calldata data) external virtual override returns (bytes[] memory results);
  • Receives and executes a batch of function calls on the contract.
  • Parameter data: The bytes data that makes up the batch of function calls to execute.
  • Return value results: The bytes data that makes up the result of the batch of function calls executed.