Events & Errors
Events
The contract defines 13 events.
| Event | Emitted when |
|---|---|
GameStarted(uint256 indexed gameId, uint256 entryAmount, uint256 grandPrizeLogBase, uint256 viralityBonusLogBase, uint256 deadline, uint256 grandPrizeProportion, uint256 viralityBonusProportion, uint256 depositFeeBps, uint256 minTicketsBeforeEnd) |
A new game starts. The full locked config is included. |
GameEntered(uint256 indexed gameId, address indexed entrant, uint256 entryAmount, uint256 entrantCount, uint256 timestamp, uint256 num_winners, uint256 prizePool, uint256 num_entries) |
Per successful entry transaction. entrantCount is the post-entry total, so the IDs assigned to this tx are the contiguous range (entrantCount - num_entries + 1) … entrantCount. entryAmount here is the effective ETH contributed in this tx. |
GameConfigUpdated(uint256 entryAmount, uint256 deadline, uint256 grandPrizeLogBase, uint256 viralityBonusLogBase, uint256 grandPrizeProportion, uint256 viralityBonusProportion, uint256 depositFeeBps, uint256 minTicketsBeforeEnd) |
Host updates nextGameConfig. The values shown apply to the next game. |
EntryRefunded(address indexed entrant, uint256 refundAmount) |
msg.value % entryAmount of dust refunded to the sender. |
PrizeRecipientSet(uint256 indexed gameId, uint256 indexed entrantId, address indexed payer, address recipient) |
Once per overridden entry, when fallback() was used. |
PrizeClaimed(uint256 indexed gameId, uint256 indexed entrantId, uint256 prize) |
Grand-prize claim succeeded; prize was sent to getPrizeRecipient(gameId, entrantId). |
ClaimedAdoptionBonus(uint256 indexed game_id, address indexed recipient, uint256 indexed entrant_id, uint256 cohort_id, uint256 prize) |
Adoption-bonus claim succeeded. |
AdoptionBonusTransferFailed(uint256 indexed gameId, address indexed recipient, uint256 indexed entrantId, uint256 cohortId, uint256 prize) |
Within batchClaimAdoptionBonusPrize, a single recipient transfer failed (gas-cap exceeded or recipient reverted). The batch continues processing other claims; the failed claim is not marked as paid and can be retried. |
DepositFeeCollected(uint256 indexed gameId, address indexed payer, uint256 feeAmount, uint256 poolContribution) |
Per successful deposit when feeAmount > 0. |
DepositFeesWithdrawn(address indexed host, uint256 amount) |
Host swept accruedDepositFees. Always emitted (even when amount is 0). |
HostTransferInitiated(address indexed currentHost, address indexed pendingHost) |
Step 1 of two-step host transfer. |
HostTransferCompleted(address indexed oldHost, address indexed newHost) |
Step 2 — the pending host accepted. |
HostTransferCancelled(address indexed cancelledPendingHost) |
Current host aborted a pending transfer. |
Note: clearLeftoverAdoptionBonus does not emit a dedicated event; it
sweeps the last cohort's pool via an internal ETH transfer only.
Custom errors
The contract defines 24 custom errors. All require strings have been
replaced with these gas-efficient reverts.
Access control
| Error | Cause |
|---|---|
OnlyHost |
Non-host called a host-only function (setNextGameConfig, clearLeftoverAdoptionBonus, withdrawDepositFees, initiateHostTransfer, cancelHostTransfer), or a non-host sent ETH while the game was over |
NoPendingHostTransfer |
acceptHostTransfer or cancelHostTransfer called when no transfer is pending |
NotPendingHost |
Someone other than pendingHost called acceptHostTransfer |
InvalidHostAddress |
initiateHostTransfer called with address(0) |
Entry validation
| Error | Cause |
|---|---|
NoValidEntries |
msg.value < entryAmount (sender did not pay for at least one entry) — reverts before fee computation |
InvalidRecipientCalldata |
fallback() invoked with msg.data.length != 20 |
InvalidPrizeRecipient |
fallback() decoded a recipient of address(0) |
Configuration validation
| Error | Cause |
|---|---|
ZeroProportions |
Constructor or setNextGameConfig called with grandPrizeProportion + viralityBonusProportion == 0 |
LogBaseMustBeGreaterThanOne |
Either log base set to 0 or 1 (also thrown by log/safePow helpers with base <= 1) |
EntryAmountMustBePositive |
entryAmount == 0 |
DeadlineMustBeInFuture |
deadline <= 1 |
DepositFeeTooHigh |
depositFeeBps > MAX_DEPOSIT_FEE_BPS (1000) |
Claim validation
| Error | Cause |
|---|---|
NotAWinner |
claimPrize called for a ticket that did not land a Power Slot (does not match the winner formula) |
IneligibleEntrantId |
claimPrize called with _entrantId == 0 or _entrantId > entrantCount |
GameNotFinished |
Grand-prize or leftover claim attempted before the game is over (referenced game still active, or future game id) |
CanOnlyClaimOnce |
Grand prize already claimed for this (gameId, entrantId) |
AlreadyClaimed |
clearLeftoverAdoptionBonus called again after the leftover was already swept |
IneligibleCohort |
Adoption bonus cohort/entrant pair fails isQualifiedAdoptionBonus (single-claim path; the batch path silently skips ineligible items) |
CohortIdTooLow |
getAdoptionBonusPrizePerTeam called with _cohortId <= 1 |
Reserved / declared errors
These errors are declared in the contract's error set. OnlyActiveOrPastGames
and OnlySurpassedCohorts describe ineligible game/cohort references.
| Error | Meaning |
|---|---|
OnlyActiveOrPastGames |
References a game that does not exist yet |
OnlySurpassedCohorts |
Claiming from a cohort that has not been surpassed |
CannotCalculateLogOfZero |
log called with x == 0 |
ExponentiationOverflow |
safePow would overflow uint256 |
Misc
| Error | Cause |
|---|---|
EtherTransferFailed |
.call{value:} returned false in the single-claim path, in claimPrize, in withdrawDepositFees, in clearLeftoverAdoptionBonus, or on a dust refund |
Indexer / subgraph notes
Recommended indexed fields if building a subgraph or off-chain indexer:
GameStartedandGameConfigUpdatedcarry the full per-game config — index both, but treatGameStartedas the source of truth (the rates inGameConfigUpdatedapply only to the next-started game).GameEnteredis the canonical per-tx record; combine with the call'sto == fallback()check to detect cold-wallet entries (or just listen forPrizeRecipientSet).AdoptionBonusTransferFailedindicates a recipient that needs the single-claim path — surface it to the user as a "retry" affordance rather than a failure.