bandforband.fun docs
Security & control

Settlement

How a contest is settled on-chain, the limits the program enforces, and how to verify a result yourself.

What the program checks

When the settler settles a contest, the wagers program enforces:

  • Payouts go to entrants only. The winning side is a set of seats of that contest. Their payouts are claimed into their own vaults.
  • The rake is capped. The fee cannot exceed the tier stored on the contest when it was created, and no tier can exceed the program's hard cap of 10 percent.
  • Payouts add up. The rake, the winners' payouts and the rounding remainder always add up to exactly the pot. Winners on a side get equal payouts, and the remainder (less than one micro-USDC per winning seat) goes to the treasury. In tournaments, the remainder goes to first place.
  • One settlement. A settled contest cannot be settled again.

A tie refunds every stake with no fee.

Result hashes

Each settlement commits a result_hash on-chain, in the ContestSettled event of the settle transaction. It is the SHA-256 of the full scoring breakdown: every trade, quote and rule decision that produced the result, serialized as canonical JSON (sorted keys, integers as strings).

The breakdown is public once the contest settles. You can re-hash it and compare:

Get the breakdown and the hash from the API:

# API is the bandforband.fun API origin the app talks to.
curl -G "$API/trpc/contests.result" \
  --data-urlencode 'input={"json":{"contestId":"<contest id>"}}'

Read the ContestSettled event of the settleTx returned above (in any Solana explorer, or by decoding the transaction logs with the program IDL) and check that its result_hash equals resultHash.

Re-hash the breakdown with the same canonical JSON rules:

import { verifyBreakdown } from '@wagers/scoring'

verifyBreakdown(result.breakdown, result.resultHash) // true

If the hash matches, the published breakdown is exactly what the result was based on, and you can check every number in it against the chain.

When scoring is not clean

  • A result flagged by anti-cheat, or a scoring outage, is not settled automatically. In duels, players can self-report for 30 minutes. Matching reports settle; anything else becomes a dispute.
  • Staff resolve disputes by picking a winner, a draw or a refund. The decision is hashed and committed like any other result.

The timeout refund

If a contest is still not settled 7 days after it ends, anyone can call cancel on it. The program marks it cancelled and every entrant can claim their full stake back into their vault. This works even if the bandforband.fun servers are gone. The program refuses a timeout shorter than 24 hours.

On this page