🏦Investing

This page describes the use cases related to investing into the TurboSwap, such as invest, redeem, and capital rebalance

Token Spot Price

The TurboSwap protocol acts as an automated market-maker for TurboSwap tokens. It calculates the spot token's priceppdenominated in the base currency as:

p=Ξ±CNp = \frac{\alpha C}{N}

HereCCis the value of the protocol capital,NNis the total number of tokens in circulation, andΞ±\alphais the capitalization ratio, i.e. the total value of all tokens in circulation divided by the capital of the protocol:

Ξ±=pNC\alpha = \frac{pN}{C}

This capitalization ratio could be calculated from the initial values of the capitalC0C_0, the initial number of the tokensN0N_0, and the initial token pricep0p_0:

Ξ±=p0N0C0\alpha = \frac{p_0N_0}{C_0}

Example: The reference currency is USD, the initial capital of the protocol is $6M(C0=6,000,000)(C_0 = 6,000,000), the initial number of tokens is 1B(N0=1,000,000,000)(N_0 = 1,000,000,000), and the initial token price is Β’1(p0=0.01)(p_0 = 0.01). Then:

Ξ±=p0N0C0=0.01β‹…1,000,000,0006,000,000=5/3\alpha = \frac{p_0N_0}{C_0} = \frac{0.01 \cdot 1,000,000,000}{6,000,000} = 5/3

Token Price Invariant

If we put fees aside, then a user may investdC\mathrm{d}Cworth amount of assets into the capital and getdN=dCp\mathrm{d}N = \frac{\mathrm{d}C}{p}newly minted tokens. Thus we have:

dCdN=p=Ξ±CN\frac{\mathrm{d}C}{\mathrm{d}N} = p = \frac{\alpha C}{N}

By solving this differential equation, we get the token price invariant:

C=qNΞ±C = qN^\alpha

whereqqis a constant quotient. The quotientqqcould be calculated as:

q=CNΞ±q = \frac{C}{N^\alpha}

For the example above, the initial value forqqwould be:

q=C0N0Ξ±=6,000,0001,000,000,0005/3=0.000000006q = \frac{C_0}{N_0^\alpha} = \frac{6,000,000}{1,000,000,000^{5/3}} = 0.000000006

so the token price invariant would be:

C=0.000000006β‹…N5/3C = 0.000000006 \cdot N^{5/3}

The following graph shows the relationship between the capitalCCand the number of tokens in circulationNN:

And here is the relationship between the spot token priceppand the number of tokens in circulationNN:

So the spot token price goes up when the number of tokens in circulation grows.

Invest

When a user, whose account index isjj, wants to invest anxix_iamount of thei-thi\text{-th}asset into the capital, the amount is subtracted from the user's position, then a small minting feeΟ•m\phi_mis charged from the amount, and the value of the remaining amount is added to the capital:

vijβ€²=vijβˆ’xiCβ€²=C+(1βˆ’Ο•m)pixi\begin{array}{rcl} v_{ij}' & = & v_{ij} - x_i \\[1em] C' & = & C + (1 - \phi_m)p_ix_i \end{array}

Herepip_iis the current price of thei-thi\text{-th}asset denominated in the base currency.

Then, the protocol then calculates the number of new tokensΞ”N\Delta Nto be minted and sent to the user. This number should preserve the token price invariant:

Cβ€²(N+Ξ”N)Ξ±=q=CNΞ±Ξ”N=(Cβ€²CNΞ±)1Ξ±βˆ’N=N(Cβ€²C)1Ξ±βˆ’N=N((Cβ€²C)1Ξ±βˆ’1)\frac{C'}{(N + \Delta N)^\alpha} = q = \frac{C}{N^\alpha} \\[1em] \Delta N = \left( \frac{C'}{C}N^\alpha \right)^{\frac{1}{\alpha}} - N = N \left( \frac{C'}{C} \right)^{\frac{1}{\alpha}} - N = N \left( \left( \frac{C'}{C} \right)^{\frac{1}{\alpha}} - 1\right)

So, the number of token a user will get is:

N((C+(1βˆ’Ο•m)pixiC)1Ξ±βˆ’1)N \left( \left( \frac{C + (1 - \phi_m)p_ix_i}{C} \right)^{\frac{1}{\alpha}} - 1\right)

Redeem

When a user, whose account index isjj, wants to redeemnnfor thei-thi\text{-th}asset, first the gross payoutxix_i is calculated that preserves the token price invariant:

Cβˆ’pixi(Nβˆ’n)Ξ±=q=CNΞ±xi=1pi(Cβˆ’C(Nβˆ’n)Ξ±NΞ±)=Cpi(1βˆ’(Nβˆ’nN)Ξ±)\frac{C - p_ix_i}{(N - n)^\alpha} = q = \frac{C}{N^\alpha} \\[1em] x_i = \frac{1}{p_i} \left( C - \frac{C (N - n)^\alpha}{N^\alpha} \right) = \frac{C}{p_i} \left( 1 - \left( \frac{N - n}{N} \right)^\alpha \right)

A small fractionΟ•b\phi_bof this gross amount is charged as a burning fee, and the remaining is added to the user's position, and redeemed tokens are burned:

Nβ€²=Nβˆ’nvijβ€²=vij+(1βˆ’Ο•b)β‹…Cpi(1βˆ’(Nβˆ’nN)Ξ±)\begin{array}{rcl} N' & = & N - n \\ v_{ij}' & = & v_{ij} + (1 - \phi_b) \cdot \frac{C}{p_i} \left( 1 - \left( \frac{N - n}{N} \right)^\alpha \right) \end{array}

Capital Rebalance

The protocol capital valueCCis the sum of the capital valuescic_ifor all listed assets weighted at the current asset pricespip_i:

C=βˆ‘ipiciC = \sum_i p_ic_i

Thus the capital is exposed to market risk. When the prices of different assets change, this affects the capital value. Letσi\sigma_ibe the share of thei-thi\text{-th}asset in the capital:

Οƒi=piciC\sigma_i = \frac{p_ic_i}{C}

Biggerσi\sigma_imeans that the protocol capital is more exposed to the price of the i-thi\text{-th}asset. Note, that in some casesσi\sigma_icould be negative, which means, that the capital has negative (short) exposure to the price of the corresponding asset. Anyway, the sum ofσi\sigma_ifor all the listed assets always equals to one:

βˆ‘iΟƒi=1\sum_i \sigma_i = 1

Capital allocation is a vector of all the Οƒi\sigma_ivalues:{Οƒi}\{ \sigma_i \}.

The governance sets a target capital allocation{Ο„i}\{ \tau_i \}, such as:

βˆ‘iΟ„i=1\sum_i \tau_i = 1

If, for someii,Οƒi<Ο„i\sigma_i < \tau_i, theni-thi\text{-th}asset is underweight in the capital, i.e. the protocol needs more capital to be allocated into this asset. If Οƒi>Ο„i\sigma_i > \tau_i, then the asset is overweight and the protocol needs to reduce the amount of the capital allocated to this asset.

If one asset is underweight and at the same time another asset is overweight in the capital, then a capital rebalance operation is possible.

Capital Rebalance on Exchange

Leti1i_1be the ID of the underweight asset andi2i_2be the ID of the overweight asset:

Οƒi1<Ο„i1Οƒi2>Ο„i2\sigma_{i_1} < \tau_{i_1} \\[1em] \sigma_{i_2} > \tau_{i_2}

Letjjbe the ID of a user who triggers capital rebalance trade on exchange. Let xi1x_{i_1} be the amount of the underweight assets for be bought for xi2x_{i_2}units of the overweight asset. Let ρ\rho be the capital rebalance reward. Then:

ai1β€²=ai1+xi1ai2β€²=ai2βˆ’xi2vi1,jβ€²=vi1,j+ρxi1vi2,jβ€²=vi2,j+ρxi2\begin{array}{rcl} a_{i_1}' & = & a_{i_1} + x_{i_1} \\[1em] a_{i_2}' & = & a_{i_2} - x_{i_2} \\[1em] v_{i_1,j}' & = & v_{i_1,j} + \rho x_{i_1} \\[1em] v_{i_2,j}' & = & v_{i_2,j} + \rho x_{i_2} \end{array}

It is required thatai2β©Ύxi2a_{i_2} \geqslant x_{i_2}for the trade to be successful. Also, the protocol checks that the under-/overweight states of the assets didn't flip after the trade, i.e. that:

Οƒi1β€²β©½Ο„i1Οƒi2β€²β©ΎΟ„i2\sigma_{i_1}' \leqslant \tau_{i_1} \\[1em] \sigma_{i_2}' \geqslant \tau_{i_2}

Capital Rebalance Against a User

Instead of performing capital rebalanced trade on exchange, a user may do so against the user's own account.

vi1,jβ€²=vii,jβˆ’(1βˆ’Ο)xi1vi2,jβ€²=vi2,j+(1+ρ)xi2\begin{array}{rcl} v_{i_1,j}' & = & v_{i_i,j} - (1 - \rho)x_{i_1} \\[1em] v_{i_2,j}' & = & v_{i_2,j} + (1 + \rho)x_{i_2} \end{array}

The trade is performed at the current price, i.e.:

xi1xi2=pi2pi1\frac{x_{i_1}}{x_{i_2}} = \frac{p_{i_2}}{p_{i_1}}

And as usual, the protocol checks, that the under-/overweight states of the assets didn't flip and the trade didn't leave the user's account in margin call.

Haircut

As the capital may take losses, it may go underwater, i.e. it may be thatC<0C < 0. In such extreme conditions, the protocol is not able to repay all the deposits in full, even in case all the short positions will be covered.

During the times when the capital is underwater, the protocol operates in the underwater mode, which means:

  1. Token issuance is possible at a certain minimal price, rather than at a negative price calculated by the normal price formula.

  2. Token redemption is not possible.

  3. Withdrawals are performed with a haircut.

The haircut withdrawal formula works like this:

vijβ€²=vijβˆ’xiaiβ€²=aiβˆ’(1βˆ’Ο•w)xiC+βˆ’Cβˆ’\begin{array}{rcl} v_{ij}' & = & v_{ij} - x_i \\[1em] a_i' & = & a_i - (1 - \phi_w) x_i \frac{C^+}{-C^-} \end{array}

And a user gets just(1βˆ’Ο•w)xiC+βˆ’Cβˆ’(1 - \phi_w) x_i \frac{C^+}{-C^-}units of the asset.

HereC+C^+is the sum of all the capital assets, i.e. reserves and short positions:

C+=βˆ‘i(aiβˆ’βˆ‘jmin⁑(vij,0))C^+ = \sum_i \left( a_i - \sum_j \min \left( v_{ij}, 0 \right) \right)

andC+C^+is the sum of all the capital obligations, i.e. long positions:

Cβˆ’=βˆ‘iβˆ‘jmax⁑(vij,0)C^- = \sum_i \sum_j \max \left( v_{ij}, 0 \right)

Haircut encourages users to stay invested. Also in case of unrecoverable capital damage, it allows users to return at least part of their funds.

Last updated