@strkfarm/sdk 1.1.74 → 1.1.76
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 +221 -178
- package/dist/index.browser.mjs +193 -151
- package/dist/index.d.ts +34 -6
- package/dist/index.js +277 -234
- package/dist/index.mjs +193 -151
- package/package.json +1 -1
- package/src/dataTypes/_bignumber.ts +5 -0
- package/src/strategies/sensei.ts +23 -4
- package/src/strategies/universal-adapters/vesu-adapter.ts +46 -25
- package/src/strategies/universal-lst-muliplier-strategy.tsx +54 -59
|
@@ -17920,16 +17920,16 @@ ${r2}}` : "}", l2;
|
|
|
17920
17920
|
solidityUint256PackedKeccak256: () => solidityUint256PackedKeccak2562,
|
|
17921
17921
|
starknetKeccak: () => starknetKeccak2
|
|
17922
17922
|
});
|
|
17923
|
-
var
|
|
17923
|
+
var import_starknet25 = require_lib3();
|
|
17924
17924
|
var import_sha33 = require_sha3();
|
|
17925
17925
|
var import_utils210 = require_utils2();
|
|
17926
17926
|
function keccakBn2(value) {
|
|
17927
17927
|
const hexWithoutPrefix = removeHexPrefix2(toHex3(BigInt(value)));
|
|
17928
17928
|
const evenHex = hexWithoutPrefix.length % 2 === 0 ? hexWithoutPrefix : `0${hexWithoutPrefix}`;
|
|
17929
|
-
return addHexPrefix2((0,
|
|
17929
|
+
return addHexPrefix2((0, import_starknet25.keccak)(hexToBytes4(addHexPrefix2(evenHex))).toString(16));
|
|
17930
17930
|
}
|
|
17931
17931
|
function keccakHex2(str) {
|
|
17932
|
-
return addHexPrefix2((0,
|
|
17932
|
+
return addHexPrefix2((0, import_starknet25.keccak)(utf8ToArray2(str)).toString(16));
|
|
17933
17933
|
}
|
|
17934
17934
|
function starknetKeccak2(str) {
|
|
17935
17935
|
const hash2 = BigInt(keccakHex2(str));
|
|
@@ -20176,7 +20176,7 @@ ${r2}}` : "}", l2;
|
|
|
20176
20176
|
hashDAMode: () => hashDAMode2,
|
|
20177
20177
|
hashFeeField: () => hashFeeField
|
|
20178
20178
|
});
|
|
20179
|
-
var
|
|
20179
|
+
var import_starknet26 = require_lib3();
|
|
20180
20180
|
var AToBI2 = (array) => array.map((it) => BigInt(it));
|
|
20181
20181
|
var DATA_AVAILABILITY_MODE_BITS2 = 32n;
|
|
20182
20182
|
var MAX_AMOUNT_BITS2 = 64n;
|
|
@@ -20196,7 +20196,7 @@ ${r2}}` : "}", l2;
|
|
|
20196
20196
|
function hashFeeField(tip, bounds) {
|
|
20197
20197
|
const L1Bound = encodeResourceBoundsL12(bounds);
|
|
20198
20198
|
const L2Bound = encodeResourceBoundsL22(bounds);
|
|
20199
|
-
return (0,
|
|
20199
|
+
return (0, import_starknet26.poseidonHashMany)([BigInt(tip), L1Bound, L2Bound]);
|
|
20200
20200
|
}
|
|
20201
20201
|
function calculateTransactionHashCommon22(txHashPrefix, version5, senderAddress, chainId, nonce, tip, paymasterData, nonceDataAvailabilityMode, feeDataAvailabilityMode, resourceBounds, additionalData = []) {
|
|
20202
20202
|
const feeFieldHash = hashFeeField(tip, resourceBounds);
|
|
@@ -20206,13 +20206,13 @@ ${r2}}` : "}", l2;
|
|
|
20206
20206
|
version5,
|
|
20207
20207
|
senderAddress,
|
|
20208
20208
|
feeFieldHash,
|
|
20209
|
-
(0,
|
|
20209
|
+
(0, import_starknet26.poseidonHashMany)(AToBI2(paymasterData)),
|
|
20210
20210
|
chainId,
|
|
20211
20211
|
nonce,
|
|
20212
20212
|
dAModeHash,
|
|
20213
20213
|
...AToBI2(additionalData)
|
|
20214
20214
|
]);
|
|
20215
|
-
return toHex3((0,
|
|
20215
|
+
return toHex3((0, import_starknet26.poseidonHashMany)(dataToHash));
|
|
20216
20216
|
}
|
|
20217
20217
|
function calculateDeployAccountTransactionHash22(contractAddress, classHash, compiledConstructorCalldata, salt, version5, chainId, nonce, nonceDataAvailabilityMode, feeDataAvailabilityMode, resourceBounds, tip, paymasterData) {
|
|
20218
20218
|
return calculateTransactionHashCommon22(
|
|
@@ -20226,7 +20226,7 @@ ${r2}}` : "}", l2;
|
|
|
20226
20226
|
nonceDataAvailabilityMode,
|
|
20227
20227
|
feeDataAvailabilityMode,
|
|
20228
20228
|
resourceBounds,
|
|
20229
|
-
[(0,
|
|
20229
|
+
[(0, import_starknet26.poseidonHashMany)(AToBI2(compiledConstructorCalldata)), classHash, salt]
|
|
20230
20230
|
);
|
|
20231
20231
|
}
|
|
20232
20232
|
function calculateDeclareTransactionHash22(classHash, compiledClassHash, senderAddress, version5, chainId, nonce, accountDeploymentData, nonceDataAvailabilityMode, feeDataAvailabilityMode, resourceBounds, tip, paymasterData) {
|
|
@@ -20241,7 +20241,7 @@ ${r2}}` : "}", l2;
|
|
|
20241
20241
|
nonceDataAvailabilityMode,
|
|
20242
20242
|
feeDataAvailabilityMode,
|
|
20243
20243
|
resourceBounds,
|
|
20244
|
-
[(0,
|
|
20244
|
+
[(0, import_starknet26.poseidonHashMany)(AToBI2(accountDeploymentData)), classHash, compiledClassHash]
|
|
20245
20245
|
);
|
|
20246
20246
|
}
|
|
20247
20247
|
function calculateInvokeTransactionHash3(senderAddress, version5, compiledCalldata, chainId, nonce, accountDeploymentData, nonceDataAvailabilityMode, feeDataAvailabilityMode, resourceBounds, tip, paymasterData) {
|
|
@@ -20256,7 +20256,7 @@ ${r2}}` : "}", l2;
|
|
|
20256
20256
|
nonceDataAvailabilityMode,
|
|
20257
20257
|
feeDataAvailabilityMode,
|
|
20258
20258
|
resourceBounds,
|
|
20259
|
-
[(0,
|
|
20259
|
+
[(0, import_starknet26.poseidonHashMany)(AToBI2(accountDeploymentData)), (0, import_starknet26.poseidonHashMany)(AToBI2(compiledCalldata))]
|
|
20260
20260
|
);
|
|
20261
20261
|
}
|
|
20262
20262
|
function isV3InvokeTx2(args) {
|
|
@@ -27935,6 +27935,7 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
27935
27935
|
VesuAdapter: () => VesuAdapter,
|
|
27936
27936
|
VesuAmountDenomination: () => VesuAmountDenomination,
|
|
27937
27937
|
VesuAmountType: () => VesuAmountType,
|
|
27938
|
+
VesuPoolMetadata: () => VesuPoolMetadata,
|
|
27938
27939
|
VesuPools: () => VesuPools,
|
|
27939
27940
|
VesuRebalance: () => VesuRebalance,
|
|
27940
27941
|
VesuRebalanceStrategies: () => VesuRebalanceStrategies,
|
|
@@ -30559,91 +30560,6 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
30559
30560
|
|
|
30560
30561
|
// src/dataTypes/_bignumber.ts
|
|
30561
30562
|
var import_bignumber = __toESM(require_bignumber());
|
|
30562
|
-
var _Web3Number = class extends import_bignumber.default {
|
|
30563
|
-
constructor(value, decimals) {
|
|
30564
|
-
super(value);
|
|
30565
|
-
this.decimals = decimals;
|
|
30566
|
-
}
|
|
30567
|
-
toWei() {
|
|
30568
|
-
return super.mul(10 ** this.decimals).toFixed(0);
|
|
30569
|
-
}
|
|
30570
|
-
multipliedBy(value) {
|
|
30571
|
-
const _value = this.getStandardString(value);
|
|
30572
|
-
return this.construct(super.mul(_value).toString(), this.decimals);
|
|
30573
|
-
}
|
|
30574
|
-
dividedBy(value) {
|
|
30575
|
-
const _value = this.getStandardString(value);
|
|
30576
|
-
return this.construct(super.dividedBy(_value).toString(), this.decimals);
|
|
30577
|
-
}
|
|
30578
|
-
plus(value) {
|
|
30579
|
-
const rawValue = this.getStandardString(value);
|
|
30580
|
-
const thisBN = new import_bignumber.default(this.toString());
|
|
30581
|
-
const result2 = thisBN.plus(rawValue);
|
|
30582
|
-
return this.construct(result2.toString(), this.decimals);
|
|
30583
|
-
}
|
|
30584
|
-
minus(n, base2) {
|
|
30585
|
-
const rawValue = this.getStandardString(n);
|
|
30586
|
-
const thisBN = new import_bignumber.default(this.toString());
|
|
30587
|
-
const result2 = thisBN.minus(rawValue, base2);
|
|
30588
|
-
return this.construct(result2.toString(), this.decimals);
|
|
30589
|
-
}
|
|
30590
|
-
construct(value, decimals) {
|
|
30591
|
-
return new this.constructor(value, decimals);
|
|
30592
|
-
}
|
|
30593
|
-
toString() {
|
|
30594
|
-
return super.toString();
|
|
30595
|
-
}
|
|
30596
|
-
toJSON() {
|
|
30597
|
-
return this.toString();
|
|
30598
|
-
}
|
|
30599
|
-
valueOf() {
|
|
30600
|
-
return this.toString();
|
|
30601
|
-
}
|
|
30602
|
-
maxToFixedDecimals() {
|
|
30603
|
-
return Math.min(this.decimals, 18);
|
|
30604
|
-
}
|
|
30605
|
-
getStandardString(value) {
|
|
30606
|
-
if (typeof value === "string") {
|
|
30607
|
-
return value;
|
|
30608
|
-
}
|
|
30609
|
-
if (typeof value === "number") {
|
|
30610
|
-
return value.toString();
|
|
30611
|
-
}
|
|
30612
|
-
return import_bignumber.default.prototype.toString.call(value);
|
|
30613
|
-
}
|
|
30614
|
-
minimum(value) {
|
|
30615
|
-
const _value = new import_bignumber.default(value);
|
|
30616
|
-
const _valueMe = new import_bignumber.default(this.toString());
|
|
30617
|
-
const answer = _value.lessThanOrEqualTo(_valueMe) ? _value : _valueMe;
|
|
30618
|
-
return this.construct(answer.toString(), this.decimals);
|
|
30619
|
-
}
|
|
30620
|
-
maximum(value) {
|
|
30621
|
-
const _value = new import_bignumber.default(value);
|
|
30622
|
-
const _valueMe = new import_bignumber.default(this.toString());
|
|
30623
|
-
const answer = _value.greaterThanOrEqualTo(_valueMe) ? _value : _valueMe;
|
|
30624
|
-
return this.construct(answer.toString(), this.decimals);
|
|
30625
|
-
}
|
|
30626
|
-
abs() {
|
|
30627
|
-
return this.construct(Math.abs(this.toNumber()).toFixed(12), this.decimals);
|
|
30628
|
-
}
|
|
30629
|
-
toI129() {
|
|
30630
|
-
const sign2 = this.isNegative() ? 1 : 0;
|
|
30631
|
-
return {
|
|
30632
|
-
mag: BigInt(this.toWei()) * (this.isNegative() ? -1n : 1n),
|
|
30633
|
-
sign: sign2
|
|
30634
|
-
};
|
|
30635
|
-
}
|
|
30636
|
-
};
|
|
30637
|
-
import_bignumber.default.config({ DECIMAL_PLACES: 18, ROUNDING_MODE: import_bignumber.default.ROUND_DOWN });
|
|
30638
|
-
_Web3Number.config({ DECIMAL_PLACES: 18, ROUNDING_MODE: import_bignumber.default.ROUND_DOWN });
|
|
30639
|
-
|
|
30640
|
-
// src/dataTypes/bignumber.browser.ts
|
|
30641
|
-
var Web3Number = class _Web3Number2 extends _Web3Number {
|
|
30642
|
-
static fromWei(weiNumber, decimals) {
|
|
30643
|
-
const bn = new _Web3Number2(weiNumber, decimals).dividedBy(10 ** decimals);
|
|
30644
|
-
return new _Web3Number2(bn.toString(), decimals);
|
|
30645
|
-
}
|
|
30646
|
-
};
|
|
30647
30563
|
|
|
30648
30564
|
// node_modules/.pnpm/@starknet-io+types-js@0.9.2/node_modules/@starknet-io/types-js/dist/esm/index.js
|
|
30649
30565
|
var esm_exports = {};
|
|
@@ -49123,6 +49039,96 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
49123
49039
|
};
|
|
49124
49040
|
var export_TypedDataRevision = api_exports3.TypedDataRevision;
|
|
49125
49041
|
|
|
49042
|
+
// src/dataTypes/_bignumber.ts
|
|
49043
|
+
var _Web3Number = class extends import_bignumber.default {
|
|
49044
|
+
constructor(value, decimals) {
|
|
49045
|
+
super(value);
|
|
49046
|
+
this.decimals = decimals;
|
|
49047
|
+
}
|
|
49048
|
+
toWei() {
|
|
49049
|
+
return super.mul(10 ** this.decimals).toFixed(0);
|
|
49050
|
+
}
|
|
49051
|
+
multipliedBy(value) {
|
|
49052
|
+
const _value = this.getStandardString(value);
|
|
49053
|
+
return this.construct(super.mul(_value).toString(), this.decimals);
|
|
49054
|
+
}
|
|
49055
|
+
dividedBy(value) {
|
|
49056
|
+
const _value = this.getStandardString(value);
|
|
49057
|
+
return this.construct(super.dividedBy(_value).toString(), this.decimals);
|
|
49058
|
+
}
|
|
49059
|
+
plus(value) {
|
|
49060
|
+
const rawValue = this.getStandardString(value);
|
|
49061
|
+
const thisBN = new import_bignumber.default(this.toString());
|
|
49062
|
+
const result2 = thisBN.plus(rawValue);
|
|
49063
|
+
return this.construct(result2.toString(), this.decimals);
|
|
49064
|
+
}
|
|
49065
|
+
minus(n, base2) {
|
|
49066
|
+
const rawValue = this.getStandardString(n);
|
|
49067
|
+
const thisBN = new import_bignumber.default(this.toString());
|
|
49068
|
+
const result2 = thisBN.minus(rawValue, base2);
|
|
49069
|
+
return this.construct(result2.toString(), this.decimals);
|
|
49070
|
+
}
|
|
49071
|
+
construct(value, decimals) {
|
|
49072
|
+
return new this.constructor(value, decimals);
|
|
49073
|
+
}
|
|
49074
|
+
toString() {
|
|
49075
|
+
return super.toString();
|
|
49076
|
+
}
|
|
49077
|
+
toJSON() {
|
|
49078
|
+
return this.toString();
|
|
49079
|
+
}
|
|
49080
|
+
valueOf() {
|
|
49081
|
+
return this.toString();
|
|
49082
|
+
}
|
|
49083
|
+
maxToFixedDecimals() {
|
|
49084
|
+
return Math.min(this.decimals, 18);
|
|
49085
|
+
}
|
|
49086
|
+
getStandardString(value) {
|
|
49087
|
+
if (typeof value === "string") {
|
|
49088
|
+
return value;
|
|
49089
|
+
}
|
|
49090
|
+
if (typeof value === "number") {
|
|
49091
|
+
return value.toString();
|
|
49092
|
+
}
|
|
49093
|
+
return import_bignumber.default.prototype.toString.call(value);
|
|
49094
|
+
}
|
|
49095
|
+
minimum(value) {
|
|
49096
|
+
const _value = new import_bignumber.default(value);
|
|
49097
|
+
const _valueMe = new import_bignumber.default(this.toString());
|
|
49098
|
+
const answer = _value.lessThanOrEqualTo(_valueMe) ? _value : _valueMe;
|
|
49099
|
+
return this.construct(answer.toString(), this.decimals);
|
|
49100
|
+
}
|
|
49101
|
+
maximum(value) {
|
|
49102
|
+
const _value = new import_bignumber.default(value);
|
|
49103
|
+
const _valueMe = new import_bignumber.default(this.toString());
|
|
49104
|
+
const answer = _value.greaterThanOrEqualTo(_valueMe) ? _value : _valueMe;
|
|
49105
|
+
return this.construct(answer.toString(), this.decimals);
|
|
49106
|
+
}
|
|
49107
|
+
abs() {
|
|
49108
|
+
return this.construct(Math.abs(this.toNumber()).toFixed(12), this.decimals);
|
|
49109
|
+
}
|
|
49110
|
+
toI129() {
|
|
49111
|
+
const sign2 = this.isNegative() ? 1 : 0;
|
|
49112
|
+
return {
|
|
49113
|
+
mag: BigInt(this.toWei()) * (this.isNegative() ? -1n : 1n),
|
|
49114
|
+
sign: sign2
|
|
49115
|
+
};
|
|
49116
|
+
}
|
|
49117
|
+
toUint256() {
|
|
49118
|
+
return uint256_exports.bnToUint256(this.toWei());
|
|
49119
|
+
}
|
|
49120
|
+
};
|
|
49121
|
+
import_bignumber.default.config({ DECIMAL_PLACES: 18, ROUNDING_MODE: import_bignumber.default.ROUND_DOWN });
|
|
49122
|
+
_Web3Number.config({ DECIMAL_PLACES: 18, ROUNDING_MODE: import_bignumber.default.ROUND_DOWN });
|
|
49123
|
+
|
|
49124
|
+
// src/dataTypes/bignumber.browser.ts
|
|
49125
|
+
var Web3Number = class _Web3Number2 extends _Web3Number {
|
|
49126
|
+
static fromWei(weiNumber, decimals) {
|
|
49127
|
+
const bn = new _Web3Number2(weiNumber, decimals).dividedBy(10 ** decimals);
|
|
49128
|
+
return new _Web3Number2(bn.toString(), decimals);
|
|
49129
|
+
}
|
|
49130
|
+
};
|
|
49131
|
+
|
|
49126
49132
|
// src/dataTypes/address.ts
|
|
49127
49133
|
var ContractAddr = class _ContractAddr {
|
|
49128
49134
|
constructor(address) {
|
|
@@ -83445,22 +83451,40 @@ spurious results.`);
|
|
|
83445
83451
|
if (!data.data || data.data.length == 0) {
|
|
83446
83452
|
throw new Error("No positions found");
|
|
83447
83453
|
}
|
|
83448
|
-
|
|
83454
|
+
let collateralXSTRK = Web3Number.fromWei(
|
|
83449
83455
|
data.data[0].collateral.value,
|
|
83450
83456
|
data.data[0].collateral.decimals
|
|
83451
83457
|
);
|
|
83452
|
-
|
|
83458
|
+
let collateralUSDValue = Web3Number.fromWei(
|
|
83453
83459
|
data.data[0].collateral.usdPrice.value,
|
|
83454
83460
|
data.data[0].collateral.usdPrice.decimals
|
|
83455
83461
|
);
|
|
83456
|
-
|
|
83462
|
+
let debtSTRK = Web3Number.fromWei(
|
|
83457
83463
|
data.data[0].debt.value,
|
|
83458
83464
|
data.data[0].debt.decimals
|
|
83459
83465
|
);
|
|
83460
|
-
|
|
83466
|
+
let debtUSDValue = Web3Number.fromWei(
|
|
83461
83467
|
data.data[0].debt.usdPrice.value,
|
|
83462
83468
|
data.data[0].debt.usdPrice.decimals
|
|
83463
83469
|
);
|
|
83470
|
+
if (data.data[1]) {
|
|
83471
|
+
collateralXSTRK = collateralXSTRK.plus(Web3Number.fromWei(
|
|
83472
|
+
data.data[1].collateral.value,
|
|
83473
|
+
data.data[1].collateral.decimals
|
|
83474
|
+
));
|
|
83475
|
+
collateralUSDValue = collateralUSDValue.plus(Web3Number.fromWei(
|
|
83476
|
+
data.data[1].collateral.usdPrice.value,
|
|
83477
|
+
data.data[1].collateral.usdPrice.decimals
|
|
83478
|
+
));
|
|
83479
|
+
debtSTRK = debtSTRK.plus(Web3Number.fromWei(
|
|
83480
|
+
data.data[1].debt.value,
|
|
83481
|
+
data.data[1].debt.decimals
|
|
83482
|
+
));
|
|
83483
|
+
debtUSDValue = debtUSDValue.plus(Web3Number.fromWei(
|
|
83484
|
+
data.data[1].debt.usdPrice.value,
|
|
83485
|
+
data.data[1].debt.usdPrice.decimals
|
|
83486
|
+
));
|
|
83487
|
+
}
|
|
83464
83488
|
const xSTRKPrice = await this.getSecondaryTokenPriceRelativeToMain();
|
|
83465
83489
|
const collateralInSTRK = Number(collateralXSTRK.toFixed(6)) * xSTRKPrice;
|
|
83466
83490
|
const STRKUSDPrice = Number(debtUSDValue.toFixed(6)) / Number(debtSTRK.toFixed(6));
|
|
@@ -91115,7 +91139,25 @@ spurious results.`);
|
|
|
91115
91139
|
Genesis: ContractAddr.from("0x4dc4f0ca6ea4961e4c8373265bfd5317678f4fe374d76f3fd7135f57763bf28"),
|
|
91116
91140
|
Re7xSTRK: ContractAddr.from("0x052fb52363939c3aa848f8f4ac28f0a51379f8d1b971d8444de25fbd77d8f161"),
|
|
91117
91141
|
Re7xBTC: ContractAddr.from("0x3a8416bf20d036df5b1cf3447630a2e1cb04685f6b0c3a70ed7fb1473548ecf"),
|
|
91118
|
-
Prime: ContractAddr.from("0x451fe483d5921a2919ddd81d0de6696669bccdacd859f72a4fba7656b97c3b5")
|
|
91142
|
+
Prime: ContractAddr.from("0x451fe483d5921a2919ddd81d0de6696669bccdacd859f72a4fba7656b97c3b5"),
|
|
91143
|
+
Re7STRK: ContractAddr.from("0x01fcdacc1d8184eca7b472b5acbaf1500cec9d5683ca95fede8128b46c8f9cc2")
|
|
91144
|
+
};
|
|
91145
|
+
var VesuPoolMetadata = {
|
|
91146
|
+
[VesuPools.Genesis.address]: {
|
|
91147
|
+
name: "Genesis"
|
|
91148
|
+
},
|
|
91149
|
+
[VesuPools.Re7xSTRK.address]: {
|
|
91150
|
+
name: "Re7 xSTRK"
|
|
91151
|
+
},
|
|
91152
|
+
[VesuPools.Re7xBTC.address]: {
|
|
91153
|
+
name: "Re7 xBTC"
|
|
91154
|
+
},
|
|
91155
|
+
[VesuPools.Prime.address]: {
|
|
91156
|
+
name: "Prime"
|
|
91157
|
+
},
|
|
91158
|
+
[VesuPools.Re7STRK.address]: {
|
|
91159
|
+
name: "Re7 STRK"
|
|
91160
|
+
}
|
|
91119
91161
|
};
|
|
91120
91162
|
var extensionMap = {};
|
|
91121
91163
|
extensionMap[VesuPools.Re7xSTRK.address] = ContractAddr.from("0x04e06e04b8d624d039aa1c3ca8e0aa9e21dc1ccba1d88d0d650837159e0ee054");
|
|
@@ -91258,15 +91300,15 @@ spurious results.`);
|
|
|
91258
91300
|
}
|
|
91259
91301
|
};
|
|
91260
91302
|
};
|
|
91261
|
-
this.getVesuModifyDelegationAdapter = (id) => {
|
|
91303
|
+
this.getVesuModifyDelegationAdapter = (id, delegatee) => {
|
|
91262
91304
|
return () => {
|
|
91263
91305
|
const { addr: VESU_SINGLETON2, isV2 } = getVesuSingletonAddress(this.config.poolId);
|
|
91264
91306
|
const packedArguments = isV2 ? [
|
|
91265
|
-
toBigInt3(
|
|
91307
|
+
toBigInt3(delegatee.toString())
|
|
91266
91308
|
// v2
|
|
91267
91309
|
] : [
|
|
91268
91310
|
this.config.poolId.toBigInt(),
|
|
91269
|
-
toBigInt3(
|
|
91311
|
+
toBigInt3(delegatee.toString())
|
|
91270
91312
|
// v1
|
|
91271
91313
|
];
|
|
91272
91314
|
const output = this.constructSimpleLeafData({
|
|
@@ -91275,29 +91317,31 @@ spurious results.`);
|
|
|
91275
91317
|
method: "modify_delegation",
|
|
91276
91318
|
packedArguments
|
|
91277
91319
|
}, isV2 ? SIMPLE_SANITIZER_V2 : SIMPLE_SANITIZER_VESU_V1_DELEGATIONS);
|
|
91278
|
-
return { leaf: output, callConstructor: this.getVesuModifyDelegationCall.bind(this) };
|
|
91320
|
+
return { leaf: output, callConstructor: this.getVesuModifyDelegationCall(delegatee).bind(this) };
|
|
91279
91321
|
};
|
|
91280
91322
|
};
|
|
91281
|
-
this.getVesuModifyDelegationCall = (
|
|
91282
|
-
|
|
91283
|
-
|
|
91284
|
-
|
|
91285
|
-
|
|
91286
|
-
|
|
91287
|
-
|
|
91288
|
-
|
|
91289
|
-
|
|
91290
|
-
|
|
91291
|
-
|
|
91292
|
-
|
|
91293
|
-
|
|
91294
|
-
|
|
91295
|
-
|
|
91296
|
-
|
|
91297
|
-
|
|
91298
|
-
|
|
91299
|
-
|
|
91300
|
-
|
|
91323
|
+
this.getVesuModifyDelegationCall = (delegatee) => {
|
|
91324
|
+
return (params) => {
|
|
91325
|
+
const VESU_SINGLETON2 = getVesuSingletonAddress(this.config.poolId).addr;
|
|
91326
|
+
const { contract, isV2 } = this.getVesuSingletonContract(getMainnetConfig(), this.config.poolId);
|
|
91327
|
+
const call = contract.populate("modify_delegation", isV2 ? {
|
|
91328
|
+
delegatee: delegatee.toBigInt(),
|
|
91329
|
+
delegation: params.delegation
|
|
91330
|
+
} : {
|
|
91331
|
+
pool_id: this.config.poolId.toBigInt(),
|
|
91332
|
+
delegatee: delegatee.toBigInt(),
|
|
91333
|
+
delegation: params.delegation
|
|
91334
|
+
});
|
|
91335
|
+
return {
|
|
91336
|
+
sanitizer: isV2 ? SIMPLE_SANITIZER_V2 : SIMPLE_SANITIZER_VESU_V1_DELEGATIONS,
|
|
91337
|
+
call: {
|
|
91338
|
+
contractAddress: VESU_SINGLETON2,
|
|
91339
|
+
selector: hash_exports.getSelectorFromName("modify_delegation"),
|
|
91340
|
+
calldata: [
|
|
91341
|
+
...call.calldata
|
|
91342
|
+
]
|
|
91343
|
+
}
|
|
91344
|
+
};
|
|
91301
91345
|
};
|
|
91302
91346
|
};
|
|
91303
91347
|
this.getDefispringRewardsAdapter = (id) => {
|
|
@@ -91500,12 +91544,12 @@ spurious results.`);
|
|
|
91500
91544
|
amount: collateralAmount,
|
|
91501
91545
|
token: this.config.collateral,
|
|
91502
91546
|
usdValue: collateralAmount.multipliedBy(token1Price.price).toNumber(),
|
|
91503
|
-
remarks:
|
|
91547
|
+
remarks: `Collateral - ${VesuPoolMetadata[this.config.poolId.address].name} pool`
|
|
91504
91548
|
}, {
|
|
91505
91549
|
amount: debtAmount,
|
|
91506
91550
|
token: this.config.debt,
|
|
91507
91551
|
usdValue: debtAmount.multipliedBy(token2Price.price).toNumber(),
|
|
91508
|
-
remarks:
|
|
91552
|
+
remarks: `Debt - ${VesuPoolMetadata[this.config.poolId.address].name} pool`
|
|
91509
91553
|
}];
|
|
91510
91554
|
this.setCache(CACHE_KEY, value, 6e4);
|
|
91511
91555
|
return value;
|
|
@@ -94962,20 +95006,19 @@ spurious results.`);
|
|
|
94962
95006
|
// todo support lending assets of underlying as well (like if xSTRK looping is not viable, simply supply STRK)
|
|
94963
95007
|
getVesuAdapters() {
|
|
94964
95008
|
const adapters = [];
|
|
94965
|
-
for (const
|
|
94966
|
-
const
|
|
94967
|
-
|
|
94968
|
-
|
|
94969
|
-
|
|
94970
|
-
|
|
94971
|
-
|
|
94972
|
-
|
|
94973
|
-
|
|
94974
|
-
|
|
94975
|
-
|
|
94976
|
-
|
|
94977
|
-
|
|
94978
|
-
}
|
|
95009
|
+
for (const borrowableInfo of this.metadata.additionalInfo.borrowable_assets) {
|
|
95010
|
+
const asset = borrowableInfo.token;
|
|
95011
|
+
const poolId = borrowableInfo.poolId;
|
|
95012
|
+
const vesuAdapter1 = new VesuAdapter({
|
|
95013
|
+
poolId,
|
|
95014
|
+
collateral: this.asset(),
|
|
95015
|
+
debt: asset,
|
|
95016
|
+
vaultAllocator: this.metadata.additionalInfo.vaultAllocator,
|
|
95017
|
+
id: ""
|
|
95018
|
+
});
|
|
95019
|
+
vesuAdapter1.pricer = this.pricer;
|
|
95020
|
+
vesuAdapter1.networkConfig = this.config;
|
|
95021
|
+
adapters.push(vesuAdapter1);
|
|
94979
95022
|
}
|
|
94980
95023
|
return adapters;
|
|
94981
95024
|
}
|
|
@@ -95601,19 +95644,21 @@ spurious results.`);
|
|
|
95601
95644
|
id: getVesuLegId("vesu_leg1" /* VESU_LEG1 */, underlyingToken.symbol, poolId.toString()),
|
|
95602
95645
|
adapter: vesuAdapterLST
|
|
95603
95646
|
}]);
|
|
95604
|
-
const { isV2, addr:
|
|
95647
|
+
const { isV2, addr: poolAddr } = getVesuSingletonAddress(poolId);
|
|
95605
95648
|
const VESU_MULTIPLY = isV2 ? vesuAdapterLST.VESU_MULTIPLY : vesuAdapterLST.VESU_MULTIPLY_V1;
|
|
95606
95649
|
const leafIdApprove = getVesuGenericLegId(poolId.toString(), "multiple_approve" /* MULTIPLE_APPROVE */);
|
|
95607
95650
|
vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, VESU_MULTIPLY, leafIdApprove).bind(commonAdapter));
|
|
95608
95651
|
const leafIdDelegationOn = getVesuGenericLegId(poolId.toString(), "switch_delegation_on" /* SWITCH_DELEGATION_ON */);
|
|
95609
|
-
vaultSettings.leafAdapters.push(vesuAdapterLST.getVesuModifyDelegationAdapter(leafIdDelegationOn).bind(vesuAdapterLST));
|
|
95652
|
+
vaultSettings.leafAdapters.push(vesuAdapterLST.getVesuModifyDelegationAdapter(leafIdDelegationOn, VESU_MULTIPLY).bind(vesuAdapterLST));
|
|
95610
95653
|
const leafIdDelegationOff = getVesuGenericLegId(poolId.toString(), "switch_delegation_off" /* SWITCH_DELEGATION_OFF */);
|
|
95611
|
-
vaultSettings.leafAdapters.push(vesuAdapterLST.getVesuModifyDelegationAdapter(leafIdDelegationOff).bind(vesuAdapterLST));
|
|
95654
|
+
vaultSettings.leafAdapters.push(vesuAdapterLST.getVesuModifyDelegationAdapter(leafIdDelegationOff, VESU_MULTIPLY).bind(vesuAdapterLST));
|
|
95612
95655
|
const multiplID = getVesuLegId("multiply_vesu" /* MULTIPLY_VESU */, underlyingToken.symbol, poolId.toString());
|
|
95613
95656
|
vaultSettings.leafAdapters.push(vesuAdapterLST.getMultiplyAdapter(multiplID).bind(vesuAdapterLST));
|
|
95657
|
+
vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, poolAddr, "approve_token1" /* APPROVE_TOKEN1 */).bind(commonAdapter));
|
|
95658
|
+
vaultSettings.leafAdapters.push(vesuAdapterLST.getModifyPosition.bind(vesuAdapterLST));
|
|
95614
95659
|
return vesuAdapterLST;
|
|
95615
95660
|
}
|
|
95616
|
-
function getLooperSettings2(lstSymbol, underlyingSymbol, vaultSettings, defaultPoolId
|
|
95661
|
+
function getLooperSettings2(lstSymbol, underlyingSymbol, vaultSettings, defaultPoolId) {
|
|
95617
95662
|
vaultSettings.leafAdapters = [];
|
|
95618
95663
|
const pool1 = vaultSettings.defaultPoolId;
|
|
95619
95664
|
if (!pool1.eq(defaultPoolId)) {
|
|
@@ -95632,10 +95677,11 @@ spurious results.`);
|
|
|
95632
95677
|
id: "common_adapter" /* COMMON */,
|
|
95633
95678
|
adapter: commonAdapter
|
|
95634
95679
|
}]);
|
|
95635
|
-
|
|
95636
|
-
altSupportedPoolIds.map((poolId) => addVesuLeaves(poolId, lstSymbol, underlyingSymbol, vaultSettings, commonAdapter));
|
|
95680
|
+
vaultSettings.borrowable_assets.map((borrowableAsset) => addVesuLeaves(borrowableAsset.poolId, lstSymbol, underlyingSymbol, vaultSettings, commonAdapter));
|
|
95637
95681
|
vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, AVNU_EXCHANGE, "avnu_mul_approve_withdr" /* AVNU_MULTIPLY_APPROVE_WITHDRAW */).bind(commonAdapter));
|
|
95638
|
-
|
|
95682
|
+
const uniqueBorrowableAssets = [...new Set(vaultSettings.borrowable_assets.map((borrowableAsset) => borrowableAsset.token.symbol))];
|
|
95683
|
+
for (let borrowableAssetSymbol of uniqueBorrowableAssets) {
|
|
95684
|
+
const borrowableAsset = Global.getDefaultTokens().find((token) => token.symbol === borrowableAssetSymbol);
|
|
95639
95685
|
const debtAsset = borrowableAsset;
|
|
95640
95686
|
const approve_debt_token_id = getAvnuManageIDs("avnu_mul_approve_dep" /* AVNU_MULTIPLY_APPROVE_DEPOSIT */, debtAsset.symbol);
|
|
95641
95687
|
const swap_debt_token_id = getAvnuManageIDs("avnu_mul_swap_dep" /* AVNU_MULTIPLY_SWAP_DEPOSIT */, debtAsset.symbol);
|
|
@@ -95643,23 +95689,9 @@ spurious results.`);
|
|
|
95643
95689
|
vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(debtAsset.address, AVNU_EXCHANGE, approve_debt_token_id).bind(commonAdapter));
|
|
95644
95690
|
vaultSettings.leafAdapters.push(commonAdapter.getAvnuAdapter(debtAsset.address, lstToken.address, swap_debt_token_id, false).bind(commonAdapter));
|
|
95645
95691
|
vaultSettings.leafAdapters.push(commonAdapter.getAvnuAdapter(lstToken.address, debtAsset.address, swap_lst_token_id, false).bind(commonAdapter));
|
|
95646
|
-
const vesuAdapter = new VesuAdapter({
|
|
95647
|
-
poolId: pool1,
|
|
95648
|
-
collateral: lstToken,
|
|
95649
|
-
debt: debtAsset,
|
|
95650
|
-
vaultAllocator: vaultSettings.vaultAllocator,
|
|
95651
|
-
id: getVesuLegId("vesu_leg1" /* VESU_LEG1 */, debtAsset.symbol, pool1.toString())
|
|
95652
|
-
});
|
|
95653
|
-
const { isV2, addr: poolAddr } = getVesuSingletonAddress(pool1);
|
|
95654
|
-
vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, poolAddr, "approve_token1" /* APPROVE_TOKEN1 */).bind(commonAdapter));
|
|
95655
|
-
vaultSettings.leafAdapters.push(vesuAdapter.getModifyPosition.bind(vesuAdapter));
|
|
95656
|
-
if (borrowableAsset.address.eq(underlyingToken.address)) {
|
|
95657
|
-
continue;
|
|
95658
|
-
}
|
|
95659
95692
|
}
|
|
95660
95693
|
vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, vaultSettings.vaultAddress, "approve_bring_liquidity" /* APPROVE_BRING_LIQUIDITY */).bind(commonAdapter));
|
|
95661
95694
|
vaultSettings.leafAdapters.push(commonAdapter.getBringLiquidityAdapter("bring_liquidity" /* BRING_LIQUIDITY */).bind(commonAdapter));
|
|
95662
|
-
vaultSettings.leafAdapters.push(vesuAdapterLST.getDefispringRewardsAdapter("defispring_rewards" /* DEFISPRING_REWARDS */).bind(vesuAdapterLST));
|
|
95663
95695
|
const STRKToken = Global.getDefaultTokens().find((token) => token.symbol === "STRK");
|
|
95664
95696
|
vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(STRKToken.address, AVNU_EXCHANGE, "approve_swap_token1" /* APPROVE_SWAP_TOKEN1 */).bind(commonAdapter));
|
|
95665
95697
|
vaultSettings.leafAdapters.push(commonAdapter.getAvnuAdapter(STRKToken.address, lstToken.address, "avnu_swap_rewards" /* AVNU_SWAP_REWARDS */, false).bind(commonAdapter));
|
|
@@ -95718,7 +95750,7 @@ spurious results.`);
|
|
|
95718
95750
|
{ type: "Technical Risk" /* TECHNICAL_RISK */, value: 1 /* STABLE_INFRASTRUCTURE */, weight: 25, reason: "Liquidation can only happen if vault is left un-monitored for weeks, which is highly unlikely. We actively monitor all services on a daily basis." },
|
|
95719
95751
|
{ type: "Depeg Risk" /* DEPEG_RISK */, value: 2 /* GENERALLY_STABLE */, weight: 25, reason: "Generally stable pegged assets" }
|
|
95720
95752
|
];
|
|
95721
|
-
var
|
|
95753
|
+
var btcBorrowableAssets = [
|
|
95722
95754
|
"WBTC",
|
|
95723
95755
|
"tBTC",
|
|
95724
95756
|
"LBTC",
|
|
@@ -95734,10 +95766,14 @@ spurious results.`);
|
|
|
95734
95766
|
adapters: [],
|
|
95735
95767
|
targetHealthFactor: 1.1,
|
|
95736
95768
|
minHealthFactor: 1.05,
|
|
95737
|
-
borrowable_assets:
|
|
95769
|
+
borrowable_assets: [
|
|
95770
|
+
...Global.getDefaultTokens().filter((token) => token.symbol === "STRK").map((token) => ({ token, poolId: VesuPools.Re7xSTRK })),
|
|
95771
|
+
...Global.getDefaultTokens().filter((token) => token.symbol === "STRK").map((token) => ({ token, poolId: VesuPools.Prime })),
|
|
95772
|
+
...Global.getDefaultTokens().filter((token) => token.symbol === "STRK").map((token) => ({ token, poolId: VesuPools.Re7STRK }))
|
|
95773
|
+
// v2, new alt for Re7xSTRK
|
|
95774
|
+
],
|
|
95738
95775
|
underlyingToken: Global.getDefaultTokens().find((token) => token.symbol === "STRK"),
|
|
95739
|
-
defaultPoolId: VesuPools.Re7xSTRK
|
|
95740
|
-
altSupportedPoolIds: [VesuPools.Prime]
|
|
95776
|
+
defaultPoolId: VesuPools.Re7xSTRK
|
|
95741
95777
|
};
|
|
95742
95778
|
var hyperxWBTC = {
|
|
95743
95779
|
vaultAddress: ContractAddr.from("0x2da9d0f96a46b453f55604313785dc866424240b1c6811d13bef594343db818"),
|
|
@@ -95749,10 +95785,14 @@ spurious results.`);
|
|
|
95749
95785
|
adapters: [],
|
|
95750
95786
|
targetHealthFactor: 1.1,
|
|
95751
95787
|
minHealthFactor: 1.05,
|
|
95752
|
-
borrowable_assets:
|
|
95788
|
+
borrowable_assets: [
|
|
95789
|
+
// allow all BTC flavours borrowing on Re7xBTC pool
|
|
95790
|
+
...btcBorrowableAssets.map((asset) => Global.getDefaultTokens().find((token) => token.symbol === asset)).map((token) => ({ token, poolId: VesuPools.Re7xBTC })),
|
|
95791
|
+
// allow only WBTC borrowing on Prime pool
|
|
95792
|
+
...Global.getDefaultTokens().filter((token) => token.symbol === "WBTC").map((token) => ({ token, poolId: VesuPools.Prime }))
|
|
95793
|
+
],
|
|
95753
95794
|
underlyingToken: Global.getDefaultTokens().find((token) => token.symbol === "WBTC"),
|
|
95754
|
-
defaultPoolId: VesuPools.Re7xBTC
|
|
95755
|
-
altSupportedPoolIds: [VesuPools.Prime]
|
|
95795
|
+
defaultPoolId: VesuPools.Re7xBTC
|
|
95756
95796
|
};
|
|
95757
95797
|
var hyperxtBTC = {
|
|
95758
95798
|
vaultAddress: ContractAddr.from("0x47d5f68477e5637ce0e56436c6b5eee5a354e6828995dae106b11a48679328"),
|
|
@@ -95764,10 +95804,11 @@ spurious results.`);
|
|
|
95764
95804
|
adapters: [],
|
|
95765
95805
|
targetHealthFactor: 1.1,
|
|
95766
95806
|
minHealthFactor: 1.05,
|
|
95767
|
-
borrowable_assets:
|
|
95807
|
+
borrowable_assets: [
|
|
95808
|
+
...Global.getDefaultTokens().filter((token) => token.symbol === "tBTC" || token.symbol === "WBTC").map((token) => ({ token, poolId: VesuPools.Re7xBTC }))
|
|
95809
|
+
],
|
|
95768
95810
|
underlyingToken: Global.getDefaultTokens().find((token) => token.symbol === "tBTC"),
|
|
95769
|
-
defaultPoolId: VesuPools.Re7xBTC
|
|
95770
|
-
altSupportedPoolIds: []
|
|
95811
|
+
defaultPoolId: VesuPools.Re7xBTC
|
|
95771
95812
|
};
|
|
95772
95813
|
var hyperxsBTC = {
|
|
95773
95814
|
vaultAddress: ContractAddr.from("0x437ef1e7d0f100b2e070b7a65cafec0b2be31b0290776da8b4112f5473d8d9"),
|
|
@@ -95779,10 +95820,11 @@ spurious results.`);
|
|
|
95779
95820
|
adapters: [],
|
|
95780
95821
|
targetHealthFactor: 1.1,
|
|
95781
95822
|
minHealthFactor: 1.05,
|
|
95782
|
-
borrowable_assets:
|
|
95823
|
+
borrowable_assets: [
|
|
95824
|
+
...Global.getDefaultTokens().filter((token) => token.symbol === "solvBTC").map((token) => ({ token, poolId: VesuPools.Re7xBTC }))
|
|
95825
|
+
],
|
|
95783
95826
|
underlyingToken: Global.getDefaultTokens().find((token) => token.symbol === "solvBTC"),
|
|
95784
|
-
defaultPoolId: VesuPools.Re7xBTC
|
|
95785
|
-
altSupportedPoolIds: []
|
|
95827
|
+
defaultPoolId: VesuPools.Re7xBTC
|
|
95786
95828
|
};
|
|
95787
95829
|
var hyperxLBTC = {
|
|
95788
95830
|
vaultAddress: ContractAddr.from("0x64cf24d4883fe569926419a0569ab34497c6956a1a308fa883257f7486d7030"),
|
|
@@ -95794,10 +95836,11 @@ spurious results.`);
|
|
|
95794
95836
|
adapters: [],
|
|
95795
95837
|
targetHealthFactor: 1.1,
|
|
95796
95838
|
minHealthFactor: 1.05,
|
|
95797
|
-
borrowable_assets:
|
|
95839
|
+
borrowable_assets: [
|
|
95840
|
+
...Global.getDefaultTokens().filter((token) => token.symbol === "LBTC").map((token) => ({ token, poolId: VesuPools.Re7xBTC }))
|
|
95841
|
+
],
|
|
95798
95842
|
underlyingToken: Global.getDefaultTokens().find((token) => token.symbol === "LBTC"),
|
|
95799
|
-
defaultPoolId: VesuPools.Re7xBTC
|
|
95800
|
-
altSupportedPoolIds: []
|
|
95843
|
+
defaultPoolId: VesuPools.Re7xBTC
|
|
95801
95844
|
};
|
|
95802
95845
|
function getInvestmentSteps(lstSymbol, underlyingSymbol) {
|
|
95803
95846
|
return [
|
|
@@ -95816,7 +95859,7 @@ spurious results.`);
|
|
|
95816
95859
|
launchBlock: 0,
|
|
95817
95860
|
type: "Other",
|
|
95818
95861
|
depositTokens: [Global.getDefaultTokens().find((token) => token.symbol === lstSymbol)],
|
|
95819
|
-
additionalInfo: getLooperSettings2(lstSymbol, underlyingSymbol, addresses, addresses.defaultPoolId
|
|
95862
|
+
additionalInfo: getLooperSettings2(lstSymbol, underlyingSymbol, addresses, addresses.defaultPoolId),
|
|
95820
95863
|
risk: {
|
|
95821
95864
|
riskFactor: _riskFactor4,
|
|
95822
95865
|
netRisk: _riskFactor4.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _riskFactor4.reduce((acc, curr) => acc + curr.weight, 0),
|