Skip to content

Conversation

@alexcos20
Copy link
Member

@alexcos20 alexcos20 commented Feb 12, 2026

Add ERC20Permit Support to Escrow Contracts

Summary

This PR adds ERC20Permit (EIP-2612) support to both Escrow and EnterpriseEscrow contracts, allowing users to deposit tokens without requiring a separate approval transaction. This improves user experience by reducing gas costs and transaction complexity.

Motivation

Currently, users must perform two transactions to deposit tokens into escrow:

  1. Approve the escrow contract to spend their tokens
  2. Call the deposit function

With ERC20Permit support, users can combine these into a single transaction by providing a permit signature, eliminating the need for a separate approval transaction. This reduces gas costs and improves the user experience, especially for users interacting with the escrow contracts frequently.

How It Works

  1. User signs a permit message off-chain (using EIP-712 structured data signing)
  2. User calls depositWithPermit with the signature parameters
  3. Contract calls permit on the token to approve itself
  4. Contract calls internal _deposit function to complete the deposit
  5. Same Deposit event is emitted as regular deposits

Security Features

  1. Reentrancy Protection: Uses nonReentrant modifier
  2. Signature Validation: ERC20Permit validates the signature automatically
  3. Deadline Checking: ERC20Permit checks that the deadline hasn't expired
  4. Safe Token Transfers: Uses SafeERC20 for all token operations
  5. Same Validation: Uses the same internal _deposit function as regular deposits

@alexcos20
Copy link
Member Author

WIP: deployments

@alexcos20 alexcos20 self-assigned this Feb 12, 2026
* This is a test utility contract that implements ERC20Permit for testing permit functionality.
*/
contract MockERC20Permit is ERC20, ERC20Permit {
uint8 private _decimals;

Check warning

Code scanning / Slither

State variables that could be declared immutable Warning

MockERC20Permit._decimals should be immutable
@alexcos20 alexcos20 added the Status: InProgress Work in progress, don't merge label Feb 12, 2026
@openzeppelin-code
Copy link

openzeppelin-code bot commented Feb 12, 2026

add permit to escrow contracts

Generated at commit: f977600b4b1fba3ccc98d9065de26444a853d908

🚨 Report Summary

Severity Level Results
Contracts Critical
High
Medium
Low
Note
Total
2
1
0
9
40
52
Dependencies Critical
High
Medium
Low
Note
Total
0
0
0
0
0
0

For more details view the full report in OpenZeppelin Code Inspector

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: InProgress Work in progress, don't merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant