draft-IERC7821.sol 1.7 KB

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