Nezha
  • 🏠Introduction to Nezha
  • How nezha works
    • Stake to Win
    • Nezha Epochs
    • Yield Farmer
  • Tickets
    • Stake per Ticket
    • Tickets
    • Bonus Tickets
    • Ticket Generation
  • The Draw
    • The Draw
    • Winning Sequence
    • No Draw Scenario
  • Prizes
    • Prize Tiers
    • Prizes
  • Fees
    • Staking
    • Unstaking
    • Claiming Prizes
  • Risks & Mitigations
    • Smart Contracts
    • Low Yield Returns
    • Negative Yield Returns
    • Tickets Outside Solana
    • Insurance Costs
  • Architecture
    • Overview
    • Game Contract
      • Epoch States
      • Token Accounts
      • State Accounts
      • Initialisation Instructions
      • State Transition Instructions
      • Other Instructions
      • Roles & Capabilities
      • Derived Account Roles
    • Draw Contract
      • State Accounts
      • Instructions
      • Roles & Capabilities
      • Derived Accounts
Powered by GitBook
  1. Architecture

Overview

Staking and the winning sequence

PreviousInsurance CostsNextGame Contract

Last updated 1 year ago

The Nezha game is managed with two contracts. The "" is used to manage all aspects of the Nezha game except the generation of the winning sequence.

A second contract, the "" is dedicated to drawing the winning sequence. This is achieved by an integration with , which is used as a source of Verifiable Randomness.

The Game Contract integrates with our , which is .

The Game Contract directly references Francium and the Draw Contract. The Draw Contract directly references Switchboard.

Splitting the contracts is considered good engineering practice as it provides better encapsulation and isolation. Consequently, contracts can be tested for correctness and safety more effectively.

Coordination between the Game and Draw contracts is managed using a background process, which is common practice. The purpose of the background process is to transition the epoch states however, epoch transitions are governed by the logic in the relevant contracts.

The background process also invokes the Draw Contract, however, the logic between the Game and Draw contract ensures that draws are issued after the epoch has transitioned into the finalising state.

Game Contract
Draw Contract
Switchboard
Yield Farmer
Francium