impermax-sdk 2.1.424 → 2.1.426

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.
@@ -246,7 +246,8 @@ exports.WHITELISTED_PAIRS = {
246
246
  [types_1.Networks.Unichain]: {
247
247
  [types_1.Factory.V3]: [
248
248
  "0x08385F73C45E4ED809C1a41aE8237BdBaf699fCC",
249
- "0x242DF683a84F4ae2C77AcaBA7e1579AfFD6E5A09", // ETH/wbBTC univ3
249
+ "0x242DF683a84F4ae2C77AcaBA7e1579AfFD6E5A09",
250
+ "0x0393C31fDe67edA8E49D29D7A7E004cEb2FA29e8", // USDC/USDT0 univ3
250
251
  ],
251
252
  }
252
253
  };
@@ -205,7 +205,9 @@ class OffchainNftlpUniswapV3 extends offchainNftlp_1.default {
205
205
  // calculate the pair APR assuming a +-8% price range
206
206
  async getTotalAPR() {
207
207
  const fullRangeAPR = await this.getBestFullRangeRate() * utils_1.SECONDS_IN_YEAR;
208
- return fullRangeAPR * (0, uniswapV3General_1.uniV3ConcentrationFactor)(1 / 1.08, 1.08);
208
+ const isStable = await this.getLendingPool().isStablePair();
209
+ const adjustment = isStable ? 1.0001 : 1.08;
210
+ return fullRangeAPR * (0, uniswapV3General_1.uniV3ConcentrationFactor)(1 / adjustment, adjustment);
209
211
  }
210
212
  }
211
213
  exports.default = OffchainNftlpUniswapV3;
@@ -65,7 +65,9 @@ export default abstract class OffchainLendingPool {
65
65
  isWhitelisted(): boolean;
66
66
  isLowTVL(): Promise<boolean>;
67
67
  isHighTVL(): Promise<boolean>;
68
- isStable(): Promise<boolean>;
68
+ isStableFactory(): boolean;
69
+ private normalizeTokenSymbol;
70
+ isStablePair(): Promise<boolean>;
69
71
  getLendingPoolVersion(): LendingPoolVersion;
70
72
  getTotalBorrowsUSD(): Promise<number>;
71
73
  private initializeLendingPoolAddresses;
@@ -155,20 +155,25 @@ class OffchainLendingPool {
155
155
  return true;
156
156
  return false;
157
157
  }
158
- // Stable is defined if any following condition is met:
159
- // - Both tokens are stables
160
- // - factory type is "7" (ie. SOL_STABLE)
161
- async isStable() {
162
- // const [stables, token0, token1] = await Promise.all([
163
- // this.getOffchain().getAPRHelper().getAllStablecoins(),
164
- // this.getBorrowableA().getSymbol(),
165
- // this.getBorrowableB().getSymbol(),
166
- // ]);
167
- // const bothStable = stables.includes(token0) && stables.includes(token1);
168
- // if (bothStable || this.factory === "7") return true;
169
- if (this.factory === types_1.Factory.SOL_STABLE)
170
- return true;
171
- return false;
158
+ isStableFactory() {
159
+ return this.factory === types_1.Factory.SOL_STABLE;
160
+ }
161
+ normalizeTokenSymbol(symbol) {
162
+ const tokenMappings = {
163
+ 'USD₮0': 'USDT',
164
+ 'USDC.e': 'USDC',
165
+ };
166
+ return tokenMappings[symbol] || symbol;
167
+ }
168
+ async isStablePair() {
169
+ let [stables, token0, token1] = await Promise.all([
170
+ this.getOffchain().getAPRHelper().getAllStablecoins(),
171
+ this.getBorrowableA().getSymbol(),
172
+ this.getBorrowableB().getSymbol(),
173
+ ]);
174
+ const symbol0 = this.normalizeTokenSymbol(token0);
175
+ const symbol1 = this.normalizeTokenSymbol(token1);
176
+ return stables.includes(symbol0) && stables.includes(symbol1);
172
177
  }
173
178
  // Versions Specfics
174
179
  getLendingPoolVersion() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impermax-sdk",
3
- "version": "2.1.424",
3
+ "version": "2.1.426",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",