Bags.fm Resolution & Oracle
How Cupdiction automatically resolves Bags.fm prediction markets.
Oracle schedule
The oracle runs every 10 minutes after a market’s trading window closes. It continues retrying until the market settles.
Graduation market resolution
Check token status
Query Bags.fm API for the token’s current lifecycle status.
If MIGRATED — verify on-chain
Take the DAMM v2 pool address from the Bags.fm pool API and verify it exists via Helius getAccountInfo.
Settle or retry
- Both confirmed → Resolve YES
- Deadline passed, not graduated → Resolve NO
- API unavailable or pool key missing → Pending Recheck
- Pool key present but account missing on-chain → Needs Review
Both Bags.fm API and Helius on-chain verification must confirm graduation. API status alone is not sufficient.
Fee race resolution
Fetch current fees
Query Bags.fm lifetime-fees API for both Token A and Token B.
Compute deltas
delta_A = current_fees_A - start_fees_A
delta_B = current_fees_B - start_fees_BDetermine winner
delta_A > delta_B→ YES (Token A wins)delta_B > delta_A→ NO (Token B wins)delta_A == delta_B→ Needs Review
Settle
Run settle_market() on-chain with the outcome.
Pending Recheck
When an oracle attempt cannot confirm the outcome:
- Market status becomes
pending_recheck - Oracle retries on the next 10-minute cycle
- Continues until resolved or flagged for review
Common causes:
- Bags.fm API rate limit or downtime
- Helius RPC unavailable
- Fee API returning
nullfor one or both tokens
Needs Review
When the oracle detects a data conflict it cannot resolve automatically:
- Market status becomes
needs_review - Admin is notified
- Admin reviews
bags_resolution_snapshotslogs - Admin settles manually via admin API with documented evidence
This is rare and reserved for genuine conflicts — not just API delays (which use Pending Recheck).
Resolution snapshots
Every oracle attempt is logged. On any token detail page (/solana/bags/{mint}), you can see:
- Timestamp of each attempt
- What the Bags.fm API returned
- Whether on-chain verification passed
- The outcome and reason code
This creates a full audit trail. No resolution decision is hidden or undocumented.
Admin manual resolution
Admins can manually resolve via:
POST /api/admin/markets/{marketId}/resolve
{
"result": "YES" | "NO",
"reason": "documented justification"
}Manual resolution runs the same settle_market() on-chain RPC as the automatic oracle.