Skip to content

total_payouts_usd Over-counted Due to Duplicate AI Pot Payouts #573

@aunali8812

Description

@aunali8812

Summary

Production stats show:

  • total_donations_usd: $210,869.18
  • total_payouts_usd: $295,036.12

Payouts are higher than donations, which should never happen.

After investigation, donations appear correct, but payouts are over-counted by approximately $106,000 due to 4x duplicate payout records for the AI pot in the indexer database.


Environment

  • Frontend: potlock-nextjs-app
  • Backend: django-indexer
  • Production API: https://api.potlock.io
  • Date: Jan 19, 2026

Observed Behavior

From /v1/stats:

total_donations_usd: 210869.18
total_payouts_usd: 295036.12

yaml
Copy code

  • Payouts ($295k) > Donations ($210k)
  • This violates expected quadratic funding logic.

Root Cause

The issue is isolated to the pot:

  • ai.v1.potfactory.potlock.near

Blockchain vs indexer:

  • Blockchain: 20 payouts, 11,149 NEAR
  • Indexer: 80 payouts, 30,627 NEAR

The same payouts were indexed four times.
Other pots do not show this duplication.


Impact

AI pot over-counting:

  • Inflated AI pot payout USD: $141,256
  • Real AI pot payout USD: ~$35,314
  • Over-counted by: ~$105,942

Expected corrected totals:

  • total_donations_usd: $210,869 (unchanged)
  • total_payouts_usd: ~$189,094

After correction, donations > payouts.


Initial Assumption (Later Proven Incorrect)

It was initially thought that:

  • Donations with NULL total_amount_usd were not counted
  • Missing CoinGecko price mappings caused under-reporting

These were not the main cause.
The discrepancy was caused by duplicate payout indexing.


Fix Required

  • Remove duplicate PotPayout records for the AI pot
  • Investigate why AI pot payouts were indexed multiple times
  • Add a uniqueness constraint or deduplication logic
  • Recompute /v1/stats after cleanup
  • Verify payouts < donations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions