This project implements a prediction market for meme coin prices using Anchor, a framework for Solana programs. Users can create markets for specific meme coins, make predictions on whether the price will go up or down within a specified timeframe, and settle markets based on the actual outcome.
Develop a program using Anchor to create a prediction market for Solana meme coins. Users should be able to create markets for specific meme coins, make price predictions, and settle markets based on the actual price movement.
- Market Creation: Allows users to create prediction markets for specific meme coins.
- Placing Bets: Enables users to place bets on whether the price will go up or down.
- Market Settlement: Settles markets based on the actual price movement at the expiry time.
- Winning Claims: Allows winners to claim their winnings after market settlement.
- Rust
- Solana CLI
- Node.js
- Yarn
- Anchor
-
Install Solana CLI:
sh -c "$(curl -sSfL https://release.solana.com/stable/install)"
-
Install Rust:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
-
Install Node.js and Yarn:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash nvm install --lts npm install --global yarn
-
Install Anchor:
cargo install --git https://github.com/project-serum/anchor --tag v0.24.2 anchor-cli --locked
-
Clone the repository:
git clone [email protected]:0xCipherCoder/memecoin_prediction_market.git cd memecoin_prediction_market
-
Install dependencies:
npm install anchor build
-
Deploy the programs to Solana Local Testnet:
anchor deploy
-
Build the Solana program:
anchor build
-
Deploy the program to your local Solana cluster:
anchor deploy
-
Run the tests:
anchor test
-
Ensure your local Solana test validator is running - Not required for testing using anchor test command:
solana-test-validator
anchor test
Finished release [optimized] target(s) in 0.13s
Found a 'test' script in the Anchor.toml. Running it as a test suite!
Running test suite: "/home/pradip/Cipher/OpenSource/memecoin_prediction_market/Anchor.toml"
memecoin_prediction_market
✔ Initializes the market (443ms)
✔ Places a bet (430ms)
✔ Fails to place a bet after expiry (5022ms)
✔ Settles the market (249ms)
✔ Claims winnings (433ms)
✔ Fails to claim winnings twice
6 passing (9s)