Cancelling Bets - mevu-bet/mevu GitHub Wiki

Both standard and custom bets can be cancelled by using CancelController

Standard Bets

Untaken

function cancelWagerStandard (
        bytes32 wagerId,
        bool withdraw,
    ) 
        onlyBettorStandard(wagerId)        
        notTakenStandard(wagerId)  
        notPaused         
        external

wagerId The id of the bet to cancel.
withdraw Should always be true if calling from the front end, there is not yet a case where this will be false.

Taken

We will not be implementing cancellation of taken standard bets at this time.


Custom Bets

Untaken

 function cancelWagerCustom (
        bytes32 wagerId,
        bool withdraw,
       
    ) 
        onlyBettorCustom(wagerId)
        notPaused      
        notTakenCustom(wagerId)          
        external

wagerId The id of the bet to cancel.
withdraw Should always be true if calling from the front end, there is not yet a case where this will be false.

Taken

To cancel a bet that already has a taker, the user wishing to cancel must request the bet be cancelled and the other user has the option to do nothing and allow the bet to continue. If the second user agrees to cancel they must also call the requestCancelCustom function, then the first user can call confirmCancelCustom to trigger the refund payout.

  function requestCancelCustom (bytes32 wagerId)
        onlyBettorCustom(wagerId)        
        mustBeTakenCustom(wagerId)
        notSettledCustom(wagerId)
        external
 function confirmCancelCustom (bytes32 wagerId)
        notSettledCustom(wagerId)
        external