Skip to content

CAMM Math

This section contains lots of math.

Pron Initialization and Price Peg

Let us define, for any Pron having n2 mutually exclusive and exhaustive outcomes and each outcome i{1,2,,n}, at any given time t (t is discrete state due to swap and trade), Ti(t) be the total tokens minted, Si(t) be tokens in supply, qi(t) be the quantity of outcome tokens at each pool, and yi(t) be the stable reserve (denominated in USD or USDC) ensuring the constant invariant

qi(t)yi(t)=ki,,

where ki is a constant i. The price of outcome i's token at any given time t is yi(t)qi(t).

Liquidity Provisioning

After the initialization, LPs can add liquidity to increase the depth of the price which could help to increase the volume. Let us say a LP wants to add Lp the amount of stable liquidity, depositing the same percentage ϑ of both reserves and using the equation,

Lpnyi(t)=ϵiqi(t)=ϑ,

where quantity of each outcome tokens to be minted is ϵi, calculated as

ϵi=qi(t)Lpnyi(t),

with new reserve values can be updated with y`i(t)=yi(t)+Lpn, q`i(t)=qi(t)+ϵi. LP exits are pretty similar calculations as per constant product invariants. After the resolution finality time tend, LP exit is exact stables added. The trading fees are added only for those period when Lp is active which is implicitly time weighted.

Trading Mechanics - Buy Operation

At any given state, let total stables at liquidity reserve be σ(t)=iyi(t). Let us say, a trader wants to buy Δq quantity of tokens for the ith outcome. The trader pays Δy stables to the ith pool. Let trading fee rate be f[0,1) (e.g. (f=0.003) like in Uniswap). Then from equation (\ref{eq: samm}),

(qi(t)Δq)(yi(t)+(1f)Δy)=k,

which then leads to

Δq=qi(t)kyi(t)+(1f)Δy.

The new pool states can be updated as

q`i(t)=qi(t)Δq,y`i(t)=yi(t)+(1f)Δy.

Thus total stables at liquidity reserve be σ`(t)=iyi(t)+(1f)Δy. Now the trading fees fΔy can be distributed with fractions α to LPs (retained in outside of reserve pool), β to insurance, and γ to protocol treasury, with α+β+γ=1. Then the trader receives Δq tokens of outcome i.

Trading Mechanics - Sell Operation

Let us say, a trader wants to sell Δq tokens of outcome i. When Δq is returned to pool for the equivalent value Δy in stables can be extracted from equation (\ref{eq: samm}),

(qi(t)+Δq)(yi(t)Δy)=k,

then for tokens in and stables out swap trading is calculated as

Δy=yi(t)kqi(t)+Δq.

Since CAMM need to incentivizes prediction rather than pump and dump like regular meme tokens. The sell operation need to tackle the following issues. 1. Sniping at Low Price after initialization. 2. Profit taking by draining the liquidity pool 3. Rekking the community by removing the full liqudity. 4. A rewards pool that incentivicing holder for predicting the outcome.

Note that it is straight forward to introduce a levy on sells to reward long-term belief holders. Let L be the total levy collected at any given state. At the initial stage or if there is no sell, then L=0. Let levy rate be λ[0,1). When selling, the trader must pay levy proportional to gross stable outflow as λ(1f)Δy and the total levy pool value is

L`=L+λ(1f)Δy.

Depending on implementation, λ can be time weighted function too and the trading fee f can be distributed as like buy operation. One of the best choice of λ can be 1n. Note that this levy is calculated after stables are calculated and levy deduction from the swap output before receiving stables is not desirable. This levy discourages short-term churn, but this mechanism does not provide good trading consensus.

Hence CAMM introduces new mechanism of Rewards Reserve Fee (RRF) ensures profit redistribution and goes directly to rewards pool. RRF is sum of portion of realized profit (V) and slippage weighted fee (W). Per sell, slippage weighted fee can be calculated as follows:

W=κΔymax(0,θξ)2,

where κ is the slippage coefficient and ξ a tiny threshold for micro movement transactions and θ is the fractional slippage. W helps to mitigate the issue of large dumps but when sequential chunk sells it is not effective. Hence let us introduce the profit tax:

V=λ(max(0,π))ρ,

where ρ1 and ρ>1 increases penalities on big profits. Since Δy is the gross stable payout from the pool, the net stables collectible is (1f)ΔyRRF. Note that unlike sell tax, this method only affects profit. Also note that due to onchain functionality, there would be aggregated profit tax calculation as the trader can buy and sell in chunks.

Reward Distribution at Finality

Let the state t=tend be the finality time and resolution of true outcome $r\in\left{ 1,2,\dots,n\right} $ is confirmed by Oracle. Trading halts at block B(tend). Snapshot taken at block B(tsnap)<B(tend). Eligible addresses for the reward of holding true belief are those who are holding the true outcome tokens qr(B(tsnap))>0 and did not sell tokens of any outcome after a lock period from tsnap to tend. Let h be that holder address. Hence the total eligible rewarding tokens for all of the addresses can be calculated as

Q=hqr(B(tsnap)).

All losing outcome tokens ir expire worthless. The reward pool Rp can be computed as,

Rp=σ(t)Y0Lp(tend)+RRF.

Note that Rp>0 since there is no short selling or liquidity drain. Note that the reward pool depends on the total stables at liquidity reserve σ(t) and accumulated Rewards Reserve Fee. Sum of all liquidity added by LPs and Initial pool creation Liquidity are returned back to corresponding providers. Note that being constant product invariant is used at the core for each outcome pool, there is the possiblity of sniping tokens earlier for less stables and later on when nearing finality trader might need to spend more stables to get same amount of tokens. Hence the new hybrid weighted reward distribution is proposed:

For each holder h, the normalized payout is

Rh=ωhuωuRp,

where ωh is the weight contribution by the token holder and it can be calculated as

ωh=φUhuUu+(1φ)HhuHu,

where UhuUu represents USD-weight to reward for the capital allocation and HhuHu represents eligible holders token weight which considers the early buyers. φ helps to preserver the proportionality and helps to mitigate the gaming the market.

Consensus Probability

As the traders trading the outcome tokens with CAMM, the supplied tokens of outcomes reflects the expectation behaviour of the outcome for that event and which results in the probability. Since all outcome pools share the same stable denomination, crowd allocation of belief can be automatically reflected via outcome token accumulation quantities in supply. This does not require onchain calculations, as it is reflected only in user interface. The crowd wisdom probability signal of the outcome i is defined as Pi(t) expresses aggregate market belief with accumulated total quantity of n outcomes. After the initialization and trading enabled, initial crowd expectation probability of all outcomes is equal to Pi(0)=1n. At any time t, with smoothening value m(0.7,1], the consensus probabilityPi(t) can be calculated as

Pi(t)=Si(t)mj=1nSj(t)m.

This reflects relative conviction weights expressed by cumulative token holdings.

Everyone's got opinions on future events — we make them earnable.