Module: calculations
Functions
calcDepositToGov
▸ calcDepositToGov(inputTokenAmount, virtualSwapOutputAmount, premium, boosting, gaugePoolReserve, gaugePoolW, reserveGlobal, globalW): number
Parameters
| Name | Type |
|---|---|
inputTokenAmount | bigint |
virtualSwapOutputAmount | bigint |
premium | number |
boosting | number |
gaugePoolReserve | number |
gaugePoolW | number |
reserveGlobal | number |
globalW | number |
Returns
number
Defined in
src/calculations/investmentCalc.ts:74
calcDepositToSp
▸ calcDepositToSp(inputTokenAmount, virtualSwapOutputAmount, premium, boosting, gaugePoolReserve, gaugePoolW): number
Parameters
| Name | Type |
|---|---|
inputTokenAmount | bigint |
virtualSwapOutputAmount | bigint |
premium | number |
boosting | number |
gaugePoolReserve | number |
gaugePoolW | number |
Returns
number
Defined in
src/calculations/investmentCalc.ts:98
calcFairPriceBigInt
▸ calcFairPriceBigInt(quoteTokenFee, opponentTokenFee, quoteTokenReserve, opponentTokenReserve, quoteTokenDecimal, opponentTokenDecimal): bigint
Parameters
| Name | Type |
|---|---|
quoteTokenFee | bigint |
opponentTokenFee | bigint |
quoteTokenReserve | bigint |
opponentTokenReserve | bigint |
quoteTokenDecimal | number |
opponentTokenDecimal | number |
Returns
bigint
Defined in
src/calculations/pairInfosCalc.ts:40
calcFairPriceByPairInfoBigInt
▸ calcFairPriceByPairInfoBigInt<T>(dysonPair, quoteToken, poolToken): bigint
Type parameters
| Name | Type |
|---|---|
T | extends string |
Parameters
| Name | Type |
|---|---|
dysonPair | DysonPair |
quoteToken | string |
poolToken | PoolToken<T> |
Returns
bigint
Defined in
src/calculations/pairInfosCalc.ts:68
calcFee
▸ calcFee(lastFee, pastTime, halfLife): null | bigint
Parameters
| Name | Type |
|---|---|
lastFee | bigint |
pastTime | bigint |
halfLife | bigint |
Returns
null | bigint
Defined in
src/calculations/pairInfosCalc.ts:115
calcFeeWrapped
▸ calcFeeWrapped(lastFee, pastTime, halfLife): bigint
Parameters
| Name | Type |
|---|---|
lastFee | bigint |
pastTime | bigint |
halfLife | bigint |
Returns
bigint
Defined in
src/calculations/pairInfosCalc.ts:64
calcGovApr
▸ calcGovApr(depositTokenValue, govValue, daySecond): number
Parameters
| Name | Type |
|---|---|
depositTokenValue | number |
govValue | number |
daySecond | number |
Returns
number
Defined in
src/calculations/apyCalc.ts:76
calcGovApy
▸ calcGovApy(depositTokenValue, govValue, daySecond): number
Parameters
| Name | Type |
|---|---|
depositTokenValue | number |
govValue | number |
daySecond | number |
Returns
number
Defined in
src/calculations/apyCalc.ts:25
calcGovCurrentPrice
▸ calcGovCurrentPrice(govAmount, reserveUSD, reserveGOV): number
Parameters
| Name | Type |
|---|---|
govAmount | number |
reserveUSD | number |
reserveGOV | number |
Returns
number
Defined in
src/calculations/investmentCalc.ts:117
calcLocalAP
▸ calcLocalAP(inputTokenAmount, virtualSwapOutputAmount, premium, boosting): number
Parameters
| Name | Type |
|---|---|
inputTokenAmount | bigint |
virtualSwapOutputAmount | bigint |
premium | number |
boosting | number |
Returns
number
Defined in
src/calculations/investmentCalc.ts:7
calcMarginLocalSP
▸ calcMarginLocalSP(fairPrice, premium, baseTokenPrice, combineTokenDecimals, boosting): number
Parameters
| Name | Type |
|---|---|
fairPrice | bigint |
premium | number |
baseTokenPrice | number |
combineTokenDecimals | number |
boosting | number |
Returns
number
Defined in
src/calculations/investmentCalc.ts:25
calcMinOutput
▸ calcMinOutput(swappedAmount, slippage, decimals): bigint
Parameters
| Name | Type |
|---|---|
swappedAmount | bigint |
slippage | string |
decimals | number |
Returns
bigint
Defined in
src/calculations/swapCalc.ts:92
calcNewtonDerivativeReciprocal
▸ calcNewtonDerivativeReciprocal(depositAmount, inputReserve, outputReserve, calcFeeValue): bigint
Parameters
| Name | Type |
|---|---|
depositAmount | bigint |
inputReserve | bigint |
outputReserve | bigint |
calcFeeValue | bigint |
Returns
bigint
Defined in
src/calculations/swapCalc.ts:8
calcPcv
▸ calcPcv(token0Pcv, token1Pcv, price0, price1): number
Parameters
| Name | Type |
|---|---|
token0Pcv | number |
token1Pcv | number |
price0 | number |
price1 | number |
Returns
number
Defined in
src/calculations/pairInfosCalc.ts:149
calcPoolBoosting
▸ calcPoolBoosting(totalSupply, userBalance): bigint
Parameters
| Name | Type |
|---|---|
totalSupply | bigint |
userBalance | bigint |
Returns
bigint
Defined in
src/calculations/boostingCalc.ts:6
calcPremium
▸ calcPremium(volatility, daySecond): number
Parameters
| Name | Type |
|---|---|
volatility | number |
daySecond | number |
Returns
number
Defined in
src/calculations/investmentCalc.ts:162
calcPremiumApr
▸ calcPremiumApr(premium, depositTokenValue, govValue, daySecond): number
Parameters
| Name | Type |
|---|---|
premium | number |
depositTokenValue | number |
govValue | number |
daySecond | number |
Returns
number
Defined in
src/calculations/apyCalc.ts:34
calcPremiumAprByNote
▸ calcPremiumAprByNote(claimTokenValue, basicTokenValue, daySecond): number
Parameters
| Name | Type |
|---|---|
claimTokenValue | number |
basicTokenValue | number |
daySecond | number |
Returns
number
Defined in
src/calculations/apyCalc.ts:68
calcPremiumApy
▸ calcPremiumApy(premium, depositTokenValue, govValue, daySecond): number
Parameters
| Name | Type |
|---|---|
premium | number |
depositTokenValue | number |
govValue | number |
daySecond | number |
Returns
number
Defined in
calcPremiumApyByNote
▸ calcPremiumApyByNote(claimTokenValue, basicTokenValue, daySecond): number
Parameters
| Name | Type |
|---|---|
claimTokenValue | number |
basicTokenValue | number |
daySecond | number |
Returns
number
Defined in
src/calculations/apyCalc.ts:17
calcPriceImpact
▸ calcPriceImpact(inputAmount, swappedAmount, inputReserve, outputReserve, calcFeeValue, calcFeeDecimals?): number
Parameters
| Name | Type | Default value |
|---|---|---|
inputAmount | number | undefined |
swappedAmount | number | undefined |
inputReserve | number | undefined |
outputReserve | number | undefined |
calcFeeValue | bigint | undefined |
calcFeeDecimals | number | 18 |
Returns
number
Defined in
src/calculations/pairInfosCalc.ts:123
calcPurePremiumApr
▸ calcPurePremiumApr(premium, daySecond): number
Parameters
| Name | Type |
|---|---|
premium | number |
daySecond | number |
Returns
number
Defined in
src/calculations/apyCalc.ts:65
calcPurePremiumApy
▸ calcPurePremiumApy(premium, daySecond): number
Parameters
| Name | Type |
|---|---|
premium | number |
daySecond | number |
Returns
number
Defined in
src/calculations/apyCalc.ts:14
calcRoi
▸ calcRoi(isJoinReferrerSystem?, investTokenValue?, premium?, govValue?): undefined | number
Parameters
| Name | Type |
|---|---|
isJoinReferrerSystem? | boolean |
investTokenValue? | number |
premium? | number |
govValue? | number |
Returns
undefined | number
Defined in
src/calculations/investmentCalc.ts:134
calcRoiByAmount
▸ calcRoiByAmount(investTokenValue?, returnTokenValue?): number
Parameters
| Name | Type |
|---|---|
investTokenValue? | number |
returnTokenValue? | number |
Returns
number
Defined in
src/calculations/investmentCalc.ts:155
calcSponsorWeeklyApr
▸ calcSponsorWeeklyApr(nextWeekSponsorValue, poolSdysnValue): number
Parameters
| Name | Type |
|---|---|
nextWeekSponsorValue | number |
poolSdysnValue | number |
Returns
number
Defined in
src/calculations/apyCalc.ts:88
calcStrikePrice
▸ calcStrikePrice(depositAmountString, depositAmount, inputReserve, outputReserve, calcFeeValue): number
Parameters
| Name | Type |
|---|---|
depositAmountString | string |
depositAmount | bigint |
inputReserve | bigint |
outputReserve | bigint |
calcFeeValue | bigint |
Returns
number
Defined in
src/calculations/pairInfosCalc.ts:22
calcStrikePriceByAmount
▸ calcStrikePriceByAmount(baseTokenAmount, quoteTokenAmount): number
Parameters
| Name | Type |
|---|---|
baseTokenAmount | number |
quoteTokenAmount | number |
Returns
number
Defined in
src/calculations/pairInfosCalc.ts:12
calcSwappedAmount
▸ calcSwappedAmount(depositAmount, inputReserve, outputReserve, calcFeeValue): bigint
Parameters
| Name | Type |
|---|---|
depositAmount | bigint |
inputReserve | bigint |
outputReserve | bigint |
calcFeeValue | bigint |
Returns
bigint
Defined in
src/calculations/swapCalc.ts:81
calcSwappedInputAmount
▸ calcSwappedInputAmount(guessOutAmount, outputReserve, inputReserve, calcFeeValue): bigint
Parameters
| Name | Type |
|---|---|
guessOutAmount | bigint |
outputReserve | bigint |
inputReserve | bigint |
calcFeeValue | bigint |
Returns
bigint
Defined in
src/calculations/swapCalc.ts:64
calcTornadoMargin
▸ calcTornadoMargin(reserve, weight): number
Parameters
| Name | Type |
|---|---|
reserve | number |
weight | number |
Returns
number
Defined in
src/calculations/investmentCalc.ts:51
calcTotalApr
▸ calcTotalApr(premium, depositTokenValue, govValue, daySecond): number
Parameters
| Name | Type |
|---|---|
premium | number |
depositTokenValue | number |
govValue | number |
daySecond | number |
Returns
number
Defined in
src/calculations/apyCalc.ts:49
calcTvl
▸ calcTvl(reserve0, reserve1, price0, price1): number
Parameters
| Name | Type |
|---|---|
reserve0 | number |
reserve1 | number |
price0 | number |
price1 | number |
Returns
number
Defined in
src/calculations/pairInfosCalc.ts:142
divu
▸ divu(x, y): null | bigint
Parameters
| Name | Type |
|---|---|
x | bigint |
y | bigint |
Returns
null | bigint
Defined in
src/calculations/abdkMath64x64.ts:300
divuu
▸ divuu(x, y): null | bigint
Parameters
| Name | Type |
|---|---|
x | bigint |
y | bigint |
Returns
null | bigint
Defined in
src/calculations/abdkMath64x64.ts:221
exp_2
▸ exp_2(bigIntPower): null | bigint | 0
Parameters
| Name | Type |
|---|---|
bigIntPower | bigint |
Returns
null | bigint | 0
Defined in
src/calculations/abdkMath64x64.ts:3
getCurrentReserve
▸ getCurrentReserve(rewardRate, lastReserve, lastUpdateTime): number
Parameters
| Name | Type |
|---|---|
rewardRate | number |
lastReserve | number |
lastUpdateTime | number |
Returns
number
Defined in
src/calculations/investmentCalc.ts:126
globalApToGOV
▸ globalApToGOV(apAmount, reserveGlobal, globalW): number
Parameters
| Name | Type |
|---|---|
apAmount | number |
reserveGlobal | number |
globalW | number |
Returns
number
Defined in
src/calculations/investmentCalc.ts:65
localAPToGlobalAP
▸ localAPToGlobalAP(localApAmount, gaugePoolReserve, gaugePoolW): number
Parameters
| Name | Type |
|---|---|
localApAmount | number |
gaugePoolReserve | number |
gaugePoolW | number |
Returns
number
Defined in
src/calculations/investmentCalc.ts:55
mulu
▸ mulu(x, y): null | bigint
Parameters
| Name | Type |
|---|---|
x | bigint |
y | bigint |
Returns
null | bigint
Defined in
src/calculations/abdkMath64x64.ts:311
sqrt
▸ sqrt(x): bigint
Parameters
| Name | Type |
|---|---|
x | bigint |
Returns
bigint