🏦Escrow Contract (DiceBotGame)

The DiceBotGame contract acts as the core game logic and escrow system for the DICE game. It ensures that players' funds are securely held during the game and correctly distributed based on the game's outcome.

Key Features:

  1. Initialization: The contract is initialized with parameters like the betting token's address, minimum bet amount, revenue percentage, burn percentage, and the revenue wallet's address.

  2. Game Structure: Each game is represented by a structure that contains details such as the bet size, total game amount, list of players, the winner, the winner's score, and the game's status.

  3. Multi-Token Support: Dicebot supports multiple tokens for betting such as USDC, WETH, and DICE (coming soon!)

  4. Game Creation: A new game can be created by specifying the game ID, bet size, game amount, and the list of players. The function ensures that each player has enough balance and allowance to participate.

  5. Game Termination: At the end of a game, the contract determines the winner based on scores provided. It then calculates the amount to be burned, the revenue for the platform, and the winner's amount. The respective amounts are then transferred to the appropriate addresses.

  6. Emergency Abort: In case of emergencies, such as a bot crash, the game can be aborted, and the bets are refunded to the players.

  7. Events: The contract emits various events to log actions like placing a bet, winning a game, revenue collection, and burning tokens.


  • The contract integrates with the DiceBotToken.sol contract, which is the ERC20 token (DICE Token) used for betting in the game.

  • The contract uses the Ownable modifier to call functions such as renounceOwnership() & transferOwnership(address newOwner)

Safety Measures:

  • The contract contains checks to ensure that players have enough balance and allowance to participate in a game.

  • It also ensures that the game is in progress before allowing certain actions and checks for valid bet sizes.

Revenue and Burning:

  • A portion of the total game amount is taken as revenue for the platform, and another portion is burned if played using DICE, ensuring a deflationary mechanism for the token.Non DICE tokens are sent to the treasury

Last updated