Sure, here's a more structured and refined version of your README.md:
The Coinflip Minigame platform is powered by a Solidity-based smart contract, offering an engaging gaming experience. The contract manages available, ongoing, and completed games, enabling users to deposit or withdraw funds. Each user's balance is stored using mappings, while games are tracked through arrays.
- Deposits and Withdrawals: Users can deposit or withdraw funds within the contract.
- Game Creation and Cancellation: Users can create and cancel games as desired.
- Game Participation: Players can join games, initiating a match with another player who created a game with the same bet amount.
- Gameplay Mechanism: Matches consist of seven coinflips, and the first to reach four wins claims victory. Each coin flip is recorded in events, enhancing the frontend experience.
- NFT GameCoins: A specific NFT designed for this game tracks wins, losses, and profit/loss statistics, providing an additional layer of engagement. The NFT contract requires approval from the Coinflip Minigame contract to modify player stats.
- VRF Integration: The gameplay utilizes VRF (Verifiable Random Function) to obtain seven random values for the coinflips.
- Reward Distribution: Funds are temporarily transferred to the deployer's wallet and then distributed to the winner (minus game fees) at the end of the game.
- Player Access Control: To access the create and join game functions, users need a GameCoins NFT. The gameplay contract addresses the need for a GameCoins NFT and allows only one NFT per player.
- Deploy the contracts:
hardhat deploy --network network_name
- Add the gameplay address to the VRF service at vrf.chain.link
- Execute the script to add gameplay to the GameCoins contract:
hardhat run scripts/AddContract.js --network network_name
Update the frontend variables (contractAddresses
, abi
, abiNFT
, and contractAddressesNFT
) with the relevant contract addresses and ABIs upon deploying the contracts.