Multicall.sol 605 B

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