Multicall.sol 767 B

1234567891011121314151617181920212223
  1. // SPDX-License-Identifier: MIT
  2. // OpenZeppelin Contracts (last updated v4.9.0) (utils/Multicall.sol)
  3. pragma solidity ^0.8.19;
  4. import {Address} from "./Address.sol";
  5. /**
  6. * @dev Provides a function to batch together multiple calls in a single external call.
  7. */
  8. abstract contract Multicall {
  9. /**
  10. * @dev Receives and executes a batch of function calls on this contract.
  11. * @custom:oz-upgrades-unsafe-allow-reachable delegatecall
  12. */
  13. function multicall(bytes[] calldata data) external virtual returns (bytes[] memory results) {
  14. results = new bytes[](data.length);
  15. for (uint256 i = 0; i < data.length; i++) {
  16. results[i] = Address.functionDelegateCall(address(this), data[i]);
  17. }
  18. return results;
  19. }
  20. }