Variables
Variables used for the AMM protocol math formulations.
General Variables
i A given instant
u Factors that refers to a user (u) balance.
du 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:
UBu User Balance of a token A or B in a given moment. When adding liquidity for the first time, the UBu will be equal toAdu .
IVi−1 Last period's guessed Implied Volatility by the contract based on the latest trade activity in the AMM.
IVi 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 IVi−1 . The IViis guessed and should guarantee the condition:
fp(IVi,MarketDatai)=Ai−Bi
TBi Pool total Balance of a particular token:
TBAi Pool's total balance of token A in a given instant i .
TBBi Pool's total balance of token B in a given instanti .
DBi Pool's factor that is not amortized.
DBAi Pool's deamortized balance of token A in a given instant i .
DBBi Pool's deamortized balance of token B in a given instanti .
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:
Adu Total amount of A a user deposited originally.
Bdu Total amount of B a user deposited originally.
r Is the proportion of token a user wants to withdraw from each token. 1 would be 100% withdrawal.
rA is the proportion the user wants to withdraw from the original deposit of token A
rB 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.
Pi Token A price in units of Token B calculated by the AMM in a given instant i .
fp The AMM's price function to price the token A (options) in units of token B.
MarketDatai The underlying asset's spot price is supplied from an external source of data (currently by Chainlink).
Fvi Pool's opening value factor.
mAA How many token A the user can withdraw for each token A deposited
mBB How many token B the user can withdraw for each token B deposited
mBA How many token A the user can withdraw for each token B deposited
mAB 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:
Ai Trade amount of token A to be transferred or received in a trade event.
Bi Trade amount of token B to be transferred or received in a trade event.
poolAmountA Is the variable that contains the maximum that could be traded based on the current pool situation and option price for the token A.
poolAmountB Is the variable that contains the maximum that could be traded based on the current pool situation and option price for the token B.
k Product constant.
Glossary Comparison
Find below the variables matching with the contract names.
Documentation / Whitepaper
Code
File
UBA
UserDepositSnapshot.tokenABalance
AMM.sol
UBB
UserDepositSnapshot.tokenBBalance
AMM.sol
Fvdu
UserDepositSnapshot.fImp
AMM.sol
Pi
ABPrice
AMM.sol
fp
_getABPrice()
AMM.sol
IVi−1
PriceProperties.currentSigma
OptionAMMPool.sol
IVi
newIV
OptionAMMPool.sol
Ai
exactAmountAIn / exactAmountAOut / amountAIn / amountAOut
AMM.sol
Bi
exactAmountBIn / exactAmountBOut / amountBIn / amountBOut
AMM.sol
TBi
totalTokenA / totalTokenB
AMM.sol
DBi
deamortizedTokenABalance / deamortizedTokenBBalance
AMM.sol
Fvi
fImpOpening
AMM.sol
r
percentA / percentB
AMM.sol
mAA
Mult.AA
AMM.sol
mBB
Mult.BB
AMM.sol
mBA
Mult.BA
AMM.sol
mAB
Mult.AB
AMM.sol
Last updated