Multicall.sol 640 B

1234567891011121314151617181920212223
  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. * _Available since v4.1._
  8. */
  9. abstract contract Multicall {
  10. /**
  11. * @dev Receives and executes a batch of function calls on this contract.
  12. */
  13. function multicall(bytes[] calldata data) external 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. }