Making and Taking Bets - mevu-bet/mevu GitHub Wiki

To actually make or take a bet the mevu front-end app will be used to send a transaction to the WagersController or CustomWagersController contract depending on the bet type.

All times are in Unix Epoch timestamp (seconds)

Standard Bets

Use WagersController

Making Bet

makeWager(
        bytes32 wagerId,
        bytes32 eventId,
        uint value,        
        uint odds,
        uint makerChoice,
    )    
    notMade(wagerId)
    eventUnlocked(eventId)   
    checkBalance(value)
    notPaused
    external
    payable

wagerId The sha3 hash of the maker's ethereum address concatenated with the timestamp.
value The amount of wei the user wants to bet.
eventId The bytes32 id of the event the user is betting on.
odds The odds chosen by the bet maker where 100 is 1 : 1 (So 1 would be 1 : 100 and 200 would be 2 : 1)
makerChoice The team the maker is betting on, either 1 or 2.

The checkBalance modifier allows a user to place a bet without sending the corresponding amount of eth if they have enough unlocked eth in the contract system already to make up the difference. It remains to be seen if this will be useful from a front-end perspective.

Taking Bet

 function takeWager (bytes32 id) payable

id The id of the wager, generated by the maker.

The taker must also send eth equal to the value supplied by the maker multiplied by odds/100


Custom Bets

Use CustomWagersController

Making Bet

 function makeWager (
        bytes32 id,
        uint endTime,
        uint reportingEndTime,
        uint makerChoice,
        uint value,
        uint odds
        
        )
        notMade(id)    
        checkBalance(value)
        notPaused
        external
        payable

id The sha3 hash of the maker's ethereum address concatenated with the timestamp.
endTime The time when the event being bet on is over and the bettors will know the winner.
reportingEndTime The time after which if a bettor has not reported their answer they will be considered to have abandoned the bet and the player who finalizes the bet after this point will cause a refund to both players if no judge has been appointed.
makerChoice The team the maker is betting on, either 1 or 2. value The amount of wei the user wants to bet.
odds The odds chosen by the bet maker where 100 is 1 : 1 (So 1 would be 1 : 100 and 200 would be 2 : 1)

Taking Bet

 function takeWager (
        bytes32 id,
        address judge      
    )
        notTaken(id)
        notOver(id)
        external
        payable

id The id of the wager, generated by the maker.
judge The appointed judge must match the judge provided by taker. Must pass in zero address if no judge has been appointed. See Adding a Judge to Custom Bet for more info.

The taker must also send eth equal to the value supplied by the maker multiplied by odds/100