@strkfarm/sdk 1.1.74 → 1.1.75
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 +199 -174
- package/dist/index.browser.mjs +171 -147
- package/dist/index.d.ts +34 -6
- package/dist/index.js +255 -230
- package/dist/index.mjs +171 -147
- package/package.json +1 -1
- package/src/dataTypes/_bignumber.ts +5 -0
- 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) {
|
|
@@ -91115,7 +91121,25 @@ spurious results.`);
|
|
|
91115
91121
|
Genesis: ContractAddr.from("0x4dc4f0ca6ea4961e4c8373265bfd5317678f4fe374d76f3fd7135f57763bf28"),
|
|
91116
91122
|
Re7xSTRK: ContractAddr.from("0x052fb52363939c3aa848f8f4ac28f0a51379f8d1b971d8444de25fbd77d8f161"),
|
|
91117
91123
|
Re7xBTC: ContractAddr.from("0x3a8416bf20d036df5b1cf3447630a2e1cb04685f6b0c3a70ed7fb1473548ecf"),
|
|
91118
|
-
Prime: ContractAddr.from("0x451fe483d5921a2919ddd81d0de6696669bccdacd859f72a4fba7656b97c3b5")
|
|
91124
|
+
Prime: ContractAddr.from("0x451fe483d5921a2919ddd81d0de6696669bccdacd859f72a4fba7656b97c3b5"),
|
|
91125
|
+
Re7STRK: ContractAddr.from("0x01fcdacc1d8184eca7b472b5acbaf1500cec9d5683ca95fede8128b46c8f9cc2")
|
|
91126
|
+
};
|
|
91127
|
+
var VesuPoolMetadata = {
|
|
91128
|
+
[VesuPools.Genesis.address]: {
|
|
91129
|
+
name: "Genesis"
|
|
91130
|
+
},
|
|
91131
|
+
[VesuPools.Re7xSTRK.address]: {
|
|
91132
|
+
name: "Re7 xSTRK"
|
|
91133
|
+
},
|
|
91134
|
+
[VesuPools.Re7xBTC.address]: {
|
|
91135
|
+
name: "Re7 xBTC"
|
|
91136
|
+
},
|
|
91137
|
+
[VesuPools.Prime.address]: {
|
|
91138
|
+
name: "Prime"
|
|
91139
|
+
},
|
|
91140
|
+
[VesuPools.Re7STRK.address]: {
|
|
91141
|
+
name: "Re7 STRK"
|
|
91142
|
+
}
|
|
91119
91143
|
};
|
|
91120
91144
|
var extensionMap = {};
|
|
91121
91145
|
extensionMap[VesuPools.Re7xSTRK.address] = ContractAddr.from("0x04e06e04b8d624d039aa1c3ca8e0aa9e21dc1ccba1d88d0d650837159e0ee054");
|
|
@@ -91258,15 +91282,15 @@ spurious results.`);
|
|
|
91258
91282
|
}
|
|
91259
91283
|
};
|
|
91260
91284
|
};
|
|
91261
|
-
this.getVesuModifyDelegationAdapter = (id) => {
|
|
91285
|
+
this.getVesuModifyDelegationAdapter = (id, delegatee) => {
|
|
91262
91286
|
return () => {
|
|
91263
91287
|
const { addr: VESU_SINGLETON2, isV2 } = getVesuSingletonAddress(this.config.poolId);
|
|
91264
91288
|
const packedArguments = isV2 ? [
|
|
91265
|
-
toBigInt3(
|
|
91289
|
+
toBigInt3(delegatee.toString())
|
|
91266
91290
|
// v2
|
|
91267
91291
|
] : [
|
|
91268
91292
|
this.config.poolId.toBigInt(),
|
|
91269
|
-
toBigInt3(
|
|
91293
|
+
toBigInt3(delegatee.toString())
|
|
91270
91294
|
// v1
|
|
91271
91295
|
];
|
|
91272
91296
|
const output = this.constructSimpleLeafData({
|
|
@@ -91275,29 +91299,31 @@ spurious results.`);
|
|
|
91275
91299
|
method: "modify_delegation",
|
|
91276
91300
|
packedArguments
|
|
91277
91301
|
}, isV2 ? SIMPLE_SANITIZER_V2 : SIMPLE_SANITIZER_VESU_V1_DELEGATIONS);
|
|
91278
|
-
return { leaf: output, callConstructor: this.getVesuModifyDelegationCall.bind(this) };
|
|
91302
|
+
return { leaf: output, callConstructor: this.getVesuModifyDelegationCall(delegatee).bind(this) };
|
|
91279
91303
|
};
|
|
91280
91304
|
};
|
|
91281
|
-
this.getVesuModifyDelegationCall = (
|
|
91282
|
-
|
|
91283
|
-
|
|
91284
|
-
|
|
91285
|
-
|
|
91286
|
-
|
|
91287
|
-
|
|
91288
|
-
|
|
91289
|
-
|
|
91290
|
-
|
|
91291
|
-
|
|
91292
|
-
|
|
91293
|
-
|
|
91294
|
-
|
|
91295
|
-
|
|
91296
|
-
|
|
91297
|
-
|
|
91298
|
-
|
|
91299
|
-
|
|
91300
|
-
|
|
91305
|
+
this.getVesuModifyDelegationCall = (delegatee) => {
|
|
91306
|
+
return (params) => {
|
|
91307
|
+
const VESU_SINGLETON2 = getVesuSingletonAddress(this.config.poolId).addr;
|
|
91308
|
+
const { contract, isV2 } = this.getVesuSingletonContract(getMainnetConfig(), this.config.poolId);
|
|
91309
|
+
const call = contract.populate("modify_delegation", isV2 ? {
|
|
91310
|
+
delegatee: delegatee.toBigInt(),
|
|
91311
|
+
delegation: params.delegation
|
|
91312
|
+
} : {
|
|
91313
|
+
pool_id: this.config.poolId.toBigInt(),
|
|
91314
|
+
delegatee: delegatee.toBigInt(),
|
|
91315
|
+
delegation: params.delegation
|
|
91316
|
+
});
|
|
91317
|
+
return {
|
|
91318
|
+
sanitizer: isV2 ? SIMPLE_SANITIZER_V2 : SIMPLE_SANITIZER_VESU_V1_DELEGATIONS,
|
|
91319
|
+
call: {
|
|
91320
|
+
contractAddress: VESU_SINGLETON2,
|
|
91321
|
+
selector: hash_exports.getSelectorFromName("modify_delegation"),
|
|
91322
|
+
calldata: [
|
|
91323
|
+
...call.calldata
|
|
91324
|
+
]
|
|
91325
|
+
}
|
|
91326
|
+
};
|
|
91301
91327
|
};
|
|
91302
91328
|
};
|
|
91303
91329
|
this.getDefispringRewardsAdapter = (id) => {
|
|
@@ -91500,12 +91526,12 @@ spurious results.`);
|
|
|
91500
91526
|
amount: collateralAmount,
|
|
91501
91527
|
token: this.config.collateral,
|
|
91502
91528
|
usdValue: collateralAmount.multipliedBy(token1Price.price).toNumber(),
|
|
91503
|
-
remarks:
|
|
91529
|
+
remarks: `Collateral - ${VesuPoolMetadata[this.config.poolId.address].name} pool`
|
|
91504
91530
|
}, {
|
|
91505
91531
|
amount: debtAmount,
|
|
91506
91532
|
token: this.config.debt,
|
|
91507
91533
|
usdValue: debtAmount.multipliedBy(token2Price.price).toNumber(),
|
|
91508
|
-
remarks:
|
|
91534
|
+
remarks: `Debt - ${VesuPoolMetadata[this.config.poolId.address].name} pool`
|
|
91509
91535
|
}];
|
|
91510
91536
|
this.setCache(CACHE_KEY, value, 6e4);
|
|
91511
91537
|
return value;
|
|
@@ -94962,20 +94988,19 @@ spurious results.`);
|
|
|
94962
94988
|
// todo support lending assets of underlying as well (like if xSTRK looping is not viable, simply supply STRK)
|
|
94963
94989
|
getVesuAdapters() {
|
|
94964
94990
|
const adapters = [];
|
|
94965
|
-
for (const
|
|
94966
|
-
const
|
|
94967
|
-
|
|
94968
|
-
|
|
94969
|
-
|
|
94970
|
-
|
|
94971
|
-
|
|
94972
|
-
|
|
94973
|
-
|
|
94974
|
-
|
|
94975
|
-
|
|
94976
|
-
|
|
94977
|
-
|
|
94978
|
-
}
|
|
94991
|
+
for (const borrowableInfo of this.metadata.additionalInfo.borrowable_assets) {
|
|
94992
|
+
const asset = borrowableInfo.token;
|
|
94993
|
+
const poolId = borrowableInfo.poolId;
|
|
94994
|
+
const vesuAdapter1 = new VesuAdapter({
|
|
94995
|
+
poolId,
|
|
94996
|
+
collateral: this.asset(),
|
|
94997
|
+
debt: asset,
|
|
94998
|
+
vaultAllocator: this.metadata.additionalInfo.vaultAllocator,
|
|
94999
|
+
id: ""
|
|
95000
|
+
});
|
|
95001
|
+
vesuAdapter1.pricer = this.pricer;
|
|
95002
|
+
vesuAdapter1.networkConfig = this.config;
|
|
95003
|
+
adapters.push(vesuAdapter1);
|
|
94979
95004
|
}
|
|
94980
95005
|
return adapters;
|
|
94981
95006
|
}
|
|
@@ -95601,19 +95626,21 @@ spurious results.`);
|
|
|
95601
95626
|
id: getVesuLegId("vesu_leg1" /* VESU_LEG1 */, underlyingToken.symbol, poolId.toString()),
|
|
95602
95627
|
adapter: vesuAdapterLST
|
|
95603
95628
|
}]);
|
|
95604
|
-
const { isV2, addr:
|
|
95629
|
+
const { isV2, addr: poolAddr } = getVesuSingletonAddress(poolId);
|
|
95605
95630
|
const VESU_MULTIPLY = isV2 ? vesuAdapterLST.VESU_MULTIPLY : vesuAdapterLST.VESU_MULTIPLY_V1;
|
|
95606
95631
|
const leafIdApprove = getVesuGenericLegId(poolId.toString(), "multiple_approve" /* MULTIPLE_APPROVE */);
|
|
95607
95632
|
vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, VESU_MULTIPLY, leafIdApprove).bind(commonAdapter));
|
|
95608
95633
|
const leafIdDelegationOn = getVesuGenericLegId(poolId.toString(), "switch_delegation_on" /* SWITCH_DELEGATION_ON */);
|
|
95609
|
-
vaultSettings.leafAdapters.push(vesuAdapterLST.getVesuModifyDelegationAdapter(leafIdDelegationOn).bind(vesuAdapterLST));
|
|
95634
|
+
vaultSettings.leafAdapters.push(vesuAdapterLST.getVesuModifyDelegationAdapter(leafIdDelegationOn, VESU_MULTIPLY).bind(vesuAdapterLST));
|
|
95610
95635
|
const leafIdDelegationOff = getVesuGenericLegId(poolId.toString(), "switch_delegation_off" /* SWITCH_DELEGATION_OFF */);
|
|
95611
|
-
vaultSettings.leafAdapters.push(vesuAdapterLST.getVesuModifyDelegationAdapter(leafIdDelegationOff).bind(vesuAdapterLST));
|
|
95636
|
+
vaultSettings.leafAdapters.push(vesuAdapterLST.getVesuModifyDelegationAdapter(leafIdDelegationOff, VESU_MULTIPLY).bind(vesuAdapterLST));
|
|
95612
95637
|
const multiplID = getVesuLegId("multiply_vesu" /* MULTIPLY_VESU */, underlyingToken.symbol, poolId.toString());
|
|
95613
95638
|
vaultSettings.leafAdapters.push(vesuAdapterLST.getMultiplyAdapter(multiplID).bind(vesuAdapterLST));
|
|
95639
|
+
vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, poolAddr, "approve_token1" /* APPROVE_TOKEN1 */).bind(commonAdapter));
|
|
95640
|
+
vaultSettings.leafAdapters.push(vesuAdapterLST.getModifyPosition.bind(vesuAdapterLST));
|
|
95614
95641
|
return vesuAdapterLST;
|
|
95615
95642
|
}
|
|
95616
|
-
function getLooperSettings2(lstSymbol, underlyingSymbol, vaultSettings, defaultPoolId
|
|
95643
|
+
function getLooperSettings2(lstSymbol, underlyingSymbol, vaultSettings, defaultPoolId) {
|
|
95617
95644
|
vaultSettings.leafAdapters = [];
|
|
95618
95645
|
const pool1 = vaultSettings.defaultPoolId;
|
|
95619
95646
|
if (!pool1.eq(defaultPoolId)) {
|
|
@@ -95632,10 +95659,11 @@ spurious results.`);
|
|
|
95632
95659
|
id: "common_adapter" /* COMMON */,
|
|
95633
95660
|
adapter: commonAdapter
|
|
95634
95661
|
}]);
|
|
95635
|
-
|
|
95636
|
-
altSupportedPoolIds.map((poolId) => addVesuLeaves(poolId, lstSymbol, underlyingSymbol, vaultSettings, commonAdapter));
|
|
95662
|
+
vaultSettings.borrowable_assets.map((borrowableAsset) => addVesuLeaves(borrowableAsset.poolId, lstSymbol, underlyingSymbol, vaultSettings, commonAdapter));
|
|
95637
95663
|
vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, AVNU_EXCHANGE, "avnu_mul_approve_withdr" /* AVNU_MULTIPLY_APPROVE_WITHDRAW */).bind(commonAdapter));
|
|
95638
|
-
|
|
95664
|
+
const uniqueBorrowableAssets = [...new Set(vaultSettings.borrowable_assets.map((borrowableAsset) => borrowableAsset.token.symbol))];
|
|
95665
|
+
for (let borrowableAssetSymbol of uniqueBorrowableAssets) {
|
|
95666
|
+
const borrowableAsset = Global.getDefaultTokens().find((token) => token.symbol === borrowableAssetSymbol);
|
|
95639
95667
|
const debtAsset = borrowableAsset;
|
|
95640
95668
|
const approve_debt_token_id = getAvnuManageIDs("avnu_mul_approve_dep" /* AVNU_MULTIPLY_APPROVE_DEPOSIT */, debtAsset.symbol);
|
|
95641
95669
|
const swap_debt_token_id = getAvnuManageIDs("avnu_mul_swap_dep" /* AVNU_MULTIPLY_SWAP_DEPOSIT */, debtAsset.symbol);
|
|
@@ -95643,23 +95671,9 @@ spurious results.`);
|
|
|
95643
95671
|
vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(debtAsset.address, AVNU_EXCHANGE, approve_debt_token_id).bind(commonAdapter));
|
|
95644
95672
|
vaultSettings.leafAdapters.push(commonAdapter.getAvnuAdapter(debtAsset.address, lstToken.address, swap_debt_token_id, false).bind(commonAdapter));
|
|
95645
95673
|
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
95674
|
}
|
|
95660
95675
|
vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, vaultSettings.vaultAddress, "approve_bring_liquidity" /* APPROVE_BRING_LIQUIDITY */).bind(commonAdapter));
|
|
95661
95676
|
vaultSettings.leafAdapters.push(commonAdapter.getBringLiquidityAdapter("bring_liquidity" /* BRING_LIQUIDITY */).bind(commonAdapter));
|
|
95662
|
-
vaultSettings.leafAdapters.push(vesuAdapterLST.getDefispringRewardsAdapter("defispring_rewards" /* DEFISPRING_REWARDS */).bind(vesuAdapterLST));
|
|
95663
95677
|
const STRKToken = Global.getDefaultTokens().find((token) => token.symbol === "STRK");
|
|
95664
95678
|
vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(STRKToken.address, AVNU_EXCHANGE, "approve_swap_token1" /* APPROVE_SWAP_TOKEN1 */).bind(commonAdapter));
|
|
95665
95679
|
vaultSettings.leafAdapters.push(commonAdapter.getAvnuAdapter(STRKToken.address, lstToken.address, "avnu_swap_rewards" /* AVNU_SWAP_REWARDS */, false).bind(commonAdapter));
|
|
@@ -95718,7 +95732,7 @@ spurious results.`);
|
|
|
95718
95732
|
{ 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
95733
|
{ type: "Depeg Risk" /* DEPEG_RISK */, value: 2 /* GENERALLY_STABLE */, weight: 25, reason: "Generally stable pegged assets" }
|
|
95720
95734
|
];
|
|
95721
|
-
var
|
|
95735
|
+
var btcBorrowableAssets = [
|
|
95722
95736
|
"WBTC",
|
|
95723
95737
|
"tBTC",
|
|
95724
95738
|
"LBTC",
|
|
@@ -95734,10 +95748,14 @@ spurious results.`);
|
|
|
95734
95748
|
adapters: [],
|
|
95735
95749
|
targetHealthFactor: 1.1,
|
|
95736
95750
|
minHealthFactor: 1.05,
|
|
95737
|
-
borrowable_assets:
|
|
95751
|
+
borrowable_assets: [
|
|
95752
|
+
...Global.getDefaultTokens().filter((token) => token.symbol === "STRK").map((token) => ({ token, poolId: VesuPools.Re7xSTRK })),
|
|
95753
|
+
...Global.getDefaultTokens().filter((token) => token.symbol === "STRK").map((token) => ({ token, poolId: VesuPools.Prime })),
|
|
95754
|
+
...Global.getDefaultTokens().filter((token) => token.symbol === "STRK").map((token) => ({ token, poolId: VesuPools.Re7STRK }))
|
|
95755
|
+
// v2, new alt for Re7xSTRK
|
|
95756
|
+
],
|
|
95738
95757
|
underlyingToken: Global.getDefaultTokens().find((token) => token.symbol === "STRK"),
|
|
95739
|
-
defaultPoolId: VesuPools.Re7xSTRK
|
|
95740
|
-
altSupportedPoolIds: [VesuPools.Prime]
|
|
95758
|
+
defaultPoolId: VesuPools.Re7xSTRK
|
|
95741
95759
|
};
|
|
95742
95760
|
var hyperxWBTC = {
|
|
95743
95761
|
vaultAddress: ContractAddr.from("0x2da9d0f96a46b453f55604313785dc866424240b1c6811d13bef594343db818"),
|
|
@@ -95749,10 +95767,14 @@ spurious results.`);
|
|
|
95749
95767
|
adapters: [],
|
|
95750
95768
|
targetHealthFactor: 1.1,
|
|
95751
95769
|
minHealthFactor: 1.05,
|
|
95752
|
-
borrowable_assets:
|
|
95770
|
+
borrowable_assets: [
|
|
95771
|
+
// allow all BTC flavours borrowing on Re7xBTC pool
|
|
95772
|
+
...btcBorrowableAssets.map((asset) => Global.getDefaultTokens().find((token) => token.symbol === asset)).map((token) => ({ token, poolId: VesuPools.Re7xBTC })),
|
|
95773
|
+
// allow only WBTC borrowing on Prime pool
|
|
95774
|
+
...Global.getDefaultTokens().filter((token) => token.symbol === "WBTC").map((token) => ({ token, poolId: VesuPools.Prime }))
|
|
95775
|
+
],
|
|
95753
95776
|
underlyingToken: Global.getDefaultTokens().find((token) => token.symbol === "WBTC"),
|
|
95754
|
-
defaultPoolId: VesuPools.Re7xBTC
|
|
95755
|
-
altSupportedPoolIds: [VesuPools.Prime]
|
|
95777
|
+
defaultPoolId: VesuPools.Re7xBTC
|
|
95756
95778
|
};
|
|
95757
95779
|
var hyperxtBTC = {
|
|
95758
95780
|
vaultAddress: ContractAddr.from("0x47d5f68477e5637ce0e56436c6b5eee5a354e6828995dae106b11a48679328"),
|
|
@@ -95764,10 +95786,11 @@ spurious results.`);
|
|
|
95764
95786
|
adapters: [],
|
|
95765
95787
|
targetHealthFactor: 1.1,
|
|
95766
95788
|
minHealthFactor: 1.05,
|
|
95767
|
-
borrowable_assets:
|
|
95789
|
+
borrowable_assets: [
|
|
95790
|
+
...Global.getDefaultTokens().filter((token) => token.symbol === "tBTC" || token.symbol === "WBTC").map((token) => ({ token, poolId: VesuPools.Re7xBTC }))
|
|
95791
|
+
],
|
|
95768
95792
|
underlyingToken: Global.getDefaultTokens().find((token) => token.symbol === "tBTC"),
|
|
95769
|
-
defaultPoolId: VesuPools.Re7xBTC
|
|
95770
|
-
altSupportedPoolIds: []
|
|
95793
|
+
defaultPoolId: VesuPools.Re7xBTC
|
|
95771
95794
|
};
|
|
95772
95795
|
var hyperxsBTC = {
|
|
95773
95796
|
vaultAddress: ContractAddr.from("0x437ef1e7d0f100b2e070b7a65cafec0b2be31b0290776da8b4112f5473d8d9"),
|
|
@@ -95779,10 +95802,11 @@ spurious results.`);
|
|
|
95779
95802
|
adapters: [],
|
|
95780
95803
|
targetHealthFactor: 1.1,
|
|
95781
95804
|
minHealthFactor: 1.05,
|
|
95782
|
-
borrowable_assets:
|
|
95805
|
+
borrowable_assets: [
|
|
95806
|
+
...Global.getDefaultTokens().filter((token) => token.symbol === "solvBTC").map((token) => ({ token, poolId: VesuPools.Re7xBTC }))
|
|
95807
|
+
],
|
|
95783
95808
|
underlyingToken: Global.getDefaultTokens().find((token) => token.symbol === "solvBTC"),
|
|
95784
|
-
defaultPoolId: VesuPools.Re7xBTC
|
|
95785
|
-
altSupportedPoolIds: []
|
|
95809
|
+
defaultPoolId: VesuPools.Re7xBTC
|
|
95786
95810
|
};
|
|
95787
95811
|
var hyperxLBTC = {
|
|
95788
95812
|
vaultAddress: ContractAddr.from("0x64cf24d4883fe569926419a0569ab34497c6956a1a308fa883257f7486d7030"),
|
|
@@ -95794,10 +95818,11 @@ spurious results.`);
|
|
|
95794
95818
|
adapters: [],
|
|
95795
95819
|
targetHealthFactor: 1.1,
|
|
95796
95820
|
minHealthFactor: 1.05,
|
|
95797
|
-
borrowable_assets:
|
|
95821
|
+
borrowable_assets: [
|
|
95822
|
+
...Global.getDefaultTokens().filter((token) => token.symbol === "LBTC").map((token) => ({ token, poolId: VesuPools.Re7xBTC }))
|
|
95823
|
+
],
|
|
95798
95824
|
underlyingToken: Global.getDefaultTokens().find((token) => token.symbol === "LBTC"),
|
|
95799
|
-
defaultPoolId: VesuPools.Re7xBTC
|
|
95800
|
-
altSupportedPoolIds: []
|
|
95825
|
+
defaultPoolId: VesuPools.Re7xBTC
|
|
95801
95826
|
};
|
|
95802
95827
|
function getInvestmentSteps(lstSymbol, underlyingSymbol) {
|
|
95803
95828
|
return [
|
|
@@ -95816,7 +95841,7 @@ spurious results.`);
|
|
|
95816
95841
|
launchBlock: 0,
|
|
95817
95842
|
type: "Other",
|
|
95818
95843
|
depositTokens: [Global.getDefaultTokens().find((token) => token.symbol === lstSymbol)],
|
|
95819
|
-
additionalInfo: getLooperSettings2(lstSymbol, underlyingSymbol, addresses, addresses.defaultPoolId
|
|
95844
|
+
additionalInfo: getLooperSettings2(lstSymbol, underlyingSymbol, addresses, addresses.defaultPoolId),
|
|
95820
95845
|
risk: {
|
|
95821
95846
|
riskFactor: _riskFactor4,
|
|
95822
95847
|
netRisk: _riskFactor4.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _riskFactor4.reduce((acc, curr) => acc + curr.weight, 0),
|