Skip to content

Add invoice creation deposit slashing for spam prevention #196

Description

@Kingsman-99

Label: complexity: high
Points: 200

Description

creation_fee goes straight to treasury and is never returned, but there's no refundable deposit mechanism that gets slashed only on bad behavior (e.g. creating an invoice that's cancelled within minutes). This issue adds an optional refundable anti-spam deposit.

Technical Context

Involves lib.rsset_spam_deposit(env, admin, amount: i128, min_age_secs: u64); create_invoice() charges the deposit into contract custody; cancel_invoice() returns it only if now - created_at >= min_age_secs, otherwise it's slashed to treasury.

Acceptance Criteria

  • Deposit is charged in addition to creation_fee, held by the contract (not treasury) until resolved
  • Cancelling after min_age_secs returns the full deposit to the creator
  • Cancelling before min_age_secs sends the deposit to treasury instead
  • Deposit of 0 (default) disables the feature entirely
  • Test: early cancel slashes deposit to treasury, late cancel refunds creator
  • All existing cargo tests pass
  • cargo clippy passes with zero warnings

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programcomplexity: highComplex feature requiring deep knowledge - 200 pts

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions