Skip to content

feat(contract): implement SEP-41 permit signature support#300

Open
mofejo1 wants to merge 2 commits intoceejaylaboratory:mainfrom
mofejo1:feat/250-sep41-permit
Open

feat(contract): implement SEP-41 permit signature support#300
mofejo1 wants to merge 2 commits intoceejaylaboratory:mainfrom
mofejo1:feat/250-sep41-permit

Conversation

@mofejo1
Copy link
Copy Markdown

@mofejo1 mofejo1 commented Apr 26, 2026

Closes #250

Summary

  • add permit function to token contract for off-chain signed allowance approvals
  • add permit_nonce getter and per (token_id, owner, spender) nonce tracking
  • enforce replay protection by requiring exact nonce match and incrementing nonce on success
  • enforce expiry protection using ledger timestamp deadline checks
  • emit permit event when permit approvals are applied

Security

  • replay attack prevention: nonce must match current stored nonce
  • permit expiration: rejects permits after deadline
  • no on-chain owner approval transaction needed; relies on Soroban auth entries via require_auth_for_args

Tests added

  • test_permit_sets_allowance_and_increments_nonce
  • test_permit_expired_panics
  • test_permit_replay_panics

Validation note

  • cargo test -p sep41-token is currently blocked by a pre-existing workspace manifest error unrelated to this change:
    • src/bridge/Cargo.toml references missing src/lib.rs

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Apr 26, 2026

@mofejo1 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

Contract: Implement SEP-41 permit signature support

1 participant