Top Cap Game is a decentralized application built on the Solana blockchain. It allows users to participate in a game where they can stake tokens and predict the market capitalization of various assets. The game rewards users based on the accuracy of their predictions, with daily and weekly epochs determining the winners.
Ensure you have the following installed:
-
Clone the repository:
git clone https://github.com/your-username/top-cap-game.git cd top-cap-game -
Install the dependencies:
yarn install
-
Build the project:
anchor build
top-cap-game/
│
├── Anchor.toml # Anchor configuration file
├── Cargo.toml # Rust package manager file for the program
├── tsconfig.json # TypeScript configuration file
├── package.json # Node.js project metadata
├── node_modules/ # Node.js dependencies
├── target/ # Compiled output
│
├── programs/ # Smart contract source code
│ └── top-cap-game/
│ ├── src/
│ │ ├── lib.rs # Main entry point for the program
│ │ └── instructions/ # Instruction handlers
│ │ └── *.rs
│ └── Cargo.toml # Rust package manager file for the program
│
├── tests/ # TypeScript tests
│ └── top_cap_game_tests.ts # Test cases for the program
│
├── migrations/ # Migration scripts for deployment
│ └── deploy.ts # Script to deploy the program
│
└── dist/ # Compiled JavaScript files
## Smart Contracts
The smart contracts are written in Rust using the Anchor framework. The primary logic of the game is implemented in the `lib.rs` file, with specific instructions handled in separate files within the `instructions/` directory.
### Key Contracts
- `lib.rs`: Contains the core program logic and handles the initialization of the game, as well as the settlement of daily and weekly epochs.
## Testing
Testing is done using TypeScript in conjunction with the Anchor framework. Tests are located in the `tests/` directory and can be run using the following command:
```bash
anchor test
## Deployment
The program can be deployed to a Solana cluster using the `deploy.ts` script in the `migrations/` directory.
To deploy the program, run:
```bash
anchor deploy