Onchain casino game smar contract - A Solana smart contract for Chess game between two parties, designed for use cases like chess or other competitive games.
This program allows two users to securely deposit SOL into an escrow account, with funds released to the winner (or split as needed) after the result is determined. The contract handles fee distribution, rent exemption, and ensures only valid parties can interact with the escrow.
If you have any quesion, contact here: Telegram
- Initialize Escrow: Either party can create or join an escrow by depositing SOL.
- Withdraw Escrow: After the result is determined, the winner (or both parties) can withdraw the escrowed funds.
- Fee Distribution: A small fee is distributed to admin and fee accounts, with the majority of funds held in escrow.
- Rent Exemption: Ensures escrow accounts are rent-exempt on Solana.
src/processor.rs
— Main logic for processing instructions and handling escrow state.src/instruction.rs
— Defines the instructions (init, withdraw) and their serialization.src/state.rs
— Escrow account structure and packing/unpacking logic.src/error.rs
— Custom error types for the program.src/entrypoint.rs
— Solana program entrypoint.
- Creator: The user who initializes the escrow.
- Competitor: The second party joining the escrow.
- Admin/Fee Accounts: Receive a small portion of the wager as fees.
- PDA Account: Holds the escrowed funds securely.