Resolving Bets
The resolveBet function allows the owner of the contract to resolve a bet, by specifying the winning outcome. This function checks the current state of the contract, stores the winning outcome in the
Function Breakdown
The function first checks if the contract is in the
Closed
state. If not, it reverts the transaction.It then stores the winning outcome in the contract's state variables.
The state of the contract is then changed to
Resolved
.Finally, a
BetResolved
event is emitted, with the winning outcome and the current version of the contract.
Last updated