👩‍🏫USD Settlement & Interest Rate Model

A deep-dive into the calculation and conversion between USD and USDC, and the use of various interest models.

USD to USDC Settlement

Funding fees, positions’ financing costs and PNL are all settled in real time in USD value. In below situations, total accumulated USD value will be converted to USDC amounts:

  • Takers’ trade actions, i.e. open trades, close all / part of positions;

  • Takers withdraw USDC and withdrawal amounts exceeds existing USDC balance;

  • When USDCBalance0USDCBalance \ge 0, below situation will trigger conversion.

unsettledUSDmin(1.0,pusdcusd)+USDCBalance<threshold\frac {unsettledUSD} {min(1.0, p_{usdcusd})} +USDCBalance < threshold
  • When USDCBalance<0USDCBalance < 0, below situation will trigger conversion.

unsettledUSDmin(1.0,pusdcusd)<threshold\frac {unsettledUSD} {min(1.0, p_{usdcusd})} < threshold

where unsettledUSD=PnL+Funding+FinancialCostsunsettledUSD= \sum PnL+ \sum Funding + \sum FinancialCosts, threshold<0threshold <0, and thresholdthreshold now could be set as -10,000 at the beginning.

When traders’ trade action triggers USD to USDC settlement, entry price of positions will be changed to the execution price pexecp_{exec}. Keeper fees will be paid by takers.

When withdrawal actions and negative amounts trigger USD to USDC settlement, entry price of positions will be changed to the oracle price poraclep_{oracle}. Keeper fees will be paid by LP.

Interest Rate Model

When takers making money, they will receive USDC and USDC could be used as collaterals;

When takers losing money, USDC will be deducted from their accounts. If takers do not have enough USDC, which means USDC balance is negative, protocol will auto borrow USDC for accounts and start to charge interests. Interests will be credited to LP.

Our target to charge interests is encouraging takers to deposit USDC as soon as possible, as negative USDC balance will not only take use of extra margin but also will be charged interests.

The supply of USDC is from liquidity providers and the maximum supply is LPsmax(1.0,pusdcusd)\frac {LP-\sum |s|} {max(1.0, p_{usdcusd})}. Where ss is net positions of each currency for all users in USD.

Total USDC debts equals to the sum of negative USDC balance from all takers. USDC debts maintain the base interest rate IR0IR_0 until the specific rebalancing conditions are met.

Here we introduce the debt/equity ratio, DEDE.

DE={max(totalUSDCDebt×max(1.0,pusdcusd)LPs,2)(LPs)>02(LPs)0DE = \left \{ \begin{array}{rcl} max(\frac {totalUSDCDebt \times max(1.0,p_{usdcusd})} {LP - \sum |s|},2) && (LP - \sum |s|)>0 \\ 2 && (LP - \sum |s|) \le 0 \end{array} \right.

where, the ceiling of DEDE is set as 2.

The real-time annual interest rate is calculated as the combination of two interest rate models:

  • Linear Interest Rate Model

IR={IRvertex+DEDE1DE×(IRmaxIRvertex)DE>DEIR0+DEDE×(IRvertexIR0)DEDEIR = \left \{ \begin{array}{rcl} IR_{vertex} + \frac {DE - DE^*} {1-DE^*} \times (IR_{max} - IR_{vertex}) && DE > DE^*\\ \\ IR_0 + \frac {DE} {DE^*} \times (IR_{vertex} - IR_0) && DE \le DE^* \end{array} \right.

Where, IR0IR_0 is the minimum interest rate when DE=0DE =0, IRmaxIR_{max} is the maximum interest rate when DE=1DE =1, IRvertexIR_{vertex} is the vertex interest rate when DE=DEDE =DE^*, DEDE^* is the vertex debt/equity ratio.

Symbol
Rate

IR0IR_0

5%

IRmax0IR^0_{max}

120%

IRvertexIR_{vertex}

25%

DEDE^*

40%

  • Time-weighted Variable Interest Rate Model

To protect LP in extreme market conditions, IRmaxIR_{max} follows time-weighted variable interest rate model and will change over time. When DE>DEDE > DE^* for 12 hours, IRmaxIR_{max} will double.

For takers with negative USDC balance NN , the accrued interests between t0t_0 and t1t_1 (no actions happen between t0t_0 and t1t_1 in the protocol) is calculated as below:

  • DEtiDEDE^{t_i} \le DE^*

ΔI=0Δt(IR×N)dt=N0Δt(IR0+DEDE×(IRvertexIR0))dt=NΔt(IR0+DEDE×(IRvertexIR0))\begin{align*} \Delta I &= \int_{0}^{\Delta t } (IR\times N) \,dt \\ &=N\int_{0}^{\Delta t } (IR_0 + \frac {DE} {DE^*} \times (IR_{vertex} - IR_0)) \,dt \\ &=N \cdot \Delta t \cdot(IR_0 + \frac {DE} {DE^*} \times (IR_{vertex} - IR_0)) \end{align*}
  • DEti>DEDE^{t_i} > DE^*

ΔI=0Δt(IR×N)dt=N0Δt(IRvertex+DEDE1DE((1+t12)IRmaxtiIRvertex))dt=N(1DE1DEIRvertexΔt+DEDE1DEIRmaxti(Δt+Δt224))\begin{align*} \Delta I &= \int_{0}^{\Delta t} (IR\times N) \,dt \\ &=N\int_{0}^{\Delta t} (IR_{vertex} + \frac {DE - DE^*} {1-DE^*} ((1+\frac {t} {12})IR^{t_i}_{max} - IR_{vertex})) \,dt \\ &=N \cdot \left(\frac {1 - DE} {1-DE^*} \cdot IR_{vertex} \cdot \Delta t + \frac {DE - DE^*} {1-DE^*} \cdot IR^{t_i}_{max} \cdot(\Delta t + \frac {\Delta t^2} {24} )\right) \end{align*}

then calculate IRmaxti+1IR^{t_{i+1}}_{max} for next transaction:

IRmaxti+1={(1+Δt12)IRmaxtiDEti+1>DEIRmax0DEti+1DEIR^{t_{i+1}}_{max}=\left \{ \begin{array}{rcl} (1+\frac{\Delta t}{12})IR^{t_{i}}_{max} && DE^{t_{i+1}} > DE^*\\ \\ IR^{0}_{max} && DE^{t_{i+1}} \le DE^* \end{array} \right.

Last updated