Skip to content

KKQanT/bonsai-program

Repository files navigation

bonsai-logo

Bonsai Program

Project Overview

Bonsai is a Solana-based price prediction platform that allows users to stake SOL on future price points of various assets. The platform aims to create an engaging, fair, and rewarding environment for price prediction enthusiasts and market analysts. The program utilizes Pyth oracle for price feeds and implements SPL Token for ticket minting and management.

Key Features

  1. Exact price prediction: Users specify precise asset prices for specific time slots. High-performing predictors receive the majority of the prize pool, while others can enjoy lottery-style rewards.
  2. Prediction oracle: Over time, the platform accumulates prediction accuracy data, serving as a price oracle for other platforms. Top predictors receive additional incentives when their predictions are used.

Core Functionality

  1. User Staking:
    • Users stake SOL on price predictions
    • Minimum stake: 0.01 SOL, Maximum stake: 1 SOL
    • Each 0.01 SOL represents one "ticket" in the prediction pool
  2. Price Prediction Mechanism:
    • Users predict prices for specific assets at future timestamps
    • Each price point contains 100 tickets (0.01 SOL per ticket)
    • Predictions close when all tickets for a time/price slot are sold
  3. Winning Conditions:
    • Settlement triggered by Pyth price oracle when prediction time is reached
    • Exact match: 50% of pool distributed to winning tickets
    • Proximity winners (within 0.1%): 25% of pool
    • Fortune (lottery) winners: 10% of pool
    • 15% to reserve (10%) and platform fee (5%)
    • Unclaimed rewards go to the reserve pool
  4. Leaderboard:
    • Smart contract tracks prediction accuracy per wallet
    • Users accumulate long-term accuracy
    • Ranking based on accuracy and prediction frequency
  5. Future Engagement Mechanisms:
    • Dynamic reward multipliers for low-participation periods
    • Cumulative jackpots for consecutive low-participation rounds
    • Streak bonuses for consistent participation

Installation and Setup

  1. Clone the repository:

    git clone https://gitlab.com/atadia/fortune-favor-program
    cd fortune-favor-program
  2. Install dependencies:

    npm install
  3. Build the program:

    anchor build
  4. Run tests:

    anchor test

Smart Contract Structure

  • Main program account: FortuneFavor
  • Key accounts: PriceSlot, Settlement
  • Important instructions: initialize_slot, reserve_price_slot, settle_from_pyth_feed_account, claim_winner_prize

Development

  • Built with Anchor framework
  • Uses Pyth oracle for price feeds
  • Implements SPL Token for ticket minting and management

Related Repositories

  1. Frontend: https://gitlab.com/atadia/bonsai-sol-frontend
  2. Bot: https://gitlab.com/atadia/bonsai-bot

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published