-
Notifications
You must be signed in to change notification settings - Fork 12
feat: add support for ERC-3009 #214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for ERC-3009 deposit flows to the Payments contract, enabling meta-transactions and gasless deposits using cryptographic signatures. ERC-3009 provides an alternative to ERC-2612 permits by allowing transfers to be authorized via signatures without requiring on-chain approvals.
- Introduces
IERC3009
interface and three new deposit methods leveraging authorization signatures - Generalizes signature-based validation by renaming permit-specific error and modifier names
- Extends the
DepositRecorded
event to include authorization type and nonce for better tracking
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
test/mocks/MockERC20.sol |
Implements ERC-3009 functionality with transferWithAuthorization and receiveWithAuthorization methods |
test/helpers/PaymentsTestHelpers.sol |
Adds helper functions for ERC-3009 signature generation and test scenarios |
test/PaymentsEvents.t.sol |
Updates event emission tests to include new AuthType and nonce parameters |
test/DepositWithAuthorizationAndOperatorApproval.t.sol |
Comprehensive test coverage for ERC-3009 deposit flows with operator approval |
test/DepositWithAuthorization.t.sol |
Test coverage for basic ERC-3009 deposit functionality |
src/Payments.sol |
Core implementation of ERC-3009 deposit methods and interface definition |
src/Errors.sol |
Generalizes error naming from permit-specific to signature-based validation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Adding pull_request_target so PRs like #214 get automatically added to the board.
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## main #214 +/- ##
=======================================
Coverage ? 81.25%
=======================================
Files ? 2
Lines ? 480
Branches ? 100
=======================================
Hits ? 390
Misses ? 84
Partials ? 6
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
src/Payments.sol
Outdated
* @custom:constraint Operator must already be approved. | ||
*/ | ||
function depositWithAuthorizationAndIncreaseOperatorApproval( | ||
address token, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IERC3009 token
…tBeMsgSender and remove from arg from depositWithAuthorization
- Replace transferWithAuthorization with receiveWithAuthorization - Rename helper to getReceiveWithAuthorizationSignature and update all call sites - Align EIP-712 signing to token.domainSeparator() and fix revert expectations
Adding pull_request_target so PRs like FilOzone#214 get automatically added to the board.
I wonder why your merge looks like this ![]() Normally Github only shows the merge commit, not all of the commits in the other branch. Example How did you merge main in git? ![]() |
defebbc
to
6b025a9
Compare
@pali101 It seems like there is only three small nits that you need to address here, before we can merge this PR 🙏 |
Summary
Adds
ERC-3009
deposit flows, event extensions, and tests.Changes
IERC3009
.AuthType
enum; extendDepositRecorded(token, from, to, amount, authType, nonce)
.PermitRecipientMustBeMsgSender
→SignerMustBeMsgSender
;validatePermitRecipient
→validateSignerIsRecipient
.depositWithAuthorization(...)
,depositWithAuthorizationAndApproveOperator(...)
,depositWithAuthorizationAndIncreaseOperatorApproval(...)
MockERC20
: implements ERC-3009.Notes
authorizationState
used for replay protectiondomain separation
enforced by signatures.Closes #205