impermax-sdk 2.1.293 → 2.1.294
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -43,13 +43,9 @@ class OffchainNftlpUniswapV3 extends offchainNftlp_1.default {
|
|
|
43
43
|
const feeRaw = fee * 1000000;
|
|
44
44
|
const nftlpUniswapV3Data = await this.getNftlpData();
|
|
45
45
|
const pools = nftlpUniswapV3Data.uniswapV3Pools;
|
|
46
|
-
console.log("feeRaw", feeRaw);
|
|
47
|
-
console.log("pools", pools);
|
|
48
46
|
for (let pool of pools) {
|
|
49
47
|
if (parseInt(pool.fee) == feeRaw) {
|
|
50
|
-
console.log("initializeUniswapV3Pool");
|
|
51
48
|
const liquidity = parseInt(pool.liquidity);
|
|
52
|
-
console.log("liquidity", liquidity);
|
|
53
49
|
const decimalsA = await this.getLendingPool().getBorrowableA().getDecimals();
|
|
54
50
|
const decimalsB = await this.getLendingPool().getBorrowableB().getDecimals();
|
|
55
51
|
return {
|
|
@@ -83,10 +79,6 @@ class OffchainNftlpUniswapV3 extends offchainNftlp_1.default {
|
|
|
83
79
|
const llamaApyBase = apyBase / 100;
|
|
84
80
|
const apr1dFees = volumeUsd1d * fee * 365 / tvlUsd;
|
|
85
81
|
const apr7dFees = volumeUsd7d * fee / 7 * 365 / tvlUsd;
|
|
86
|
-
console.log("llamaApyBase", llamaApyBase);
|
|
87
|
-
console.log("apr1dFees", apr1dFees);
|
|
88
|
-
console.log("apr7dFees", apr7dFees);
|
|
89
|
-
console.log("tvlUsd", tvlUsd);
|
|
90
82
|
// convert llama apy to rate
|
|
91
83
|
const avgRate = apr7dFees / utils_1.SECONDS_IN_YEAR;
|
|
92
84
|
// calculate the usd price of 1 unit of formatted liquidity
|
|
@@ -97,11 +89,6 @@ class OffchainNftlpUniswapV3 extends offchainNftlp_1.default {
|
|
|
97
89
|
const baseLiquidityUsd = pool.liquidity * baseLiquidityPrice;
|
|
98
90
|
const avgConcentrationFactor = baseLiquidityUsd / tvlUsd;
|
|
99
91
|
const fullRangeRate = avgRate / avgConcentrationFactor;
|
|
100
|
-
console.log("avgRate", avgRate);
|
|
101
|
-
console.log("baseLiquidityPrice", baseLiquidityPrice);
|
|
102
|
-
console.log("baseLiquidityUsd", baseLiquidityUsd);
|
|
103
|
-
console.log("avgConcentrationFactor", avgConcentrationFactor);
|
|
104
|
-
console.log("fullRangeRate", fullRangeRate);
|
|
105
92
|
return { fullRangeRate, tvlUsd };
|
|
106
93
|
}
|
|
107
94
|
async getFullRangeRate(fee) {
|
|
@@ -116,15 +103,11 @@ class OffchainNftlpUniswapV3 extends offchainNftlp_1.default {
|
|
|
116
103
|
totalTvl += tvlUsd;
|
|
117
104
|
totalCompoundedRate += fullRangeRate * tvlUsd;
|
|
118
105
|
}
|
|
119
|
-
console.log("totalTvl", totalTvl);
|
|
120
|
-
console.log("totalCompoundedRate", totalCompoundedRate);
|
|
121
106
|
return totalTvl > 0 ? totalCompoundedRate / totalTvl : 0;
|
|
122
107
|
}
|
|
123
108
|
// calculate the pair APR assuming a +-30% price range
|
|
124
109
|
async getTotalAPR() {
|
|
125
110
|
const fullRangeAPR = await this.getWeightedAvgFullRangeRate() * utils_1.SECONDS_IN_YEAR;
|
|
126
|
-
console.log("fullRangeAPR", fullRangeAPR);
|
|
127
|
-
console.log("uniV3ConcentrationFactor", (0, uniswapV3General_1.uniV3ConcentrationFactor)(1 / 1.3, 1.3));
|
|
128
111
|
return fullRangeAPR * (0, uniswapV3General_1.uniV3ConcentrationFactor)(1 / 1.3, 1.3);
|
|
129
112
|
}
|
|
130
113
|
}
|
|
@@ -80,9 +80,11 @@ class UniswapV3Position extends genericPosition_1.default {
|
|
|
80
80
|
return this.getInitialRealY() + this.initialUnclaimedFeesY;
|
|
81
81
|
}
|
|
82
82
|
getDepositedX() {
|
|
83
|
+
console.log("getDepositedX", this.getRealX() + this.unclaimedFeesX, this.getRealX(), this.unclaimedFeesX);
|
|
83
84
|
return this.getRealX() + this.unclaimedFeesX;
|
|
84
85
|
}
|
|
85
86
|
getDepositedY() {
|
|
87
|
+
console.log("getDepositedY", this.getRealY() + this.unclaimedFeesY, this.getRealY(), this.unclaimedFeesY);
|
|
86
88
|
return this.getRealY() + this.unclaimedFeesY;
|
|
87
89
|
}
|
|
88
90
|
getBaseRate() {
|