Skip to content

Implement N-of-M co-signer approval gate before invoice release #346

Description

@Kingsman-99

Overview

Some invoices require explicit approval from a set of co-signers before funds can be released — even if fully funded. Implement a configurable N-of-M multi-sig approval flow as part of InvoiceOptions.

Requirements

  • Extend InvoiceOptions with optional cosigners: Option<Vec<Address>> and cosigner_threshold: Option<u32>
  • Add approve_release(env, invoice_id, cosigner) entry point — records approval, checks if threshold reached
  • release must gate on co-signer approval when cosigners is set
  • Store approvals under cosign_key(invoice_id) with a Vec<Address> of approvers
  • Emit CosignerApproved event on each approval, CosignerThresholdReached when quorum met
  • Write tests: threshold met → release succeeds; threshold not met → release panics; non-cosigner call → panics; duplicate approval → panics

Acceptance Criteria

  • approve_release entry point implemented
  • Release correctly blocked until threshold is met
  • Non-cosigner callers are rejected
  • Duplicate approvals rejected
  • Storage snapshot updated for cosign_key
  • All existing tests pass
  • cargo test --workspace passes with zero failures
  • cargo clippy --all-targets -- -D warnings produces zero warnings

Definition of Done

All CI checks must pass before the PR is reviewed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official CampaignOfficial Campaign | FWC26Campaign: Official Campaign | FWC26complexity: highComplex feature requiring deep knowledge - 200 ptsfeatureNew contract feature or operationgrantfoxIssue for GrantFox program

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions