Skip to content

feat: add support for ERC3009, ERC2612, and Permit2 token transfers#1023

Draft
levalleux-ludo wants to merge 6 commits into
mainfrom
1021-executeMetaTransactionWithTokenTransferAuthorization
Draft

feat: add support for ERC3009, ERC2612, and Permit2 token transfers#1023
levalleux-ludo wants to merge 6 commits into
mainfrom
1021-executeMetaTransactionWithTokenTransferAuthorization

Conversation

@levalleux-ludo
Copy link
Copy Markdown
Member

closes #1021

This pull request introduces support for ERC-3009, ERC-2612, and Permit2 token authorization flows in the deployment scripts and end-to-end tests. It adds deployment logic for mock versions of these tokens, updates the test suite to verify their integration, and refactors token deployment for maintainability. Additionally, it expands the available test accounts and updates contract deployment configuration.

Token Support and Deployment Enhancements:

  • Added deployment scripts for MockERC2612Token, MockERC3009Token, and MockPermit2, and included them in the Hardhat deployment configuration (contracts/scripts/deploy-other-tokens.js, contracts/hardhat.config.js, contracts/scripts/deploy.js). [1] [2] [3] [4]
  • Refactored deployment logic to consolidate token deployments into a single script and removed the now-unnecessary deploy-weth.js (contracts/scripts/deploy-other-tokens.js, contracts/scripts/deploy-weth.js, contracts/scripts/deploy.js). [1] [2] [3]

End-to-End Test Improvements:

  • Added comprehensive tests for ERC-3009 and ERC-2612 token flows, including EIP-712 typed data signing and verification, and a placeholder for Permit2 tests (e2e/tests/core-sdk-token-auth.test.ts).
  • Updated test utilities to provide addresses for the new mock tokens and to include the new test account (e2e/tests/utils.ts). [1] [2]

Accounts and Configuration:

  • Added ACCOUNT_25 to the test accounts and included it in all relevant exports and arrays (contracts/accounts.js). [1] [2] [3]
  • Updated the Docker Compose configuration to use a new build of the protocol node (e2e/docker-compose.yml).

… ABIs

- Introduced MockERC3009Token.json and MockPermit2.json to provide mock implementations for ERC3009 and Permit2 functionalities.
- Updated index.ts to export new ABIs for MockERC3009Token and MockPermit2.
- Enhanced core-sdk to support signing of ERC3009 authorization with new functions in handler.ts and mixin.ts.
- Added tests for ERC3009 authorization signing in handler.test.ts and mixin.test.ts to ensure correct functionality and data structure.
@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.59%. Comparing base (3a59b65) to head (6170944).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1023      +/-   ##
==========================================
+ Coverage   91.49%   91.59%   +0.10%     
==========================================
  Files         179      179              
  Lines        7451     7544      +93     
  Branches     1433     1458      +25     
==========================================
+ Hits         6817     6910      +93     
  Misses        634      634              
Flag Coverage Δ
common 92.73% <100.00%> (+0.14%) ⬆️
core-sdk 63.22% <100.00%> (+0.59%) ⬆️
e2e 85.21% <82.79%> (-0.04%) ⬇️
eth-connect-sdk 95.06% <ø> (ø)
ethers-sdk 74.45% <ø> (ø)
ipfs-storage 91.75% <ø> (ø)
metadata 94.70% <ø> (ø)
unittests 66.45% <100.00%> (+0.49%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

… types

- Introduced `UnsignedTransferAuthorization` and `TransferAuthorization` types to standardize authorization structures.
- Updated functions `signReceiveWithErc3009Authorization`, `signReceiveWithErc2612Permit`, and `signReceiveWithPermit2` to return `TransferAuthorization` objects instead of specific signed types.
- Implemented `encodeTransferAuthorizationEntry` and `encodeTransferAuthorizationQueue` to handle encoding of multiple authorization strategies.
- Modified `relayMetaTransaction` and related mixins to support transfer authorizations in meta transactions.
- Updated tests to reflect changes in return types and ensure proper encoding of authorization data.
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.

support new meta-transaction with authorizatoin (executeMetaTransactionWithTokenTransferAuthorization)

1 participant