@strkfarm/sdk 1.1.16 → 1.1.19

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.js CHANGED
@@ -85,6 +85,7 @@ __export(index_exports, {
85
85
  getRiskColor: () => getRiskColor,
86
86
  getRiskExplaination: () => getRiskExplaination,
87
87
  getTrovesEndpoint: () => getTrovesEndpoint,
88
+ getVesuSingletonAddress: () => getVesuSingletonAddress,
88
89
  highlightTextWithLinks: () => highlightTextWithLinks,
89
90
  logger: () => logger
90
91
  });
@@ -107,23 +108,27 @@ var _Web3Number = class extends import_bignumber.default {
107
108
  this.decimals = decimals;
108
109
  }
109
110
  toWei() {
110
- return this.mul(10 ** this.decimals).toFixed(0);
111
+ return super.mul(10 ** this.decimals).toFixed(0);
111
112
  }
112
113
  multipliedBy(value) {
113
114
  const _value = this.getStandardString(value);
114
- return this.construct(this.mul(_value).toString(), this.decimals);
115
+ return this.construct(super.mul(_value).toString(), this.decimals);
115
116
  }
116
117
  dividedBy(value) {
117
118
  const _value = this.getStandardString(value);
118
- return this.construct(this.div(_value).toString(), this.decimals);
119
+ return this.construct(super.dividedBy(_value).toString(), this.decimals);
119
120
  }
120
121
  plus(value) {
121
- const _value = this.getStandardString(value);
122
- return this.construct(this.add(_value).toString(), this.decimals);
122
+ const rawValue = this.getStandardString(value);
123
+ const thisBN = new import_bignumber.default(this.toString());
124
+ const result = thisBN.plus(rawValue);
125
+ return this.construct(result.toString(), this.decimals);
123
126
  }
124
127
  minus(n, base) {
125
- const _value = this.getStandardString(n);
126
- return this.construct(super.minus(_value, base).toString(), this.decimals);
128
+ const rawValue = this.getStandardString(n);
129
+ const thisBN = new import_bignumber.default(this.toString());
130
+ const result = thisBN.minus(rawValue, base);
131
+ return this.construct(result.toString(), this.decimals);
127
132
  }
128
133
  construct(value, decimals) {
129
134
  return new this.constructor(value, decimals);
@@ -141,10 +146,13 @@ var _Web3Number = class extends import_bignumber.default {
141
146
  return Math.min(this.decimals, 18);
142
147
  }
143
148
  getStandardString(value) {
144
- if (typeof value == "string") {
149
+ if (typeof value === "string") {
145
150
  return value;
146
151
  }
147
- return value.toFixed(this.maxToFixedDecimals());
152
+ if (typeof value === "number") {
153
+ return value.toString();
154
+ }
155
+ return import_bignumber.default.prototype.toString.call(value);
148
156
  }
149
157
  minimum(value) {
150
158
  const _value = new import_bignumber.default(value);
@@ -155,12 +163,10 @@ var _Web3Number = class extends import_bignumber.default {
155
163
  maximum(value) {
156
164
  const _value = new import_bignumber.default(value);
157
165
  const _valueMe = new import_bignumber.default(this.toString());
158
- console.warn(`maximum: _value: ${_value.toString()}, _valueMe: ${_valueMe.toString()}`);
159
166
  const answer = _value.greaterThanOrEqualTo(_valueMe) ? _value : _valueMe;
160
167
  return this.construct(answer.toString(), this.decimals);
161
168
  }
162
169
  abs() {
163
- console.warn(`abs: this: ${this}`);
164
170
  return this.construct(Math.abs(this.toNumber()).toFixed(12), this.decimals);
165
171
  }
166
172
  toI129() {
@@ -609,13 +615,14 @@ var Pricer = class extends PricerBase {
609
615
  logger.verbose(`Fetching price of ${token.symbol} using ${methodToUse}`);
610
616
  switch (methodToUse) {
611
617
  case "Coinbase":
612
- try {
613
- const result = await this._getPriceCoinbase(token);
614
- this.methodToUse[token.symbol] = "Coinbase";
615
- return result;
616
- } catch (error) {
617
- console.warn(`Coinbase: price err: message [${token.symbol}]: `, error.message);
618
- }
618
+ // try {
619
+ // const result = await this._getPriceCoinbase(token);
620
+ // this.methodToUse[token.symbol] = 'Coinbase';
621
+ // return result;
622
+ // } catch (error: any) {
623
+ // console.warn(`Coinbase: price err: message [${token.symbol}]: `, error.message);
624
+ // // do nothing, try next
625
+ // }
619
626
  case "Coinmarketcap":
620
627
  try {
621
628
  const result = await this._getPriceCoinMarketCap(token);
@@ -999,7 +1006,7 @@ var PricerFromApi = class extends PricerBase {
999
1006
  }
1000
1007
  async getPriceFromMyAPI(tokenSymbol) {
1001
1008
  logger.verbose(`getPrice from redis: ${tokenSymbol}`);
1002
- const endpoint = "https://cache-server-t2me.onrender.com";
1009
+ const endpoint = "https://proxy.api.troves.fi";
1003
1010
  const url = `${endpoint}/api/price/${tokenSymbol}`;
1004
1011
  const priceInfoRes = await fetch(url);
1005
1012
  const priceInfo = await priceInfoRes.json();
@@ -4067,6 +4074,9 @@ var BaseStrategy = class extends CacheClass {
4067
4074
  async withdrawCall(amountInfo, receiver, owner) {
4068
4075
  throw new Error("Not implemented");
4069
4076
  }
4077
+ async getVaultPositions() {
4078
+ throw new Error("Not implemented");
4079
+ }
4070
4080
  };
4071
4081
 
4072
4082
  // src/node/headless.browser.ts
@@ -4086,7 +4096,7 @@ var COMMON_CONTRACTS = [{
4086
4096
  sourceCodeUrl: "https://github.com/strkfarm/strkfarm-contracts/blob/main/src/components/accessControl.cairo"
4087
4097
  }];
4088
4098
  var ENDPOINTS = {
4089
- VESU_BASE: "https://cache-server-t2me.onrender.com/vesu"
4099
+ VESU_BASE: "https://proxy.api.troves.fi/vesu-staging"
4090
4100
  };
4091
4101
 
4092
4102
  // src/modules/harvests.ts
@@ -15805,6 +15815,49 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
15805
15815
  const tick = Math.floor(value / tickSpacing) * tickSpacing;
15806
15816
  return this.tickToi129(tick);
15807
15817
  }
15818
+ async getVaultPositions() {
15819
+ const tvlInfo = await this.getTVL();
15820
+ const fees = await this.getUncollectedFees();
15821
+ const unusedBalance = await this.unusedBalances();
15822
+ return [
15823
+ {
15824
+ amount: tvlInfo.token0.amount,
15825
+ usdValue: tvlInfo.token0.usdValue,
15826
+ token: tvlInfo.token0.tokenInfo,
15827
+ remarks: `Liquidity in Ekubo`
15828
+ },
15829
+ {
15830
+ amount: fees.token0.amount,
15831
+ usdValue: fees.token0.usdValue,
15832
+ token: fees.token0.tokenInfo,
15833
+ remarks: "Uncollected Fees in Ekubo"
15834
+ },
15835
+ {
15836
+ amount: unusedBalance.token0.amount,
15837
+ usdValue: unusedBalance.token0.usdValue,
15838
+ token: unusedBalance.token0.tokenInfo,
15839
+ remarks: "Unused Balance in the Vault"
15840
+ },
15841
+ {
15842
+ amount: tvlInfo.token1.amount,
15843
+ usdValue: tvlInfo.token1.usdValue,
15844
+ token: tvlInfo.token1.tokenInfo,
15845
+ remarks: "Liquidity in Ekubo"
15846
+ },
15847
+ {
15848
+ amount: fees.token1.amount,
15849
+ usdValue: fees.token1.usdValue,
15850
+ token: fees.token1.tokenInfo,
15851
+ remarks: "Uncollected Fees in Ekubo"
15852
+ },
15853
+ {
15854
+ amount: unusedBalance.token1.amount,
15855
+ usdValue: unusedBalance.token1.usdValue,
15856
+ token: unusedBalance.token1.tokenInfo,
15857
+ remarks: "Unused Balance in the Vault"
15858
+ }
15859
+ ];
15860
+ }
15808
15861
  async getPoolKey(blockIdentifier = "latest") {
15809
15862
  if (this.poolKey) {
15810
15863
  return this.poolKey;
@@ -18966,9 +19019,10 @@ var import_starknet13 = require("starknet");
18966
19019
 
18967
19020
  // src/strategies/universal-adapters/adapter-utils.ts
18968
19021
  var SIMPLE_SANITIZER = ContractAddr.from("0x5a2e3ceb3da368b983a8717898427ab7b6daf04014b70f321e777f9aad940b4");
18969
- var SIMPLE_SANITIZER_V2 = ContractAddr.from("0x5643d54da70a471cd2b6fa37f52ea7a13cc3f3910689a839f8490a663d2208a");
19022
+ var SIMPLE_SANITIZER_V2 = ContractAddr.from("0x7b6f98311af8aa425278570e62abf523e6462eaa01a38c1feab9b2f416492e2");
18970
19023
  var PRICE_ROUTER = ContractAddr.from("0x05e83Fa38D791d2dba8E6f487758A9687FfEe191A6Cf8a6c5761ab0a110DB837");
18971
19024
  var AVNU_MIDDLEWARE = ContractAddr.from("0x4a7972ed3f5d1e74a6d6c4a8f467666953d081c8f2270390cc169d50d17cb0d");
19025
+ var VESU_SINGLETON = ContractAddr.from("0x000d8d6dfec4d33bfb6895de9f3852143a17c6f92fd2a21da3d6924d34870160");
18972
19026
  function toBigInt(value) {
18973
19027
  if (typeof value === "string") {
18974
19028
  return BigInt(value);
@@ -21903,232 +21957,2098 @@ var vesu_multiple_abi_default = [
21903
21957
  }
21904
21958
  ];
21905
21959
 
21906
- // src/strategies/universal-adapters/vesu-adapter.ts
21907
- var VesuAmountType = /* @__PURE__ */ ((VesuAmountType2) => {
21908
- VesuAmountType2[VesuAmountType2["Delta"] = 0] = "Delta";
21909
- VesuAmountType2[VesuAmountType2["Target"] = 1] = "Target";
21910
- return VesuAmountType2;
21911
- })(VesuAmountType || {});
21912
- var VesuAmountDenomination = /* @__PURE__ */ ((VesuAmountDenomination2) => {
21913
- VesuAmountDenomination2[VesuAmountDenomination2["Native"] = 0] = "Native";
21914
- VesuAmountDenomination2[VesuAmountDenomination2["Assets"] = 1] = "Assets";
21915
- return VesuAmountDenomination2;
21916
- })(VesuAmountDenomination || {});
21917
- function getVesuMultiplyParams(isIncrease, params) {
21918
- if (isIncrease) {
21919
- const _params2 = params;
21920
- return {
21921
- action: new import_starknet15.CairoCustomEnum({ IncreaseLever: {
21922
- pool_id: _params2.pool_id.toBigInt(),
21923
- collateral_asset: _params2.collateral_asset.toBigInt(),
21924
- debt_asset: _params2.debt_asset.toBigInt(),
21925
- user: _params2.user.toBigInt(),
21926
- add_margin: BigInt(_params2.add_margin.toWei()),
21927
- margin_swap: _params2.margin_swap.map((swap) => ({
21928
- route: swap.route.map((route) => ({
21929
- pool_key: {
21930
- token0: route.pool_key.token0.toBigInt(),
21931
- token1: route.pool_key.token1.toBigInt(),
21932
- fee: route.pool_key.fee,
21933
- tick_spacing: route.pool_key.tick_spacing,
21934
- extension: BigInt(import_starknet15.num.hexToDecimalString(route.pool_key.extension))
21935
- },
21936
- sqrt_ratio_limit: import_starknet15.uint256.bnToUint256(route.sqrt_ratio_limit.toWei()),
21937
- skip_ahead: BigInt(100)
21938
- })),
21939
- token_amount: {
21940
- token: swap.token_amount.token.toBigInt(),
21941
- amount: swap.token_amount.amount.toI129()
21942
- }
21943
- })),
21944
- margin_swap_limit_amount: BigInt(_params2.margin_swap_limit_amount.toWei()),
21945
- lever_swap: _params2.lever_swap.map((swap) => ({
21946
- route: swap.route.map((route) => ({
21947
- pool_key: {
21948
- token0: route.pool_key.token0.toBigInt(),
21949
- token1: route.pool_key.token1.toBigInt(),
21950
- fee: route.pool_key.fee,
21951
- tick_spacing: route.pool_key.tick_spacing,
21952
- extension: BigInt(import_starknet15.num.hexToDecimalString(route.pool_key.extension))
21953
- },
21954
- sqrt_ratio_limit: import_starknet15.uint256.bnToUint256(route.sqrt_ratio_limit.toWei()),
21955
- skip_ahead: BigInt(100)
21956
- })),
21957
- token_amount: {
21958
- token: swap.token_amount.token.toBigInt(),
21959
- amount: swap.token_amount.amount.toI129()
21960
- }
21961
- })),
21962
- lever_swap_limit_amount: BigInt(_params2.lever_swap_limit_amount.toWei())
21963
- } })
21964
- };
21965
- }
21966
- const _params = params;
21967
- return {
21968
- action: new import_starknet15.CairoCustomEnum({ DecreaseLever: {
21969
- pool_id: _params.pool_id.toBigInt(),
21970
- collateral_asset: _params.collateral_asset.toBigInt(),
21971
- debt_asset: _params.debt_asset.toBigInt(),
21972
- user: _params.user.toBigInt(),
21973
- sub_margin: BigInt(_params.sub_margin.toWei()),
21974
- recipient: _params.recipient.toBigInt(),
21975
- lever_swap: _params.lever_swap.map((swap) => ({
21976
- route: swap.route.map((route) => ({
21977
- pool_key: {
21978
- token0: route.pool_key.token0.toBigInt(),
21979
- token1: route.pool_key.token1.toBigInt(),
21980
- fee: route.pool_key.fee,
21981
- tick_spacing: route.pool_key.tick_spacing,
21982
- extension: ContractAddr.from(route.pool_key.extension).toBigInt()
21983
- },
21984
- sqrt_ratio_limit: import_starknet15.uint256.bnToUint256(route.sqrt_ratio_limit.toWei()),
21985
- skip_ahead: BigInt(route.skip_ahead.toWei())
21986
- })),
21987
- token_amount: {
21988
- token: swap.token_amount.token.toBigInt(),
21989
- amount: swap.token_amount.amount.toI129()
21990
- }
21991
- })),
21992
- lever_swap_limit_amount: BigInt(_params.lever_swap_limit_amount.toWei()),
21993
- lever_swap_weights: _params.lever_swap_weights.map((weight) => BigInt(weight.toWei())),
21994
- withdraw_swap: _params.withdraw_swap.map((swap) => ({
21995
- route: swap.route.map((route) => ({
21996
- pool_key: {
21997
- token0: route.pool_key.token0.toBigInt(),
21998
- token1: route.pool_key.token1.toBigInt(),
21999
- fee: route.pool_key.fee,
22000
- tick_spacing: route.pool_key.tick_spacing,
22001
- extension: ContractAddr.from(route.pool_key.extension).toBigInt()
22002
- },
22003
- sqrt_ratio_limit: import_starknet15.uint256.bnToUint256(route.sqrt_ratio_limit.toWei()),
22004
- skip_ahead: BigInt(route.skip_ahead.toWei())
22005
- })),
22006
- token_amount: {
22007
- token: swap.token_amount.token.toBigInt(),
22008
- amount: swap.token_amount.amount.toI129()
22009
- }
22010
- })),
22011
- withdraw_swap_limit_amount: BigInt(_params.withdraw_swap_limit_amount.toWei()),
22012
- withdraw_swap_weights: _params.withdraw_swap_weights.map((weight) => BigInt(weight.toWei())),
22013
- close_position: _params.close_position
22014
- } })
22015
- };
22016
- }
22017
- var VesuPools = {
22018
- Genesis: ContractAddr.from("0x4dc4f0ca6ea4961e4c8373265bfd5317678f4fe374d76f3fd7135f57763bf28"),
22019
- Re7xSTRK: ContractAddr.from("0x052fb52363939c3aa848f8f4ac28f0a51379f8d1b971d8444de25fbd77d8f161")
22020
- };
22021
- var VesuAdapter = class _VesuAdapter extends BaseAdapter {
22022
- constructor(config) {
22023
- super();
22024
- this.VESU_SINGLETON = ContractAddr.from("0x000d8d6dfec4d33bfb6895de9f3852143a17c6f92fd2a21da3d6924d34870160");
22025
- this.VESU_MULTIPLY = ContractAddr.from("0x3630f1f8e5b8f5c4c4ae9b6620f8a570ae55cddebc0276c37550e7c118edf67");
22026
- this.getModifyPosition = () => {
22027
- const positionData = [0n];
22028
- const packedArguments = [
22029
- toBigInt(this.config.poolId.toString()),
22030
- // pool id
22031
- toBigInt(this.config.collateral.address.toString()),
22032
- // collateral
22033
- toBigInt(this.config.debt.address.toString()),
22034
- // debt
22035
- toBigInt(this.config.vaultAllocator.toString()),
22036
- // vault allocator
22037
- toBigInt(positionData.length),
22038
- ...positionData
22039
- ];
22040
- const output = this.constructSimpleLeafData({
22041
- id: this.config.id,
22042
- target: this.VESU_SINGLETON,
22043
- method: "modify_position",
22044
- packedArguments
22045
- });
22046
- return { leaf: output, callConstructor: this.getModifyPositionCall.bind(this) };
22047
- };
22048
- this.getModifyPositionCall = (params) => {
22049
- const _collateral = {
22050
- amount_type: this.formatAmountTypeEnum(params.collateralAmount.amount_type),
22051
- denomination: this.formatAmountDenominationEnum(params.collateralAmount.denomination),
22052
- value: {
22053
- abs: import_starknet15.uint256.bnToUint256(params.collateralAmount.value.abs.toWei()),
22054
- is_negative: params.collateralAmount.value.abs.isZero() ? false : params.collateralAmount.value.is_negative
22055
- }
22056
- };
22057
- logger.verbose(`VesuAdapter::ConstructingModify::Collateral::${JSON.stringify(_collateral)}`);
22058
- const _debt = {
22059
- amount_type: this.formatAmountTypeEnum(params.debtAmount.amount_type),
22060
- denomination: this.formatAmountDenominationEnum(params.debtAmount.denomination),
22061
- value: {
22062
- abs: import_starknet15.uint256.bnToUint256(params.debtAmount.value.abs.toWei()),
22063
- is_negative: params.debtAmount.value.abs.isZero() ? false : params.debtAmount.value.is_negative
22064
- }
22065
- };
22066
- logger.verbose(`VesuAdapter::ConstructingModify::Debt::${JSON.stringify(_debt)}`);
22067
- const singletonContract = new import_starknet15.Contract({ abi: vesu_singleton_abi_default, address: this.VESU_SINGLETON.toString(), providerOrAccount: new import_starknet15.RpcProvider({ nodeUrl: "" }) });
22068
- const call = singletonContract.populate("modify_position", {
22069
- params: {
22070
- pool_id: this.config.poolId.toBigInt(),
22071
- collateral_asset: this.config.collateral.address.toBigInt(),
22072
- debt_asset: this.config.debt.address.toBigInt(),
22073
- user: this.config.vaultAllocator.toBigInt(),
22074
- collateral: _collateral,
22075
- debt: _debt,
22076
- data: [0]
22077
- }
22078
- });
22079
- return {
22080
- sanitizer: SIMPLE_SANITIZER,
22081
- call: {
22082
- contractAddress: this.VESU_SINGLETON,
22083
- selector: import_starknet15.hash.getSelectorFromName("modify_position"),
22084
- calldata: [
22085
- ...call.calldata
22086
- ]
22087
- }
22088
- };
22089
- };
22090
- this.getMultiplyAdapter = () => {
22091
- const packedArguments = [
22092
- toBigInt(this.config.poolId.toString()),
22093
- // pool id
22094
- toBigInt(this.config.collateral.address.toString()),
22095
- // collateral
22096
- toBigInt(this.config.debt.address.toString()),
22097
- // debt
22098
- toBigInt(this.config.vaultAllocator.toString())
22099
- // vault allocator
22100
- ];
22101
- const output = this.constructSimpleLeafData({
22102
- id: this.config.id,
22103
- target: this.VESU_MULTIPLY,
22104
- method: "modify_lever",
22105
- packedArguments
22106
- }, SIMPLE_SANITIZER_V2);
22107
- return { leaf: output, callConstructor: this.getMultiplyCall.bind(this) };
22108
- };
22109
- this.getMultiplyCall = (params) => {
22110
- const isIncrease = params.isIncrease;
22111
- const multiplyParams = isIncrease ? params.increaseParams : params.decreaseParams;
22112
- if (!multiplyParams) {
22113
- throw new Error("Multiply params are not provided");
21960
+ // src/data/vesu-pool-v2.abi.json
21961
+ var vesu_pool_v2_abi_default = [
21962
+ {
21963
+ type: "impl",
21964
+ name: "PoolImpl",
21965
+ interface_name: "vesu::pool::IPool"
21966
+ },
21967
+ {
21968
+ type: "struct",
21969
+ name: "core::integer::u256",
21970
+ members: [
21971
+ {
21972
+ name: "low",
21973
+ type: "core::integer::u128"
21974
+ },
21975
+ {
21976
+ name: "high",
21977
+ type: "core::integer::u128"
22114
21978
  }
22115
- const multiplyContract = new import_starknet15.Contract({ abi: vesu_multiple_abi_default, address: this.VESU_MULTIPLY.toString(), providerOrAccount: new import_starknet15.RpcProvider({ nodeUrl: "" }) });
22116
- const call = multiplyContract.populate("modify_lever", {
22117
- modify_lever_params: getVesuMultiplyParams(isIncrease, {
22118
- ...multiplyParams,
22119
- user: this.config.vaultAllocator,
22120
- pool_id: this.config.poolId,
22121
- collateral_asset: this.config.collateral.address,
22122
- debt_asset: this.config.debt.address,
22123
- recipient: this.config.vaultAllocator
22124
- })
22125
- });
22126
- return {
22127
- sanitizer: SIMPLE_SANITIZER_V2,
22128
- call: {
22129
- contractAddress: this.VESU_MULTIPLY,
22130
- selector: import_starknet15.hash.getSelectorFromName("modify_lever"),
22131
- calldata: [
21979
+ ]
21980
+ },
21981
+ {
21982
+ type: "enum",
21983
+ name: "core::bool",
21984
+ variants: [
21985
+ {
21986
+ name: "False",
21987
+ type: "()"
21988
+ },
21989
+ {
21990
+ name: "True",
21991
+ type: "()"
21992
+ }
21993
+ ]
21994
+ },
21995
+ {
21996
+ type: "struct",
21997
+ name: "vesu::data_model::AssetConfig",
21998
+ members: [
21999
+ {
22000
+ name: "total_collateral_shares",
22001
+ type: "core::integer::u256"
22002
+ },
22003
+ {
22004
+ name: "total_nominal_debt",
22005
+ type: "core::integer::u256"
22006
+ },
22007
+ {
22008
+ name: "reserve",
22009
+ type: "core::integer::u256"
22010
+ },
22011
+ {
22012
+ name: "max_utilization",
22013
+ type: "core::integer::u256"
22014
+ },
22015
+ {
22016
+ name: "floor",
22017
+ type: "core::integer::u256"
22018
+ },
22019
+ {
22020
+ name: "scale",
22021
+ type: "core::integer::u256"
22022
+ },
22023
+ {
22024
+ name: "is_legacy",
22025
+ type: "core::bool"
22026
+ },
22027
+ {
22028
+ name: "last_updated",
22029
+ type: "core::integer::u64"
22030
+ },
22031
+ {
22032
+ name: "last_rate_accumulator",
22033
+ type: "core::integer::u256"
22034
+ },
22035
+ {
22036
+ name: "last_full_utilization_rate",
22037
+ type: "core::integer::u256"
22038
+ },
22039
+ {
22040
+ name: "fee_rate",
22041
+ type: "core::integer::u256"
22042
+ },
22043
+ {
22044
+ name: "fee_shares",
22045
+ type: "core::integer::u256"
22046
+ }
22047
+ ]
22048
+ },
22049
+ {
22050
+ type: "struct",
22051
+ name: "vesu::data_model::AssetPrice",
22052
+ members: [
22053
+ {
22054
+ name: "value",
22055
+ type: "core::integer::u256"
22056
+ },
22057
+ {
22058
+ name: "is_valid",
22059
+ type: "core::bool"
22060
+ }
22061
+ ]
22062
+ },
22063
+ {
22064
+ type: "struct",
22065
+ name: "vesu::data_model::Position",
22066
+ members: [
22067
+ {
22068
+ name: "collateral_shares",
22069
+ type: "core::integer::u256"
22070
+ },
22071
+ {
22072
+ name: "nominal_debt",
22073
+ type: "core::integer::u256"
22074
+ }
22075
+ ]
22076
+ },
22077
+ {
22078
+ type: "struct",
22079
+ name: "vesu::data_model::Context",
22080
+ members: [
22081
+ {
22082
+ name: "collateral_asset",
22083
+ type: "core::starknet::contract_address::ContractAddress"
22084
+ },
22085
+ {
22086
+ name: "debt_asset",
22087
+ type: "core::starknet::contract_address::ContractAddress"
22088
+ },
22089
+ {
22090
+ name: "collateral_asset_config",
22091
+ type: "vesu::data_model::AssetConfig"
22092
+ },
22093
+ {
22094
+ name: "debt_asset_config",
22095
+ type: "vesu::data_model::AssetConfig"
22096
+ },
22097
+ {
22098
+ name: "collateral_asset_price",
22099
+ type: "vesu::data_model::AssetPrice"
22100
+ },
22101
+ {
22102
+ name: "debt_asset_price",
22103
+ type: "vesu::data_model::AssetPrice"
22104
+ },
22105
+ {
22106
+ name: "max_ltv",
22107
+ type: "core::integer::u64"
22108
+ },
22109
+ {
22110
+ name: "user",
22111
+ type: "core::starknet::contract_address::ContractAddress"
22112
+ },
22113
+ {
22114
+ name: "position",
22115
+ type: "vesu::data_model::Position"
22116
+ }
22117
+ ]
22118
+ },
22119
+ {
22120
+ type: "struct",
22121
+ name: "alexandria_math::i257::i257",
22122
+ members: [
22123
+ {
22124
+ name: "abs",
22125
+ type: "core::integer::u256"
22126
+ },
22127
+ {
22128
+ name: "is_negative",
22129
+ type: "core::bool"
22130
+ }
22131
+ ]
22132
+ },
22133
+ {
22134
+ type: "enum",
22135
+ name: "vesu::data_model::AmountDenomination",
22136
+ variants: [
22137
+ {
22138
+ name: "Native",
22139
+ type: "()"
22140
+ },
22141
+ {
22142
+ name: "Assets",
22143
+ type: "()"
22144
+ }
22145
+ ]
22146
+ },
22147
+ {
22148
+ type: "struct",
22149
+ name: "vesu::data_model::Amount",
22150
+ members: [
22151
+ {
22152
+ name: "denomination",
22153
+ type: "vesu::data_model::AmountDenomination"
22154
+ },
22155
+ {
22156
+ name: "value",
22157
+ type: "alexandria_math::i257::i257"
22158
+ }
22159
+ ]
22160
+ },
22161
+ {
22162
+ type: "struct",
22163
+ name: "vesu::data_model::ModifyPositionParams",
22164
+ members: [
22165
+ {
22166
+ name: "collateral_asset",
22167
+ type: "core::starknet::contract_address::ContractAddress"
22168
+ },
22169
+ {
22170
+ name: "debt_asset",
22171
+ type: "core::starknet::contract_address::ContractAddress"
22172
+ },
22173
+ {
22174
+ name: "user",
22175
+ type: "core::starknet::contract_address::ContractAddress"
22176
+ },
22177
+ {
22178
+ name: "collateral",
22179
+ type: "vesu::data_model::Amount"
22180
+ },
22181
+ {
22182
+ name: "debt",
22183
+ type: "vesu::data_model::Amount"
22184
+ }
22185
+ ]
22186
+ },
22187
+ {
22188
+ type: "struct",
22189
+ name: "vesu::data_model::UpdatePositionResponse",
22190
+ members: [
22191
+ {
22192
+ name: "collateral_delta",
22193
+ type: "alexandria_math::i257::i257"
22194
+ },
22195
+ {
22196
+ name: "collateral_shares_delta",
22197
+ type: "alexandria_math::i257::i257"
22198
+ },
22199
+ {
22200
+ name: "debt_delta",
22201
+ type: "alexandria_math::i257::i257"
22202
+ },
22203
+ {
22204
+ name: "nominal_debt_delta",
22205
+ type: "alexandria_math::i257::i257"
22206
+ },
22207
+ {
22208
+ name: "bad_debt",
22209
+ type: "core::integer::u256"
22210
+ }
22211
+ ]
22212
+ },
22213
+ {
22214
+ type: "struct",
22215
+ name: "vesu::data_model::LiquidatePositionParams",
22216
+ members: [
22217
+ {
22218
+ name: "collateral_asset",
22219
+ type: "core::starknet::contract_address::ContractAddress"
22220
+ },
22221
+ {
22222
+ name: "debt_asset",
22223
+ type: "core::starknet::contract_address::ContractAddress"
22224
+ },
22225
+ {
22226
+ name: "user",
22227
+ type: "core::starknet::contract_address::ContractAddress"
22228
+ },
22229
+ {
22230
+ name: "min_collateral_to_receive",
22231
+ type: "core::integer::u256"
22232
+ },
22233
+ {
22234
+ name: "debt_to_repay",
22235
+ type: "core::integer::u256"
22236
+ }
22237
+ ]
22238
+ },
22239
+ {
22240
+ type: "struct",
22241
+ name: "core::array::Span::<core::felt252>",
22242
+ members: [
22243
+ {
22244
+ name: "snapshot",
22245
+ type: "@core::array::Array::<core::felt252>"
22246
+ }
22247
+ ]
22248
+ },
22249
+ {
22250
+ type: "struct",
22251
+ name: "vesu::data_model::AssetParams",
22252
+ members: [
22253
+ {
22254
+ name: "asset",
22255
+ type: "core::starknet::contract_address::ContractAddress"
22256
+ },
22257
+ {
22258
+ name: "floor",
22259
+ type: "core::integer::u256"
22260
+ },
22261
+ {
22262
+ name: "initial_full_utilization_rate",
22263
+ type: "core::integer::u256"
22264
+ },
22265
+ {
22266
+ name: "max_utilization",
22267
+ type: "core::integer::u256"
22268
+ },
22269
+ {
22270
+ name: "is_legacy",
22271
+ type: "core::bool"
22272
+ },
22273
+ {
22274
+ name: "fee_rate",
22275
+ type: "core::integer::u256"
22276
+ }
22277
+ ]
22278
+ },
22279
+ {
22280
+ type: "struct",
22281
+ name: "vesu::interest_rate_model::InterestRateConfig",
22282
+ members: [
22283
+ {
22284
+ name: "min_target_utilization",
22285
+ type: "core::integer::u256"
22286
+ },
22287
+ {
22288
+ name: "max_target_utilization",
22289
+ type: "core::integer::u256"
22290
+ },
22291
+ {
22292
+ name: "target_utilization",
22293
+ type: "core::integer::u256"
22294
+ },
22295
+ {
22296
+ name: "min_full_utilization_rate",
22297
+ type: "core::integer::u256"
22298
+ },
22299
+ {
22300
+ name: "max_full_utilization_rate",
22301
+ type: "core::integer::u256"
22302
+ },
22303
+ {
22304
+ name: "zero_utilization_rate",
22305
+ type: "core::integer::u256"
22306
+ },
22307
+ {
22308
+ name: "rate_half_life",
22309
+ type: "core::integer::u256"
22310
+ },
22311
+ {
22312
+ name: "target_rate_percent",
22313
+ type: "core::integer::u256"
22314
+ }
22315
+ ]
22316
+ },
22317
+ {
22318
+ type: "struct",
22319
+ name: "vesu::data_model::Pair",
22320
+ members: [
22321
+ {
22322
+ name: "total_collateral_shares",
22323
+ type: "core::integer::u256"
22324
+ },
22325
+ {
22326
+ name: "total_nominal_debt",
22327
+ type: "core::integer::u256"
22328
+ }
22329
+ ]
22330
+ },
22331
+ {
22332
+ type: "struct",
22333
+ name: "vesu::data_model::PairConfig",
22334
+ members: [
22335
+ {
22336
+ name: "max_ltv",
22337
+ type: "core::integer::u64"
22338
+ },
22339
+ {
22340
+ name: "liquidation_factor",
22341
+ type: "core::integer::u64"
22342
+ },
22343
+ {
22344
+ name: "debt_cap",
22345
+ type: "core::integer::u128"
22346
+ }
22347
+ ]
22348
+ },
22349
+ {
22350
+ type: "enum",
22351
+ name: "core::option::Option::<(core::starknet::class_hash::ClassHash, core::array::Span::<core::felt252>)>",
22352
+ variants: [
22353
+ {
22354
+ name: "Some",
22355
+ type: "(core::starknet::class_hash::ClassHash, core::array::Span::<core::felt252>)"
22356
+ },
22357
+ {
22358
+ name: "None",
22359
+ type: "()"
22360
+ }
22361
+ ]
22362
+ },
22363
+ {
22364
+ type: "interface",
22365
+ name: "vesu::pool::IPool",
22366
+ items: [
22367
+ {
22368
+ type: "function",
22369
+ name: "pool_name",
22370
+ inputs: [],
22371
+ outputs: [
22372
+ {
22373
+ type: "core::felt252"
22374
+ }
22375
+ ],
22376
+ state_mutability: "view"
22377
+ },
22378
+ {
22379
+ type: "function",
22380
+ name: "context",
22381
+ inputs: [
22382
+ {
22383
+ name: "collateral_asset",
22384
+ type: "core::starknet::contract_address::ContractAddress"
22385
+ },
22386
+ {
22387
+ name: "debt_asset",
22388
+ type: "core::starknet::contract_address::ContractAddress"
22389
+ },
22390
+ {
22391
+ name: "user",
22392
+ type: "core::starknet::contract_address::ContractAddress"
22393
+ }
22394
+ ],
22395
+ outputs: [
22396
+ {
22397
+ type: "vesu::data_model::Context"
22398
+ }
22399
+ ],
22400
+ state_mutability: "view"
22401
+ },
22402
+ {
22403
+ type: "function",
22404
+ name: "position",
22405
+ inputs: [
22406
+ {
22407
+ name: "collateral_asset",
22408
+ type: "core::starknet::contract_address::ContractAddress"
22409
+ },
22410
+ {
22411
+ name: "debt_asset",
22412
+ type: "core::starknet::contract_address::ContractAddress"
22413
+ },
22414
+ {
22415
+ name: "user",
22416
+ type: "core::starknet::contract_address::ContractAddress"
22417
+ }
22418
+ ],
22419
+ outputs: [
22420
+ {
22421
+ type: "(vesu::data_model::Position, core::integer::u256, core::integer::u256)"
22422
+ }
22423
+ ],
22424
+ state_mutability: "view"
22425
+ },
22426
+ {
22427
+ type: "function",
22428
+ name: "check_collateralization",
22429
+ inputs: [
22430
+ {
22431
+ name: "collateral_asset",
22432
+ type: "core::starknet::contract_address::ContractAddress"
22433
+ },
22434
+ {
22435
+ name: "debt_asset",
22436
+ type: "core::starknet::contract_address::ContractAddress"
22437
+ },
22438
+ {
22439
+ name: "user",
22440
+ type: "core::starknet::contract_address::ContractAddress"
22441
+ }
22442
+ ],
22443
+ outputs: [
22444
+ {
22445
+ type: "(core::bool, core::integer::u256, core::integer::u256)"
22446
+ }
22447
+ ],
22448
+ state_mutability: "view"
22449
+ },
22450
+ {
22451
+ type: "function",
22452
+ name: "check_invariants",
22453
+ inputs: [
22454
+ {
22455
+ name: "collateral_asset",
22456
+ type: "core::starknet::contract_address::ContractAddress"
22457
+ },
22458
+ {
22459
+ name: "debt_asset",
22460
+ type: "core::starknet::contract_address::ContractAddress"
22461
+ },
22462
+ {
22463
+ name: "user",
22464
+ type: "core::starknet::contract_address::ContractAddress"
22465
+ },
22466
+ {
22467
+ name: "collateral_delta",
22468
+ type: "alexandria_math::i257::i257"
22469
+ },
22470
+ {
22471
+ name: "collateral_shares_delta",
22472
+ type: "alexandria_math::i257::i257"
22473
+ },
22474
+ {
22475
+ name: "debt_delta",
22476
+ type: "alexandria_math::i257::i257"
22477
+ },
22478
+ {
22479
+ name: "nominal_debt_delta",
22480
+ type: "alexandria_math::i257::i257"
22481
+ },
22482
+ {
22483
+ name: "is_liquidation",
22484
+ type: "core::bool"
22485
+ }
22486
+ ],
22487
+ outputs: [],
22488
+ state_mutability: "view"
22489
+ },
22490
+ {
22491
+ type: "function",
22492
+ name: "modify_position",
22493
+ inputs: [
22494
+ {
22495
+ name: "params",
22496
+ type: "vesu::data_model::ModifyPositionParams"
22497
+ }
22498
+ ],
22499
+ outputs: [
22500
+ {
22501
+ type: "vesu::data_model::UpdatePositionResponse"
22502
+ }
22503
+ ],
22504
+ state_mutability: "external"
22505
+ },
22506
+ {
22507
+ type: "function",
22508
+ name: "liquidate_position",
22509
+ inputs: [
22510
+ {
22511
+ name: "params",
22512
+ type: "vesu::data_model::LiquidatePositionParams"
22513
+ }
22514
+ ],
22515
+ outputs: [
22516
+ {
22517
+ type: "vesu::data_model::UpdatePositionResponse"
22518
+ }
22519
+ ],
22520
+ state_mutability: "external"
22521
+ },
22522
+ {
22523
+ type: "function",
22524
+ name: "flash_loan",
22525
+ inputs: [
22526
+ {
22527
+ name: "receiver",
22528
+ type: "core::starknet::contract_address::ContractAddress"
22529
+ },
22530
+ {
22531
+ name: "asset",
22532
+ type: "core::starknet::contract_address::ContractAddress"
22533
+ },
22534
+ {
22535
+ name: "amount",
22536
+ type: "core::integer::u256"
22537
+ },
22538
+ {
22539
+ name: "is_legacy",
22540
+ type: "core::bool"
22541
+ },
22542
+ {
22543
+ name: "data",
22544
+ type: "core::array::Span::<core::felt252>"
22545
+ }
22546
+ ],
22547
+ outputs: [],
22548
+ state_mutability: "external"
22549
+ },
22550
+ {
22551
+ type: "function",
22552
+ name: "modify_delegation",
22553
+ inputs: [
22554
+ {
22555
+ name: "delegatee",
22556
+ type: "core::starknet::contract_address::ContractAddress"
22557
+ },
22558
+ {
22559
+ name: "delegation",
22560
+ type: "core::bool"
22561
+ }
22562
+ ],
22563
+ outputs: [],
22564
+ state_mutability: "external"
22565
+ },
22566
+ {
22567
+ type: "function",
22568
+ name: "delegation",
22569
+ inputs: [
22570
+ {
22571
+ name: "delegator",
22572
+ type: "core::starknet::contract_address::ContractAddress"
22573
+ },
22574
+ {
22575
+ name: "delegatee",
22576
+ type: "core::starknet::contract_address::ContractAddress"
22577
+ }
22578
+ ],
22579
+ outputs: [
22580
+ {
22581
+ type: "core::bool"
22582
+ }
22583
+ ],
22584
+ state_mutability: "view"
22585
+ },
22586
+ {
22587
+ type: "function",
22588
+ name: "donate_to_reserve",
22589
+ inputs: [
22590
+ {
22591
+ name: "asset",
22592
+ type: "core::starknet::contract_address::ContractAddress"
22593
+ },
22594
+ {
22595
+ name: "amount",
22596
+ type: "core::integer::u256"
22597
+ }
22598
+ ],
22599
+ outputs: [],
22600
+ state_mutability: "external"
22601
+ },
22602
+ {
22603
+ type: "function",
22604
+ name: "add_asset",
22605
+ inputs: [
22606
+ {
22607
+ name: "params",
22608
+ type: "vesu::data_model::AssetParams"
22609
+ },
22610
+ {
22611
+ name: "interest_rate_config",
22612
+ type: "vesu::interest_rate_model::InterestRateConfig"
22613
+ }
22614
+ ],
22615
+ outputs: [],
22616
+ state_mutability: "external"
22617
+ },
22618
+ {
22619
+ type: "function",
22620
+ name: "set_asset_parameter",
22621
+ inputs: [
22622
+ {
22623
+ name: "asset",
22624
+ type: "core::starknet::contract_address::ContractAddress"
22625
+ },
22626
+ {
22627
+ name: "parameter",
22628
+ type: "core::felt252"
22629
+ },
22630
+ {
22631
+ name: "value",
22632
+ type: "core::integer::u256"
22633
+ }
22634
+ ],
22635
+ outputs: [],
22636
+ state_mutability: "external"
22637
+ },
22638
+ {
22639
+ type: "function",
22640
+ name: "asset_config",
22641
+ inputs: [
22642
+ {
22643
+ name: "asset",
22644
+ type: "core::starknet::contract_address::ContractAddress"
22645
+ }
22646
+ ],
22647
+ outputs: [
22648
+ {
22649
+ type: "vesu::data_model::AssetConfig"
22650
+ }
22651
+ ],
22652
+ state_mutability: "view"
22653
+ },
22654
+ {
22655
+ type: "function",
22656
+ name: "set_oracle",
22657
+ inputs: [
22658
+ {
22659
+ name: "oracle",
22660
+ type: "core::starknet::contract_address::ContractAddress"
22661
+ }
22662
+ ],
22663
+ outputs: [],
22664
+ state_mutability: "external"
22665
+ },
22666
+ {
22667
+ type: "function",
22668
+ name: "oracle",
22669
+ inputs: [],
22670
+ outputs: [
22671
+ {
22672
+ type: "core::starknet::contract_address::ContractAddress"
22673
+ }
22674
+ ],
22675
+ state_mutability: "view"
22676
+ },
22677
+ {
22678
+ type: "function",
22679
+ name: "price",
22680
+ inputs: [
22681
+ {
22682
+ name: "asset",
22683
+ type: "core::starknet::contract_address::ContractAddress"
22684
+ }
22685
+ ],
22686
+ outputs: [
22687
+ {
22688
+ type: "vesu::data_model::AssetPrice"
22689
+ }
22690
+ ],
22691
+ state_mutability: "view"
22692
+ },
22693
+ {
22694
+ type: "function",
22695
+ name: "set_fee_recipient",
22696
+ inputs: [
22697
+ {
22698
+ name: "fee_recipient",
22699
+ type: "core::starknet::contract_address::ContractAddress"
22700
+ }
22701
+ ],
22702
+ outputs: [],
22703
+ state_mutability: "external"
22704
+ },
22705
+ {
22706
+ type: "function",
22707
+ name: "fee_recipient",
22708
+ inputs: [],
22709
+ outputs: [
22710
+ {
22711
+ type: "core::starknet::contract_address::ContractAddress"
22712
+ }
22713
+ ],
22714
+ state_mutability: "view"
22715
+ },
22716
+ {
22717
+ type: "function",
22718
+ name: "claim_fees",
22719
+ inputs: [
22720
+ {
22721
+ name: "asset",
22722
+ type: "core::starknet::contract_address::ContractAddress"
22723
+ },
22724
+ {
22725
+ name: "fee_shares",
22726
+ type: "core::integer::u256"
22727
+ }
22728
+ ],
22729
+ outputs: [],
22730
+ state_mutability: "external"
22731
+ },
22732
+ {
22733
+ type: "function",
22734
+ name: "get_fees",
22735
+ inputs: [
22736
+ {
22737
+ name: "asset",
22738
+ type: "core::starknet::contract_address::ContractAddress"
22739
+ }
22740
+ ],
22741
+ outputs: [
22742
+ {
22743
+ type: "(core::integer::u256, core::integer::u256)"
22744
+ }
22745
+ ],
22746
+ state_mutability: "view"
22747
+ },
22748
+ {
22749
+ type: "function",
22750
+ name: "rate_accumulator",
22751
+ inputs: [
22752
+ {
22753
+ name: "asset",
22754
+ type: "core::starknet::contract_address::ContractAddress"
22755
+ }
22756
+ ],
22757
+ outputs: [
22758
+ {
22759
+ type: "core::integer::u256"
22760
+ }
22761
+ ],
22762
+ state_mutability: "view"
22763
+ },
22764
+ {
22765
+ type: "function",
22766
+ name: "utilization",
22767
+ inputs: [
22768
+ {
22769
+ name: "asset",
22770
+ type: "core::starknet::contract_address::ContractAddress"
22771
+ }
22772
+ ],
22773
+ outputs: [
22774
+ {
22775
+ type: "core::integer::u256"
22776
+ }
22777
+ ],
22778
+ state_mutability: "view"
22779
+ },
22780
+ {
22781
+ type: "function",
22782
+ name: "interest_rate",
22783
+ inputs: [
22784
+ {
22785
+ name: "asset",
22786
+ type: "core::starknet::contract_address::ContractAddress"
22787
+ },
22788
+ {
22789
+ name: "utilization",
22790
+ type: "core::integer::u256"
22791
+ },
22792
+ {
22793
+ name: "last_updated",
22794
+ type: "core::integer::u64"
22795
+ },
22796
+ {
22797
+ name: "last_full_utilization_rate",
22798
+ type: "core::integer::u256"
22799
+ }
22800
+ ],
22801
+ outputs: [
22802
+ {
22803
+ type: "core::integer::u256"
22804
+ }
22805
+ ],
22806
+ state_mutability: "view"
22807
+ },
22808
+ {
22809
+ type: "function",
22810
+ name: "set_interest_rate_parameter",
22811
+ inputs: [
22812
+ {
22813
+ name: "asset",
22814
+ type: "core::starknet::contract_address::ContractAddress"
22815
+ },
22816
+ {
22817
+ name: "parameter",
22818
+ type: "core::felt252"
22819
+ },
22820
+ {
22821
+ name: "value",
22822
+ type: "core::integer::u256"
22823
+ }
22824
+ ],
22825
+ outputs: [],
22826
+ state_mutability: "external"
22827
+ },
22828
+ {
22829
+ type: "function",
22830
+ name: "interest_rate_config",
22831
+ inputs: [
22832
+ {
22833
+ name: "asset",
22834
+ type: "core::starknet::contract_address::ContractAddress"
22835
+ }
22836
+ ],
22837
+ outputs: [
22838
+ {
22839
+ type: "vesu::interest_rate_model::InterestRateConfig"
22840
+ }
22841
+ ],
22842
+ state_mutability: "view"
22843
+ },
22844
+ {
22845
+ type: "function",
22846
+ name: "pairs",
22847
+ inputs: [
22848
+ {
22849
+ name: "collateral_asset",
22850
+ type: "core::starknet::contract_address::ContractAddress"
22851
+ },
22852
+ {
22853
+ name: "debt_asset",
22854
+ type: "core::starknet::contract_address::ContractAddress"
22855
+ }
22856
+ ],
22857
+ outputs: [
22858
+ {
22859
+ type: "vesu::data_model::Pair"
22860
+ }
22861
+ ],
22862
+ state_mutability: "view"
22863
+ },
22864
+ {
22865
+ type: "function",
22866
+ name: "set_pair_config",
22867
+ inputs: [
22868
+ {
22869
+ name: "collateral_asset",
22870
+ type: "core::starknet::contract_address::ContractAddress"
22871
+ },
22872
+ {
22873
+ name: "debt_asset",
22874
+ type: "core::starknet::contract_address::ContractAddress"
22875
+ },
22876
+ {
22877
+ name: "pair_config",
22878
+ type: "vesu::data_model::PairConfig"
22879
+ }
22880
+ ],
22881
+ outputs: [],
22882
+ state_mutability: "external"
22883
+ },
22884
+ {
22885
+ type: "function",
22886
+ name: "set_pair_parameter",
22887
+ inputs: [
22888
+ {
22889
+ name: "collateral_asset",
22890
+ type: "core::starknet::contract_address::ContractAddress"
22891
+ },
22892
+ {
22893
+ name: "debt_asset",
22894
+ type: "core::starknet::contract_address::ContractAddress"
22895
+ },
22896
+ {
22897
+ name: "parameter",
22898
+ type: "core::felt252"
22899
+ },
22900
+ {
22901
+ name: "value",
22902
+ type: "core::integer::u128"
22903
+ }
22904
+ ],
22905
+ outputs: [],
22906
+ state_mutability: "external"
22907
+ },
22908
+ {
22909
+ type: "function",
22910
+ name: "pair_config",
22911
+ inputs: [
22912
+ {
22913
+ name: "collateral_asset",
22914
+ type: "core::starknet::contract_address::ContractAddress"
22915
+ },
22916
+ {
22917
+ name: "debt_asset",
22918
+ type: "core::starknet::contract_address::ContractAddress"
22919
+ }
22920
+ ],
22921
+ outputs: [
22922
+ {
22923
+ type: "vesu::data_model::PairConfig"
22924
+ }
22925
+ ],
22926
+ state_mutability: "view"
22927
+ },
22928
+ {
22929
+ type: "function",
22930
+ name: "calculate_debt",
22931
+ inputs: [
22932
+ {
22933
+ name: "nominal_debt",
22934
+ type: "alexandria_math::i257::i257"
22935
+ },
22936
+ {
22937
+ name: "rate_accumulator",
22938
+ type: "core::integer::u256"
22939
+ },
22940
+ {
22941
+ name: "asset_scale",
22942
+ type: "core::integer::u256"
22943
+ }
22944
+ ],
22945
+ outputs: [
22946
+ {
22947
+ type: "core::integer::u256"
22948
+ }
22949
+ ],
22950
+ state_mutability: "view"
22951
+ },
22952
+ {
22953
+ type: "function",
22954
+ name: "calculate_nominal_debt",
22955
+ inputs: [
22956
+ {
22957
+ name: "debt",
22958
+ type: "alexandria_math::i257::i257"
22959
+ },
22960
+ {
22961
+ name: "rate_accumulator",
22962
+ type: "core::integer::u256"
22963
+ },
22964
+ {
22965
+ name: "asset_scale",
22966
+ type: "core::integer::u256"
22967
+ }
22968
+ ],
22969
+ outputs: [
22970
+ {
22971
+ type: "core::integer::u256"
22972
+ }
22973
+ ],
22974
+ state_mutability: "view"
22975
+ },
22976
+ {
22977
+ type: "function",
22978
+ name: "calculate_collateral_shares",
22979
+ inputs: [
22980
+ {
22981
+ name: "asset",
22982
+ type: "core::starknet::contract_address::ContractAddress"
22983
+ },
22984
+ {
22985
+ name: "collateral",
22986
+ type: "alexandria_math::i257::i257"
22987
+ }
22988
+ ],
22989
+ outputs: [
22990
+ {
22991
+ type: "core::integer::u256"
22992
+ }
22993
+ ],
22994
+ state_mutability: "view"
22995
+ },
22996
+ {
22997
+ type: "function",
22998
+ name: "calculate_collateral",
22999
+ inputs: [
23000
+ {
23001
+ name: "asset",
23002
+ type: "core::starknet::contract_address::ContractAddress"
23003
+ },
23004
+ {
23005
+ name: "collateral_shares",
23006
+ type: "alexandria_math::i257::i257"
23007
+ }
23008
+ ],
23009
+ outputs: [
23010
+ {
23011
+ type: "core::integer::u256"
23012
+ }
23013
+ ],
23014
+ state_mutability: "view"
23015
+ },
23016
+ {
23017
+ type: "function",
23018
+ name: "deconstruct_collateral_amount",
23019
+ inputs: [
23020
+ {
23021
+ name: "collateral_asset",
23022
+ type: "core::starknet::contract_address::ContractAddress"
23023
+ },
23024
+ {
23025
+ name: "debt_asset",
23026
+ type: "core::starknet::contract_address::ContractAddress"
23027
+ },
23028
+ {
23029
+ name: "user",
23030
+ type: "core::starknet::contract_address::ContractAddress"
23031
+ },
23032
+ {
23033
+ name: "collateral",
23034
+ type: "vesu::data_model::Amount"
23035
+ }
23036
+ ],
23037
+ outputs: [
23038
+ {
23039
+ type: "(alexandria_math::i257::i257, alexandria_math::i257::i257)"
23040
+ }
23041
+ ],
23042
+ state_mutability: "view"
23043
+ },
23044
+ {
23045
+ type: "function",
23046
+ name: "deconstruct_debt_amount",
23047
+ inputs: [
23048
+ {
23049
+ name: "collateral_asset",
23050
+ type: "core::starknet::contract_address::ContractAddress"
23051
+ },
23052
+ {
23053
+ name: "debt_asset",
23054
+ type: "core::starknet::contract_address::ContractAddress"
23055
+ },
23056
+ {
23057
+ name: "user",
23058
+ type: "core::starknet::contract_address::ContractAddress"
23059
+ },
23060
+ {
23061
+ name: "debt",
23062
+ type: "vesu::data_model::Amount"
23063
+ }
23064
+ ],
23065
+ outputs: [
23066
+ {
23067
+ type: "(alexandria_math::i257::i257, alexandria_math::i257::i257)"
23068
+ }
23069
+ ],
23070
+ state_mutability: "view"
23071
+ },
23072
+ {
23073
+ type: "function",
23074
+ name: "curator",
23075
+ inputs: [],
23076
+ outputs: [
23077
+ {
23078
+ type: "core::starknet::contract_address::ContractAddress"
23079
+ }
23080
+ ],
23081
+ state_mutability: "view"
23082
+ },
23083
+ {
23084
+ type: "function",
23085
+ name: "pending_curator",
23086
+ inputs: [],
23087
+ outputs: [
23088
+ {
23089
+ type: "core::starknet::contract_address::ContractAddress"
23090
+ }
23091
+ ],
23092
+ state_mutability: "view"
23093
+ },
23094
+ {
23095
+ type: "function",
23096
+ name: "nominate_curator",
23097
+ inputs: [
23098
+ {
23099
+ name: "pending_curator",
23100
+ type: "core::starknet::contract_address::ContractAddress"
23101
+ }
23102
+ ],
23103
+ outputs: [],
23104
+ state_mutability: "external"
23105
+ },
23106
+ {
23107
+ type: "function",
23108
+ name: "accept_curator_ownership",
23109
+ inputs: [],
23110
+ outputs: [],
23111
+ state_mutability: "external"
23112
+ },
23113
+ {
23114
+ type: "function",
23115
+ name: "set_pausing_agent",
23116
+ inputs: [
23117
+ {
23118
+ name: "pausing_agent",
23119
+ type: "core::starknet::contract_address::ContractAddress"
23120
+ }
23121
+ ],
23122
+ outputs: [],
23123
+ state_mutability: "external"
23124
+ },
23125
+ {
23126
+ type: "function",
23127
+ name: "pausing_agent",
23128
+ inputs: [],
23129
+ outputs: [
23130
+ {
23131
+ type: "core::starknet::contract_address::ContractAddress"
23132
+ }
23133
+ ],
23134
+ state_mutability: "view"
23135
+ },
23136
+ {
23137
+ type: "function",
23138
+ name: "pause",
23139
+ inputs: [],
23140
+ outputs: [],
23141
+ state_mutability: "external"
23142
+ },
23143
+ {
23144
+ type: "function",
23145
+ name: "unpause",
23146
+ inputs: [],
23147
+ outputs: [],
23148
+ state_mutability: "external"
23149
+ },
23150
+ {
23151
+ type: "function",
23152
+ name: "is_paused",
23153
+ inputs: [],
23154
+ outputs: [
23155
+ {
23156
+ type: "core::bool"
23157
+ }
23158
+ ],
23159
+ state_mutability: "view"
23160
+ },
23161
+ {
23162
+ type: "function",
23163
+ name: "upgrade_name",
23164
+ inputs: [],
23165
+ outputs: [
23166
+ {
23167
+ type: "core::felt252"
23168
+ }
23169
+ ],
23170
+ state_mutability: "view"
23171
+ },
23172
+ {
23173
+ type: "function",
23174
+ name: "upgrade",
23175
+ inputs: [
23176
+ {
23177
+ name: "new_implementation",
23178
+ type: "core::starknet::class_hash::ClassHash"
23179
+ },
23180
+ {
23181
+ name: "eic_implementation_data",
23182
+ type: "core::option::Option::<(core::starknet::class_hash::ClassHash, core::array::Span::<core::felt252>)>"
23183
+ }
23184
+ ],
23185
+ outputs: [],
23186
+ state_mutability: "external"
23187
+ }
23188
+ ]
23189
+ },
23190
+ {
23191
+ type: "impl",
23192
+ name: "OwnableTwoStepImpl",
23193
+ interface_name: "openzeppelin_access::ownable::interface::IOwnableTwoStep"
23194
+ },
23195
+ {
23196
+ type: "interface",
23197
+ name: "openzeppelin_access::ownable::interface::IOwnableTwoStep",
23198
+ items: [
23199
+ {
23200
+ type: "function",
23201
+ name: "owner",
23202
+ inputs: [],
23203
+ outputs: [
23204
+ {
23205
+ type: "core::starknet::contract_address::ContractAddress"
23206
+ }
23207
+ ],
23208
+ state_mutability: "view"
23209
+ },
23210
+ {
23211
+ type: "function",
23212
+ name: "pending_owner",
23213
+ inputs: [],
23214
+ outputs: [
23215
+ {
23216
+ type: "core::starknet::contract_address::ContractAddress"
23217
+ }
23218
+ ],
23219
+ state_mutability: "view"
23220
+ },
23221
+ {
23222
+ type: "function",
23223
+ name: "accept_ownership",
23224
+ inputs: [],
23225
+ outputs: [],
23226
+ state_mutability: "external"
23227
+ },
23228
+ {
23229
+ type: "function",
23230
+ name: "transfer_ownership",
23231
+ inputs: [
23232
+ {
23233
+ name: "new_owner",
23234
+ type: "core::starknet::contract_address::ContractAddress"
23235
+ }
23236
+ ],
23237
+ outputs: [],
23238
+ state_mutability: "external"
23239
+ },
23240
+ {
23241
+ type: "function",
23242
+ name: "renounce_ownership",
23243
+ inputs: [],
23244
+ outputs: [],
23245
+ state_mutability: "external"
23246
+ }
23247
+ ]
23248
+ },
23249
+ {
23250
+ type: "constructor",
23251
+ name: "constructor",
23252
+ inputs: [
23253
+ {
23254
+ name: "name",
23255
+ type: "core::felt252"
23256
+ },
23257
+ {
23258
+ name: "owner",
23259
+ type: "core::starknet::contract_address::ContractAddress"
23260
+ },
23261
+ {
23262
+ name: "curator",
23263
+ type: "core::starknet::contract_address::ContractAddress"
23264
+ },
23265
+ {
23266
+ name: "oracle",
23267
+ type: "core::starknet::contract_address::ContractAddress"
23268
+ }
23269
+ ]
23270
+ },
23271
+ {
23272
+ type: "event",
23273
+ name: "openzeppelin_access::ownable::ownable::OwnableComponent::OwnershipTransferred",
23274
+ kind: "struct",
23275
+ members: [
23276
+ {
23277
+ name: "previous_owner",
23278
+ type: "core::starknet::contract_address::ContractAddress",
23279
+ kind: "key"
23280
+ },
23281
+ {
23282
+ name: "new_owner",
23283
+ type: "core::starknet::contract_address::ContractAddress",
23284
+ kind: "key"
23285
+ }
23286
+ ]
23287
+ },
23288
+ {
23289
+ type: "event",
23290
+ name: "openzeppelin_access::ownable::ownable::OwnableComponent::OwnershipTransferStarted",
23291
+ kind: "struct",
23292
+ members: [
23293
+ {
23294
+ name: "previous_owner",
23295
+ type: "core::starknet::contract_address::ContractAddress",
23296
+ kind: "key"
23297
+ },
23298
+ {
23299
+ name: "new_owner",
23300
+ type: "core::starknet::contract_address::ContractAddress",
23301
+ kind: "key"
23302
+ }
23303
+ ]
23304
+ },
23305
+ {
23306
+ type: "event",
23307
+ name: "openzeppelin_access::ownable::ownable::OwnableComponent::Event",
23308
+ kind: "enum",
23309
+ variants: [
23310
+ {
23311
+ name: "OwnershipTransferred",
23312
+ type: "openzeppelin_access::ownable::ownable::OwnableComponent::OwnershipTransferred",
23313
+ kind: "nested"
23314
+ },
23315
+ {
23316
+ name: "OwnershipTransferStarted",
23317
+ type: "openzeppelin_access::ownable::ownable::OwnableComponent::OwnershipTransferStarted",
23318
+ kind: "nested"
23319
+ }
23320
+ ]
23321
+ },
23322
+ {
23323
+ type: "event",
23324
+ name: "vesu::interest_rate_model::interest_rate_model_component::SetInterestRateConfig",
23325
+ kind: "struct",
23326
+ members: [
23327
+ {
23328
+ name: "asset",
23329
+ type: "core::starknet::contract_address::ContractAddress",
23330
+ kind: "data"
23331
+ },
23332
+ {
23333
+ name: "interest_rate_config",
23334
+ type: "vesu::interest_rate_model::InterestRateConfig",
23335
+ kind: "data"
23336
+ }
23337
+ ]
23338
+ },
23339
+ {
23340
+ type: "event",
23341
+ name: "vesu::interest_rate_model::interest_rate_model_component::Event",
23342
+ kind: "enum",
23343
+ variants: [
23344
+ {
23345
+ name: "SetInterestRateConfig",
23346
+ type: "vesu::interest_rate_model::interest_rate_model_component::SetInterestRateConfig",
23347
+ kind: "nested"
23348
+ }
23349
+ ]
23350
+ },
23351
+ {
23352
+ type: "event",
23353
+ name: "vesu::pool::Pool::UpdateContext",
23354
+ kind: "struct",
23355
+ members: [
23356
+ {
23357
+ name: "collateral_asset",
23358
+ type: "core::starknet::contract_address::ContractAddress",
23359
+ kind: "key"
23360
+ },
23361
+ {
23362
+ name: "debt_asset",
23363
+ type: "core::starknet::contract_address::ContractAddress",
23364
+ kind: "key"
23365
+ },
23366
+ {
23367
+ name: "collateral_asset_config",
23368
+ type: "vesu::data_model::AssetConfig",
23369
+ kind: "data"
23370
+ },
23371
+ {
23372
+ name: "debt_asset_config",
23373
+ type: "vesu::data_model::AssetConfig",
23374
+ kind: "data"
23375
+ },
23376
+ {
23377
+ name: "collateral_asset_price",
23378
+ type: "vesu::data_model::AssetPrice",
23379
+ kind: "data"
23380
+ },
23381
+ {
23382
+ name: "debt_asset_price",
23383
+ type: "vesu::data_model::AssetPrice",
23384
+ kind: "data"
23385
+ }
23386
+ ]
23387
+ },
23388
+ {
23389
+ type: "event",
23390
+ name: "vesu::pool::Pool::ModifyPosition",
23391
+ kind: "struct",
23392
+ members: [
23393
+ {
23394
+ name: "collateral_asset",
23395
+ type: "core::starknet::contract_address::ContractAddress",
23396
+ kind: "key"
23397
+ },
23398
+ {
23399
+ name: "debt_asset",
23400
+ type: "core::starknet::contract_address::ContractAddress",
23401
+ kind: "key"
23402
+ },
23403
+ {
23404
+ name: "user",
23405
+ type: "core::starknet::contract_address::ContractAddress",
23406
+ kind: "key"
23407
+ },
23408
+ {
23409
+ name: "collateral_delta",
23410
+ type: "alexandria_math::i257::i257",
23411
+ kind: "data"
23412
+ },
23413
+ {
23414
+ name: "collateral_shares_delta",
23415
+ type: "alexandria_math::i257::i257",
23416
+ kind: "data"
23417
+ },
23418
+ {
23419
+ name: "debt_delta",
23420
+ type: "alexandria_math::i257::i257",
23421
+ kind: "data"
23422
+ },
23423
+ {
23424
+ name: "nominal_debt_delta",
23425
+ type: "alexandria_math::i257::i257",
23426
+ kind: "data"
23427
+ }
23428
+ ]
23429
+ },
23430
+ {
23431
+ type: "event",
23432
+ name: "vesu::pool::Pool::LiquidatePosition",
23433
+ kind: "struct",
23434
+ members: [
23435
+ {
23436
+ name: "collateral_asset",
23437
+ type: "core::starknet::contract_address::ContractAddress",
23438
+ kind: "key"
23439
+ },
23440
+ {
23441
+ name: "debt_asset",
23442
+ type: "core::starknet::contract_address::ContractAddress",
23443
+ kind: "key"
23444
+ },
23445
+ {
23446
+ name: "user",
23447
+ type: "core::starknet::contract_address::ContractAddress",
23448
+ kind: "key"
23449
+ },
23450
+ {
23451
+ name: "liquidator",
23452
+ type: "core::starknet::contract_address::ContractAddress",
23453
+ kind: "key"
23454
+ },
23455
+ {
23456
+ name: "collateral_delta",
23457
+ type: "alexandria_math::i257::i257",
23458
+ kind: "data"
23459
+ },
23460
+ {
23461
+ name: "collateral_shares_delta",
23462
+ type: "alexandria_math::i257::i257",
23463
+ kind: "data"
23464
+ },
23465
+ {
23466
+ name: "debt_delta",
23467
+ type: "alexandria_math::i257::i257",
23468
+ kind: "data"
23469
+ },
23470
+ {
23471
+ name: "nominal_debt_delta",
23472
+ type: "alexandria_math::i257::i257",
23473
+ kind: "data"
23474
+ },
23475
+ {
23476
+ name: "bad_debt",
23477
+ type: "core::integer::u256",
23478
+ kind: "data"
23479
+ }
23480
+ ]
23481
+ },
23482
+ {
23483
+ type: "event",
23484
+ name: "vesu::pool::Pool::Flashloan",
23485
+ kind: "struct",
23486
+ members: [
23487
+ {
23488
+ name: "sender",
23489
+ type: "core::starknet::contract_address::ContractAddress",
23490
+ kind: "key"
23491
+ },
23492
+ {
23493
+ name: "receiver",
23494
+ type: "core::starknet::contract_address::ContractAddress",
23495
+ kind: "key"
23496
+ },
23497
+ {
23498
+ name: "asset",
23499
+ type: "core::starknet::contract_address::ContractAddress",
23500
+ kind: "key"
23501
+ },
23502
+ {
23503
+ name: "amount",
23504
+ type: "core::integer::u256",
23505
+ kind: "data"
23506
+ }
23507
+ ]
23508
+ },
23509
+ {
23510
+ type: "event",
23511
+ name: "vesu::pool::Pool::ModifyDelegation",
23512
+ kind: "struct",
23513
+ members: [
23514
+ {
23515
+ name: "delegator",
23516
+ type: "core::starknet::contract_address::ContractAddress",
23517
+ kind: "key"
23518
+ },
23519
+ {
23520
+ name: "delegatee",
23521
+ type: "core::starknet::contract_address::ContractAddress",
23522
+ kind: "key"
23523
+ },
23524
+ {
23525
+ name: "delegation",
23526
+ type: "core::bool",
23527
+ kind: "data"
23528
+ }
23529
+ ]
23530
+ },
23531
+ {
23532
+ type: "event",
23533
+ name: "vesu::pool::Pool::Donate",
23534
+ kind: "struct",
23535
+ members: [
23536
+ {
23537
+ name: "asset",
23538
+ type: "core::starknet::contract_address::ContractAddress",
23539
+ kind: "key"
23540
+ },
23541
+ {
23542
+ name: "amount",
23543
+ type: "core::integer::u256",
23544
+ kind: "data"
23545
+ }
23546
+ ]
23547
+ },
23548
+ {
23549
+ type: "event",
23550
+ name: "vesu::pool::Pool::SetAssetConfig",
23551
+ kind: "struct",
23552
+ members: [
23553
+ {
23554
+ name: "asset",
23555
+ type: "core::starknet::contract_address::ContractAddress",
23556
+ kind: "key"
23557
+ },
23558
+ {
23559
+ name: "asset_config",
23560
+ type: "vesu::data_model::AssetConfig",
23561
+ kind: "data"
23562
+ }
23563
+ ]
23564
+ },
23565
+ {
23566
+ type: "event",
23567
+ name: "vesu::pool::Pool::SetOracle",
23568
+ kind: "struct",
23569
+ members: [
23570
+ {
23571
+ name: "oracle",
23572
+ type: "core::starknet::contract_address::ContractAddress",
23573
+ kind: "data"
23574
+ }
23575
+ ]
23576
+ },
23577
+ {
23578
+ type: "event",
23579
+ name: "vesu::pool::Pool::SetPairConfig",
23580
+ kind: "struct",
23581
+ members: [
23582
+ {
23583
+ name: "collateral_asset",
23584
+ type: "core::starknet::contract_address::ContractAddress",
23585
+ kind: "key"
23586
+ },
23587
+ {
23588
+ name: "debt_asset",
23589
+ type: "core::starknet::contract_address::ContractAddress",
23590
+ kind: "key"
23591
+ },
23592
+ {
23593
+ name: "pair_config",
23594
+ type: "vesu::data_model::PairConfig",
23595
+ kind: "data"
23596
+ }
23597
+ ]
23598
+ },
23599
+ {
23600
+ type: "event",
23601
+ name: "vesu::pool::Pool::ClaimFees",
23602
+ kind: "struct",
23603
+ members: [
23604
+ {
23605
+ name: "asset",
23606
+ type: "core::starknet::contract_address::ContractAddress",
23607
+ kind: "key"
23608
+ },
23609
+ {
23610
+ name: "recipient",
23611
+ type: "core::starknet::contract_address::ContractAddress",
23612
+ kind: "data"
23613
+ },
23614
+ {
23615
+ name: "fee_shares",
23616
+ type: "core::integer::u256",
23617
+ kind: "data"
23618
+ },
23619
+ {
23620
+ name: "fee_amount",
23621
+ type: "core::integer::u256",
23622
+ kind: "data"
23623
+ }
23624
+ ]
23625
+ },
23626
+ {
23627
+ type: "event",
23628
+ name: "vesu::pool::Pool::SetFeeRecipient",
23629
+ kind: "struct",
23630
+ members: [
23631
+ {
23632
+ name: "fee_recipient",
23633
+ type: "core::starknet::contract_address::ContractAddress",
23634
+ kind: "key"
23635
+ }
23636
+ ]
23637
+ },
23638
+ {
23639
+ type: "event",
23640
+ name: "vesu::pool::Pool::SetPausingAgent",
23641
+ kind: "struct",
23642
+ members: [
23643
+ {
23644
+ name: "agent",
23645
+ type: "core::starknet::contract_address::ContractAddress",
23646
+ kind: "key"
23647
+ }
23648
+ ]
23649
+ },
23650
+ {
23651
+ type: "event",
23652
+ name: "vesu::pool::Pool::SetCurator",
23653
+ kind: "struct",
23654
+ members: [
23655
+ {
23656
+ name: "curator",
23657
+ type: "core::starknet::contract_address::ContractAddress",
23658
+ kind: "key"
23659
+ }
23660
+ ]
23661
+ },
23662
+ {
23663
+ type: "event",
23664
+ name: "vesu::pool::Pool::NominateCurator",
23665
+ kind: "struct",
23666
+ members: [
23667
+ {
23668
+ name: "pending_curator",
23669
+ type: "core::starknet::contract_address::ContractAddress",
23670
+ kind: "key"
23671
+ }
23672
+ ]
23673
+ },
23674
+ {
23675
+ type: "event",
23676
+ name: "vesu::pool::Pool::ContractPaused",
23677
+ kind: "struct",
23678
+ members: [
23679
+ {
23680
+ name: "account",
23681
+ type: "core::starknet::contract_address::ContractAddress",
23682
+ kind: "data"
23683
+ }
23684
+ ]
23685
+ },
23686
+ {
23687
+ type: "event",
23688
+ name: "vesu::pool::Pool::ContractUnpaused",
23689
+ kind: "struct",
23690
+ members: [
23691
+ {
23692
+ name: "account",
23693
+ type: "core::starknet::contract_address::ContractAddress",
23694
+ kind: "data"
23695
+ }
23696
+ ]
23697
+ },
23698
+ {
23699
+ type: "event",
23700
+ name: "vesu::pool::Pool::ContractUpgraded",
23701
+ kind: "struct",
23702
+ members: [
23703
+ {
23704
+ name: "new_implementation",
23705
+ type: "core::starknet::class_hash::ClassHash",
23706
+ kind: "data"
23707
+ }
23708
+ ]
23709
+ },
23710
+ {
23711
+ type: "event",
23712
+ name: "vesu::pool::Pool::Event",
23713
+ kind: "enum",
23714
+ variants: [
23715
+ {
23716
+ name: "OwnableEvent",
23717
+ type: "openzeppelin_access::ownable::ownable::OwnableComponent::Event",
23718
+ kind: "flat"
23719
+ },
23720
+ {
23721
+ name: "InterestRateModelEvents",
23722
+ type: "vesu::interest_rate_model::interest_rate_model_component::Event",
23723
+ kind: "nested"
23724
+ },
23725
+ {
23726
+ name: "UpdateContext",
23727
+ type: "vesu::pool::Pool::UpdateContext",
23728
+ kind: "nested"
23729
+ },
23730
+ {
23731
+ name: "ModifyPosition",
23732
+ type: "vesu::pool::Pool::ModifyPosition",
23733
+ kind: "nested"
23734
+ },
23735
+ {
23736
+ name: "LiquidatePosition",
23737
+ type: "vesu::pool::Pool::LiquidatePosition",
23738
+ kind: "nested"
23739
+ },
23740
+ {
23741
+ name: "Flashloan",
23742
+ type: "vesu::pool::Pool::Flashloan",
23743
+ kind: "nested"
23744
+ },
23745
+ {
23746
+ name: "ModifyDelegation",
23747
+ type: "vesu::pool::Pool::ModifyDelegation",
23748
+ kind: "nested"
23749
+ },
23750
+ {
23751
+ name: "Donate",
23752
+ type: "vesu::pool::Pool::Donate",
23753
+ kind: "nested"
23754
+ },
23755
+ {
23756
+ name: "SetAssetConfig",
23757
+ type: "vesu::pool::Pool::SetAssetConfig",
23758
+ kind: "nested"
23759
+ },
23760
+ {
23761
+ name: "SetOracle",
23762
+ type: "vesu::pool::Pool::SetOracle",
23763
+ kind: "nested"
23764
+ },
23765
+ {
23766
+ name: "SetPairConfig",
23767
+ type: "vesu::pool::Pool::SetPairConfig",
23768
+ kind: "nested"
23769
+ },
23770
+ {
23771
+ name: "ClaimFees",
23772
+ type: "vesu::pool::Pool::ClaimFees",
23773
+ kind: "nested"
23774
+ },
23775
+ {
23776
+ name: "SetFeeRecipient",
23777
+ type: "vesu::pool::Pool::SetFeeRecipient",
23778
+ kind: "nested"
23779
+ },
23780
+ {
23781
+ name: "SetPausingAgent",
23782
+ type: "vesu::pool::Pool::SetPausingAgent",
23783
+ kind: "nested"
23784
+ },
23785
+ {
23786
+ name: "SetCurator",
23787
+ type: "vesu::pool::Pool::SetCurator",
23788
+ kind: "nested"
23789
+ },
23790
+ {
23791
+ name: "NominateCurator",
23792
+ type: "vesu::pool::Pool::NominateCurator",
23793
+ kind: "nested"
23794
+ },
23795
+ {
23796
+ name: "ContractPaused",
23797
+ type: "vesu::pool::Pool::ContractPaused",
23798
+ kind: "nested"
23799
+ },
23800
+ {
23801
+ name: "ContractUnpaused",
23802
+ type: "vesu::pool::Pool::ContractUnpaused",
23803
+ kind: "nested"
23804
+ },
23805
+ {
23806
+ name: "ContractUpgraded",
23807
+ type: "vesu::pool::Pool::ContractUpgraded",
23808
+ kind: "nested"
23809
+ }
23810
+ ]
23811
+ }
23812
+ ];
23813
+
23814
+ // src/strategies/universal-adapters/vesu-adapter.ts
23815
+ var VesuAmountType = /* @__PURE__ */ ((VesuAmountType2) => {
23816
+ VesuAmountType2[VesuAmountType2["Delta"] = 0] = "Delta";
23817
+ VesuAmountType2[VesuAmountType2["Target"] = 1] = "Target";
23818
+ return VesuAmountType2;
23819
+ })(VesuAmountType || {});
23820
+ var VesuAmountDenomination = /* @__PURE__ */ ((VesuAmountDenomination2) => {
23821
+ VesuAmountDenomination2[VesuAmountDenomination2["Native"] = 0] = "Native";
23822
+ VesuAmountDenomination2[VesuAmountDenomination2["Assets"] = 1] = "Assets";
23823
+ return VesuAmountDenomination2;
23824
+ })(VesuAmountDenomination || {});
23825
+ function getVesuMultiplyParams(isIncrease, params) {
23826
+ if (isIncrease) {
23827
+ const _params2 = params;
23828
+ return {
23829
+ action: new import_starknet15.CairoCustomEnum({ IncreaseLever: {
23830
+ pool_id: _params2.pool_id.toBigInt(),
23831
+ collateral_asset: _params2.collateral_asset.toBigInt(),
23832
+ debt_asset: _params2.debt_asset.toBigInt(),
23833
+ user: _params2.user.toBigInt(),
23834
+ add_margin: BigInt(_params2.add_margin.toWei()),
23835
+ margin_swap: _params2.margin_swap.map((swap) => ({
23836
+ route: swap.route.map((route) => ({
23837
+ pool_key: {
23838
+ token0: route.pool_key.token0.toBigInt(),
23839
+ token1: route.pool_key.token1.toBigInt(),
23840
+ fee: route.pool_key.fee,
23841
+ tick_spacing: route.pool_key.tick_spacing,
23842
+ extension: BigInt(import_starknet15.num.hexToDecimalString(route.pool_key.extension))
23843
+ },
23844
+ sqrt_ratio_limit: import_starknet15.uint256.bnToUint256(route.sqrt_ratio_limit.toWei()),
23845
+ skip_ahead: BigInt(100)
23846
+ })),
23847
+ token_amount: {
23848
+ token: swap.token_amount.token.toBigInt(),
23849
+ amount: swap.token_amount.amount.toI129()
23850
+ }
23851
+ })),
23852
+ margin_swap_limit_amount: BigInt(_params2.margin_swap_limit_amount.toWei()),
23853
+ lever_swap: _params2.lever_swap.map((swap) => ({
23854
+ route: swap.route.map((route) => ({
23855
+ pool_key: {
23856
+ token0: route.pool_key.token0.toBigInt(),
23857
+ token1: route.pool_key.token1.toBigInt(),
23858
+ fee: route.pool_key.fee,
23859
+ tick_spacing: route.pool_key.tick_spacing,
23860
+ extension: BigInt(import_starknet15.num.hexToDecimalString(route.pool_key.extension))
23861
+ },
23862
+ sqrt_ratio_limit: import_starknet15.uint256.bnToUint256(route.sqrt_ratio_limit.toWei()),
23863
+ skip_ahead: BigInt(100)
23864
+ })),
23865
+ token_amount: {
23866
+ token: swap.token_amount.token.toBigInt(),
23867
+ amount: swap.token_amount.amount.toI129()
23868
+ }
23869
+ })),
23870
+ lever_swap_limit_amount: BigInt(_params2.lever_swap_limit_amount.toWei())
23871
+ } })
23872
+ };
23873
+ }
23874
+ const _params = params;
23875
+ return {
23876
+ action: new import_starknet15.CairoCustomEnum({ DecreaseLever: {
23877
+ pool_id: _params.pool_id.toBigInt(),
23878
+ collateral_asset: _params.collateral_asset.toBigInt(),
23879
+ debt_asset: _params.debt_asset.toBigInt(),
23880
+ user: _params.user.toBigInt(),
23881
+ sub_margin: BigInt(_params.sub_margin.toWei()),
23882
+ recipient: _params.recipient.toBigInt(),
23883
+ lever_swap: _params.lever_swap.map((swap) => ({
23884
+ route: swap.route.map((route) => ({
23885
+ pool_key: {
23886
+ token0: route.pool_key.token0.toBigInt(),
23887
+ token1: route.pool_key.token1.toBigInt(),
23888
+ fee: route.pool_key.fee,
23889
+ tick_spacing: route.pool_key.tick_spacing,
23890
+ extension: ContractAddr.from(route.pool_key.extension).toBigInt()
23891
+ },
23892
+ sqrt_ratio_limit: import_starknet15.uint256.bnToUint256(route.sqrt_ratio_limit.toWei()),
23893
+ skip_ahead: BigInt(route.skip_ahead.toWei())
23894
+ })),
23895
+ token_amount: {
23896
+ token: swap.token_amount.token.toBigInt(),
23897
+ amount: swap.token_amount.amount.toI129()
23898
+ }
23899
+ })),
23900
+ lever_swap_limit_amount: BigInt(_params.lever_swap_limit_amount.toWei()),
23901
+ lever_swap_weights: _params.lever_swap_weights.map((weight) => BigInt(weight.toWei())),
23902
+ withdraw_swap: _params.withdraw_swap.map((swap) => ({
23903
+ route: swap.route.map((route) => ({
23904
+ pool_key: {
23905
+ token0: route.pool_key.token0.toBigInt(),
23906
+ token1: route.pool_key.token1.toBigInt(),
23907
+ fee: route.pool_key.fee,
23908
+ tick_spacing: route.pool_key.tick_spacing,
23909
+ extension: ContractAddr.from(route.pool_key.extension).toBigInt()
23910
+ },
23911
+ sqrt_ratio_limit: import_starknet15.uint256.bnToUint256(route.sqrt_ratio_limit.toWei()),
23912
+ skip_ahead: BigInt(route.skip_ahead.toWei())
23913
+ })),
23914
+ token_amount: {
23915
+ token: swap.token_amount.token.toBigInt(),
23916
+ amount: swap.token_amount.amount.toI129()
23917
+ }
23918
+ })),
23919
+ withdraw_swap_limit_amount: BigInt(_params.withdraw_swap_limit_amount.toWei()),
23920
+ withdraw_swap_weights: _params.withdraw_swap_weights.map((weight) => BigInt(weight.toWei())),
23921
+ close_position: _params.close_position
23922
+ } })
23923
+ };
23924
+ }
23925
+ var VesuPools = {
23926
+ Genesis: ContractAddr.from("0x4dc4f0ca6ea4961e4c8373265bfd5317678f4fe374d76f3fd7135f57763bf28"),
23927
+ Re7xSTRK: ContractAddr.from("0x052fb52363939c3aa848f8f4ac28f0a51379f8d1b971d8444de25fbd77d8f161"),
23928
+ Re7xBTC: ContractAddr.from("0x3a8416bf20d036df5b1cf3447630a2e1cb04685f6b0c3a70ed7fb1473548ecf")
23929
+ };
23930
+ function getVesuSingletonAddress(vesuPool) {
23931
+ if (vesuPool.eq(VesuPools.Genesis) || vesuPool.eq(VesuPools.Re7xSTRK)) {
23932
+ return { addr: VESU_SINGLETON, isV2: false };
23933
+ }
23934
+ return { addr: vesuPool, isV2: true };
23935
+ }
23936
+ var VesuAdapter = class _VesuAdapter extends BaseAdapter {
23937
+ constructor(config) {
23938
+ super();
23939
+ this.VESU_MULTIPLY = ContractAddr.from("0x027fef272d0a9a3844767c851a64b36fe4f0115141d81134baade95d2b27b781");
23940
+ this.getModifyPosition = () => {
23941
+ const positionData = [0n];
23942
+ const packedArguments = [
23943
+ toBigInt(this.config.poolId.toString()),
23944
+ // pool id
23945
+ toBigInt(this.config.collateral.address.toString()),
23946
+ // collateral
23947
+ toBigInt(this.config.debt.address.toString()),
23948
+ // debt
23949
+ toBigInt(this.config.vaultAllocator.toString()),
23950
+ // vault allocator
23951
+ toBigInt(positionData.length),
23952
+ ...positionData
23953
+ ];
23954
+ const output = this.constructSimpleLeafData({
23955
+ id: this.config.id,
23956
+ target: getVesuSingletonAddress(this.config.poolId).addr,
23957
+ method: "modify_position",
23958
+ packedArguments
23959
+ });
23960
+ return { leaf: output, callConstructor: this.getModifyPositionCall.bind(this) };
23961
+ };
23962
+ this.getModifyPositionCall = (params) => {
23963
+ const _collateral = {
23964
+ amount_type: this.formatAmountTypeEnum(params.collateralAmount.amount_type),
23965
+ denomination: this.formatAmountDenominationEnum(params.collateralAmount.denomination),
23966
+ value: {
23967
+ abs: import_starknet15.uint256.bnToUint256(params.collateralAmount.value.abs.toWei()),
23968
+ is_negative: params.collateralAmount.value.abs.isZero() ? false : params.collateralAmount.value.is_negative
23969
+ }
23970
+ };
23971
+ logger.verbose(`VesuAdapter::ConstructingModify::Collateral::${JSON.stringify(_collateral)}`);
23972
+ const _debt = {
23973
+ amount_type: this.formatAmountTypeEnum(params.debtAmount.amount_type),
23974
+ denomination: this.formatAmountDenominationEnum(params.debtAmount.denomination),
23975
+ value: {
23976
+ abs: import_starknet15.uint256.bnToUint256(params.debtAmount.value.abs.toWei()),
23977
+ is_negative: params.debtAmount.value.abs.isZero() ? false : params.debtAmount.value.is_negative
23978
+ }
23979
+ };
23980
+ logger.verbose(`VesuAdapter::ConstructingModify::Debt::${JSON.stringify(_debt)}`);
23981
+ const { contract, isV2 } = this.getVesuSingletonContract(getMainnetConfig(), this.config.poolId);
23982
+ const call = contract.populate("modify_position", {
23983
+ params: isV2 ? {
23984
+ collateral_asset: this.config.collateral.address.toBigInt(),
23985
+ debt_asset: this.config.debt.address.toBigInt(),
23986
+ user: this.config.vaultAllocator.toBigInt(),
23987
+ collateral: _collateral,
23988
+ debt: _debt
23989
+ } : {
23990
+ pool_id: this.config.poolId.toBigInt(),
23991
+ collateral_asset: this.config.collateral.address.toBigInt(),
23992
+ debt_asset: this.config.debt.address.toBigInt(),
23993
+ user: this.config.vaultAllocator.toBigInt(),
23994
+ collateral: _collateral,
23995
+ debt: _debt,
23996
+ data: [0]
23997
+ }
23998
+ });
23999
+ return {
24000
+ sanitizer: SIMPLE_SANITIZER,
24001
+ call: {
24002
+ contractAddress: ContractAddr.from(contract.address),
24003
+ selector: import_starknet15.hash.getSelectorFromName("modify_position"),
24004
+ calldata: [
24005
+ ...call.calldata
24006
+ ]
24007
+ }
24008
+ };
24009
+ };
24010
+ this.getMultiplyAdapter = () => {
24011
+ const packedArguments = [
24012
+ toBigInt(this.config.poolId.toString()),
24013
+ // pool id
24014
+ toBigInt(this.config.collateral.address.toString()),
24015
+ // collateral
24016
+ toBigInt(this.config.debt.address.toString()),
24017
+ // debt
24018
+ toBigInt(this.config.vaultAllocator.toString())
24019
+ // vault allocator
24020
+ ];
24021
+ const output = this.constructSimpleLeafData({
24022
+ id: this.config.id,
24023
+ target: this.VESU_MULTIPLY,
24024
+ method: "modify_lever",
24025
+ packedArguments
24026
+ }, SIMPLE_SANITIZER_V2);
24027
+ return { leaf: output, callConstructor: this.getMultiplyCall.bind(this) };
24028
+ };
24029
+ this.getMultiplyCall = (params) => {
24030
+ const isIncrease = params.isIncrease;
24031
+ const multiplyParams = isIncrease ? params.increaseParams : params.decreaseParams;
24032
+ if (!multiplyParams) {
24033
+ throw new Error("Multiply params are not provided");
24034
+ }
24035
+ const multiplyContract = new import_starknet15.Contract({ abi: vesu_multiple_abi_default, address: this.VESU_MULTIPLY.toString(), providerOrAccount: new import_starknet15.RpcProvider({ nodeUrl: "" }) });
24036
+ const call = multiplyContract.populate("modify_lever", {
24037
+ modify_lever_params: getVesuMultiplyParams(isIncrease, {
24038
+ ...multiplyParams,
24039
+ user: this.config.vaultAllocator,
24040
+ pool_id: this.config.poolId,
24041
+ collateral_asset: this.config.collateral.address,
24042
+ debt_asset: this.config.debt.address,
24043
+ recipient: this.config.vaultAllocator
24044
+ })
24045
+ });
24046
+ return {
24047
+ sanitizer: SIMPLE_SANITIZER_V2,
24048
+ call: {
24049
+ contractAddress: this.VESU_MULTIPLY,
24050
+ selector: import_starknet15.hash.getSelectorFromName("modify_lever"),
24051
+ calldata: [
22132
24052
  ...call.calldata
22133
24053
  ]
22134
24054
  }
@@ -22137,14 +24057,12 @@ var VesuAdapter = class _VesuAdapter extends BaseAdapter {
22137
24057
  this.getVesuModifyDelegationAdapter = (id) => {
22138
24058
  return () => {
22139
24059
  const packedArguments = [
22140
- toBigInt(this.config.poolId.toString()),
22141
- // pool id
22142
24060
  toBigInt(this.VESU_MULTIPLY.toString())
22143
24061
  // vault allocator
22144
24062
  ];
22145
24063
  const output = this.constructSimpleLeafData({
22146
24064
  id,
22147
- target: this.VESU_SINGLETON,
24065
+ target: getVesuSingletonAddress(this.config.poolId).addr,
22148
24066
  method: "modify_delegation",
22149
24067
  packedArguments
22150
24068
  }, SIMPLE_SANITIZER_V2);
@@ -22152,8 +24070,12 @@ var VesuAdapter = class _VesuAdapter extends BaseAdapter {
22152
24070
  };
22153
24071
  };
22154
24072
  this.getVesuModifyDelegationCall = (params) => {
22155
- const singletonContract = new import_starknet15.Contract({ abi: vesu_singleton_abi_default, address: this.VESU_SINGLETON.toString(), providerOrAccount: new import_starknet15.RpcProvider({ nodeUrl: "" }) });
22156
- const call = singletonContract.populate("modify_delegation", {
24073
+ const VESU_SINGLETON2 = getVesuSingletonAddress(this.config.poolId).addr;
24074
+ const { contract, isV2 } = this.getVesuSingletonContract(getMainnetConfig(), this.config.poolId);
24075
+ const call = contract.populate("modify_delegation", isV2 ? {
24076
+ delegatee: this.VESU_MULTIPLY.toBigInt(),
24077
+ delegation: params.delegation
24078
+ } : {
22157
24079
  pool_id: this.config.poolId.toBigInt(),
22158
24080
  delegatee: this.VESU_MULTIPLY.toBigInt(),
22159
24081
  delegation: params.delegation
@@ -22161,7 +24083,7 @@ var VesuAdapter = class _VesuAdapter extends BaseAdapter {
22161
24083
  return {
22162
24084
  sanitizer: SIMPLE_SANITIZER_V2,
22163
24085
  call: {
22164
- contractAddress: this.VESU_SINGLETON,
24086
+ contractAddress: VESU_SINGLETON2,
22165
24087
  selector: import_starknet15.hash.getSelectorFromName("modify_delegation"),
22166
24088
  calldata: [
22167
24089
  ...call.calldata
@@ -22243,8 +24165,13 @@ var VesuAdapter = class _VesuAdapter extends BaseAdapter {
22243
24165
  }
22244
24166
  throw new Error(`Unknown VesuAmountDenomination: ${denomination}`);
22245
24167
  }
22246
- getVesuSingletonContract(config) {
22247
- return new import_starknet15.Contract({ abi: vesu_singleton_abi_default, address: this.VESU_SINGLETON.address, providerOrAccount: config.provider });
24168
+ getVesuSingletonContract(config, poolId) {
24169
+ const { addr: VESU_SINGLETON2, isV2 } = getVesuSingletonAddress(poolId);
24170
+ const ABI = isV2 ? vesu_pool_v2_abi_default : vesu_singleton_abi_default;
24171
+ return {
24172
+ contract: new import_starknet15.Contract({ abi: ABI, address: VESU_SINGLETON2.address, providerOrAccount: config.provider }),
24173
+ isV2
24174
+ };
22248
24175
  }
22249
24176
  async getLTVConfig(config) {
22250
24177
  const CACHE_KEY = "ltv_config";
@@ -22252,8 +24179,16 @@ var VesuAdapter = class _VesuAdapter extends BaseAdapter {
22252
24179
  if (cacheData) {
22253
24180
  return cacheData;
22254
24181
  }
22255
- const output = await this.getVesuSingletonContract(config).call("ltv_config", [this.config.poolId.address, this.config.collateral.address.address, this.config.debt.address.address]);
22256
- this.setCache(CACHE_KEY, Number(output.max_ltv) / 1e18, 3e5);
24182
+ const { contract, isV2 } = await this.getVesuSingletonContract(config, this.config.poolId);
24183
+ let ltv = 0;
24184
+ if (isV2) {
24185
+ const output = await contract.call("pair_config", [this.config.collateral.address.address, this.config.debt.address.address]);
24186
+ ltv = Number(output.max_ltv) / 1e18;
24187
+ } else {
24188
+ const output = await contract.call("ltv_config", [this.config.poolId.address, this.config.collateral.address.address, this.config.debt.address.address]);
24189
+ ltv = Number(output.max_ltv) / 1e18;
24190
+ }
24191
+ this.setCache(CACHE_KEY, ltv, 3e5);
22257
24192
  return this.getCache(CACHE_KEY);
22258
24193
  }
22259
24194
  async getPositions(config) {
@@ -22265,14 +24200,17 @@ var VesuAdapter = class _VesuAdapter extends BaseAdapter {
22265
24200
  if (cacheData) {
22266
24201
  return cacheData;
22267
24202
  }
22268
- const output = await this.getVesuSingletonContract(config).call("position_unsafe", [
22269
- this.config.poolId.address,
24203
+ const { contract, isV2 } = this.getVesuSingletonContract(config, this.config.poolId);
24204
+ const output = await contract.call(isV2 ? "position" : "position_unsafe", [
24205
+ ...isV2 ? [] : [this.config.poolId.address],
24206
+ // exclude pool id in v2
22270
24207
  this.config.collateral.address.address,
22271
24208
  this.config.debt.address.address,
22272
24209
  this.config.vaultAllocator.address
22273
24210
  ]);
22274
24211
  const token1Price = await this.pricer.getPrice(this.config.collateral.symbol);
22275
24212
  const token2Price = await this.pricer.getPrice(this.config.debt.symbol);
24213
+ logger.verbose(`VesuAdapter::getPositions token1Price: ${token1Price.price}, token2Price: ${token2Price.price}`);
22276
24214
  const collateralAmount = Web3Number.fromWei(output["1"].toString(), this.config.collateral.decimals);
22277
24215
  const debtAmount = Web3Number.fromWei(output["2"].toString(), this.config.debt.decimals);
22278
24216
  const value = [{
@@ -22298,8 +24236,10 @@ var VesuAdapter = class _VesuAdapter extends BaseAdapter {
22298
24236
  if (cacheData) {
22299
24237
  return cacheData;
22300
24238
  }
22301
- const output = await this.getVesuSingletonContract(config).call("check_collateralization_unsafe", [
22302
- this.config.poolId.address,
24239
+ const { contract, isV2 } = this.getVesuSingletonContract(config, this.config.poolId);
24240
+ const output = await contract.call(isV2 ? "check_collateralization" : "check_collateralization_unsafe", [
24241
+ ...isV2 ? [] : [this.config.poolId.address],
24242
+ // exclude pool id in v2
22303
24243
  this.config.collateral.address.address,
22304
24244
  this.config.debt.address.address,
22305
24245
  this.config.vaultAllocator.address
@@ -22359,7 +24299,7 @@ var VesuAdapter = class _VesuAdapter extends BaseAdapter {
22359
24299
  );
22360
24300
  pools = data.data;
22361
24301
  for (const pool of vesu_pools_default.data) {
22362
- const found = pools.find((d) => d.id === pool.id);
24302
+ const found = pools.find((d) => ContractAddr.from(d.id).eqString(pool.id));
22363
24303
  if (!found) {
22364
24304
  logger.verbose(`VesuRebalance: pools: ${JSON.stringify(pools)}`);
22365
24305
  logger.verbose(
@@ -24749,12 +26689,12 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
24749
26689
  const rewardAPYs = [];
24750
26690
  for (const [index, pool] of pools.entries()) {
24751
26691
  const vesuAdapter = vesuAdapters[index];
24752
- const collateralAsset = pool.assets.find((a) => a.symbol === vesuAdapter.config.collateral.symbol)?.stats;
24753
- const debtAsset = pool.assets.find((a) => a.symbol === vesuAdapter.config.debt.symbol)?.stats;
26692
+ const collateralAsset = pool.assets.find((a) => a.symbol.toLowerCase() === vesuAdapter.config.collateral.symbol.toLowerCase())?.stats;
26693
+ const debtAsset = pool.assets.find((a) => a.symbol.toLowerCase() === vesuAdapter.config.debt.symbol.toLowerCase())?.stats;
24754
26694
  const supplyApy = Number(collateralAsset.supplyApy.value || 0) / 1e18;
24755
26695
  const lstAPY = Number(collateralAsset.lstApr?.value || 0) / 1e18;
24756
26696
  baseAPYs.push(...[supplyApy + lstAPY, Number(debtAsset.borrowApr.value) / 1e18]);
24757
- rewardAPYs.push(...[Number(collateralAsset.defiSpringSupplyApr.value || "0") / 1e18, 0]);
26697
+ rewardAPYs.push(...[Number(collateralAsset.defiSpringSupplyApr?.value || "0") / 1e18, 0]);
24758
26698
  }
24759
26699
  logger.verbose(`${this.metadata.name}::netAPY: baseAPYs: ${JSON.stringify(baseAPYs)}`);
24760
26700
  logger.verbose(`${this.metadata.name}::netAPY: rewardAPYs: ${JSON.stringify(rewardAPYs)}`);
@@ -24824,6 +26764,7 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
24824
26764
  const underlying = this.asset();
24825
26765
  let vesuAum = Web3Number.fromWei("0", underlying.decimals);
24826
26766
  let tokenUnderlyingPrice = await this.pricer.getPrice(this.asset().symbol);
26767
+ logger.verbose(`${this.getTag()} tokenUnderlyingPrice: ${tokenUnderlyingPrice.price}`);
24827
26768
  if (legAUM[0].token.address.eq(underlying.address)) {
24828
26769
  vesuAum = vesuAum.plus(legAUM[0].amount);
24829
26770
  } else {
@@ -24924,7 +26865,7 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
24924
26865
  amount: unusedBalance.amount,
24925
26866
  usdValue: unusedBalance.usdValue,
24926
26867
  token: this.asset(),
24927
- remarks: "Unused Balance"
26868
+ remarks: "Unused Balance (may not include recent deposits)"
24928
26869
  }];
24929
26870
  }
24930
26871
  getSetManagerCall(strategist, root = this.getMerkleRoot()) {
@@ -25262,8 +27203,8 @@ function getLooperSettings(token1Symbol, token2Symbol, vaultSettings, pool1, poo
25262
27203
  vaultSettings.leafAdapters.push(commonAdapter.getFlashloanAdapter.bind(commonAdapter));
25263
27204
  vaultSettings.leafAdapters.push(vesuAdapterUSDCETH.getModifyPosition.bind(vesuAdapterUSDCETH));
25264
27205
  vaultSettings.leafAdapters.push(vesuAdapterETHUSDC.getModifyPosition.bind(vesuAdapterETHUSDC));
25265
- vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(USDCToken.address, vesuAdapterUSDCETH.VESU_SINGLETON, "approve_token1" /* APPROVE_TOKEN1 */).bind(commonAdapter));
25266
- vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(ETHToken.address, vesuAdapterETHUSDC.VESU_SINGLETON, "approve_token2" /* APPROVE_TOKEN2 */).bind(commonAdapter));
27206
+ vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(USDCToken.address, VESU_SINGLETON, "approve_token1" /* APPROVE_TOKEN1 */).bind(commonAdapter));
27207
+ vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(ETHToken.address, VESU_SINGLETON, "approve_token2" /* APPROVE_TOKEN2 */).bind(commonAdapter));
25267
27208
  vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(USDCToken.address, vaultSettings.vaultAddress, "approve_bring_liquidity" /* APPROVE_BRING_LIQUIDITY */).bind(commonAdapter));
25268
27209
  vaultSettings.leafAdapters.push(commonAdapter.getBringLiquidityAdapter("bring_liquidity" /* BRING_LIQUIDITY */).bind(commonAdapter));
25269
27210
  vaultSettings.leafAdapters.push(vesuAdapterUSDCETH.getDefispringRewardsAdapter("defispring_rewards" /* DEFISPRING_REWARDS */).bind(vesuAdapterUSDCETH));
@@ -25567,7 +27508,7 @@ var UniversalStrategies = [
25567
27508
  // src/strategies/universal-lst-muliplier-strategy.tsx
25568
27509
  var import_starknet17 = require("starknet");
25569
27510
  var import_jsx_runtime5 = require("react/jsx-runtime");
25570
- var UniversalLstMultiplierStrategy = class extends UniversalStrategy {
27511
+ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy extends UniversalStrategy {
25571
27512
  constructor(config, pricer, metadata) {
25572
27513
  super(config, pricer, metadata);
25573
27514
  this.quoteAmountToFetchPrice = new Web3Number(1, 18);
@@ -25579,8 +27520,15 @@ var UniversalLstMultiplierStrategy = class extends UniversalStrategy {
25579
27520
  this.quoteAmountToFetchPrice = new Web3Number(0.01, this.asset().decimals);
25580
27521
  }
25581
27522
  }
27523
+ asset() {
27524
+ const vesuAdapter1 = this.getAdapter("vesu_leg1_adapter" /* VESU_LEG1 */);
27525
+ return vesuAdapter1.config.collateral;
27526
+ }
27527
+ getTag() {
27528
+ return `${_UniversalLstMultiplierStrategy.name}:${this.metadata.name}`;
27529
+ }
25582
27530
  // only one leg is used
25583
- // todo support lending assets of underlying as well
27531
+ // todo support lending assets of underlying as well (like if xSTRK looping is not viable, simply supply STRK)
25584
27532
  getVesuAdapters() {
25585
27533
  const vesuAdapter1 = this.getAdapter("vesu_leg1_adapter" /* VESU_LEG1 */);
25586
27534
  vesuAdapter1.pricer = this.pricer;
@@ -25589,9 +27537,13 @@ var UniversalLstMultiplierStrategy = class extends UniversalStrategy {
25589
27537
  }
25590
27538
  // not applicable for this strategy
25591
27539
  // No rewards on collateral or borrowing of LST assets
25592
- // protected async getRewardsAUM(prevAum: Web3Number): Promise<Web3Number> {
25593
- // return Web3Number.fromWei("0", this.asset().decimals);
25594
- // }
27540
+ async getRewardsAUM(prevAum) {
27541
+ const lstToken = this.asset();
27542
+ if (lstToken.symbol === "xSTRK") {
27543
+ return super.getRewardsAUM(prevAum);
27544
+ }
27545
+ return Web3Number.fromWei("0", lstToken.decimals);
27546
+ }
25595
27547
  async getLSTDexPrice() {
25596
27548
  const ekuboQuoter = new EkuboQuoter(this.config);
25597
27549
  const lstTokenInfo = this.asset();
@@ -25614,6 +27566,7 @@ var UniversalLstMultiplierStrategy = class extends UniversalStrategy {
25614
27566
  async getVesuMultiplyCall(params) {
25615
27567
  const [vesuAdapter1] = this.getVesuAdapters();
25616
27568
  const legLTV = await vesuAdapter1.getLTVConfig(this.config);
27569
+ logger.verbose(`${this.getTag()}::getVesuMultiplyCall legLTV: ${legLTV}`);
25617
27570
  const existingPositions = await vesuAdapter1.getPositions(this.config);
25618
27571
  const collateralisation = await vesuAdapter1.getCollateralization(this.config);
25619
27572
  const existingCollateralInfo = existingPositions[0];
@@ -25627,8 +27580,11 @@ var UniversalLstMultiplierStrategy = class extends UniversalStrategy {
25627
27580
  const addedCollateral = params.leg1DepositAmount.multipliedBy(params.isDeposit ? 1 : -1);
25628
27581
  logger.verbose(`${this.getTag()}::getVesuMultiplyCall addedCollateral: ${addedCollateral}`);
25629
27582
  const numeratorPart1 = existingCollateralInfo.amount.plus(addedCollateral).multipliedBy(collateralPrice).multipliedBy(legLTV);
27583
+ logger.verbose(`${this.getTag()}::getVesuMultiplyCall numeratorPart1: ${numeratorPart1}`);
25630
27584
  const numeratorPart2 = existingDebtInfo.amount.multipliedBy(debtPrice).multipliedBy(this.metadata.additionalInfo.targetHealthFactor);
27585
+ logger.verbose(`${this.getTag()}::getVesuMultiplyCall numeratorPart2: ${numeratorPart2}`);
25631
27586
  const denominatorPart = this.metadata.additionalInfo.targetHealthFactor - legLTV / dexPrice;
27587
+ logger.verbose(`${this.getTag()}::getVesuMultiplyCall denominatorPart: ${denominatorPart}`);
25632
27588
  const x_debt_usd = numeratorPart1.minus(numeratorPart2).dividedBy(denominatorPart);
25633
27589
  logger.verbose(`${this.getTag()}::getVesuMultiplyCall x_debt_usd: ${x_debt_usd}`);
25634
27590
  logger.debug(`${this.getTag()}::getVesuMultiplyCall numeratorPart1: ${numeratorPart1}, numeratorPart2: ${numeratorPart2}, denominatorPart: ${denominatorPart}`);
@@ -25664,10 +27620,15 @@ var UniversalLstMultiplierStrategy = class extends UniversalStrategy {
25664
27620
  * @param params marginAmount is in LST, debtAmount is in underlying
25665
27621
  */
25666
27622
  async getModifyLeverCall(params) {
27623
+ logger.verbose(`${this.getTag()}::getModifyLeverCall marginAmount: ${params.marginAmount}, debtAmount: ${params.debtAmount}, lstDexPriceInUnderlying: ${params.lstDexPriceInUnderlying}, isIncrease: ${params.isIncrease}`);
25667
27624
  assert(!params.marginAmount.isZero() || !params.debtAmount.isZero(), "Deposit/debt must be non-0");
25668
27625
  const [vesuAdapter1] = this.getVesuAdapters();
25669
27626
  const lstTokenInfo = this.asset();
25670
27627
  const lstUnderlyingTokenInfo = vesuAdapter1.config.debt;
27628
+ const maxAmounts = lstTokenInfo.symbol == "xSTRK" ? 5e5 : 0.5;
27629
+ if (params.marginAmount.greaterThan(maxAmounts)) {
27630
+ throw new Error(`Margin amount is greater than max amount: ${params.marginAmount.toNumber()} > ${maxAmounts}`);
27631
+ }
25671
27632
  const proofsIDs = [];
25672
27633
  const manageCalls = [];
25673
27634
  if (params.marginAmount.greaterThan(0)) {
@@ -25681,9 +27642,9 @@ var UniversalLstMultiplierStrategy = class extends UniversalStrategy {
25681
27642
  manageCalls.push(manageCall1);
25682
27643
  }
25683
27644
  const lstDexPriceInUnderlying = params.lstDexPriceInUnderlying;
27645
+ const lstTrueExchangeRate = await this.getLSTExchangeRate();
25684
27646
  const ekuboQuoter = new EkuboQuoter(this.config);
25685
- const marginSwap = [];
25686
- const MAX_SLIPPAGE = 0.01;
27647
+ const MAX_SLIPPAGE = 2e-3;
25687
27648
  const fromToken = params.isIncrease ? lstUnderlyingTokenInfo : lstTokenInfo;
25688
27649
  const toToken = params.isIncrease ? lstTokenInfo : lstUnderlyingTokenInfo;
25689
27650
  const leverSwapQuote = await ekuboQuoter.getQuote(
@@ -25692,10 +27653,22 @@ var UniversalLstMultiplierStrategy = class extends UniversalStrategy {
25692
27653
  params.debtAmount
25693
27654
  // negative for exact amount out
25694
27655
  );
25695
- assert(leverSwapQuote.price_impact < MAX_SLIPPAGE, "getIncreaseLeverCall: Price impact is too high [Debt swap]");
27656
+ logger.verbose(`${this.getTag()}::getModifyLeverCall leverSwapQuote: ${JSON.stringify(leverSwapQuote)}`);
27657
+ assert(leverSwapQuote.price_impact < 0.01, "getIncreaseLeverCall: Price impact is too high [Debt swap]");
25696
27658
  const leverSwap = ekuboQuoter.getVesuMultiplyQuote(leverSwapQuote, fromToken, toToken);
25697
- const minExpectedDebt = params.debtAmount.dividedBy(lstDexPriceInUnderlying).multipliedBy(1 - MAX_SLIPPAGE);
25698
- const maxUsedCollateral = params.debtAmount.abs().dividedBy(lstDexPriceInUnderlying).multipliedBy(1 + MAX_SLIPPAGE);
27659
+ logger.verbose(`${this.getTag()}::getModifyLeverCall leverSwap: ${JSON.stringify(leverSwap)}`);
27660
+ let minLSTReceived = params.debtAmount.dividedBy(lstDexPriceInUnderlying).multipliedBy(1 - MAX_SLIPPAGE);
27661
+ const minLSTReceivedAsPerTruePrice = params.debtAmount.dividedBy(lstTrueExchangeRate);
27662
+ if (minLSTReceived < minLSTReceivedAsPerTruePrice) {
27663
+ minLSTReceived = minLSTReceivedAsPerTruePrice;
27664
+ }
27665
+ logger.verbose(`${this.getTag()}::getModifyLeverCall minLSTReceivedAsPerTruePrice: ${minLSTReceivedAsPerTruePrice}, minLSTReceived: ${minLSTReceived}`);
27666
+ let maxUsedCollateral = params.debtAmount.abs().dividedBy(lstDexPriceInUnderlying).multipliedBy(1 + MAX_SLIPPAGE);
27667
+ const maxUsedCollateralInLST = params.debtAmount.abs().dividedBy(lstTrueExchangeRate).multipliedBy(1.005);
27668
+ logger.verbose(`${this.getTag()}::getModifyLeverCall maxUsedCollateralInLST: ${maxUsedCollateralInLST}, maxUsedCollateral: ${maxUsedCollateral}`);
27669
+ if (maxUsedCollateralInLST > maxUsedCollateral) {
27670
+ maxUsedCollateral = maxUsedCollateralInLST;
27671
+ }
25699
27672
  const STEP2_ID = "switch_delegation_on" /* SWITCH_DELEGATION_ON */;
25700
27673
  const manage2Info = this.getProofs(STEP2_ID);
25701
27674
  const manageCall2 = manage2Info.callConstructor({
@@ -25707,10 +27680,10 @@ var UniversalLstMultiplierStrategy = class extends UniversalStrategy {
25707
27680
  isIncrease: true,
25708
27681
  increaseParams: {
25709
27682
  add_margin: params.marginAmount,
25710
- margin_swap: marginSwap,
27683
+ margin_swap: [],
25711
27684
  margin_swap_limit_amount: Web3Number.fromWei(0, this.asset().decimals),
25712
27685
  lever_swap: leverSwap,
25713
- lever_swap_limit_amount: minExpectedDebt
27686
+ lever_swap_limit_amount: minLSTReceived
25714
27687
  }
25715
27688
  } : {
25716
27689
  isIncrease: false,
@@ -25865,7 +27838,7 @@ var hyperxWBTC = {
25865
27838
  manager: ContractAddr.from("0x75866db44c81e6986f06035206ee9c7d15833ddb22d6a22c016cfb5c866a491"),
25866
27839
  vaultAllocator: ContractAddr.from("0x57b5c1bb457b5e840a2714ae53ada87d77be2f3fd33a59b4fe709ef20c020c1"),
25867
27840
  redeemRequestNFT: ContractAddr.from("0x7a5dc288325456f05e70e9616e16bc02ffbe448f4b89f80b47c0970b989c7c"),
25868
- aumOracle: ContractAddr.from(""),
27841
+ aumOracle: ContractAddr.from("0x258f8a0ca0d21f542e48ad89d00e92dc4d9db4999084f50ef9c22dfb1e83023"),
25869
27842
  leafAdapters: [],
25870
27843
  adapters: [],
25871
27844
  targetHealthFactor: 1.1,
@@ -25876,7 +27849,7 @@ var hyperxtBTC = {
25876
27849
  manager: ContractAddr.from("0xc4cc3e08029a0ae076f5fdfca70575abb78d23c5cd1c49a957f7e697885401"),
25877
27850
  vaultAllocator: ContractAddr.from("0x50bbd4fe69f841ecb13b2619fe50ebfa4e8944671b5d0ebf7868fd80c61b31e"),
25878
27851
  redeemRequestNFT: ContractAddr.from("0xeac9032f02057779816e38a6cb9185d12d86b3aacc9949b96b36de359c1e3"),
25879
- aumOracle: ContractAddr.from(""),
27852
+ aumOracle: ContractAddr.from("0x7e0d05cb7ba3f7db77a36c21c21583b5a524c2e685c08c24b3554911fb4a039"),
25880
27853
  leafAdapters: [],
25881
27854
  adapters: [],
25882
27855
  targetHealthFactor: 1.1,
@@ -25887,7 +27860,7 @@ var hyperxsBTC = {
25887
27860
  manager: ContractAddr.from("0xc9ac023090625b0be3f6532ca353f086746f9c09f939dbc1b2613f09e5f821"),
25888
27861
  vaultAllocator: ContractAddr.from("0x60c2d856936b975459a5b4eb28b8672d91f757bd76cebb6241f8d670185dc01"),
25889
27862
  redeemRequestNFT: ContractAddr.from("0x429e8ee8bc7ecd1ade72630d350a2e0f10f9a2507c45f188ba17fe8f2ab4cf3"),
25890
- aumOracle: ContractAddr.from(""),
27863
+ aumOracle: ContractAddr.from("0x149298ade3e79ec6cbdac6cfad289c57504eaf54e590939136ed1ceca60c345"),
25891
27864
  leafAdapters: [],
25892
27865
  adapters: [],
25893
27866
  targetHealthFactor: 1.1,
@@ -25922,7 +27895,7 @@ function getStrategySettings(lstSymbol, underlyingSymbol, addresses, isPreview =
25922
27895
  launchBlock: 0,
25923
27896
  type: "Other",
25924
27897
  depositTokens: [Global.getDefaultTokens().find((token) => token.symbol === lstSymbol)],
25925
- additionalInfo: getLooperSettings2(lstSymbol, underlyingSymbol, addresses, VesuPools.Re7xSTRK),
27898
+ additionalInfo: getLooperSettings2(lstSymbol, underlyingSymbol, addresses, lstSymbol === "xSTRK" ? VesuPools.Re7xSTRK : VesuPools.Re7xBTC),
25926
27899
  risk: {
25927
27900
  riskFactor: _riskFactor4,
25928
27901
  netRisk: _riskFactor4.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _riskFactor4.reduce((acc, curr) => acc + curr.weight, 0),
@@ -25938,10 +27911,10 @@ function getStrategySettings(lstSymbol, underlyingSymbol, addresses, isPreview =
25938
27911
  }
25939
27912
  var HyperLSTStrategies = [
25940
27913
  getStrategySettings("xSTRK", "STRK", hyperxSTRK, false),
25941
- getStrategySettings("xWBTC", "WBTC", hyperxWBTC, true),
25942
- getStrategySettings("xtBTC", "tBTC", hyperxtBTC, true),
25943
- getStrategySettings("xsBTC", "solvBTC", hyperxsBTC, true),
25944
- getStrategySettings("xLBTC", "LBTC", hyperxLBTC, true)
27914
+ getStrategySettings("xWBTC", "WBTC", hyperxWBTC, false),
27915
+ getStrategySettings("xtBTC", "tBTC", hyperxtBTC, false),
27916
+ getStrategySettings("xsBTC", "solvBTC", hyperxsBTC, false),
27917
+ getStrategySettings("xLBTC", "LBTC", hyperxLBTC, false)
25945
27918
  ];
25946
27919
 
25947
27920
  // src/modules/pricer-lst.ts
@@ -26472,6 +28445,7 @@ var deployer_default = Deployer;
26472
28445
  getRiskColor,
26473
28446
  getRiskExplaination,
26474
28447
  getTrovesEndpoint,
28448
+ getVesuSingletonAddress,
26475
28449
  highlightTextWithLinks,
26476
28450
  logger
26477
28451
  });