Horse Betting

TOOLSFINANCIAL

Exposed methods

addHorse adds horses to the array, name and number

parameter nametypedetails
_namestringstores name of the added horse

addPlayer function that adds a player by typing a nickname and the number chosen by him

parameter nametypedetails
_nicknamestringstores name of the added player
_numberuintstores the number chosen by the player

checkWinner checks if a player is winner based on the inserted string

parameter nametypedetails
_nicknamestringused to check if the nickname is the winner

raceStatus function that sets the bool variable as true if the race has started

payWinner pays the winner if checkwinner returns true with an amount set by the dapp

parameter nametypedetails
_nicknamestringname of the player
_valueuintthe amount to be paid to the player

setConditions Allows the owner of the contract to set a minimum wage

parameter nametypedetails
_minwageuintset by the owner to put the mimum wage

withdraw allows the owner to get his earnings if there a no bets in progress

winningHorse this function is used to store the winning horse

Events

Winnercheck event that shows the nickname of the winner WinnerHorse shows the horse name and it's number WinnerPayment logs the payment of the winner newPlayer stores information regarding the added players

Buy
Reviewed by Modex
Buy Contract Test Contract

Create an account or login to purchase this smart contract