Variables
Variables used for the AMM protocol math formulations.

General Variables

ii
A given instant
uu
Factors that refers to a user (
uu
) balance.
dudu
Time of the event of a user's original deposit.

State Variables

To perform the events, the contract stores, calculates, and manage the following variables:
UBuUB_u
User Balance of a token A or B in a given moment. When adding liquidity for the first time, the
UBuUB_u
will be equal to
AduA_{du}
.
IVi1IV_{i-1}
Last period's guessed Implied Volatility by the contract based on the latest trade activity in the AMM.
IViIV_i
Implied Volatility that was guessed by the OptionAMM after the current trade ended and impacted the pool position. This factor will be stored and used only in the next event, which in that case will have become the
IVi1IV_{i-1}
. The
IViIV_i
is guessed and should guarantee the condition:
fp(IVi,MarketDatai)=BiAi\displaystyle f_p(IV_i,MarketData_i)=\frac{-B_i}{A_i}
TBiTB_i
Pool total Balance of a particular token:
  • TBAiTB_{A_i}
    Pool's total balance of token A in a given instant
    ii
    .
  • TBBiTB_{B_i}
    Pool's total balance of token B in a given instant
    ii
    .
DBiDB_i
Pool's factor that is not amortized.
  • DBAiDB_{A_i}
    Pool's deamortized balance of token A in a given instant
    ii
    .
  • DBBiDB_{B_i}
    Pool's deamortized balance of token B in a given instant
    ii
    .

Dynamic Variables

Variables controlled by the users.
Variables that will be input by the user in addLiquidity or removeLiquidity

User Input

User input for liquidity provision:
  • AduA_{du}
    ​ Total amount of A a user deposited originally.
  • ​​
    BduB_{du}
    ​ Total amount of B a user deposited originally.
rr
Is the proportion of token a user wants to withdraw from each token. 1 would be 100% withdrawal.
  • rAr_A
    is the proportion the user wants to withdraw from the original deposit of token A
  • rBr_B
    is the proportion the user wants to withdraw from the original deposit of token B

Contract Variables

Find below the variables used by the AMM for calculations.
PiP_i
Token A price in units of Token B calculated by the AMM in a given instant
ii
.
fpf_p
The AMM's price function to price the token A (options) in units of token B.
MarketDataiMarketData_i
The underlying asset's spot price is supplied from an external source of data (currently by Chainlink).
FviFv_i
Pool's opening value factor.
mAAmAA
How many token A the user can withdraw for each token A deposited
mBBmBB
How many token B the user can withdraw for each token B deposited
mBAmBA
How many token A the user can withdraw for each token B deposited
mABmAB
How much token B the user can withdraw for each token A deposited

Trade formulas

Variables used by the AMM for calculations during a trade:
  • AiA_i
    Trade amount of token A to be transferred or received in a trade event.
  • BiB_i
    Trade amount of token B to be transferred or received in a trade event.
poolAmountApoolAmountA
Is the variable that contains the maximum that could be traded based on the current pool situation and option price for the token A.
poolAmountBpoolAmountB
Is the variable that contains the maximum that could be traded based on the current pool situation and option price for the token B.
kk
Product constant.

Glossary Comparison

Find below the variables matching with the contract names.
Documentation / Whitepaper
Code
File
UBAUB_A
UserDepositSnapshot.tokenABalance
AMM.sol
UBBUB_B
UserDepositSnapshot.tokenBBalance
AMM.sol
FvduFv_{du}
UserDepositSnapshot.fImp
AMM.sol
PiP_i
ABPrice
AMM.sol
fpf_p
_getABPrice()
AMM.sol
IVi1IV_{i-1}
PriceProperties.currentSigma
OptionAMMPool.sol
IViIV_i
newIV
OptionAMMPool.sol
AiA_i
exactAmountAIn / exactAmountAOut / amountAIn / amountAOut
AMM.sol
BiB_i
exactAmountBIn / exactAmountBOut / amountBIn / amountBOut
AMM.sol
TBiTB_i
totalTokenA / totalTokenB
AMM.sol
DBiDB_i
deamortizedTokenABalance / deamortizedTokenBBalance
AMM.sol
FviFv_i
fImpOpening
AMM.sol
rr
percentA / percentB
AMM.sol
mAAmAA
Mult.AA
AMM.sol
mBBmBB
Mult.BB
AMM.sol
mBAmBA
Mult.BA
AMM.sol
mABmAB
Mult.AB
AMM.sol
Last modified 9mo ago