A Betting Engine that combines outcomes from different Conditions in a single bet

The BetExpress contract allows users to place combo bets. The contract is linked to a specific deployed PrematchCore contract and only takes information about the Conditions from it.

An unlimited number of sub-bets on different Conditions can be included in a single Express, but the maximum possible winnings for one Condition in all bets are limited to a fixed amount of 25,000. There is also another restriction on the maximum net payout for all Expresses at a given moment, which should not exceed a certain percentage of the total pool, currently around 250,000.


Some conditions have restrictions and cannot be used in a combo bet, for example, eSports conditions. To avoid this error you need check the isExpressForbidden field in condition subgraph data, if this field is true than you should forbid such combo bet and show warning notification in your UI.

The coefficients for the sub-bets are calculated as follows:

  1. the coefficients for each sub-bet are calculated without margin and with a zero value for "amount".

  2. All the coefficients are summed up, and the resulting sum is referred to as "oddsSum". The product of all coefficients is also calculated, denoted as "oddsProd".

  3. To determine the bet amount for each sub-bet, the following formula is applied:

    subBetAmount = (oddsProd - 1) * expressBetAmount / (oddsSum - number of sub-bets)

    where "expressBetAmount" represents the total bet amount on the Express, and "number of sub-bets" is the count of sub-bets included in the Express.

  4. To calculate the odds with margin (each sub-bet has its own margin corresponding to the ordinary condition), the following formula is used:

    expressOdds = the multiplication of coefficients of all sub-bets

The winnings for a combo bet can only be obtained after all the included Conditions have been completed. If a Condition included in an Express is canceled, the combo bet remains valid, but the potential winnings will be adjusted proportionally based on the betting odds of the canceled sub-bet. If all the Conditions included in the Express are canceled, the bettor can claim their bet back.