Skip to content

Implement on-chain reputation scoring for payers and creators #349

Description

@Kingsman-99

Overview

Build a reputation system that tracks on-chain behaviour for addresses. Payers earn points for paying on time; creators earn points for invoices that successfully release. Reputation scores can be queried and used as optional gate conditions on future invoices.

Requirements

  • rep_key(address) storage key (persistent) storing RepScore { paid_on_time: u32, late_pays: u32, invoices_released: u32, invoices_refunded: u32 }
  • Update rep scores automatically on release (creator + payers) and refund (creator penalty)
  • get_rep(env, address) -> RepScore read function
  • Extend InvoiceOptions with optional min_payer_rep: Option<u32> — reject pay calls from addresses below threshold
  • Emit RepUpdated { address, score } event after each update
  • Write tests covering all rep update paths and the min_rep gate

Acceptance Criteria

  • Rep scores update correctly on release and refund
  • min_payer_rep gate rejects low-rep payers
  • get_rep returns correct accumulated scores
  • Storage snapshot updated for rep_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 Campaigncomplexity: highComplex feature requiring deep knowledge - 200 ptsfeatureNew contract feature or operationgrantfoxIssue for GrantFox program

    Type

    No type

    Fields

    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