Documentation

Cliques Games (Technicals)

This is the core engine: highly composable, scalable, and built to run real economic gameplay with strong safety, no custody, and real-time feedback loops. Below are the key technical pillars you need to understand.


Scalability & Expiry / Cleanup

Cliques games are designed to scale without state bloat or stale garbage:

  • Game Expiry: Games that are created but never started can be cleaned up after a fixed window (cleanup period, e.g., 1 hour). This prevents orphaned state from accumulating.
  • On-chain Cleanup Methods: Anyone can invoke cleanup_expired_game; expired unstarted games are safely removed, associated token accounts closed if empty, and factory tracking updated. Incentivized cleaners receive rent back, making cleanup permissionless and self-maintaining.
  • Factory-Level Garbage Collection: Bulk operations like clear_all_games and targeted force_close_game allow efficient pruning or emergency teardown of game state with validation and safety guards.

Streamflow Vesting Handoff (Zero Custody)

Winners funds are never custodial—ownership and vesting are enforced with Streamflow streams:

  • Permissionless Claim: After game finalization, the winner (or any claimer) triggers claim_winnings. The on-chain flow:
    1. Vault remains under PDA control throughout; no authority handoff.
    2. Entire winner pot is transferred to an intermediate ATA.
    3. Streamflow is invoked to create a vesting stream for the actual winner.
  • Safe Fee Handling: Streamflow fee is calculated transparently; the winner receives a streamed amount over time, preventing immediate dumps while locking belief.
  • Royalty Separation: Creator royalty is carved out first (if configured) before vesting is established, maintaining clear economic flows.
  • Immutable Vesting Terms: Vesting parameters (duration, periodicity, transferability flags, etc.) are encoded into the Streamflow stream; once live, they guarantee the locked outcome without further intervention.

Game Mechanics Customizability

Cliques exposes a powerful yet auditable parameter set so creators can tailor economic behavior:

  • Configurable Split: Per-game percentages for vault (winner pot), burn (deflation), and rewards (stakers) must sum to 100. Minimum guardrails (e.g., minimum rewards percentage) prevent degenerate misconfigurations.
  • Initial & Incremental Pricing: initial_click_amount and click_increment define the rising cost curve—enabling “U-shaped” or purely parabolic ROI dynamics based on creator intent.
  • Royalty Control: Creators choose a small royalty (0-5%) to earn from the final pot, rewarding early pioneers without undermining game virality.
  • Stream Duration: Games define how long winner vesting spans; flexible between defined bounds (e.g., 3 days to 365 days), shaping belief and sell-pressure control.
  • Whitelist & Fee Waivers: Optional whitelist logic allows selected creators to bypass creation fees, enabling curated or partner-driven distribution models.

PDA Write Contention & Priority Fee Protection

High-concurrency environments (many users clicking near-simultaneously) are mitigated with economic and technical defenses:

  • Priority Fee Incentivization (e.g., via Jito): Users can submit priority-fee-bearing transactions to win race conditions for click execution. Because each click directly impacts pot USD value, actors are economically motivated to pay for priority—reducing harmful front-running and preventing griefing.
  • PDA Contention Mitigation: Critical account writes (game state, vault updates) are serialized via predictable PDA seeds (GAME_AUTH_SEED, vault seeds), and clients are expected to include slippage protection (expected_price) to ensure state coherence.
  • Economic Disincentive to Grief: Attempting to spam or disrupt requires paying click costs plus any priority fee—while meaningful upside is only earned by genuine participation. This raises the economic floor for abuse.
  • Real-Time Extensions: Each valid click extends the endgame timer (EXTENSION_TIME), keeping competitive dynamics fluid while incorporating safe math and overflow guards to prevent manipulation.

No Custody, Transparent Events, and Auditability

  • Events: Structured events (GameCreatedEvent, GameFinalizedEvent, GameCompletedEvent, cleanup/whitelist events) emit rich metadata for indexers, UIs, and on-chain analytics.
  • Factory Statistics: Aggregated metrics (total games created, SPL locked, active games) are queryable without trusting off-chain infrastructure.
  • Immutable Game State: Core game parameters, provenance (creator, royalty, creation timestamp), and lifecycle flags live in GameState. Finalization and claiming require explicit state transitions, preventing silent rewrites.

Summary

Cliques Games combine:

  • Scalable lifecycle management (expiry + cleanup),
  • Trustless reward delivery (Streamflow vesting with no custody),
  • Deep customizability (split curves, pricing, royalties, durations),
  • Robust anti-grief and contention mechanics (priority fees and slippage checks),
  • Full transparency and auditability through eventing and canonical state.

This makes it a live, programmable engine for commitment, scarcity, and community-driven virality—engineered for real economic gameplay, not passive distribution.