Skip to content

[ETHEREUM-CONTRACTS] ClearMacro forwarder (+ Permit2 variant)#2148

Open
d10r wants to merge 39 commits intodevfrom
2026-03-permit2_and_macro
Open

[ETHEREUM-CONTRACTS] ClearMacro forwarder (+ Permit2 variant)#2148
d10r wants to merge 39 commits intodevfrom
2026-03-permit2_and_macro

Conversation

@d10r
Copy link
Copy Markdown
Collaborator

@d10r d10r commented Mar 9, 2026

Summary

Introduces a ClearMacro Forwarder that runs macros via EIP-712 signed payloads (action + security). Includes an optional Permit2 variant for flows where the user also transfers/upgrades tokens in the same signature.

ClearMacro Forwarder

  • Contract: ClearMacroForwarder — executes macros on behalf of a signer. Payload: macro-specific action (opaque; macro defines EIP-712 type/struct hash) and security (domain, provider, validity window, ERC-4337-style nonce).
  • Flow: Relayer or signer calls runMacro(macro, params, signer, signature). Forwarder verifies signature, validates validity window and nonce, enforces provider ACL, then runs the macro.
  • Interfaces: IClearMacroForwarder (payload, runMacro, encodeParams, type getters), IClearMacro (extends IMacro with EIP-712 metadata: getPrimaryTypeName, getActionTypeDefinition, getActionStructHash).
  • Scripts for deployment and macro-provider ACL; Foundry tests for signature, nonce, validity, provider checks and encoding.

Permit2 variant (optional)

  • Contract: Permit2ClearMacroForwarder — same ClearMacro payload, bound via Permit2 witness; entrypoint runPermit2AndMacro(...).
  • Use case: One signature: pull via Permit2 → optional upgrade to SuperToken (forwarder) → run macro. For users who already have a Permit2 allowance.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 9, 2026

Changelog Reminder

Reminder to update the CHANGELOG.md for any of the modified packages in this PR.

  • CHANGELOG.md modified
  • Double check before merge

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 10, 2026

Codecov Report

❌ Patch coverage is 98.65772% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...-contracts/contracts/utils/BlindMacroForwarder.sol 66.66% 1 Missing ⚠️
...ntracts/utils/ClearMacroForwarderV1WithPermit2.sol 98.14% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@d10r d10r changed the base branch from 2026-01-only712 to dev March 17, 2026 11:22
@d10r d10r changed the title Add variant of Only712MacroForwarder which can be used via Permit2 witness [ETHEREUM-CONTRACTS] ClearMacro forwarder (+ Permit2 variant) Mar 17, 2026
@hellwolf
Copy link
Copy Markdown
Contributor

image

@hellwolf
Copy link
Copy Markdown
Contributor

image

@d10r d10r marked this pull request as ready for review March 28, 2026 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants