Skip to content

feat: add max_payment_amount guard to create_invoice — cap individual payment size #53

Description

@MarcusDavidG

Summary

Add an optional max_payment_amount: Option<i128> to InvoiceOptions that caps the maximum a single payer can contribute in one pay() call.

Motivation

Prevents whale dominance in partially-funded invoices and enables fair contribution mechanics for DAO treasury payments.

Proposed Change

  • Add max_payment_amount: Option<i128> to InvoiceOptions
  • Enforce cap in pay() with assert
  • Store in Invoice struct
  • Emit in invoice_created event

Acceptance Criteria

  • max_payment_amount stored in Invoice
  • pay() rejects amounts above cap
  • test: payment at cap succeeds
  • test: payment above cap panics
  • test: None cap allows any amount

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions