Skip to content

Policies: Make allowed recipients and amount fields optional#103

Merged
alberto-crossmint merged 2 commits intomainfrom
alb/change-allowed-signers
Mar 16, 2026
Merged

Policies: Make allowed recipients and amount fields optional#103
alberto-crossmint merged 2 commits intomainfrom
alb/change-allowed-signers

Conversation

@alberto-crossmint
Copy link
Contributor

@alberto-crossmint alberto-crossmint commented Mar 12, 2026

Make limit and allowed_recipients optional in TokenTransferPolicy

Changes both fields to Option<T> to enable cleaner semantics:

  • limit: None — no spending cap; no tracker created/maintained
  • allowed_recipients: None — any recipient allowed
  • allowed_recipients: Some([]) — explicit deny-all

Previously, empty/zero values were ambiguous. All other checks (token, expiration, recipients) still apply regardless of whether a limit is set.

Changes:

  • TokenTransferPolicy struct updated in smart-account-interfaces
  • on_add only initializes spend tracker when limit is Some
  • check_auth skips tracker logic when limit is None
  • Added tests for None-limit and Some([])-recipients behavior
  • Updated README example

@alberto-crossmint alberto-crossmint changed the title Policies: Make the allowed recipients field optional Policies: Make allowed recipients and amount fields optional Mar 16, 2026
@alberto-crossmint alberto-crossmint merged commit 0449db1 into main Mar 16, 2026
2 checks passed
@alberto-crossmint alberto-crossmint deleted the alb/change-allowed-signers branch March 16, 2026 18:20
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.

2 participants