Skip to content

Support ERC-2612 (permit) for Gasless Token Approvals#17

Merged
pali101 merged 4 commits intomainfrom
feat/erc-2612-support
Jul 6, 2025
Merged

Support ERC-2612 (permit) for Gasless Token Approvals#17
pali101 merged 4 commits intomainfrom
feat/erc-2612-support

Conversation

@pali101
Copy link
Collaborator

@pali101 pali101 commented Jul 6, 2025

Summary

  • Added createChannelWithPermit to MuPay and Multisig contract to support ERC-2612 permit (gasless token approval)
  • Wrote tests covering success, invalid signature, and non-permit token cases

Impact

Enables one- transaction channel creation, improves UX for wallets and dApps, and aligns with modern token standards.

Closes #16

pali101 added 3 commits July 6, 2025 21:14
- Add createChannelWithPermit function for MuPay supporting EIP-2612 permit
- Add createChannelWithPermit function for Multisig supporting EIP-2612 permit
- Wrote tests for both schemes
@pali101 pali101 linked an issue Jul 6, 2025 that may be closed by this pull request
4 tasks
@pali101 pali101 requested a review from Copilot July 6, 2025 19:28
Copy link
Contributor

Copilot AI left a 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 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 createChannelWithPermit in both MuPay and Multisig to allow single-transaction channel creation with ERC-2612 permits.
  • Introduce MockERC20 inheriting ERC20Permit for 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 createChannelWithPermit includes duplicate @param duration and omits descriptions for deadline, v, r, and s. 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 CreateChannelERC20PermitTest is 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 CreateChannelERC20PermitTest is 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>
@pali101 pali101 merged commit 3cc49cc into main Jul 6, 2025
2 checks passed
@pali101 pali101 deleted the feat/erc-2612-support branch July 6, 2025 19:31
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.

Feature: Support ERC-2612 (permit) for Gasless Token Approvals

1 participant