Overview
Staking and the winning sequence
The Nezha game is managed with two contracts. The "Game Contract" is used to manage all aspects of the Nezha game except the generation of the winning sequence.
A second contract, the "Draw Contract" is dedicated to drawing the winning sequence. This is achieved by an integration with Switchboard, which is used as a source of Verifiable Randomness.
The Game Contract integrates with our Yield Farmer, which is Francium.
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.
Last updated