@strkfarm/sdk 1.0.23 → 1.0.25
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 +10 -3
- package/dist/index.browser.mjs +10 -3
- package/dist/index.js +10 -3
- package/dist/index.mjs +10 -3
- package/package.json +1 -1
- package/src/strategies/vesu-rebalance.ts +10 -3
|
@@ -38701,16 +38701,23 @@ var strkfarm_risk_engine = (() => {
|
|
|
38701
38701
|
const totalAssets = (await this.getTVL()).amount;
|
|
38702
38702
|
const info = allowedPools.map(async (p) => {
|
|
38703
38703
|
const vesuPosition = vesuPositions.find((d) => d.pool.id.toString() === num_exports.getDecimalString(p.pool_id.address.toString()));
|
|
38704
|
-
const
|
|
38704
|
+
const _pool = pools.find((d) => {
|
|
38705
|
+
logger.verbose(`pool check: ${d.id == num_exports.getDecimalString(p.pool_id.address.toString())}, id: ${d.id}, pool_id: ${num_exports.getDecimalString(p.pool_id.address.toString())}`);
|
|
38705
38706
|
return d.id == num_exports.getDecimalString(p.pool_id.address.toString());
|
|
38706
38707
|
});
|
|
38707
|
-
|
|
38708
|
+
logger.verbose(`pool: ${JSON.stringify(_pool)}`);
|
|
38709
|
+
logger.verbose(typeof _pool);
|
|
38710
|
+
logger.verbose(`name: ${_pool?.name}`);
|
|
38711
|
+
if (!_pool) {
|
|
38712
|
+
throw new Error(`Pool ${p.pool_id.address.toString()} not found`);
|
|
38713
|
+
}
|
|
38714
|
+
const assetInfo = _pool?.assets.find((d) => this.asset().address.eqString(d.address));
|
|
38708
38715
|
let vTokenContract = new Contract(vesu_rebalance_abi_default, p.v_token.address, this.config.provider);
|
|
38709
38716
|
const bal = await vTokenContract.balanceOf(this.address.address);
|
|
38710
38717
|
const assets = await vTokenContract.convert_to_assets(uint256_exports.bnToUint256(bal.toString()));
|
|
38711
38718
|
const item = {
|
|
38712
38719
|
pool_id: p.pool_id,
|
|
38713
|
-
pool_name:
|
|
38720
|
+
pool_name: _pool?.name,
|
|
38714
38721
|
max_weight: p.max_weight,
|
|
38715
38722
|
current_weight: isErrorPositionsAPI || !vesuPosition ? 0 : Number(Web3Number.fromWei(vesuPosition.collateral.value, this.decimals()).dividedBy(totalAssets.toString()).toFixed(6)),
|
|
38716
38723
|
v_token: p.v_token,
|
package/dist/index.browser.mjs
CHANGED
|
@@ -3713,16 +3713,23 @@ var VesuRebalance = class _VesuRebalance extends BaseStrategy {
|
|
|
3713
3713
|
const totalAssets = (await this.getTVL()).amount;
|
|
3714
3714
|
const info = allowedPools.map(async (p) => {
|
|
3715
3715
|
const vesuPosition = vesuPositions.find((d) => d.pool.id.toString() === num2.getDecimalString(p.pool_id.address.toString()));
|
|
3716
|
-
const
|
|
3716
|
+
const _pool = pools.find((d) => {
|
|
3717
|
+
logger.verbose(`pool check: ${d.id == num2.getDecimalString(p.pool_id.address.toString())}, id: ${d.id}, pool_id: ${num2.getDecimalString(p.pool_id.address.toString())}`);
|
|
3717
3718
|
return d.id == num2.getDecimalString(p.pool_id.address.toString());
|
|
3718
3719
|
});
|
|
3719
|
-
|
|
3720
|
+
logger.verbose(`pool: ${JSON.stringify(_pool)}`);
|
|
3721
|
+
logger.verbose(typeof _pool);
|
|
3722
|
+
logger.verbose(`name: ${_pool?.name}`);
|
|
3723
|
+
if (!_pool) {
|
|
3724
|
+
throw new Error(`Pool ${p.pool_id.address.toString()} not found`);
|
|
3725
|
+
}
|
|
3726
|
+
const assetInfo = _pool?.assets.find((d) => this.asset().address.eqString(d.address));
|
|
3720
3727
|
let vTokenContract = new Contract4(vesu_rebalance_abi_default, p.v_token.address, this.config.provider);
|
|
3721
3728
|
const bal = await vTokenContract.balanceOf(this.address.address);
|
|
3722
3729
|
const assets = await vTokenContract.convert_to_assets(uint2563.bnToUint256(bal.toString()));
|
|
3723
3730
|
const item = {
|
|
3724
3731
|
pool_id: p.pool_id,
|
|
3725
|
-
pool_name:
|
|
3732
|
+
pool_name: _pool?.name,
|
|
3726
3733
|
max_weight: p.max_weight,
|
|
3727
3734
|
current_weight: isErrorPositionsAPI || !vesuPosition ? 0 : Number(Web3Number.fromWei(vesuPosition.collateral.value, this.decimals()).dividedBy(totalAssets.toString()).toFixed(6)),
|
|
3728
3735
|
v_token: p.v_token,
|
package/dist/index.js
CHANGED
|
@@ -3801,16 +3801,23 @@ var VesuRebalance = class _VesuRebalance extends BaseStrategy {
|
|
|
3801
3801
|
const totalAssets = (await this.getTVL()).amount;
|
|
3802
3802
|
const info = allowedPools.map(async (p) => {
|
|
3803
3803
|
const vesuPosition = vesuPositions.find((d) => d.pool.id.toString() === import_starknet7.num.getDecimalString(p.pool_id.address.toString()));
|
|
3804
|
-
const
|
|
3804
|
+
const _pool = pools.find((d) => {
|
|
3805
|
+
logger.verbose(`pool check: ${d.id == import_starknet7.num.getDecimalString(p.pool_id.address.toString())}, id: ${d.id}, pool_id: ${import_starknet7.num.getDecimalString(p.pool_id.address.toString())}`);
|
|
3805
3806
|
return d.id == import_starknet7.num.getDecimalString(p.pool_id.address.toString());
|
|
3806
3807
|
});
|
|
3807
|
-
|
|
3808
|
+
logger.verbose(`pool: ${JSON.stringify(_pool)}`);
|
|
3809
|
+
logger.verbose(typeof _pool);
|
|
3810
|
+
logger.verbose(`name: ${_pool?.name}`);
|
|
3811
|
+
if (!_pool) {
|
|
3812
|
+
throw new Error(`Pool ${p.pool_id.address.toString()} not found`);
|
|
3813
|
+
}
|
|
3814
|
+
const assetInfo = _pool?.assets.find((d) => this.asset().address.eqString(d.address));
|
|
3808
3815
|
let vTokenContract = new import_starknet7.Contract(vesu_rebalance_abi_default, p.v_token.address, this.config.provider);
|
|
3809
3816
|
const bal = await vTokenContract.balanceOf(this.address.address);
|
|
3810
3817
|
const assets = await vTokenContract.convert_to_assets(import_starknet7.uint256.bnToUint256(bal.toString()));
|
|
3811
3818
|
const item = {
|
|
3812
3819
|
pool_id: p.pool_id,
|
|
3813
|
-
pool_name:
|
|
3820
|
+
pool_name: _pool?.name,
|
|
3814
3821
|
max_weight: p.max_weight,
|
|
3815
3822
|
current_weight: isErrorPositionsAPI || !vesuPosition ? 0 : Number(Web3Number.fromWei(vesuPosition.collateral.value, this.decimals()).dividedBy(totalAssets.toString()).toFixed(6)),
|
|
3816
3823
|
v_token: p.v_token,
|
package/dist/index.mjs
CHANGED
|
@@ -3733,16 +3733,23 @@ var VesuRebalance = class _VesuRebalance extends BaseStrategy {
|
|
|
3733
3733
|
const totalAssets = (await this.getTVL()).amount;
|
|
3734
3734
|
const info = allowedPools.map(async (p) => {
|
|
3735
3735
|
const vesuPosition = vesuPositions.find((d) => d.pool.id.toString() === num2.getDecimalString(p.pool_id.address.toString()));
|
|
3736
|
-
const
|
|
3736
|
+
const _pool = pools.find((d) => {
|
|
3737
|
+
logger.verbose(`pool check: ${d.id == num2.getDecimalString(p.pool_id.address.toString())}, id: ${d.id}, pool_id: ${num2.getDecimalString(p.pool_id.address.toString())}`);
|
|
3737
3738
|
return d.id == num2.getDecimalString(p.pool_id.address.toString());
|
|
3738
3739
|
});
|
|
3739
|
-
|
|
3740
|
+
logger.verbose(`pool: ${JSON.stringify(_pool)}`);
|
|
3741
|
+
logger.verbose(typeof _pool);
|
|
3742
|
+
logger.verbose(`name: ${_pool?.name}`);
|
|
3743
|
+
if (!_pool) {
|
|
3744
|
+
throw new Error(`Pool ${p.pool_id.address.toString()} not found`);
|
|
3745
|
+
}
|
|
3746
|
+
const assetInfo = _pool?.assets.find((d) => this.asset().address.eqString(d.address));
|
|
3740
3747
|
let vTokenContract = new Contract4(vesu_rebalance_abi_default, p.v_token.address, this.config.provider);
|
|
3741
3748
|
const bal = await vTokenContract.balanceOf(this.address.address);
|
|
3742
3749
|
const assets = await vTokenContract.convert_to_assets(uint2563.bnToUint256(bal.toString()));
|
|
3743
3750
|
const item = {
|
|
3744
3751
|
pool_id: p.pool_id,
|
|
3745
|
-
pool_name:
|
|
3752
|
+
pool_name: _pool?.name,
|
|
3746
3753
|
max_weight: p.max_weight,
|
|
3747
3754
|
current_weight: isErrorPositionsAPI || !vesuPosition ? 0 : Number(Web3Number.fromWei(vesuPosition.collateral.value, this.decimals()).dividedBy(totalAssets.toString()).toFixed(6)),
|
|
3748
3755
|
v_token: p.v_token,
|
package/package.json
CHANGED
|
@@ -264,16 +264,23 @@ export class VesuRebalance extends BaseStrategy<SingleTokenInfo, SingleActionAmo
|
|
|
264
264
|
|
|
265
265
|
const info = allowedPools.map(async (p) => {
|
|
266
266
|
const vesuPosition = vesuPositions.find((d: any) => d.pool.id.toString() === num.getDecimalString(p.pool_id.address.toString()));
|
|
267
|
-
const
|
|
267
|
+
const _pool = pools.find((d: any) => {
|
|
268
|
+
logger.verbose(`pool check: ${d.id == num.getDecimalString(p.pool_id.address.toString())}, id: ${d.id}, pool_id: ${num.getDecimalString(p.pool_id.address.toString())}`);
|
|
268
269
|
return d.id == num.getDecimalString(p.pool_id.address.toString());
|
|
269
270
|
});
|
|
270
|
-
|
|
271
|
+
logger.verbose(`pool: ${JSON.stringify(_pool)}`);
|
|
272
|
+
logger.verbose(typeof _pool);
|
|
273
|
+
logger.verbose(`name: ${_pool?.name}`);
|
|
274
|
+
if (!_pool) {
|
|
275
|
+
throw new Error(`Pool ${p.pool_id.address.toString()} not found`);
|
|
276
|
+
}
|
|
277
|
+
const assetInfo = _pool?.assets.find((d: any) => this.asset().address.eqString(d.address));
|
|
271
278
|
let vTokenContract = new Contract(VesuRebalanceAbi, p.v_token.address, this.config.provider);
|
|
272
279
|
const bal = await vTokenContract.balanceOf(this.address.address);
|
|
273
280
|
const assets = await vTokenContract.convert_to_assets(uint256.bnToUint256(bal.toString()));
|
|
274
281
|
const item = {
|
|
275
282
|
pool_id: p.pool_id,
|
|
276
|
-
pool_name:
|
|
283
|
+
pool_name: _pool?.name,
|
|
277
284
|
max_weight: p.max_weight,
|
|
278
285
|
current_weight: isErrorPositionsAPI || !vesuPosition ? 0 : Number(Web3Number.fromWei(vesuPosition.collateral.value, this.decimals()).dividedBy(totalAssets.toString()).toFixed(6)),
|
|
279
286
|
v_token: p.v_token,
|