Support ERC-2612 (permit) for Gasless Token Approvals#17
Merged
Conversation
- Add createChannelWithPermit function for MuPay supporting EIP-2612 permit - Add createChannelWithPermit function for Multisig supporting EIP-2612 permit - Wrote tests for both schemes
4 tasks
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds EIP-2612 permit support for gasless token approvals in the MuPay and Multisig contracts and includes corresponding tests covering success, expired, and invalid signature cases.
- Implement
createChannelWithPermitin bothMuPayandMultisigto allow single-transaction channel creation with ERC-2612 permits. - Introduce
MockERC20inheritingERC20Permitfor testing permit flows. - Add comprehensive tests for permit success, expired signature, and invalid signer scenarios.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/multisig/CreateChannelWithPermit.sol | Added tests for Multisig.createChannelWithPermit. |
| test/CreateChannelWithPermit.t.sol | Added tests for MuPay.createChannelWithPermit. |
| test/mocks/MockERC20.sol | Created MockERC20 with ERC-2612 permit functionality. |
| src/Multisig_2of2.sol | Implemented createChannelWithPermit and imported IERC20Permit. |
| src/MuPay.sol | Implemented createChannelWithPermit, imported IERC20Permit, and wired up permit flow. |
Comments suppressed due to low confidence (3)
src/Multisig_2of2.sol:113
- The NatSpec for
createChannelWithPermitincludes duplicate@param durationand omits descriptions fordeadline,v,r, ands. Please update the comments to list each parameter once and include missing parameter descriptions.
* @param duration The channel lifetime in blocks (from current block).
test/multisig/CreateChannelWithPermit.sol:10
- The test contract name
CreateChannelERC20PermitTestis duplicated in another test file. Consider renaming one to avoid name collisions when running the test suite.
contract CreateChannelERC20PermitTest is Test, BaseTestHelper {
test/CreateChannelWithPermit.t.sol:12
- The test contract name
CreateChannelERC20PermitTestis duplicated in another test file. Consider renaming one to avoid name collisions when running the test suite.
contract CreateChannelERC20PermitTest is Test, BaseTestHelper {
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
createChannelWithPermittoMuPayandMultisigcontract to support ERC-2612 permit (gasless token approval)Impact
Enables one- transaction channel creation, improves UX for wallets and dApps, and aligns with modern token standards.
Closes #16