Skip to content

feat: add depositWithPermit for single-tx EIP-2612 deposits#77

Open
Tranquil-Flow wants to merge 1 commit into
devfrom
32-deposit-with-permit
Open

feat: add depositWithPermit for single-tx EIP-2612 deposits#77
Tranquil-Flow wants to merge 1 commit into
devfrom
32-deposit-with-permit

Conversation

@Tranquil-Flow
Copy link
Copy Markdown

Summary

Adds depositWithPermit() enabling single-transaction deposits using EIP-2612 permit signatures — no separate approve() tx needed.

Changes

  • SafetyNet.sol: New depositWithPermit(id, value, deadline, v, r, s) function
    • Imports IERC20Permit
    • Detects onboarding vs regular deposit to set correct permit amount
    • Calls IERC20Permit.permit() then delegates to existing _deposit()
  • ISafetyNet.sol: Interface declaration with NatSpec
  • MockERC20Permit.sol: New test mock (ERC20 + ERC20Permit)

Testing

3 new tests: onboarding via permit, regular epoch deposit via permit, expired deadline revert. All 100 tests pass.

Note: If #46 (_msgSender) lands first, msg.sender in the permit function should be updated to _msgSender().

Closes #32

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.

Automated ERC20 Allowance-Based Deposits and Batch Account Abstraction

1 participant