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
On this page
  • [Admin] CreateEpoch
  • [Admin] YieldWithdrawByInvestor / [Admin] FranciumInvest
  • [Investor] YieldDepositByInvestor / [Admin] FranciumWithdrawInvestment
  • [Admin] CreateEpochWinnersMeta
  • [Admin] PublishEpochWinnersPage
  1. Architecture
  2. Game Contract

State Transition Instructions

[Role] Instruction

[Admin] CreateEpoch

  • LatestEpoch.index += 1

  • Create new Epoch account with index=LatestEpoch.index

  • Epoch.state = CREATED

[Admin] YieldWithdrawByInvestor / [Admin] FranciumInvest

  • Epoch.total_invested = DepositVault.amount

  • Transfer the contents of Deposit Vault to Investor's USDC ATA or into the Francium protocol.

  • Epoch.state = YIELDING

[Investor] YieldDepositByInvestor / [Admin] FranciumWithdrawInvestment

  • Move funds from Investor's USDC ATA or the Francium protocol back into our program.

  • If return < deposit:

    • Move all of the returns into DepositVault

    • cumulative_return_rate *= return/deposit

    • Epoch.draw_enabled = false

  • Else, If there is enough money to pay jackpot insurer:

    • Epoch.draw_enabled = true

    • Move insurance amount into InsuranceVault.

    • Move deposited amount into DepositVault.

    • Move remaining amount into: TreasuryVault, Tier2PrizeVault, Tier3PrizeVault as per configured ratio.

  • Epoch.draw_enabled` will be used by the off-chain code to decide whether to publish a winning combination in case we enter a no-draw scenario.

  • Epoch.state = FINALISING

[Admin] CreateEpochWinnersMeta

  • Upload metadata of winners

[Admin] PublishEpochWinnersPage

  • Upload list of winner pages by page

  • If this is the last page, mark upload as complete in the EpochWinnersMeta account:

    • Epoch.state = ENDED

PreviousInitialisation InstructionsNextOther Instructions

Last updated 1 year ago