Multicall.sol 695 B

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