@strkfarm/sdk 1.1.0 → 1.1.1
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.
- package/dist/index.browser.global.js +12 -12
- package/dist/index.browser.mjs +12 -12
- package/dist/index.js +12 -12
- package/dist/index.mjs +12 -12
- package/package.json +1 -1
- package/src/global.ts +1 -1
- package/src/strategies/ekubo-cl-vault.tsx +11 -11
|
@@ -49037,7 +49037,7 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
49037
49037
|
address: ContractAddr.from("0x49d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7"),
|
|
49038
49038
|
decimals: 18,
|
|
49039
49039
|
coingeckId: void 0,
|
|
49040
|
-
displayDecimals:
|
|
49040
|
+
displayDecimals: 6
|
|
49041
49041
|
}, {
|
|
49042
49042
|
name: "USDC",
|
|
49043
49043
|
symbol: "USDC",
|
|
@@ -66795,7 +66795,7 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
66795
66795
|
* Calculates assets before and now in a given token of TVL per share to observe growth
|
|
66796
66796
|
* @returns {Promise<number>} The weighted average APY across all pools
|
|
66797
66797
|
*/
|
|
66798
|
-
async netAPY(blockIdentifier = "
|
|
66798
|
+
async netAPY(blockIdentifier = "latest", sinceBlocks = 2e4) {
|
|
66799
66799
|
const tvlNow = await this._getTVL(blockIdentifier);
|
|
66800
66800
|
const supplyNow = await this.totalSupply(blockIdentifier);
|
|
66801
66801
|
const priceNow = await this.getCurrentPrice(blockIdentifier);
|
|
@@ -66854,13 +66854,13 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
66854
66854
|
}
|
|
66855
66855
|
return shares;
|
|
66856
66856
|
}
|
|
66857
|
-
async balanceOf(user, blockIdentifier = "
|
|
66857
|
+
async balanceOf(user, blockIdentifier = "latest") {
|
|
66858
66858
|
let bal = await this.contract.call("balance_of", [user.address], {
|
|
66859
66859
|
blockIdentifier
|
|
66860
66860
|
});
|
|
66861
66861
|
return Web3Number.fromWei(bal.toString(), 18);
|
|
66862
66862
|
}
|
|
66863
|
-
async getUserTVL(user, blockIdentifier = "
|
|
66863
|
+
async getUserTVL(user, blockIdentifier = "latest") {
|
|
66864
66864
|
let bal = await this.balanceOf(user, blockIdentifier);
|
|
66865
66865
|
const assets = await this.contract.call(
|
|
66866
66866
|
"convert_to_assets",
|
|
@@ -66899,7 +66899,7 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
66899
66899
|
}
|
|
66900
66900
|
};
|
|
66901
66901
|
}
|
|
66902
|
-
async _getTVL(blockIdentifier = "
|
|
66902
|
+
async _getTVL(blockIdentifier = "latest") {
|
|
66903
66903
|
const result = await this.contract.call("total_liquidity", [], {
|
|
66904
66904
|
blockIdentifier
|
|
66905
66905
|
});
|
|
@@ -66911,7 +66911,7 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
66911
66911
|
);
|
|
66912
66912
|
return { amount0, amount1 };
|
|
66913
66913
|
}
|
|
66914
|
-
async totalSupply(blockIdentifier = "
|
|
66914
|
+
async totalSupply(blockIdentifier = "latest") {
|
|
66915
66915
|
const res = await this.contract.call("total_supply", [], {
|
|
66916
66916
|
blockIdentifier
|
|
66917
66917
|
});
|
|
@@ -66927,7 +66927,7 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
66927
66927
|
"Expected token1 in depositTokens[1]"
|
|
66928
66928
|
);
|
|
66929
66929
|
}
|
|
66930
|
-
async getTVL(blockIdentifier = "
|
|
66930
|
+
async getTVL(blockIdentifier = "latest") {
|
|
66931
66931
|
const { amount0, amount1 } = await this._getTVL(blockIdentifier);
|
|
66932
66932
|
const poolKey = await this.getPoolKey(blockIdentifier);
|
|
66933
66933
|
this.assertValidDepositTokens(poolKey);
|
|
@@ -67016,11 +67016,11 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
67016
67016
|
}
|
|
67017
67017
|
throw new Error("No true price available");
|
|
67018
67018
|
}
|
|
67019
|
-
async getCurrentPrice(blockIdentifier = "
|
|
67019
|
+
async getCurrentPrice(blockIdentifier = "latest") {
|
|
67020
67020
|
const poolKey = await this.getPoolKey(blockIdentifier);
|
|
67021
67021
|
return this._getCurrentPrice(poolKey, blockIdentifier);
|
|
67022
67022
|
}
|
|
67023
|
-
async _getCurrentPrice(poolKey, blockIdentifier = "
|
|
67023
|
+
async _getCurrentPrice(poolKey, blockIdentifier = "latest") {
|
|
67024
67024
|
const priceInfo = await this.ekuboPositionsContract.call(
|
|
67025
67025
|
"get_pool_price",
|
|
67026
67026
|
[
|
|
@@ -67055,7 +67055,7 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
67055
67055
|
sqrtRatio: priceInfo.sqrt_ratio.toString()
|
|
67056
67056
|
};
|
|
67057
67057
|
}
|
|
67058
|
-
async getCurrentBounds(blockIdentifier = "
|
|
67058
|
+
async getCurrentBounds(blockIdentifier = "latest") {
|
|
67059
67059
|
const result = await this.contract.call("get_position_key", [], {
|
|
67060
67060
|
blockIdentifier
|
|
67061
67061
|
});
|
|
@@ -67072,7 +67072,7 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
67072
67072
|
const tick = Math.floor(value / tickSpacing) * tickSpacing;
|
|
67073
67073
|
return this.tickToi129(tick);
|
|
67074
67074
|
}
|
|
67075
|
-
async getPoolKey(blockIdentifier = "
|
|
67075
|
+
async getPoolKey(blockIdentifier = "latest") {
|
|
67076
67076
|
if (this.poolKey) {
|
|
67077
67077
|
return this.poolKey;
|
|
67078
67078
|
}
|
|
@@ -67570,7 +67570,7 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
67570
67570
|
static tickToPrice(tick) {
|
|
67571
67571
|
return Math.pow(1.000001, Number(tick));
|
|
67572
67572
|
}
|
|
67573
|
-
async getLiquidityToAmounts(liquidity, bounds, blockIdentifier = "
|
|
67573
|
+
async getLiquidityToAmounts(liquidity, bounds, blockIdentifier = "latest", _poolKey = null, _currentPrice = null) {
|
|
67574
67574
|
const currentPrice = _currentPrice || await this.getCurrentPrice(blockIdentifier);
|
|
67575
67575
|
const lowerPrice = _EkuboCLVault.tickToPrice(bounds.lowerTick);
|
|
67576
67576
|
const upperPrice = _EkuboCLVault.tickToPrice(bounds.upperTick);
|
package/dist/index.browser.mjs
CHANGED
|
@@ -151,7 +151,7 @@ var defaultTokens = [{
|
|
|
151
151
|
address: ContractAddr.from("0x49d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7"),
|
|
152
152
|
decimals: 18,
|
|
153
153
|
coingeckId: void 0,
|
|
154
|
-
displayDecimals:
|
|
154
|
+
displayDecimals: 6
|
|
155
155
|
}, {
|
|
156
156
|
name: "USDC",
|
|
157
157
|
symbol: "USDC",
|
|
@@ -15234,7 +15234,7 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
15234
15234
|
* Calculates assets before and now in a given token of TVL per share to observe growth
|
|
15235
15235
|
* @returns {Promise<number>} The weighted average APY across all pools
|
|
15236
15236
|
*/
|
|
15237
|
-
async netAPY(blockIdentifier = "
|
|
15237
|
+
async netAPY(blockIdentifier = "latest", sinceBlocks = 2e4) {
|
|
15238
15238
|
const tvlNow = await this._getTVL(blockIdentifier);
|
|
15239
15239
|
const supplyNow = await this.totalSupply(blockIdentifier);
|
|
15240
15240
|
const priceNow = await this.getCurrentPrice(blockIdentifier);
|
|
@@ -15293,13 +15293,13 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
15293
15293
|
}
|
|
15294
15294
|
return shares;
|
|
15295
15295
|
}
|
|
15296
|
-
async balanceOf(user, blockIdentifier = "
|
|
15296
|
+
async balanceOf(user, blockIdentifier = "latest") {
|
|
15297
15297
|
let bal = await this.contract.call("balance_of", [user.address], {
|
|
15298
15298
|
blockIdentifier
|
|
15299
15299
|
});
|
|
15300
15300
|
return Web3Number.fromWei(bal.toString(), 18);
|
|
15301
15301
|
}
|
|
15302
|
-
async getUserTVL(user, blockIdentifier = "
|
|
15302
|
+
async getUserTVL(user, blockIdentifier = "latest") {
|
|
15303
15303
|
let bal = await this.balanceOf(user, blockIdentifier);
|
|
15304
15304
|
const assets = await this.contract.call(
|
|
15305
15305
|
"convert_to_assets",
|
|
@@ -15338,7 +15338,7 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
15338
15338
|
}
|
|
15339
15339
|
};
|
|
15340
15340
|
}
|
|
15341
|
-
async _getTVL(blockIdentifier = "
|
|
15341
|
+
async _getTVL(blockIdentifier = "latest") {
|
|
15342
15342
|
const result = await this.contract.call("total_liquidity", [], {
|
|
15343
15343
|
blockIdentifier
|
|
15344
15344
|
});
|
|
@@ -15350,7 +15350,7 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
15350
15350
|
);
|
|
15351
15351
|
return { amount0, amount1 };
|
|
15352
15352
|
}
|
|
15353
|
-
async totalSupply(blockIdentifier = "
|
|
15353
|
+
async totalSupply(blockIdentifier = "latest") {
|
|
15354
15354
|
const res = await this.contract.call("total_supply", [], {
|
|
15355
15355
|
blockIdentifier
|
|
15356
15356
|
});
|
|
@@ -15366,7 +15366,7 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
15366
15366
|
"Expected token1 in depositTokens[1]"
|
|
15367
15367
|
);
|
|
15368
15368
|
}
|
|
15369
|
-
async getTVL(blockIdentifier = "
|
|
15369
|
+
async getTVL(blockIdentifier = "latest") {
|
|
15370
15370
|
const { amount0, amount1 } = await this._getTVL(blockIdentifier);
|
|
15371
15371
|
const poolKey = await this.getPoolKey(blockIdentifier);
|
|
15372
15372
|
this.assertValidDepositTokens(poolKey);
|
|
@@ -15455,11 +15455,11 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
15455
15455
|
}
|
|
15456
15456
|
throw new Error("No true price available");
|
|
15457
15457
|
}
|
|
15458
|
-
async getCurrentPrice(blockIdentifier = "
|
|
15458
|
+
async getCurrentPrice(blockIdentifier = "latest") {
|
|
15459
15459
|
const poolKey = await this.getPoolKey(blockIdentifier);
|
|
15460
15460
|
return this._getCurrentPrice(poolKey, blockIdentifier);
|
|
15461
15461
|
}
|
|
15462
|
-
async _getCurrentPrice(poolKey, blockIdentifier = "
|
|
15462
|
+
async _getCurrentPrice(poolKey, blockIdentifier = "latest") {
|
|
15463
15463
|
const priceInfo = await this.ekuboPositionsContract.call(
|
|
15464
15464
|
"get_pool_price",
|
|
15465
15465
|
[
|
|
@@ -15494,7 +15494,7 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
15494
15494
|
sqrtRatio: priceInfo.sqrt_ratio.toString()
|
|
15495
15495
|
};
|
|
15496
15496
|
}
|
|
15497
|
-
async getCurrentBounds(blockIdentifier = "
|
|
15497
|
+
async getCurrentBounds(blockIdentifier = "latest") {
|
|
15498
15498
|
const result = await this.contract.call("get_position_key", [], {
|
|
15499
15499
|
blockIdentifier
|
|
15500
15500
|
});
|
|
@@ -15511,7 +15511,7 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
15511
15511
|
const tick = Math.floor(value / tickSpacing) * tickSpacing;
|
|
15512
15512
|
return this.tickToi129(tick);
|
|
15513
15513
|
}
|
|
15514
|
-
async getPoolKey(blockIdentifier = "
|
|
15514
|
+
async getPoolKey(blockIdentifier = "latest") {
|
|
15515
15515
|
if (this.poolKey) {
|
|
15516
15516
|
return this.poolKey;
|
|
15517
15517
|
}
|
|
@@ -16009,7 +16009,7 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
16009
16009
|
static tickToPrice(tick) {
|
|
16010
16010
|
return Math.pow(1.000001, Number(tick));
|
|
16011
16011
|
}
|
|
16012
|
-
async getLiquidityToAmounts(liquidity, bounds, blockIdentifier = "
|
|
16012
|
+
async getLiquidityToAmounts(liquidity, bounds, blockIdentifier = "latest", _poolKey = null, _currentPrice = null) {
|
|
16013
16013
|
const currentPrice = _currentPrice || await this.getCurrentPrice(blockIdentifier);
|
|
16014
16014
|
const lowerPrice = _EkuboCLVault.tickToPrice(bounds.lowerTick);
|
|
16015
16015
|
const upperPrice = _EkuboCLVault.tickToPrice(bounds.upperTick);
|
package/dist/index.js
CHANGED
|
@@ -279,7 +279,7 @@ var defaultTokens = [{
|
|
|
279
279
|
address: ContractAddr.from("0x49d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7"),
|
|
280
280
|
decimals: 18,
|
|
281
281
|
coingeckId: void 0,
|
|
282
|
-
displayDecimals:
|
|
282
|
+
displayDecimals: 6
|
|
283
283
|
}, {
|
|
284
284
|
name: "USDC",
|
|
285
285
|
symbol: "USDC",
|
|
@@ -15366,7 +15366,7 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
15366
15366
|
* Calculates assets before and now in a given token of TVL per share to observe growth
|
|
15367
15367
|
* @returns {Promise<number>} The weighted average APY across all pools
|
|
15368
15368
|
*/
|
|
15369
|
-
async netAPY(blockIdentifier = "
|
|
15369
|
+
async netAPY(blockIdentifier = "latest", sinceBlocks = 2e4) {
|
|
15370
15370
|
const tvlNow = await this._getTVL(blockIdentifier);
|
|
15371
15371
|
const supplyNow = await this.totalSupply(blockIdentifier);
|
|
15372
15372
|
const priceNow = await this.getCurrentPrice(blockIdentifier);
|
|
@@ -15425,13 +15425,13 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
15425
15425
|
}
|
|
15426
15426
|
return shares;
|
|
15427
15427
|
}
|
|
15428
|
-
async balanceOf(user, blockIdentifier = "
|
|
15428
|
+
async balanceOf(user, blockIdentifier = "latest") {
|
|
15429
15429
|
let bal = await this.contract.call("balance_of", [user.address], {
|
|
15430
15430
|
blockIdentifier
|
|
15431
15431
|
});
|
|
15432
15432
|
return Web3Number.fromWei(bal.toString(), 18);
|
|
15433
15433
|
}
|
|
15434
|
-
async getUserTVL(user, blockIdentifier = "
|
|
15434
|
+
async getUserTVL(user, blockIdentifier = "latest") {
|
|
15435
15435
|
let bal = await this.balanceOf(user, blockIdentifier);
|
|
15436
15436
|
const assets = await this.contract.call(
|
|
15437
15437
|
"convert_to_assets",
|
|
@@ -15470,7 +15470,7 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
15470
15470
|
}
|
|
15471
15471
|
};
|
|
15472
15472
|
}
|
|
15473
|
-
async _getTVL(blockIdentifier = "
|
|
15473
|
+
async _getTVL(blockIdentifier = "latest") {
|
|
15474
15474
|
const result = await this.contract.call("total_liquidity", [], {
|
|
15475
15475
|
blockIdentifier
|
|
15476
15476
|
});
|
|
@@ -15482,7 +15482,7 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
15482
15482
|
);
|
|
15483
15483
|
return { amount0, amount1 };
|
|
15484
15484
|
}
|
|
15485
|
-
async totalSupply(blockIdentifier = "
|
|
15485
|
+
async totalSupply(blockIdentifier = "latest") {
|
|
15486
15486
|
const res = await this.contract.call("total_supply", [], {
|
|
15487
15487
|
blockIdentifier
|
|
15488
15488
|
});
|
|
@@ -15498,7 +15498,7 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
15498
15498
|
"Expected token1 in depositTokens[1]"
|
|
15499
15499
|
);
|
|
15500
15500
|
}
|
|
15501
|
-
async getTVL(blockIdentifier = "
|
|
15501
|
+
async getTVL(blockIdentifier = "latest") {
|
|
15502
15502
|
const { amount0, amount1 } = await this._getTVL(blockIdentifier);
|
|
15503
15503
|
const poolKey = await this.getPoolKey(blockIdentifier);
|
|
15504
15504
|
this.assertValidDepositTokens(poolKey);
|
|
@@ -15587,11 +15587,11 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
15587
15587
|
}
|
|
15588
15588
|
throw new Error("No true price available");
|
|
15589
15589
|
}
|
|
15590
|
-
async getCurrentPrice(blockIdentifier = "
|
|
15590
|
+
async getCurrentPrice(blockIdentifier = "latest") {
|
|
15591
15591
|
const poolKey = await this.getPoolKey(blockIdentifier);
|
|
15592
15592
|
return this._getCurrentPrice(poolKey, blockIdentifier);
|
|
15593
15593
|
}
|
|
15594
|
-
async _getCurrentPrice(poolKey, blockIdentifier = "
|
|
15594
|
+
async _getCurrentPrice(poolKey, blockIdentifier = "latest") {
|
|
15595
15595
|
const priceInfo = await this.ekuboPositionsContract.call(
|
|
15596
15596
|
"get_pool_price",
|
|
15597
15597
|
[
|
|
@@ -15626,7 +15626,7 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
15626
15626
|
sqrtRatio: priceInfo.sqrt_ratio.toString()
|
|
15627
15627
|
};
|
|
15628
15628
|
}
|
|
15629
|
-
async getCurrentBounds(blockIdentifier = "
|
|
15629
|
+
async getCurrentBounds(blockIdentifier = "latest") {
|
|
15630
15630
|
const result = await this.contract.call("get_position_key", [], {
|
|
15631
15631
|
blockIdentifier
|
|
15632
15632
|
});
|
|
@@ -15643,7 +15643,7 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
15643
15643
|
const tick = Math.floor(value / tickSpacing) * tickSpacing;
|
|
15644
15644
|
return this.tickToi129(tick);
|
|
15645
15645
|
}
|
|
15646
|
-
async getPoolKey(blockIdentifier = "
|
|
15646
|
+
async getPoolKey(blockIdentifier = "latest") {
|
|
15647
15647
|
if (this.poolKey) {
|
|
15648
15648
|
return this.poolKey;
|
|
15649
15649
|
}
|
|
@@ -16141,7 +16141,7 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
16141
16141
|
static tickToPrice(tick) {
|
|
16142
16142
|
return Math.pow(1.000001, Number(tick));
|
|
16143
16143
|
}
|
|
16144
|
-
async getLiquidityToAmounts(liquidity, bounds, blockIdentifier = "
|
|
16144
|
+
async getLiquidityToAmounts(liquidity, bounds, blockIdentifier = "latest", _poolKey = null, _currentPrice = null) {
|
|
16145
16145
|
const currentPrice = _currentPrice || await this.getCurrentPrice(blockIdentifier);
|
|
16146
16146
|
const lowerPrice = _EkuboCLVault.tickToPrice(bounds.lowerTick);
|
|
16147
16147
|
const upperPrice = _EkuboCLVault.tickToPrice(bounds.upperTick);
|
package/dist/index.mjs
CHANGED
|
@@ -192,7 +192,7 @@ var defaultTokens = [{
|
|
|
192
192
|
address: ContractAddr.from("0x49d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7"),
|
|
193
193
|
decimals: 18,
|
|
194
194
|
coingeckId: void 0,
|
|
195
|
-
displayDecimals:
|
|
195
|
+
displayDecimals: 6
|
|
196
196
|
}, {
|
|
197
197
|
name: "USDC",
|
|
198
198
|
symbol: "USDC",
|
|
@@ -15283,7 +15283,7 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
15283
15283
|
* Calculates assets before and now in a given token of TVL per share to observe growth
|
|
15284
15284
|
* @returns {Promise<number>} The weighted average APY across all pools
|
|
15285
15285
|
*/
|
|
15286
|
-
async netAPY(blockIdentifier = "
|
|
15286
|
+
async netAPY(blockIdentifier = "latest", sinceBlocks = 2e4) {
|
|
15287
15287
|
const tvlNow = await this._getTVL(blockIdentifier);
|
|
15288
15288
|
const supplyNow = await this.totalSupply(blockIdentifier);
|
|
15289
15289
|
const priceNow = await this.getCurrentPrice(blockIdentifier);
|
|
@@ -15342,13 +15342,13 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
15342
15342
|
}
|
|
15343
15343
|
return shares;
|
|
15344
15344
|
}
|
|
15345
|
-
async balanceOf(user, blockIdentifier = "
|
|
15345
|
+
async balanceOf(user, blockIdentifier = "latest") {
|
|
15346
15346
|
let bal = await this.contract.call("balance_of", [user.address], {
|
|
15347
15347
|
blockIdentifier
|
|
15348
15348
|
});
|
|
15349
15349
|
return Web3Number.fromWei(bal.toString(), 18);
|
|
15350
15350
|
}
|
|
15351
|
-
async getUserTVL(user, blockIdentifier = "
|
|
15351
|
+
async getUserTVL(user, blockIdentifier = "latest") {
|
|
15352
15352
|
let bal = await this.balanceOf(user, blockIdentifier);
|
|
15353
15353
|
const assets = await this.contract.call(
|
|
15354
15354
|
"convert_to_assets",
|
|
@@ -15387,7 +15387,7 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
15387
15387
|
}
|
|
15388
15388
|
};
|
|
15389
15389
|
}
|
|
15390
|
-
async _getTVL(blockIdentifier = "
|
|
15390
|
+
async _getTVL(blockIdentifier = "latest") {
|
|
15391
15391
|
const result = await this.contract.call("total_liquidity", [], {
|
|
15392
15392
|
blockIdentifier
|
|
15393
15393
|
});
|
|
@@ -15399,7 +15399,7 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
15399
15399
|
);
|
|
15400
15400
|
return { amount0, amount1 };
|
|
15401
15401
|
}
|
|
15402
|
-
async totalSupply(blockIdentifier = "
|
|
15402
|
+
async totalSupply(blockIdentifier = "latest") {
|
|
15403
15403
|
const res = await this.contract.call("total_supply", [], {
|
|
15404
15404
|
blockIdentifier
|
|
15405
15405
|
});
|
|
@@ -15415,7 +15415,7 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
15415
15415
|
"Expected token1 in depositTokens[1]"
|
|
15416
15416
|
);
|
|
15417
15417
|
}
|
|
15418
|
-
async getTVL(blockIdentifier = "
|
|
15418
|
+
async getTVL(blockIdentifier = "latest") {
|
|
15419
15419
|
const { amount0, amount1 } = await this._getTVL(blockIdentifier);
|
|
15420
15420
|
const poolKey = await this.getPoolKey(blockIdentifier);
|
|
15421
15421
|
this.assertValidDepositTokens(poolKey);
|
|
@@ -15504,11 +15504,11 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
15504
15504
|
}
|
|
15505
15505
|
throw new Error("No true price available");
|
|
15506
15506
|
}
|
|
15507
|
-
async getCurrentPrice(blockIdentifier = "
|
|
15507
|
+
async getCurrentPrice(blockIdentifier = "latest") {
|
|
15508
15508
|
const poolKey = await this.getPoolKey(blockIdentifier);
|
|
15509
15509
|
return this._getCurrentPrice(poolKey, blockIdentifier);
|
|
15510
15510
|
}
|
|
15511
|
-
async _getCurrentPrice(poolKey, blockIdentifier = "
|
|
15511
|
+
async _getCurrentPrice(poolKey, blockIdentifier = "latest") {
|
|
15512
15512
|
const priceInfo = await this.ekuboPositionsContract.call(
|
|
15513
15513
|
"get_pool_price",
|
|
15514
15514
|
[
|
|
@@ -15543,7 +15543,7 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
15543
15543
|
sqrtRatio: priceInfo.sqrt_ratio.toString()
|
|
15544
15544
|
};
|
|
15545
15545
|
}
|
|
15546
|
-
async getCurrentBounds(blockIdentifier = "
|
|
15546
|
+
async getCurrentBounds(blockIdentifier = "latest") {
|
|
15547
15547
|
const result = await this.contract.call("get_position_key", [], {
|
|
15548
15548
|
blockIdentifier
|
|
15549
15549
|
});
|
|
@@ -15560,7 +15560,7 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
15560
15560
|
const tick = Math.floor(value / tickSpacing) * tickSpacing;
|
|
15561
15561
|
return this.tickToi129(tick);
|
|
15562
15562
|
}
|
|
15563
|
-
async getPoolKey(blockIdentifier = "
|
|
15563
|
+
async getPoolKey(blockIdentifier = "latest") {
|
|
15564
15564
|
if (this.poolKey) {
|
|
15565
15565
|
return this.poolKey;
|
|
15566
15566
|
}
|
|
@@ -16058,7 +16058,7 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
16058
16058
|
static tickToPrice(tick) {
|
|
16059
16059
|
return Math.pow(1.000001, Number(tick));
|
|
16060
16060
|
}
|
|
16061
|
-
async getLiquidityToAmounts(liquidity, bounds, blockIdentifier = "
|
|
16061
|
+
async getLiquidityToAmounts(liquidity, bounds, blockIdentifier = "latest", _poolKey = null, _currentPrice = null) {
|
|
16062
16062
|
const currentPrice = _currentPrice || await this.getCurrentPrice(blockIdentifier);
|
|
16063
16063
|
const lowerPrice = _EkuboCLVault.tickToPrice(bounds.lowerTick);
|
|
16064
16064
|
const upperPrice = _EkuboCLVault.tickToPrice(bounds.upperTick);
|
package/package.json
CHANGED
package/src/global.ts
CHANGED
|
@@ -37,7 +37,7 @@ const defaultTokens: TokenInfo[] = [{
|
|
|
37
37
|
address: ContractAddr.from('0x49d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7'),
|
|
38
38
|
decimals: 18,
|
|
39
39
|
coingeckId: undefined,
|
|
40
|
-
displayDecimals:
|
|
40
|
+
displayDecimals: 6,
|
|
41
41
|
}, {
|
|
42
42
|
name: 'USDC',
|
|
43
43
|
symbol: 'USDC',
|
|
@@ -286,7 +286,7 @@ export class EkuboCLVault extends BaseStrategy<
|
|
|
286
286
|
* @returns {Promise<number>} The weighted average APY across all pools
|
|
287
287
|
*/
|
|
288
288
|
async netAPY(
|
|
289
|
-
blockIdentifier: BlockIdentifier = "
|
|
289
|
+
blockIdentifier: BlockIdentifier = "latest",
|
|
290
290
|
sinceBlocks = 20000
|
|
291
291
|
): Promise<number> {
|
|
292
292
|
// no special provisions required to account for defi spring rewards
|
|
@@ -376,7 +376,7 @@ export class EkuboCLVault extends BaseStrategy<
|
|
|
376
376
|
|
|
377
377
|
async balanceOf(
|
|
378
378
|
user: ContractAddr,
|
|
379
|
-
blockIdentifier: BlockIdentifier = "
|
|
379
|
+
blockIdentifier: BlockIdentifier = "latest"
|
|
380
380
|
): Promise<Web3Number> {
|
|
381
381
|
let bal = await this.contract.call("balance_of", [user.address], {
|
|
382
382
|
blockIdentifier,
|
|
@@ -386,7 +386,7 @@ export class EkuboCLVault extends BaseStrategy<
|
|
|
386
386
|
|
|
387
387
|
async getUserTVL(
|
|
388
388
|
user: ContractAddr,
|
|
389
|
-
blockIdentifier: BlockIdentifier = "
|
|
389
|
+
blockIdentifier: BlockIdentifier = "latest"
|
|
390
390
|
): Promise<DualTokenInfo> {
|
|
391
391
|
let bal = await this.balanceOf(user, blockIdentifier);
|
|
392
392
|
const assets: any = await this.contract.call(
|
|
@@ -428,7 +428,7 @@ export class EkuboCLVault extends BaseStrategy<
|
|
|
428
428
|
};
|
|
429
429
|
}
|
|
430
430
|
|
|
431
|
-
async _getTVL(blockIdentifier: BlockIdentifier = "
|
|
431
|
+
async _getTVL(blockIdentifier: BlockIdentifier = "latest") {
|
|
432
432
|
const result = await this.contract.call("total_liquidity", [], {
|
|
433
433
|
blockIdentifier,
|
|
434
434
|
});
|
|
@@ -443,7 +443,7 @@ export class EkuboCLVault extends BaseStrategy<
|
|
|
443
443
|
}
|
|
444
444
|
|
|
445
445
|
async totalSupply(
|
|
446
|
-
blockIdentifier: BlockIdentifier = "
|
|
446
|
+
blockIdentifier: BlockIdentifier = "latest"
|
|
447
447
|
): Promise<Web3Number> {
|
|
448
448
|
const res = await this.contract.call("total_supply", [], {
|
|
449
449
|
blockIdentifier,
|
|
@@ -464,7 +464,7 @@ export class EkuboCLVault extends BaseStrategy<
|
|
|
464
464
|
}
|
|
465
465
|
|
|
466
466
|
async getTVL(
|
|
467
|
-
blockIdentifier: BlockIdentifier = "
|
|
467
|
+
blockIdentifier: BlockIdentifier = "latest"
|
|
468
468
|
): Promise<DualTokenInfo> {
|
|
469
469
|
const { amount0, amount1 } = await this._getTVL(blockIdentifier);
|
|
470
470
|
const poolKey = await this.getPoolKey(blockIdentifier);
|
|
@@ -561,14 +561,14 @@ export class EkuboCLVault extends BaseStrategy<
|
|
|
561
561
|
throw new Error("No true price available");
|
|
562
562
|
}
|
|
563
563
|
|
|
564
|
-
async getCurrentPrice(blockIdentifier: BlockIdentifier = "
|
|
564
|
+
async getCurrentPrice(blockIdentifier: BlockIdentifier = "latest") {
|
|
565
565
|
const poolKey = await this.getPoolKey(blockIdentifier);
|
|
566
566
|
return this._getCurrentPrice(poolKey, blockIdentifier);
|
|
567
567
|
}
|
|
568
568
|
|
|
569
569
|
async _getCurrentPrice(
|
|
570
570
|
poolKey: EkuboPoolKey,
|
|
571
|
-
blockIdentifier: BlockIdentifier = "
|
|
571
|
+
blockIdentifier: BlockIdentifier = "latest"
|
|
572
572
|
) {
|
|
573
573
|
const priceInfo: any = await this.ekuboPositionsContract.call(
|
|
574
574
|
"get_pool_price",
|
|
@@ -606,7 +606,7 @@ export class EkuboCLVault extends BaseStrategy<
|
|
|
606
606
|
}
|
|
607
607
|
|
|
608
608
|
async getCurrentBounds(
|
|
609
|
-
blockIdentifier: BlockIdentifier = "
|
|
609
|
+
blockIdentifier: BlockIdentifier = "latest"
|
|
610
610
|
): Promise<EkuboBounds> {
|
|
611
611
|
const result: any = await this.contract.call("get_position_key", [], {
|
|
612
612
|
blockIdentifier,
|
|
@@ -632,7 +632,7 @@ export class EkuboCLVault extends BaseStrategy<
|
|
|
632
632
|
}
|
|
633
633
|
|
|
634
634
|
async getPoolKey(
|
|
635
|
-
blockIdentifier: BlockIdentifier = "
|
|
635
|
+
blockIdentifier: BlockIdentifier = "latest"
|
|
636
636
|
): Promise<EkuboPoolKey> {
|
|
637
637
|
if (this.poolKey) {
|
|
638
638
|
return this.poolKey;
|
|
@@ -1345,7 +1345,7 @@ export class EkuboCLVault extends BaseStrategy<
|
|
|
1345
1345
|
async getLiquidityToAmounts(
|
|
1346
1346
|
liquidity: Web3Number,
|
|
1347
1347
|
bounds: EkuboBounds,
|
|
1348
|
-
blockIdentifier: BlockIdentifier = "
|
|
1348
|
+
blockIdentifier: BlockIdentifier = "latest",
|
|
1349
1349
|
_poolKey: EkuboPoolKey | null = null,
|
|
1350
1350
|
_currentPrice: {
|
|
1351
1351
|
price: number;
|