LunaFi/ Housebets

How House Pool Total Value Locked (TVL) is Calculated

Understanding how the protocol calculates current total value locked
L = Liquidity (liquidity from deposits, winning bets & pending stakes) EV = Expected Value of pending bets Ps=Pending Stakes ME = Max Exposure of pending bets
When an LP deposits liquidity, the individual exchanges their cryptocurrency for a share in the pool which is returned as an “LP token”. These can be redeemed at any time for the underlying tokens staked in the pool (USDC, BTC and ETH).
We know from the above equation that the ownership of LP tokens represents a proportional share of the TVL.
The formula behind our sports betting pools has to take into account the significant jump risk and impermanent loss associated with gambling markets.
The LP pricing is determined by the assets and liabilities of the pool.
There is a risk management system in place to ensure there are no disproportionate losses to the size of the pool i.e. 1% of losses to any event.
This is to ensure the oracle sets a fair value of trade entry, so the returns can be accurately calculated within the context of the entire market. A note of the EV value is stored in the contract on deposit which will be relevant for withdrawals as a baseline value.
The equation demonstrates how the pool keeps track of the total payout for LPs. In order for the pool to be open-ended, we need to ensure LPs can deposit and withdraw accurately. The contract is able to calculate the liquidity in the pool + the pending stakes (Ps) but we need an oracle to report the expected value EV of all LunaFi bets. This is because the expected value of sports matches are reported in real-time and the odds are constantly changing.

Expected Value

(Amountwonperbet∗probabilityofhousewinning)–(Amountlostperbet∗probabilityofhouselosing) (Amount won per bet * probability of house winning) – (Amount lost per bet * probability of house losing)
he simplest calculation of probability is the coin toss. Assuming the coin and the toss are fair, each outcome (heads or tails) has an equal 50/50 probability - therefore the odds offered on a fair market would be 2.0.
This would result in an EV of 0 for either Heads or Tails - because the probability of the two outcomes is the same, meaning if you tossed a coin infinitely it would theoretically end up even. EV data regarding the toss is received via an impartial observer that all parties trust, described as an oracle.

Max Exposure

The max exposure of the protocol is the worst-case scenario from all combined outcomes. This is a relatively easy figure to calculate as it is static until the outcomes are settled. The reason this figure needs to be calculated despite the expected value being positive and a significantly smaller number, is the variance is significant. Therefore the contract can’t allow withdrawals that don’t leave ample liquidity in the pool’s smart contract to payout in all scenarios.
In the future, the max exposure figure will be weighted so the sportsbook can take on more risk than the liquidity currently allows for. This takes into account the law of large numbers (LLN) and the sheer improbability of certain events ever happening. This can only be achieved once the LFI-vLFI pool has been established, and acts to insure the protocol against such risks. This will be designed as the pools mature and the community votes on the programmable parameters of this mechanism.


House Pool margins are levied on all the bets to incentivise the provision of liquidity.
In this hypothetical example we will assume a margin of 5% on a bet of heads or tails resulting in odds of 2/0, resulting in a calculation ratio by the LunaFi platform of 1.95.
For example, the player might bet 100 USDC on “Heads”. In this case, the House Pools will pay out the player’s stake of 100 USDC and their winnings of 95 USDC if the player wins, but would retain the 100 USDC stake if the Player loses.
This model dictates that the House Pool will earn an average of 2.5 USDC per play. Note that the margin is applied to the potential winnings, and not the stake.