PolyFrog

Mechanism

Opening, betting, closing, settling.

A market has four moments: it opens, it takes stakes, it closes, and it settles.

Opening

Anyone may call open(auction) on any auction, once. It is refused if the auction is already over, or if it has already graduated — in both cases there is nothing left to have an opinion about.

The market records the auction’s end block as its own. PolyFrog never invents a deadline; it inherits the auction’s.

Betting

bet(id, yes) takes ETH and assigns it to a side. Before it accepts anything it checkpoints the auction and checks the outcome is still open. A bet is refused when:

  • the auction has graduated — the answer is already known;
  • the end block has passed — the auction is over;
  • the stake is below the minimum or above the per-stake cap.

Closing

There is no separate closing transaction. The market is open exactly as long as the outcome is genuinely unknown: until graduation, or until the end block, whichever comes first. This is enforced inside bet() rather than announced in advance, because the closing moment is not knowable ahead of time.

Settling

After the end block, anyone can call resolve(id). It:

  1. checkpoints the auction if it is not already finalised at its end block;
  2. refuses to continue unless lastCheckpointedBlock == endBlock — no settling on stale state;
  3. voids the market if either side is empty, since a one-sided pool has no counterparty;
  4. otherwise reads isGraduated() and records the outcome permanently.

The escape hatch

An auction that never received its token supply can never be checkpointed, and would otherwise strand stakes forever. If a market cannot be finalised for roughly a day of blocks after its end, anyone may call voidStuck(id) and every bettor takes their money back.

Nothing here is privileged

Opening, betting, resolving, voiding and claiming are all callable by anyone. The owner key can change the fee (capped at 5%), the treasury and the $FROG discount. It cannot touch a market, a position, or your stake.