-
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
IERC3009interface and three new deposit methods leveraging authorization signatures - Generalizes signature-based validation by renaming permit-specific error and modifier names
- Extends the
DepositRecordedevent 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
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 🙏 |
Closes: #232 I used this: `git log f9b8844..HEAD --oneline --no-merges` (where the f9b88, is my best guess/estimate on which commit the previous contract on Calibration was published with based on the date posted in Slack). Changes called out in the changelog marked with ✅: - a91f5e6 (HEAD -> phi/prep-M3-release, origin/phi/prep-M3-release) build: prep Filecoin-Pay 0.6.0 release - ✅ f94ea2e (origin/main, origin/HEAD, main) feat: burn via precompile (#234) - ✅ c6b12da feat!: Update auction starting price to 0.5 FIL (#243) - ✅ 6a9c489 feat: add pagination to _getRailsForAddressAndToken (#237) - ✅ 8313e55 revert: "revert: "Anyone Can settleRail (#219)"" (#221) - ✅ a33b604 feat: Fee Auction (#229) - 477228d forge lint (#240) - b262e8f fix(ci): remove npm ci from publish-abis workflow (#236) - 16a7923 (tag: v0.5.0) build: prep v0.5.0 version of Filecoin-Pay (#230) - ✅ f990700 docs: add security audit to readme (#231) - e50e8b1 feat: add changelog-file to filecoin-pay (#226) - ✅ 3b298e4 IERC20 type, and label mapping keys (#225) - ✅ 3fba762 chore: charge network fee in settleRailInternal (#224) - ✅ 5a34645 feat: add support for ERC-3009 (#214) - ✅ 29726a3 Fix lack of networkFee settleTerminatedRailWithoutValidation (#223) - ✅ 2dcf206 revert: "Anyone Can settleRail (#219)" (#220) - 7eb9650 Anyone Can settleRail (#219) - ✅be3c91d feat: allow relayers to submit deposit transactions (#217)


Summary
Adds
ERC-3009deposit flows, event extensions, and tests.Changes
IERC3009.AuthTypeenum; extendDepositRecorded(token, from, to, amount, authType, nonce).PermitRecipientMustBeMsgSender→SignerMustBeMsgSender;validatePermitRecipient→validateSignerIsRecipient.depositWithAuthorization(...),depositWithAuthorizationAndApproveOperator(...),depositWithAuthorizationAndIncreaseOperatorApproval(...)MockERC20: implements ERC-3009.Notes
authorizationStateused for replay protectiondomain separationenforced by signatures.Closes #205