📟Roulette Bet
RouletteBet
is a Solidity smart contract designed for the blockchain-based game of Roulette. It manages individual bets placed by players, tracking various details such as the bet amount, the specific condition or numbers bet on (represented as a bitmap), and the outcome of the bet. This contract is integral to the game's operation, providing functions to set and retrieve bet information, ensuring secure and verified gameplay.
RouletteBet
inherits from Ownable
and implements the BetInterface
, providing a structured approach to managing a roulette bet's lifecycle and data. It encapsulates bet details, including the player's address, the associated game, amounts, and outcomes, with access control enforced through the Ownable
contract.
Usage Scenario
In a typical usage scenario, a Roulette
game contract will instantiate a RouletteBet
for each bet made by a player. The game contract, acting as the owner of the bet contract, will then update the bet details based on game outcomes, such as determining whether the player wins or loses and updating the bet status and result accordingly.
Functions
Getters: Functions to retrieve bet information, such as
getPlayer()
,getGame()
,getAmount()
,getStatus()
,getCreated()
,getResult()
,getBetInfo()
,getRequestId()
,getWinNumber()
,getBetsCount()
, andgetBet(index)
.Setters: Functions to set bet details, restricted to the contract owner (e.g.,
setPlayer()
,setGame()
,setAmount()
,setStatus()
,setRequestId()
,setResult()
,setWinNumber()
,setBets()
).
Last updated