impermax-sdk 2.1.180 → 2.1.182

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.
@@ -51,7 +51,8 @@ class OffchainAccountNftlpUniswapV3 extends offchainAccountNftlp_1.default {
51
51
  return new uniswapV3_1.default(await this.getLiquidity(tokenId), uncollectedFees0, uncollectedFees1, await this.getLendingPool().getBorrowableA().getBorrowedAmount(tokenId), await this.getLendingPool().getBorrowableB().getBorrowedAmount(tokenId), await this.getNftlp().getMarketPrice(), await this.getNftlp().getOraclePrice(), await this.getPriceA(tokenId), await this.getPriceB(tokenId), await this.getLendingPool().getSafetyMargin(), await this.getLendingPool().getLiquidationPenalty(), lockStateChange);
52
52
  }
53
53
  async createNewPositionObject(fee, priceA, priceB, lockStateChange = false) {
54
- // TODO check for priceA/priceB sanity
54
+ priceA = await this.getNftlp().nearestUsableTickPrice(priceA, fee);
55
+ priceB = await this.getNftlp().nearestUsableTickPrice(priceB, fee);
55
56
  return new uniswapV3_1.default(0, 0, 0, 0, 0, await this.getNftlp().getMarketPrice(), await this.getNftlp().getOraclePrice(), priceA, priceB, await this.getLendingPool().getSafetyMargin(), await this.getLendingPool().getLiquidationPenalty(), lockStateChange);
56
57
  }
57
58
  async getPositionObject(tokenId) {
@@ -49,7 +49,8 @@ class OnchainAccountNftlpUniswapV3 extends onchainAccountNftlp_1.default {
49
49
  0, await this.getLendingPool().getBorrowableA().getBorrowed(tokenId), await this.getLendingPool().getBorrowableB().getBorrowed(tokenId), await this.getNftlp().getMarketPrice(), await this.getNftlp().getOraclePrice(), await this.getPriceA(tokenId), await this.getPriceB(tokenId), await this.getLendingPool().getSafetyMargin(), await this.getLendingPool().getLiquidationPenalty(), lockStateChange);
50
50
  }
51
51
  async createNewPositionObject(fee, priceA, priceB, lockStateChange = false) {
52
- // TODO check for priceA/priceB sanity
52
+ priceA = await this.getNftlp().nearestUsableTickPrice(priceA, fee);
53
+ priceB = await this.getNftlp().nearestUsableTickPrice(priceB, fee);
53
54
  return new uniswapV3_1.default(0, 0, 0, 0, 0, await this.getNftlp().getMarketPrice(), await this.getNftlp().getOraclePrice(), priceA, priceB, await this.getLendingPool().getSafetyMargin(), await this.getLendingPool().getLiquidationPenalty(), lockStateChange);
54
55
  }
55
56
  async getPositionObject(tokenId) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impermax-sdk",
3
- "version": "2.1.180",
3
+ "version": "2.1.182",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",