ALTBCEquations
Git Source Author: @oscarsernarosero @mpetersoCode55 @cirsteveState Variables
MOST_SIGNIFICANT_BIT_SET_TO_1
Functions
calculateS
The result will be a WAD number. This function calculates s(n) and stores it in the tbc definition as b.| Name | Type | Description |
|---|---|---|
altbc | ALTBCDef | the tbc definition |
Xn | uint256 | the X value at n, this parameter is expected to be in WEI/WAD |
calculateConstantC
This function expects the parameters to be WAD numbers, the result will also be a WAD number. This function calculates the constant C and stores it in the tbc definition.| Name | Type | Description |
|---|---|---|
altbc | ALTBCDef | the tbc definition |
calculateC
The result for c will be in WAD ** 2. This function calculates the parameter c and stores it in the tbc definition. The result will be in WAD ** 2.| Name | Type | Description |
|---|---|---|
altbc | ALTBCDef | the tbc definition. Parameters used are expected to be in WAD ** 2. |
Xn | uint256 | the x coordinate, this parameter is expected to naturally be in WAD |
DnLow | uint256 | lower bits of the area under the curve, this parameter is expected to be multiplied by WAD ** 4 |
DnHigh | uint256 | higher bits of the area under the curve, this parameter is expected to be multiplied by WAD ** 4 |
calculatefx
The result for f(x) will be in WAD. This function calculates f(x) at n.| Name | Type | Description |
|---|---|---|
altbc | ALTBCDef | the tbc definition |
x | uint256 | value for x at n, this parameter is expected to naturally be in WAD |
| Name | Type | Description |
|---|---|---|
result | uint256 | the calculated f(x), this value will be a WAD number |
calculateFxWAD4
The result for F(x) will be in WAD ** 4. This function calculates F(x) at n and returns the result as a 512 bit number.| Name | Type | Description |
|---|---|---|
altbc | ALTBCDef | the tbc definition |
x | uint256 | value for x at n, this parameter is expected to naturally be in WAD |
| Name | Type | Description |
|---|---|---|
resultLow | uint256 | the lower bits of the calculated F(x), this value will be a WAD ** 4 number |
resultHigh | uint256 | the higher bits of the calculated F(x), this value will be a WAD ** 4 number |
calculateFx
The result for F(x) will be in WAD. This function calculates F(x) at n.| Name | Type | Description |
|---|---|---|
altbc | ALTBCDef | the tbc definition |
x | uint256 | value for x at n, this parameter is expected to naturally be in WAD |
| Name | Type | Description |
|---|---|---|
result | uint256 | the calculated F(x), this value will be a WAD number |
calculateDv
The result for Dv will be in WAD ** 2. This function calculates the virtual liquidity of the pool.| Name | Type | Description |
|---|---|---|
altbc | ALTBCDef | the tbc definition |
calculateFxInverse
The result for F(D) inverse will be in WAD. This function calculates F(D) inverse at n.| Name | Type | Description |
|---|---|---|
altbc | ALTBCDef | the tbc definition |
D | uint256 | Area under the TBC curve before the nth transaction, this parameter is expected to be a WAD number |
| Name | Type | Description |
|---|---|---|
result | uint256 | the calculated F(D) inverse, this value will be a WAD number |
calculateCInitial
We proceed to increase numerator precision by multiplying it by WAD. In the case of third param, this means we need to make it square to put it inside the square root without effecting the math. We also multiply the subtrahend of the numerator by WAD to keep it consistent The result for c will be in WAD ** 2. This function calculates the intial value of c.| Name | Type | Description |
|---|---|---|
altbc | ALTBCDef | the tbc definition |
calculateRMax
The result for RMax will be in WAD. This function calculates RMax at n which is the total revenue a developer can collect from the TBC at time n.| Name | Type | Description |
|---|---|---|
altbc | ALTBCDef | the tbc definition |
Xn | uint256 | the x coordinate, this parameter is expected to be value in WAD |
R | uint256 | the amount of revenue accrued for the owner of the pool over the lifetime of the pool |
| Name | Type | Description |
|---|---|---|
result | uint256 | the calculated RMax, this value will be a WAD number |
rMaxNaturalLogCalc
The result for the natural logarithm of the ratio of xMin and Xn will be in WAD ** 2. this result needs to be multlied by -1 to be properly used in the RMax calculation This function calculates the natural logarithm of the ratio of xMin and Xn.| Name | Type | Description |
|---|---|---|
altbc | ALTBCDef | the tbc definition |
Xn | uint256 | the x coordinate, this parameter is expected to be in WAD |
| Name | Type | Description |
|---|---|---|
result | uint256 | the calculated natural logarithm of the ratio of xMin and Xn, this value will be a WAD ** 2 number |