IERC7821.sol 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.0;
  3. /**
  4. * @dev Interface for minimal batch executor.
  5. */
  6. interface IERC7821 {
  7. /**
  8. * @dev Executes the calls in `executionData`.
  9. * Reverts and bubbles up error if any call fails.
  10. *
  11. * `executionData` encoding:
  12. * - If `opData` is empty, `executionData` is simply `abi.encode(calls)`.
  13. * - Else, `executionData` is `abi.encode(calls, opData)`.
  14. * See: https://eips.ethereum.org/EIPS/eip-7579
  15. *
  16. * Supported modes:
  17. * - `bytes32(0x01000000000000000000...)`: does not support optional `opData`.
  18. * - `bytes32(0x01000000000078210001...)`: supports optional `opData`.
  19. *
  20. * Authorization checks:
  21. * - If `opData` is empty, the implementation SHOULD require that
  22. * `msg.sender == address(this)`.
  23. * - If `opData` is not empty, the implementation SHOULD use the signature
  24. * encoded in `opData` to determine if the caller can perform the execution.
  25. *
  26. * `opData` may be used to store additional data for authentication,
  27. * paymaster data, gas limits, etc.
  28. *
  29. * For calldata compression efficiency, if a Call.to is `address(0)`,
  30. * it will be replaced with `address(this)`.
  31. */
  32. function execute(bytes32 mode, bytes calldata executionData) external payable;
  33. /**
  34. * @dev This function is provided for frontends to detect support.
  35. * Only returns true for:
  36. * - `bytes32(0x01000000000000000000...)`: does not support optional `opData`.
  37. * - `bytes32(0x01000000000078210001...)`: supports optional `opData`.
  38. */
  39. function supportsExecutionMode(bytes32 mode) external view returns (bool);
  40. }