Understand how DeepBook Predict computes trading fees — the Bernoulli fee for uncertainty, the utilization fee for vault protection, how they combine into ask price, and how fee revenue is distributed across LPs, protocol, and insurance.
The vault takes the opposite side of every trade a user makes. When you buy a binary UP position, the vault is effectively selling it to you. Fees compensate the vault (and its LPs) for bearing this risk. The fee structure is designed to be fair — fees scale with the uncertainty of the outcome and the current load on the vault.
The Bernoulli fee captures the uncertainty of a binary outcome. It is derived from the standard deviation of a Bernoulli random variable. When probability p is near 0.5, uncertainty is maximized and the fee peaks. When p is near 0 or 1, the outcome is nearly certain and the fee approaches zero.
The utilization fee protects the vault from concentrated risk. As the vault's liability grows relative to its balance, the utilization fee increases quadratically. This discourages traders from piling into one side and ensures the vault maintains a healthy reserve ratio.
The total fee is the sum of the Bernoulli fee (floored by minFee) and the utilization fee. The total cost per unit is the fair price plus the total fee. The minFee floor ensures the vault always earns a baseline spread, even on near-certain outcomes.
A well-structured fee breakdown helps traders understand exactly what they are paying and why. The computeFeeBreakdown function packages all fee components into a single object for display and decision-making.
Understanding fee dynamics helps traders pick optimal entry points. Fees depend on two independent axes: probability (Bernoulli) and vault load (utilization). Match each scenario to its fee impact.
Every fee collected is split across three buckets. This split ensures LPs are rewarded for providing capital, the protocol has revenue for development, and an insurance fund exists for extreme scenarios.
All fractional values on-chain are stored as integers scaled by FLOAT_SCALING (1e9). This avoids floating-point precision issues in the Move virtual machine. You must encode values before sending transactions and decode them when reading on-chain state.
The protocol enforces minimum and maximum ask price bounds to prevent abuse at probability extremes. These bounds ensure orderly markets and protect both traders and the vault from degenerate pricing.