@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.
@@ -12,23 +12,27 @@ var _Web3Number = class extends BigNumber {
12
12
  this.decimals = decimals;
13
13
  }
14
14
  toWei() {
15
- return this.mul(10 ** this.decimals).toFixed(0);
15
+ return super.mul(10 ** this.decimals).toFixed(0);
16
16
  }
17
17
  multipliedBy(value) {
18
18
  const _value = this.getStandardString(value);
19
- return this.construct(this.mul(_value).toString(), this.decimals);
19
+ return this.construct(super.mul(_value).toString(), this.decimals);
20
20
  }
21
21
  dividedBy(value) {
22
22
  const _value = this.getStandardString(value);
23
- return this.construct(this.div(_value).toString(), this.decimals);
23
+ return this.construct(super.dividedBy(_value).toString(), this.decimals);
24
24
  }
25
25
  plus(value) {
26
- const _value = this.getStandardString(value);
27
- return this.construct(this.add(_value).toString(), this.decimals);
26
+ const rawValue = this.getStandardString(value);
27
+ const thisBN = new BigNumber(this.toString());
28
+ const result = thisBN.plus(rawValue);
29
+ return this.construct(result.toString(), this.decimals);
28
30
  }
29
31
  minus(n, base) {
30
- const _value = this.getStandardString(n);
31
- return this.construct(super.minus(_value, base).toString(), this.decimals);
32
+ const rawValue = this.getStandardString(n);
33
+ const thisBN = new BigNumber(this.toString());
34
+ const result = thisBN.minus(rawValue, base);
35
+ return this.construct(result.toString(), this.decimals);
32
36
  }
33
37
  construct(value, decimals) {
34
38
  return new this.constructor(value, decimals);
@@ -46,10 +50,13 @@ var _Web3Number = class extends BigNumber {
46
50
  return Math.min(this.decimals, 18);
47
51
  }
48
52
  getStandardString(value) {
49
- if (typeof value == "string") {
53
+ if (typeof value === "string") {
50
54
  return value;
51
55
  }
52
- return value.toFixed(this.maxToFixedDecimals());
56
+ if (typeof value === "number") {
57
+ return value.toString();
58
+ }
59
+ return BigNumber.prototype.toString.call(value);
53
60
  }
54
61
  minimum(value) {
55
62
  const _value = new BigNumber(value);
@@ -60,12 +67,10 @@ var _Web3Number = class extends BigNumber {
60
67
  maximum(value) {
61
68
  const _value = new BigNumber(value);
62
69
  const _valueMe = new BigNumber(this.toString());
63
- console.warn(`maximum: _value: ${_value.toString()}, _valueMe: ${_valueMe.toString()}`);
64
70
  const answer = _value.greaterThanOrEqualTo(_valueMe) ? _value : _valueMe;
65
71
  return this.construct(answer.toString(), this.decimals);
66
72
  }
67
73
  abs() {
68
- console.warn(`abs: this: ${this}`);
69
74
  return this.construct(Math.abs(this.toNumber()).toFixed(12), this.decimals);
70
75
  }
71
76
  toI129() {
@@ -476,13 +481,14 @@ var Pricer = class extends PricerBase {
476
481
  logger.verbose(`Fetching price of ${token.symbol} using ${methodToUse}`);
477
482
  switch (methodToUse) {
478
483
  case "Coinbase":
479
- try {
480
- const result = await this._getPriceCoinbase(token);
481
- this.methodToUse[token.symbol] = "Coinbase";
482
- return result;
483
- } catch (error) {
484
- console.warn(`Coinbase: price err: message [${token.symbol}]: `, error.message);
485
- }
484
+ // try {
485
+ // const result = await this._getPriceCoinbase(token);
486
+ // this.methodToUse[token.symbol] = 'Coinbase';
487
+ // return result;
488
+ // } catch (error: any) {
489
+ // console.warn(`Coinbase: price err: message [${token.symbol}]: `, error.message);
490
+ // // do nothing, try next
491
+ // }
486
492
  case "Coinmarketcap":
487
493
  try {
488
494
  const result = await this._getPriceCoinMarketCap(token);
@@ -858,7 +864,7 @@ var PricerFromApi = class extends PricerBase {
858
864
  }
859
865
  async getPriceFromMyAPI(tokenSymbol) {
860
866
  logger.verbose(`getPrice from redis: ${tokenSymbol}`);
861
- const endpoint = "https://cache-server-t2me.onrender.com";
867
+ const endpoint = "https://proxy.api.troves.fi";
862
868
  const url = `${endpoint}/api/price/${tokenSymbol}`;
863
869
  const priceInfoRes = await fetch(url);
864
870
  const priceInfo = await priceInfoRes.json();
@@ -3976,6 +3982,9 @@ var BaseStrategy = class extends CacheClass {
3976
3982
  async withdrawCall(amountInfo, receiver, owner) {
3977
3983
  throw new Error("Not implemented");
3978
3984
  }
3985
+ async getVaultPositions() {
3986
+ throw new Error("Not implemented");
3987
+ }
3979
3988
  };
3980
3989
 
3981
3990
  // src/node/headless.browser.ts
@@ -3995,7 +4004,7 @@ var COMMON_CONTRACTS = [{
3995
4004
  sourceCodeUrl: "https://github.com/strkfarm/strkfarm-contracts/blob/main/src/components/accessControl.cairo"
3996
4005
  }];
3997
4006
  var ENDPOINTS = {
3998
- VESU_BASE: "https://cache-server-t2me.onrender.com/vesu"
4007
+ VESU_BASE: "https://proxy.api.troves.fi/vesu-staging"
3999
4008
  };
4000
4009
 
4001
4010
  // src/modules/harvests.ts
@@ -15718,6 +15727,49 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
15718
15727
  const tick = Math.floor(value / tickSpacing) * tickSpacing;
15719
15728
  return this.tickToi129(tick);
15720
15729
  }
15730
+ async getVaultPositions() {
15731
+ const tvlInfo = await this.getTVL();
15732
+ const fees = await this.getUncollectedFees();
15733
+ const unusedBalance = await this.unusedBalances();
15734
+ return [
15735
+ {
15736
+ amount: tvlInfo.token0.amount,
15737
+ usdValue: tvlInfo.token0.usdValue,
15738
+ token: tvlInfo.token0.tokenInfo,
15739
+ remarks: `Liquidity in Ekubo`
15740
+ },
15741
+ {
15742
+ amount: fees.token0.amount,
15743
+ usdValue: fees.token0.usdValue,
15744
+ token: fees.token0.tokenInfo,
15745
+ remarks: "Uncollected Fees in Ekubo"
15746
+ },
15747
+ {
15748
+ amount: unusedBalance.token0.amount,
15749
+ usdValue: unusedBalance.token0.usdValue,
15750
+ token: unusedBalance.token0.tokenInfo,
15751
+ remarks: "Unused Balance in the Vault"
15752
+ },
15753
+ {
15754
+ amount: tvlInfo.token1.amount,
15755
+ usdValue: tvlInfo.token1.usdValue,
15756
+ token: tvlInfo.token1.tokenInfo,
15757
+ remarks: "Liquidity in Ekubo"
15758
+ },
15759
+ {
15760
+ amount: fees.token1.amount,
15761
+ usdValue: fees.token1.usdValue,
15762
+ token: fees.token1.tokenInfo,
15763
+ remarks: "Uncollected Fees in Ekubo"
15764
+ },
15765
+ {
15766
+ amount: unusedBalance.token1.amount,
15767
+ usdValue: unusedBalance.token1.usdValue,
15768
+ token: unusedBalance.token1.tokenInfo,
15769
+ remarks: "Unused Balance in the Vault"
15770
+ }
15771
+ ];
15772
+ }
15721
15773
  async getPoolKey(blockIdentifier = "latest") {
15722
15774
  if (this.poolKey) {
15723
15775
  return this.poolKey;
@@ -18879,9 +18931,10 @@ import { hash, num as num6, shortString } from "starknet";
18879
18931
 
18880
18932
  // src/strategies/universal-adapters/adapter-utils.ts
18881
18933
  var SIMPLE_SANITIZER = ContractAddr.from("0x5a2e3ceb3da368b983a8717898427ab7b6daf04014b70f321e777f9aad940b4");
18882
- var SIMPLE_SANITIZER_V2 = ContractAddr.from("0x5643d54da70a471cd2b6fa37f52ea7a13cc3f3910689a839f8490a663d2208a");
18934
+ var SIMPLE_SANITIZER_V2 = ContractAddr.from("0x7b6f98311af8aa425278570e62abf523e6462eaa01a38c1feab9b2f416492e2");
18883
18935
  var PRICE_ROUTER = ContractAddr.from("0x05e83Fa38D791d2dba8E6f487758A9687FfEe191A6Cf8a6c5761ab0a110DB837");
18884
18936
  var AVNU_MIDDLEWARE = ContractAddr.from("0x4a7972ed3f5d1e74a6d6c4a8f467666953d081c8f2270390cc169d50d17cb0d");
18937
+ var VESU_SINGLETON = ContractAddr.from("0x000d8d6dfec4d33bfb6895de9f3852143a17c6f92fd2a21da3d6924d34870160");
18885
18938
  function toBigInt(value) {
18886
18939
  if (typeof value === "string") {
18887
18940
  return BigInt(value);
@@ -21816,232 +21869,2098 @@ var vesu_multiple_abi_default = [
21816
21869
  }
21817
21870
  ];
21818
21871
 
21819
- // src/strategies/universal-adapters/vesu-adapter.ts
21820
- var VesuAmountType = /* @__PURE__ */ ((VesuAmountType2) => {
21821
- VesuAmountType2[VesuAmountType2["Delta"] = 0] = "Delta";
21822
- VesuAmountType2[VesuAmountType2["Target"] = 1] = "Target";
21823
- return VesuAmountType2;
21824
- })(VesuAmountType || {});
21825
- var VesuAmountDenomination = /* @__PURE__ */ ((VesuAmountDenomination2) => {
21826
- VesuAmountDenomination2[VesuAmountDenomination2["Native"] = 0] = "Native";
21827
- VesuAmountDenomination2[VesuAmountDenomination2["Assets"] = 1] = "Assets";
21828
- return VesuAmountDenomination2;
21829
- })(VesuAmountDenomination || {});
21830
- function getVesuMultiplyParams(isIncrease, params) {
21831
- if (isIncrease) {
21832
- const _params2 = params;
21833
- return {
21834
- action: new CairoCustomEnum2({ IncreaseLever: {
21835
- pool_id: _params2.pool_id.toBigInt(),
21836
- collateral_asset: _params2.collateral_asset.toBigInt(),
21837
- debt_asset: _params2.debt_asset.toBigInt(),
21838
- user: _params2.user.toBigInt(),
21839
- add_margin: BigInt(_params2.add_margin.toWei()),
21840
- margin_swap: _params2.margin_swap.map((swap) => ({
21841
- route: swap.route.map((route) => ({
21842
- pool_key: {
21843
- token0: route.pool_key.token0.toBigInt(),
21844
- token1: route.pool_key.token1.toBigInt(),
21845
- fee: route.pool_key.fee,
21846
- tick_spacing: route.pool_key.tick_spacing,
21847
- extension: BigInt(num8.hexToDecimalString(route.pool_key.extension))
21848
- },
21849
- sqrt_ratio_limit: uint2567.bnToUint256(route.sqrt_ratio_limit.toWei()),
21850
- skip_ahead: BigInt(100)
21851
- })),
21852
- token_amount: {
21853
- token: swap.token_amount.token.toBigInt(),
21854
- amount: swap.token_amount.amount.toI129()
21855
- }
21856
- })),
21857
- margin_swap_limit_amount: BigInt(_params2.margin_swap_limit_amount.toWei()),
21858
- lever_swap: _params2.lever_swap.map((swap) => ({
21859
- route: swap.route.map((route) => ({
21860
- pool_key: {
21861
- token0: route.pool_key.token0.toBigInt(),
21862
- token1: route.pool_key.token1.toBigInt(),
21863
- fee: route.pool_key.fee,
21864
- tick_spacing: route.pool_key.tick_spacing,
21865
- extension: BigInt(num8.hexToDecimalString(route.pool_key.extension))
21866
- },
21867
- sqrt_ratio_limit: uint2567.bnToUint256(route.sqrt_ratio_limit.toWei()),
21868
- skip_ahead: BigInt(100)
21869
- })),
21870
- token_amount: {
21871
- token: swap.token_amount.token.toBigInt(),
21872
- amount: swap.token_amount.amount.toI129()
21873
- }
21874
- })),
21875
- lever_swap_limit_amount: BigInt(_params2.lever_swap_limit_amount.toWei())
21876
- } })
21877
- };
21878
- }
21879
- const _params = params;
21880
- return {
21881
- action: new CairoCustomEnum2({ DecreaseLever: {
21882
- pool_id: _params.pool_id.toBigInt(),
21883
- collateral_asset: _params.collateral_asset.toBigInt(),
21884
- debt_asset: _params.debt_asset.toBigInt(),
21885
- user: _params.user.toBigInt(),
21886
- sub_margin: BigInt(_params.sub_margin.toWei()),
21887
- recipient: _params.recipient.toBigInt(),
21888
- lever_swap: _params.lever_swap.map((swap) => ({
21889
- route: swap.route.map((route) => ({
21890
- pool_key: {
21891
- token0: route.pool_key.token0.toBigInt(),
21892
- token1: route.pool_key.token1.toBigInt(),
21893
- fee: route.pool_key.fee,
21894
- tick_spacing: route.pool_key.tick_spacing,
21895
- extension: ContractAddr.from(route.pool_key.extension).toBigInt()
21896
- },
21897
- sqrt_ratio_limit: uint2567.bnToUint256(route.sqrt_ratio_limit.toWei()),
21898
- skip_ahead: BigInt(route.skip_ahead.toWei())
21899
- })),
21900
- token_amount: {
21901
- token: swap.token_amount.token.toBigInt(),
21902
- amount: swap.token_amount.amount.toI129()
21903
- }
21904
- })),
21905
- lever_swap_limit_amount: BigInt(_params.lever_swap_limit_amount.toWei()),
21906
- lever_swap_weights: _params.lever_swap_weights.map((weight) => BigInt(weight.toWei())),
21907
- withdraw_swap: _params.withdraw_swap.map((swap) => ({
21908
- route: swap.route.map((route) => ({
21909
- pool_key: {
21910
- token0: route.pool_key.token0.toBigInt(),
21911
- token1: route.pool_key.token1.toBigInt(),
21912
- fee: route.pool_key.fee,
21913
- tick_spacing: route.pool_key.tick_spacing,
21914
- extension: ContractAddr.from(route.pool_key.extension).toBigInt()
21915
- },
21916
- sqrt_ratio_limit: uint2567.bnToUint256(route.sqrt_ratio_limit.toWei()),
21917
- skip_ahead: BigInt(route.skip_ahead.toWei())
21918
- })),
21919
- token_amount: {
21920
- token: swap.token_amount.token.toBigInt(),
21921
- amount: swap.token_amount.amount.toI129()
21922
- }
21923
- })),
21924
- withdraw_swap_limit_amount: BigInt(_params.withdraw_swap_limit_amount.toWei()),
21925
- withdraw_swap_weights: _params.withdraw_swap_weights.map((weight) => BigInt(weight.toWei())),
21926
- close_position: _params.close_position
21927
- } })
21928
- };
21929
- }
21930
- var VesuPools = {
21931
- Genesis: ContractAddr.from("0x4dc4f0ca6ea4961e4c8373265bfd5317678f4fe374d76f3fd7135f57763bf28"),
21932
- Re7xSTRK: ContractAddr.from("0x052fb52363939c3aa848f8f4ac28f0a51379f8d1b971d8444de25fbd77d8f161")
21933
- };
21934
- var VesuAdapter = class _VesuAdapter extends BaseAdapter {
21935
- constructor(config) {
21936
- super();
21937
- this.VESU_SINGLETON = ContractAddr.from("0x000d8d6dfec4d33bfb6895de9f3852143a17c6f92fd2a21da3d6924d34870160");
21938
- this.VESU_MULTIPLY = ContractAddr.from("0x3630f1f8e5b8f5c4c4ae9b6620f8a570ae55cddebc0276c37550e7c118edf67");
21939
- this.getModifyPosition = () => {
21940
- const positionData = [0n];
21941
- const packedArguments = [
21942
- toBigInt(this.config.poolId.toString()),
21943
- // pool id
21944
- toBigInt(this.config.collateral.address.toString()),
21945
- // collateral
21946
- toBigInt(this.config.debt.address.toString()),
21947
- // debt
21948
- toBigInt(this.config.vaultAllocator.toString()),
21949
- // vault allocator
21950
- toBigInt(positionData.length),
21951
- ...positionData
21952
- ];
21953
- const output = this.constructSimpleLeafData({
21954
- id: this.config.id,
21955
- target: this.VESU_SINGLETON,
21956
- method: "modify_position",
21957
- packedArguments
21958
- });
21959
- return { leaf: output, callConstructor: this.getModifyPositionCall.bind(this) };
21960
- };
21961
- this.getModifyPositionCall = (params) => {
21962
- const _collateral = {
21963
- amount_type: this.formatAmountTypeEnum(params.collateralAmount.amount_type),
21964
- denomination: this.formatAmountDenominationEnum(params.collateralAmount.denomination),
21965
- value: {
21966
- abs: uint2567.bnToUint256(params.collateralAmount.value.abs.toWei()),
21967
- is_negative: params.collateralAmount.value.abs.isZero() ? false : params.collateralAmount.value.is_negative
21968
- }
21969
- };
21970
- logger.verbose(`VesuAdapter::ConstructingModify::Collateral::${JSON.stringify(_collateral)}`);
21971
- const _debt = {
21972
- amount_type: this.formatAmountTypeEnum(params.debtAmount.amount_type),
21973
- denomination: this.formatAmountDenominationEnum(params.debtAmount.denomination),
21974
- value: {
21975
- abs: uint2567.bnToUint256(params.debtAmount.value.abs.toWei()),
21976
- is_negative: params.debtAmount.value.abs.isZero() ? false : params.debtAmount.value.is_negative
21977
- }
21978
- };
21979
- logger.verbose(`VesuAdapter::ConstructingModify::Debt::${JSON.stringify(_debt)}`);
21980
- const singletonContract = new Contract8({ abi: vesu_singleton_abi_default, address: this.VESU_SINGLETON.toString(), providerOrAccount: new RpcProvider4({ nodeUrl: "" }) });
21981
- const call = singletonContract.populate("modify_position", {
21982
- params: {
21983
- pool_id: this.config.poolId.toBigInt(),
21984
- collateral_asset: this.config.collateral.address.toBigInt(),
21985
- debt_asset: this.config.debt.address.toBigInt(),
21986
- user: this.config.vaultAllocator.toBigInt(),
21987
- collateral: _collateral,
21988
- debt: _debt,
21989
- data: [0]
21990
- }
21991
- });
21992
- return {
21993
- sanitizer: SIMPLE_SANITIZER,
21994
- call: {
21995
- contractAddress: this.VESU_SINGLETON,
21996
- selector: hash3.getSelectorFromName("modify_position"),
21997
- calldata: [
21998
- ...call.calldata
21999
- ]
22000
- }
22001
- };
22002
- };
22003
- this.getMultiplyAdapter = () => {
22004
- const packedArguments = [
22005
- toBigInt(this.config.poolId.toString()),
22006
- // pool id
22007
- toBigInt(this.config.collateral.address.toString()),
22008
- // collateral
22009
- toBigInt(this.config.debt.address.toString()),
22010
- // debt
22011
- toBigInt(this.config.vaultAllocator.toString())
22012
- // vault allocator
22013
- ];
22014
- const output = this.constructSimpleLeafData({
22015
- id: this.config.id,
22016
- target: this.VESU_MULTIPLY,
22017
- method: "modify_lever",
22018
- packedArguments
22019
- }, SIMPLE_SANITIZER_V2);
22020
- return { leaf: output, callConstructor: this.getMultiplyCall.bind(this) };
22021
- };
22022
- this.getMultiplyCall = (params) => {
22023
- const isIncrease = params.isIncrease;
22024
- const multiplyParams = isIncrease ? params.increaseParams : params.decreaseParams;
22025
- if (!multiplyParams) {
22026
- throw new Error("Multiply params are not provided");
21872
+ // src/data/vesu-pool-v2.abi.json
21873
+ var vesu_pool_v2_abi_default = [
21874
+ {
21875
+ type: "impl",
21876
+ name: "PoolImpl",
21877
+ interface_name: "vesu::pool::IPool"
21878
+ },
21879
+ {
21880
+ type: "struct",
21881
+ name: "core::integer::u256",
21882
+ members: [
21883
+ {
21884
+ name: "low",
21885
+ type: "core::integer::u128"
21886
+ },
21887
+ {
21888
+ name: "high",
21889
+ type: "core::integer::u128"
22027
21890
  }
22028
- const multiplyContract = new Contract8({ abi: vesu_multiple_abi_default, address: this.VESU_MULTIPLY.toString(), providerOrAccount: new RpcProvider4({ nodeUrl: "" }) });
22029
- const call = multiplyContract.populate("modify_lever", {
22030
- modify_lever_params: getVesuMultiplyParams(isIncrease, {
22031
- ...multiplyParams,
22032
- user: this.config.vaultAllocator,
22033
- pool_id: this.config.poolId,
22034
- collateral_asset: this.config.collateral.address,
22035
- debt_asset: this.config.debt.address,
22036
- recipient: this.config.vaultAllocator
22037
- })
22038
- });
22039
- return {
22040
- sanitizer: SIMPLE_SANITIZER_V2,
22041
- call: {
22042
- contractAddress: this.VESU_MULTIPLY,
22043
- selector: hash3.getSelectorFromName("modify_lever"),
22044
- calldata: [
21891
+ ]
21892
+ },
21893
+ {
21894
+ type: "enum",
21895
+ name: "core::bool",
21896
+ variants: [
21897
+ {
21898
+ name: "False",
21899
+ type: "()"
21900
+ },
21901
+ {
21902
+ name: "True",
21903
+ type: "()"
21904
+ }
21905
+ ]
21906
+ },
21907
+ {
21908
+ type: "struct",
21909
+ name: "vesu::data_model::AssetConfig",
21910
+ members: [
21911
+ {
21912
+ name: "total_collateral_shares",
21913
+ type: "core::integer::u256"
21914
+ },
21915
+ {
21916
+ name: "total_nominal_debt",
21917
+ type: "core::integer::u256"
21918
+ },
21919
+ {
21920
+ name: "reserve",
21921
+ type: "core::integer::u256"
21922
+ },
21923
+ {
21924
+ name: "max_utilization",
21925
+ type: "core::integer::u256"
21926
+ },
21927
+ {
21928
+ name: "floor",
21929
+ type: "core::integer::u256"
21930
+ },
21931
+ {
21932
+ name: "scale",
21933
+ type: "core::integer::u256"
21934
+ },
21935
+ {
21936
+ name: "is_legacy",
21937
+ type: "core::bool"
21938
+ },
21939
+ {
21940
+ name: "last_updated",
21941
+ type: "core::integer::u64"
21942
+ },
21943
+ {
21944
+ name: "last_rate_accumulator",
21945
+ type: "core::integer::u256"
21946
+ },
21947
+ {
21948
+ name: "last_full_utilization_rate",
21949
+ type: "core::integer::u256"
21950
+ },
21951
+ {
21952
+ name: "fee_rate",
21953
+ type: "core::integer::u256"
21954
+ },
21955
+ {
21956
+ name: "fee_shares",
21957
+ type: "core::integer::u256"
21958
+ }
21959
+ ]
21960
+ },
21961
+ {
21962
+ type: "struct",
21963
+ name: "vesu::data_model::AssetPrice",
21964
+ members: [
21965
+ {
21966
+ name: "value",
21967
+ type: "core::integer::u256"
21968
+ },
21969
+ {
21970
+ name: "is_valid",
21971
+ type: "core::bool"
21972
+ }
21973
+ ]
21974
+ },
21975
+ {
21976
+ type: "struct",
21977
+ name: "vesu::data_model::Position",
21978
+ members: [
21979
+ {
21980
+ name: "collateral_shares",
21981
+ type: "core::integer::u256"
21982
+ },
21983
+ {
21984
+ name: "nominal_debt",
21985
+ type: "core::integer::u256"
21986
+ }
21987
+ ]
21988
+ },
21989
+ {
21990
+ type: "struct",
21991
+ name: "vesu::data_model::Context",
21992
+ members: [
21993
+ {
21994
+ name: "collateral_asset",
21995
+ type: "core::starknet::contract_address::ContractAddress"
21996
+ },
21997
+ {
21998
+ name: "debt_asset",
21999
+ type: "core::starknet::contract_address::ContractAddress"
22000
+ },
22001
+ {
22002
+ name: "collateral_asset_config",
22003
+ type: "vesu::data_model::AssetConfig"
22004
+ },
22005
+ {
22006
+ name: "debt_asset_config",
22007
+ type: "vesu::data_model::AssetConfig"
22008
+ },
22009
+ {
22010
+ name: "collateral_asset_price",
22011
+ type: "vesu::data_model::AssetPrice"
22012
+ },
22013
+ {
22014
+ name: "debt_asset_price",
22015
+ type: "vesu::data_model::AssetPrice"
22016
+ },
22017
+ {
22018
+ name: "max_ltv",
22019
+ type: "core::integer::u64"
22020
+ },
22021
+ {
22022
+ name: "user",
22023
+ type: "core::starknet::contract_address::ContractAddress"
22024
+ },
22025
+ {
22026
+ name: "position",
22027
+ type: "vesu::data_model::Position"
22028
+ }
22029
+ ]
22030
+ },
22031
+ {
22032
+ type: "struct",
22033
+ name: "alexandria_math::i257::i257",
22034
+ members: [
22035
+ {
22036
+ name: "abs",
22037
+ type: "core::integer::u256"
22038
+ },
22039
+ {
22040
+ name: "is_negative",
22041
+ type: "core::bool"
22042
+ }
22043
+ ]
22044
+ },
22045
+ {
22046
+ type: "enum",
22047
+ name: "vesu::data_model::AmountDenomination",
22048
+ variants: [
22049
+ {
22050
+ name: "Native",
22051
+ type: "()"
22052
+ },
22053
+ {
22054
+ name: "Assets",
22055
+ type: "()"
22056
+ }
22057
+ ]
22058
+ },
22059
+ {
22060
+ type: "struct",
22061
+ name: "vesu::data_model::Amount",
22062
+ members: [
22063
+ {
22064
+ name: "denomination",
22065
+ type: "vesu::data_model::AmountDenomination"
22066
+ },
22067
+ {
22068
+ name: "value",
22069
+ type: "alexandria_math::i257::i257"
22070
+ }
22071
+ ]
22072
+ },
22073
+ {
22074
+ type: "struct",
22075
+ name: "vesu::data_model::ModifyPositionParams",
22076
+ members: [
22077
+ {
22078
+ name: "collateral_asset",
22079
+ type: "core::starknet::contract_address::ContractAddress"
22080
+ },
22081
+ {
22082
+ name: "debt_asset",
22083
+ type: "core::starknet::contract_address::ContractAddress"
22084
+ },
22085
+ {
22086
+ name: "user",
22087
+ type: "core::starknet::contract_address::ContractAddress"
22088
+ },
22089
+ {
22090
+ name: "collateral",
22091
+ type: "vesu::data_model::Amount"
22092
+ },
22093
+ {
22094
+ name: "debt",
22095
+ type: "vesu::data_model::Amount"
22096
+ }
22097
+ ]
22098
+ },
22099
+ {
22100
+ type: "struct",
22101
+ name: "vesu::data_model::UpdatePositionResponse",
22102
+ members: [
22103
+ {
22104
+ name: "collateral_delta",
22105
+ type: "alexandria_math::i257::i257"
22106
+ },
22107
+ {
22108
+ name: "collateral_shares_delta",
22109
+ type: "alexandria_math::i257::i257"
22110
+ },
22111
+ {
22112
+ name: "debt_delta",
22113
+ type: "alexandria_math::i257::i257"
22114
+ },
22115
+ {
22116
+ name: "nominal_debt_delta",
22117
+ type: "alexandria_math::i257::i257"
22118
+ },
22119
+ {
22120
+ name: "bad_debt",
22121
+ type: "core::integer::u256"
22122
+ }
22123
+ ]
22124
+ },
22125
+ {
22126
+ type: "struct",
22127
+ name: "vesu::data_model::LiquidatePositionParams",
22128
+ members: [
22129
+ {
22130
+ name: "collateral_asset",
22131
+ type: "core::starknet::contract_address::ContractAddress"
22132
+ },
22133
+ {
22134
+ name: "debt_asset",
22135
+ type: "core::starknet::contract_address::ContractAddress"
22136
+ },
22137
+ {
22138
+ name: "user",
22139
+ type: "core::starknet::contract_address::ContractAddress"
22140
+ },
22141
+ {
22142
+ name: "min_collateral_to_receive",
22143
+ type: "core::integer::u256"
22144
+ },
22145
+ {
22146
+ name: "debt_to_repay",
22147
+ type: "core::integer::u256"
22148
+ }
22149
+ ]
22150
+ },
22151
+ {
22152
+ type: "struct",
22153
+ name: "core::array::Span::<core::felt252>",
22154
+ members: [
22155
+ {
22156
+ name: "snapshot",
22157
+ type: "@core::array::Array::<core::felt252>"
22158
+ }
22159
+ ]
22160
+ },
22161
+ {
22162
+ type: "struct",
22163
+ name: "vesu::data_model::AssetParams",
22164
+ members: [
22165
+ {
22166
+ name: "asset",
22167
+ type: "core::starknet::contract_address::ContractAddress"
22168
+ },
22169
+ {
22170
+ name: "floor",
22171
+ type: "core::integer::u256"
22172
+ },
22173
+ {
22174
+ name: "initial_full_utilization_rate",
22175
+ type: "core::integer::u256"
22176
+ },
22177
+ {
22178
+ name: "max_utilization",
22179
+ type: "core::integer::u256"
22180
+ },
22181
+ {
22182
+ name: "is_legacy",
22183
+ type: "core::bool"
22184
+ },
22185
+ {
22186
+ name: "fee_rate",
22187
+ type: "core::integer::u256"
22188
+ }
22189
+ ]
22190
+ },
22191
+ {
22192
+ type: "struct",
22193
+ name: "vesu::interest_rate_model::InterestRateConfig",
22194
+ members: [
22195
+ {
22196
+ name: "min_target_utilization",
22197
+ type: "core::integer::u256"
22198
+ },
22199
+ {
22200
+ name: "max_target_utilization",
22201
+ type: "core::integer::u256"
22202
+ },
22203
+ {
22204
+ name: "target_utilization",
22205
+ type: "core::integer::u256"
22206
+ },
22207
+ {
22208
+ name: "min_full_utilization_rate",
22209
+ type: "core::integer::u256"
22210
+ },
22211
+ {
22212
+ name: "max_full_utilization_rate",
22213
+ type: "core::integer::u256"
22214
+ },
22215
+ {
22216
+ name: "zero_utilization_rate",
22217
+ type: "core::integer::u256"
22218
+ },
22219
+ {
22220
+ name: "rate_half_life",
22221
+ type: "core::integer::u256"
22222
+ },
22223
+ {
22224
+ name: "target_rate_percent",
22225
+ type: "core::integer::u256"
22226
+ }
22227
+ ]
22228
+ },
22229
+ {
22230
+ type: "struct",
22231
+ name: "vesu::data_model::Pair",
22232
+ members: [
22233
+ {
22234
+ name: "total_collateral_shares",
22235
+ type: "core::integer::u256"
22236
+ },
22237
+ {
22238
+ name: "total_nominal_debt",
22239
+ type: "core::integer::u256"
22240
+ }
22241
+ ]
22242
+ },
22243
+ {
22244
+ type: "struct",
22245
+ name: "vesu::data_model::PairConfig",
22246
+ members: [
22247
+ {
22248
+ name: "max_ltv",
22249
+ type: "core::integer::u64"
22250
+ },
22251
+ {
22252
+ name: "liquidation_factor",
22253
+ type: "core::integer::u64"
22254
+ },
22255
+ {
22256
+ name: "debt_cap",
22257
+ type: "core::integer::u128"
22258
+ }
22259
+ ]
22260
+ },
22261
+ {
22262
+ type: "enum",
22263
+ name: "core::option::Option::<(core::starknet::class_hash::ClassHash, core::array::Span::<core::felt252>)>",
22264
+ variants: [
22265
+ {
22266
+ name: "Some",
22267
+ type: "(core::starknet::class_hash::ClassHash, core::array::Span::<core::felt252>)"
22268
+ },
22269
+ {
22270
+ name: "None",
22271
+ type: "()"
22272
+ }
22273
+ ]
22274
+ },
22275
+ {
22276
+ type: "interface",
22277
+ name: "vesu::pool::IPool",
22278
+ items: [
22279
+ {
22280
+ type: "function",
22281
+ name: "pool_name",
22282
+ inputs: [],
22283
+ outputs: [
22284
+ {
22285
+ type: "core::felt252"
22286
+ }
22287
+ ],
22288
+ state_mutability: "view"
22289
+ },
22290
+ {
22291
+ type: "function",
22292
+ name: "context",
22293
+ inputs: [
22294
+ {
22295
+ name: "collateral_asset",
22296
+ type: "core::starknet::contract_address::ContractAddress"
22297
+ },
22298
+ {
22299
+ name: "debt_asset",
22300
+ type: "core::starknet::contract_address::ContractAddress"
22301
+ },
22302
+ {
22303
+ name: "user",
22304
+ type: "core::starknet::contract_address::ContractAddress"
22305
+ }
22306
+ ],
22307
+ outputs: [
22308
+ {
22309
+ type: "vesu::data_model::Context"
22310
+ }
22311
+ ],
22312
+ state_mutability: "view"
22313
+ },
22314
+ {
22315
+ type: "function",
22316
+ name: "position",
22317
+ inputs: [
22318
+ {
22319
+ name: "collateral_asset",
22320
+ type: "core::starknet::contract_address::ContractAddress"
22321
+ },
22322
+ {
22323
+ name: "debt_asset",
22324
+ type: "core::starknet::contract_address::ContractAddress"
22325
+ },
22326
+ {
22327
+ name: "user",
22328
+ type: "core::starknet::contract_address::ContractAddress"
22329
+ }
22330
+ ],
22331
+ outputs: [
22332
+ {
22333
+ type: "(vesu::data_model::Position, core::integer::u256, core::integer::u256)"
22334
+ }
22335
+ ],
22336
+ state_mutability: "view"
22337
+ },
22338
+ {
22339
+ type: "function",
22340
+ name: "check_collateralization",
22341
+ inputs: [
22342
+ {
22343
+ name: "collateral_asset",
22344
+ type: "core::starknet::contract_address::ContractAddress"
22345
+ },
22346
+ {
22347
+ name: "debt_asset",
22348
+ type: "core::starknet::contract_address::ContractAddress"
22349
+ },
22350
+ {
22351
+ name: "user",
22352
+ type: "core::starknet::contract_address::ContractAddress"
22353
+ }
22354
+ ],
22355
+ outputs: [
22356
+ {
22357
+ type: "(core::bool, core::integer::u256, core::integer::u256)"
22358
+ }
22359
+ ],
22360
+ state_mutability: "view"
22361
+ },
22362
+ {
22363
+ type: "function",
22364
+ name: "check_invariants",
22365
+ inputs: [
22366
+ {
22367
+ name: "collateral_asset",
22368
+ type: "core::starknet::contract_address::ContractAddress"
22369
+ },
22370
+ {
22371
+ name: "debt_asset",
22372
+ type: "core::starknet::contract_address::ContractAddress"
22373
+ },
22374
+ {
22375
+ name: "user",
22376
+ type: "core::starknet::contract_address::ContractAddress"
22377
+ },
22378
+ {
22379
+ name: "collateral_delta",
22380
+ type: "alexandria_math::i257::i257"
22381
+ },
22382
+ {
22383
+ name: "collateral_shares_delta",
22384
+ type: "alexandria_math::i257::i257"
22385
+ },
22386
+ {
22387
+ name: "debt_delta",
22388
+ type: "alexandria_math::i257::i257"
22389
+ },
22390
+ {
22391
+ name: "nominal_debt_delta",
22392
+ type: "alexandria_math::i257::i257"
22393
+ },
22394
+ {
22395
+ name: "is_liquidation",
22396
+ type: "core::bool"
22397
+ }
22398
+ ],
22399
+ outputs: [],
22400
+ state_mutability: "view"
22401
+ },
22402
+ {
22403
+ type: "function",
22404
+ name: "modify_position",
22405
+ inputs: [
22406
+ {
22407
+ name: "params",
22408
+ type: "vesu::data_model::ModifyPositionParams"
22409
+ }
22410
+ ],
22411
+ outputs: [
22412
+ {
22413
+ type: "vesu::data_model::UpdatePositionResponse"
22414
+ }
22415
+ ],
22416
+ state_mutability: "external"
22417
+ },
22418
+ {
22419
+ type: "function",
22420
+ name: "liquidate_position",
22421
+ inputs: [
22422
+ {
22423
+ name: "params",
22424
+ type: "vesu::data_model::LiquidatePositionParams"
22425
+ }
22426
+ ],
22427
+ outputs: [
22428
+ {
22429
+ type: "vesu::data_model::UpdatePositionResponse"
22430
+ }
22431
+ ],
22432
+ state_mutability: "external"
22433
+ },
22434
+ {
22435
+ type: "function",
22436
+ name: "flash_loan",
22437
+ inputs: [
22438
+ {
22439
+ name: "receiver",
22440
+ type: "core::starknet::contract_address::ContractAddress"
22441
+ },
22442
+ {
22443
+ name: "asset",
22444
+ type: "core::starknet::contract_address::ContractAddress"
22445
+ },
22446
+ {
22447
+ name: "amount",
22448
+ type: "core::integer::u256"
22449
+ },
22450
+ {
22451
+ name: "is_legacy",
22452
+ type: "core::bool"
22453
+ },
22454
+ {
22455
+ name: "data",
22456
+ type: "core::array::Span::<core::felt252>"
22457
+ }
22458
+ ],
22459
+ outputs: [],
22460
+ state_mutability: "external"
22461
+ },
22462
+ {
22463
+ type: "function",
22464
+ name: "modify_delegation",
22465
+ inputs: [
22466
+ {
22467
+ name: "delegatee",
22468
+ type: "core::starknet::contract_address::ContractAddress"
22469
+ },
22470
+ {
22471
+ name: "delegation",
22472
+ type: "core::bool"
22473
+ }
22474
+ ],
22475
+ outputs: [],
22476
+ state_mutability: "external"
22477
+ },
22478
+ {
22479
+ type: "function",
22480
+ name: "delegation",
22481
+ inputs: [
22482
+ {
22483
+ name: "delegator",
22484
+ type: "core::starknet::contract_address::ContractAddress"
22485
+ },
22486
+ {
22487
+ name: "delegatee",
22488
+ type: "core::starknet::contract_address::ContractAddress"
22489
+ }
22490
+ ],
22491
+ outputs: [
22492
+ {
22493
+ type: "core::bool"
22494
+ }
22495
+ ],
22496
+ state_mutability: "view"
22497
+ },
22498
+ {
22499
+ type: "function",
22500
+ name: "donate_to_reserve",
22501
+ inputs: [
22502
+ {
22503
+ name: "asset",
22504
+ type: "core::starknet::contract_address::ContractAddress"
22505
+ },
22506
+ {
22507
+ name: "amount",
22508
+ type: "core::integer::u256"
22509
+ }
22510
+ ],
22511
+ outputs: [],
22512
+ state_mutability: "external"
22513
+ },
22514
+ {
22515
+ type: "function",
22516
+ name: "add_asset",
22517
+ inputs: [
22518
+ {
22519
+ name: "params",
22520
+ type: "vesu::data_model::AssetParams"
22521
+ },
22522
+ {
22523
+ name: "interest_rate_config",
22524
+ type: "vesu::interest_rate_model::InterestRateConfig"
22525
+ }
22526
+ ],
22527
+ outputs: [],
22528
+ state_mutability: "external"
22529
+ },
22530
+ {
22531
+ type: "function",
22532
+ name: "set_asset_parameter",
22533
+ inputs: [
22534
+ {
22535
+ name: "asset",
22536
+ type: "core::starknet::contract_address::ContractAddress"
22537
+ },
22538
+ {
22539
+ name: "parameter",
22540
+ type: "core::felt252"
22541
+ },
22542
+ {
22543
+ name: "value",
22544
+ type: "core::integer::u256"
22545
+ }
22546
+ ],
22547
+ outputs: [],
22548
+ state_mutability: "external"
22549
+ },
22550
+ {
22551
+ type: "function",
22552
+ name: "asset_config",
22553
+ inputs: [
22554
+ {
22555
+ name: "asset",
22556
+ type: "core::starknet::contract_address::ContractAddress"
22557
+ }
22558
+ ],
22559
+ outputs: [
22560
+ {
22561
+ type: "vesu::data_model::AssetConfig"
22562
+ }
22563
+ ],
22564
+ state_mutability: "view"
22565
+ },
22566
+ {
22567
+ type: "function",
22568
+ name: "set_oracle",
22569
+ inputs: [
22570
+ {
22571
+ name: "oracle",
22572
+ type: "core::starknet::contract_address::ContractAddress"
22573
+ }
22574
+ ],
22575
+ outputs: [],
22576
+ state_mutability: "external"
22577
+ },
22578
+ {
22579
+ type: "function",
22580
+ name: "oracle",
22581
+ inputs: [],
22582
+ outputs: [
22583
+ {
22584
+ type: "core::starknet::contract_address::ContractAddress"
22585
+ }
22586
+ ],
22587
+ state_mutability: "view"
22588
+ },
22589
+ {
22590
+ type: "function",
22591
+ name: "price",
22592
+ inputs: [
22593
+ {
22594
+ name: "asset",
22595
+ type: "core::starknet::contract_address::ContractAddress"
22596
+ }
22597
+ ],
22598
+ outputs: [
22599
+ {
22600
+ type: "vesu::data_model::AssetPrice"
22601
+ }
22602
+ ],
22603
+ state_mutability: "view"
22604
+ },
22605
+ {
22606
+ type: "function",
22607
+ name: "set_fee_recipient",
22608
+ inputs: [
22609
+ {
22610
+ name: "fee_recipient",
22611
+ type: "core::starknet::contract_address::ContractAddress"
22612
+ }
22613
+ ],
22614
+ outputs: [],
22615
+ state_mutability: "external"
22616
+ },
22617
+ {
22618
+ type: "function",
22619
+ name: "fee_recipient",
22620
+ inputs: [],
22621
+ outputs: [
22622
+ {
22623
+ type: "core::starknet::contract_address::ContractAddress"
22624
+ }
22625
+ ],
22626
+ state_mutability: "view"
22627
+ },
22628
+ {
22629
+ type: "function",
22630
+ name: "claim_fees",
22631
+ inputs: [
22632
+ {
22633
+ name: "asset",
22634
+ type: "core::starknet::contract_address::ContractAddress"
22635
+ },
22636
+ {
22637
+ name: "fee_shares",
22638
+ type: "core::integer::u256"
22639
+ }
22640
+ ],
22641
+ outputs: [],
22642
+ state_mutability: "external"
22643
+ },
22644
+ {
22645
+ type: "function",
22646
+ name: "get_fees",
22647
+ inputs: [
22648
+ {
22649
+ name: "asset",
22650
+ type: "core::starknet::contract_address::ContractAddress"
22651
+ }
22652
+ ],
22653
+ outputs: [
22654
+ {
22655
+ type: "(core::integer::u256, core::integer::u256)"
22656
+ }
22657
+ ],
22658
+ state_mutability: "view"
22659
+ },
22660
+ {
22661
+ type: "function",
22662
+ name: "rate_accumulator",
22663
+ inputs: [
22664
+ {
22665
+ name: "asset",
22666
+ type: "core::starknet::contract_address::ContractAddress"
22667
+ }
22668
+ ],
22669
+ outputs: [
22670
+ {
22671
+ type: "core::integer::u256"
22672
+ }
22673
+ ],
22674
+ state_mutability: "view"
22675
+ },
22676
+ {
22677
+ type: "function",
22678
+ name: "utilization",
22679
+ inputs: [
22680
+ {
22681
+ name: "asset",
22682
+ type: "core::starknet::contract_address::ContractAddress"
22683
+ }
22684
+ ],
22685
+ outputs: [
22686
+ {
22687
+ type: "core::integer::u256"
22688
+ }
22689
+ ],
22690
+ state_mutability: "view"
22691
+ },
22692
+ {
22693
+ type: "function",
22694
+ name: "interest_rate",
22695
+ inputs: [
22696
+ {
22697
+ name: "asset",
22698
+ type: "core::starknet::contract_address::ContractAddress"
22699
+ },
22700
+ {
22701
+ name: "utilization",
22702
+ type: "core::integer::u256"
22703
+ },
22704
+ {
22705
+ name: "last_updated",
22706
+ type: "core::integer::u64"
22707
+ },
22708
+ {
22709
+ name: "last_full_utilization_rate",
22710
+ type: "core::integer::u256"
22711
+ }
22712
+ ],
22713
+ outputs: [
22714
+ {
22715
+ type: "core::integer::u256"
22716
+ }
22717
+ ],
22718
+ state_mutability: "view"
22719
+ },
22720
+ {
22721
+ type: "function",
22722
+ name: "set_interest_rate_parameter",
22723
+ inputs: [
22724
+ {
22725
+ name: "asset",
22726
+ type: "core::starknet::contract_address::ContractAddress"
22727
+ },
22728
+ {
22729
+ name: "parameter",
22730
+ type: "core::felt252"
22731
+ },
22732
+ {
22733
+ name: "value",
22734
+ type: "core::integer::u256"
22735
+ }
22736
+ ],
22737
+ outputs: [],
22738
+ state_mutability: "external"
22739
+ },
22740
+ {
22741
+ type: "function",
22742
+ name: "interest_rate_config",
22743
+ inputs: [
22744
+ {
22745
+ name: "asset",
22746
+ type: "core::starknet::contract_address::ContractAddress"
22747
+ }
22748
+ ],
22749
+ outputs: [
22750
+ {
22751
+ type: "vesu::interest_rate_model::InterestRateConfig"
22752
+ }
22753
+ ],
22754
+ state_mutability: "view"
22755
+ },
22756
+ {
22757
+ type: "function",
22758
+ name: "pairs",
22759
+ inputs: [
22760
+ {
22761
+ name: "collateral_asset",
22762
+ type: "core::starknet::contract_address::ContractAddress"
22763
+ },
22764
+ {
22765
+ name: "debt_asset",
22766
+ type: "core::starknet::contract_address::ContractAddress"
22767
+ }
22768
+ ],
22769
+ outputs: [
22770
+ {
22771
+ type: "vesu::data_model::Pair"
22772
+ }
22773
+ ],
22774
+ state_mutability: "view"
22775
+ },
22776
+ {
22777
+ type: "function",
22778
+ name: "set_pair_config",
22779
+ inputs: [
22780
+ {
22781
+ name: "collateral_asset",
22782
+ type: "core::starknet::contract_address::ContractAddress"
22783
+ },
22784
+ {
22785
+ name: "debt_asset",
22786
+ type: "core::starknet::contract_address::ContractAddress"
22787
+ },
22788
+ {
22789
+ name: "pair_config",
22790
+ type: "vesu::data_model::PairConfig"
22791
+ }
22792
+ ],
22793
+ outputs: [],
22794
+ state_mutability: "external"
22795
+ },
22796
+ {
22797
+ type: "function",
22798
+ name: "set_pair_parameter",
22799
+ inputs: [
22800
+ {
22801
+ name: "collateral_asset",
22802
+ type: "core::starknet::contract_address::ContractAddress"
22803
+ },
22804
+ {
22805
+ name: "debt_asset",
22806
+ type: "core::starknet::contract_address::ContractAddress"
22807
+ },
22808
+ {
22809
+ name: "parameter",
22810
+ type: "core::felt252"
22811
+ },
22812
+ {
22813
+ name: "value",
22814
+ type: "core::integer::u128"
22815
+ }
22816
+ ],
22817
+ outputs: [],
22818
+ state_mutability: "external"
22819
+ },
22820
+ {
22821
+ type: "function",
22822
+ name: "pair_config",
22823
+ inputs: [
22824
+ {
22825
+ name: "collateral_asset",
22826
+ type: "core::starknet::contract_address::ContractAddress"
22827
+ },
22828
+ {
22829
+ name: "debt_asset",
22830
+ type: "core::starknet::contract_address::ContractAddress"
22831
+ }
22832
+ ],
22833
+ outputs: [
22834
+ {
22835
+ type: "vesu::data_model::PairConfig"
22836
+ }
22837
+ ],
22838
+ state_mutability: "view"
22839
+ },
22840
+ {
22841
+ type: "function",
22842
+ name: "calculate_debt",
22843
+ inputs: [
22844
+ {
22845
+ name: "nominal_debt",
22846
+ type: "alexandria_math::i257::i257"
22847
+ },
22848
+ {
22849
+ name: "rate_accumulator",
22850
+ type: "core::integer::u256"
22851
+ },
22852
+ {
22853
+ name: "asset_scale",
22854
+ type: "core::integer::u256"
22855
+ }
22856
+ ],
22857
+ outputs: [
22858
+ {
22859
+ type: "core::integer::u256"
22860
+ }
22861
+ ],
22862
+ state_mutability: "view"
22863
+ },
22864
+ {
22865
+ type: "function",
22866
+ name: "calculate_nominal_debt",
22867
+ inputs: [
22868
+ {
22869
+ name: "debt",
22870
+ type: "alexandria_math::i257::i257"
22871
+ },
22872
+ {
22873
+ name: "rate_accumulator",
22874
+ type: "core::integer::u256"
22875
+ },
22876
+ {
22877
+ name: "asset_scale",
22878
+ type: "core::integer::u256"
22879
+ }
22880
+ ],
22881
+ outputs: [
22882
+ {
22883
+ type: "core::integer::u256"
22884
+ }
22885
+ ],
22886
+ state_mutability: "view"
22887
+ },
22888
+ {
22889
+ type: "function",
22890
+ name: "calculate_collateral_shares",
22891
+ inputs: [
22892
+ {
22893
+ name: "asset",
22894
+ type: "core::starknet::contract_address::ContractAddress"
22895
+ },
22896
+ {
22897
+ name: "collateral",
22898
+ type: "alexandria_math::i257::i257"
22899
+ }
22900
+ ],
22901
+ outputs: [
22902
+ {
22903
+ type: "core::integer::u256"
22904
+ }
22905
+ ],
22906
+ state_mutability: "view"
22907
+ },
22908
+ {
22909
+ type: "function",
22910
+ name: "calculate_collateral",
22911
+ inputs: [
22912
+ {
22913
+ name: "asset",
22914
+ type: "core::starknet::contract_address::ContractAddress"
22915
+ },
22916
+ {
22917
+ name: "collateral_shares",
22918
+ type: "alexandria_math::i257::i257"
22919
+ }
22920
+ ],
22921
+ outputs: [
22922
+ {
22923
+ type: "core::integer::u256"
22924
+ }
22925
+ ],
22926
+ state_mutability: "view"
22927
+ },
22928
+ {
22929
+ type: "function",
22930
+ name: "deconstruct_collateral_amount",
22931
+ inputs: [
22932
+ {
22933
+ name: "collateral_asset",
22934
+ type: "core::starknet::contract_address::ContractAddress"
22935
+ },
22936
+ {
22937
+ name: "debt_asset",
22938
+ type: "core::starknet::contract_address::ContractAddress"
22939
+ },
22940
+ {
22941
+ name: "user",
22942
+ type: "core::starknet::contract_address::ContractAddress"
22943
+ },
22944
+ {
22945
+ name: "collateral",
22946
+ type: "vesu::data_model::Amount"
22947
+ }
22948
+ ],
22949
+ outputs: [
22950
+ {
22951
+ type: "(alexandria_math::i257::i257, alexandria_math::i257::i257)"
22952
+ }
22953
+ ],
22954
+ state_mutability: "view"
22955
+ },
22956
+ {
22957
+ type: "function",
22958
+ name: "deconstruct_debt_amount",
22959
+ inputs: [
22960
+ {
22961
+ name: "collateral_asset",
22962
+ type: "core::starknet::contract_address::ContractAddress"
22963
+ },
22964
+ {
22965
+ name: "debt_asset",
22966
+ type: "core::starknet::contract_address::ContractAddress"
22967
+ },
22968
+ {
22969
+ name: "user",
22970
+ type: "core::starknet::contract_address::ContractAddress"
22971
+ },
22972
+ {
22973
+ name: "debt",
22974
+ type: "vesu::data_model::Amount"
22975
+ }
22976
+ ],
22977
+ outputs: [
22978
+ {
22979
+ type: "(alexandria_math::i257::i257, alexandria_math::i257::i257)"
22980
+ }
22981
+ ],
22982
+ state_mutability: "view"
22983
+ },
22984
+ {
22985
+ type: "function",
22986
+ name: "curator",
22987
+ inputs: [],
22988
+ outputs: [
22989
+ {
22990
+ type: "core::starknet::contract_address::ContractAddress"
22991
+ }
22992
+ ],
22993
+ state_mutability: "view"
22994
+ },
22995
+ {
22996
+ type: "function",
22997
+ name: "pending_curator",
22998
+ inputs: [],
22999
+ outputs: [
23000
+ {
23001
+ type: "core::starknet::contract_address::ContractAddress"
23002
+ }
23003
+ ],
23004
+ state_mutability: "view"
23005
+ },
23006
+ {
23007
+ type: "function",
23008
+ name: "nominate_curator",
23009
+ inputs: [
23010
+ {
23011
+ name: "pending_curator",
23012
+ type: "core::starknet::contract_address::ContractAddress"
23013
+ }
23014
+ ],
23015
+ outputs: [],
23016
+ state_mutability: "external"
23017
+ },
23018
+ {
23019
+ type: "function",
23020
+ name: "accept_curator_ownership",
23021
+ inputs: [],
23022
+ outputs: [],
23023
+ state_mutability: "external"
23024
+ },
23025
+ {
23026
+ type: "function",
23027
+ name: "set_pausing_agent",
23028
+ inputs: [
23029
+ {
23030
+ name: "pausing_agent",
23031
+ type: "core::starknet::contract_address::ContractAddress"
23032
+ }
23033
+ ],
23034
+ outputs: [],
23035
+ state_mutability: "external"
23036
+ },
23037
+ {
23038
+ type: "function",
23039
+ name: "pausing_agent",
23040
+ inputs: [],
23041
+ outputs: [
23042
+ {
23043
+ type: "core::starknet::contract_address::ContractAddress"
23044
+ }
23045
+ ],
23046
+ state_mutability: "view"
23047
+ },
23048
+ {
23049
+ type: "function",
23050
+ name: "pause",
23051
+ inputs: [],
23052
+ outputs: [],
23053
+ state_mutability: "external"
23054
+ },
23055
+ {
23056
+ type: "function",
23057
+ name: "unpause",
23058
+ inputs: [],
23059
+ outputs: [],
23060
+ state_mutability: "external"
23061
+ },
23062
+ {
23063
+ type: "function",
23064
+ name: "is_paused",
23065
+ inputs: [],
23066
+ outputs: [
23067
+ {
23068
+ type: "core::bool"
23069
+ }
23070
+ ],
23071
+ state_mutability: "view"
23072
+ },
23073
+ {
23074
+ type: "function",
23075
+ name: "upgrade_name",
23076
+ inputs: [],
23077
+ outputs: [
23078
+ {
23079
+ type: "core::felt252"
23080
+ }
23081
+ ],
23082
+ state_mutability: "view"
23083
+ },
23084
+ {
23085
+ type: "function",
23086
+ name: "upgrade",
23087
+ inputs: [
23088
+ {
23089
+ name: "new_implementation",
23090
+ type: "core::starknet::class_hash::ClassHash"
23091
+ },
23092
+ {
23093
+ name: "eic_implementation_data",
23094
+ type: "core::option::Option::<(core::starknet::class_hash::ClassHash, core::array::Span::<core::felt252>)>"
23095
+ }
23096
+ ],
23097
+ outputs: [],
23098
+ state_mutability: "external"
23099
+ }
23100
+ ]
23101
+ },
23102
+ {
23103
+ type: "impl",
23104
+ name: "OwnableTwoStepImpl",
23105
+ interface_name: "openzeppelin_access::ownable::interface::IOwnableTwoStep"
23106
+ },
23107
+ {
23108
+ type: "interface",
23109
+ name: "openzeppelin_access::ownable::interface::IOwnableTwoStep",
23110
+ items: [
23111
+ {
23112
+ type: "function",
23113
+ name: "owner",
23114
+ inputs: [],
23115
+ outputs: [
23116
+ {
23117
+ type: "core::starknet::contract_address::ContractAddress"
23118
+ }
23119
+ ],
23120
+ state_mutability: "view"
23121
+ },
23122
+ {
23123
+ type: "function",
23124
+ name: "pending_owner",
23125
+ inputs: [],
23126
+ outputs: [
23127
+ {
23128
+ type: "core::starknet::contract_address::ContractAddress"
23129
+ }
23130
+ ],
23131
+ state_mutability: "view"
23132
+ },
23133
+ {
23134
+ type: "function",
23135
+ name: "accept_ownership",
23136
+ inputs: [],
23137
+ outputs: [],
23138
+ state_mutability: "external"
23139
+ },
23140
+ {
23141
+ type: "function",
23142
+ name: "transfer_ownership",
23143
+ inputs: [
23144
+ {
23145
+ name: "new_owner",
23146
+ type: "core::starknet::contract_address::ContractAddress"
23147
+ }
23148
+ ],
23149
+ outputs: [],
23150
+ state_mutability: "external"
23151
+ },
23152
+ {
23153
+ type: "function",
23154
+ name: "renounce_ownership",
23155
+ inputs: [],
23156
+ outputs: [],
23157
+ state_mutability: "external"
23158
+ }
23159
+ ]
23160
+ },
23161
+ {
23162
+ type: "constructor",
23163
+ name: "constructor",
23164
+ inputs: [
23165
+ {
23166
+ name: "name",
23167
+ type: "core::felt252"
23168
+ },
23169
+ {
23170
+ name: "owner",
23171
+ type: "core::starknet::contract_address::ContractAddress"
23172
+ },
23173
+ {
23174
+ name: "curator",
23175
+ type: "core::starknet::contract_address::ContractAddress"
23176
+ },
23177
+ {
23178
+ name: "oracle",
23179
+ type: "core::starknet::contract_address::ContractAddress"
23180
+ }
23181
+ ]
23182
+ },
23183
+ {
23184
+ type: "event",
23185
+ name: "openzeppelin_access::ownable::ownable::OwnableComponent::OwnershipTransferred",
23186
+ kind: "struct",
23187
+ members: [
23188
+ {
23189
+ name: "previous_owner",
23190
+ type: "core::starknet::contract_address::ContractAddress",
23191
+ kind: "key"
23192
+ },
23193
+ {
23194
+ name: "new_owner",
23195
+ type: "core::starknet::contract_address::ContractAddress",
23196
+ kind: "key"
23197
+ }
23198
+ ]
23199
+ },
23200
+ {
23201
+ type: "event",
23202
+ name: "openzeppelin_access::ownable::ownable::OwnableComponent::OwnershipTransferStarted",
23203
+ kind: "struct",
23204
+ members: [
23205
+ {
23206
+ name: "previous_owner",
23207
+ type: "core::starknet::contract_address::ContractAddress",
23208
+ kind: "key"
23209
+ },
23210
+ {
23211
+ name: "new_owner",
23212
+ type: "core::starknet::contract_address::ContractAddress",
23213
+ kind: "key"
23214
+ }
23215
+ ]
23216
+ },
23217
+ {
23218
+ type: "event",
23219
+ name: "openzeppelin_access::ownable::ownable::OwnableComponent::Event",
23220
+ kind: "enum",
23221
+ variants: [
23222
+ {
23223
+ name: "OwnershipTransferred",
23224
+ type: "openzeppelin_access::ownable::ownable::OwnableComponent::OwnershipTransferred",
23225
+ kind: "nested"
23226
+ },
23227
+ {
23228
+ name: "OwnershipTransferStarted",
23229
+ type: "openzeppelin_access::ownable::ownable::OwnableComponent::OwnershipTransferStarted",
23230
+ kind: "nested"
23231
+ }
23232
+ ]
23233
+ },
23234
+ {
23235
+ type: "event",
23236
+ name: "vesu::interest_rate_model::interest_rate_model_component::SetInterestRateConfig",
23237
+ kind: "struct",
23238
+ members: [
23239
+ {
23240
+ name: "asset",
23241
+ type: "core::starknet::contract_address::ContractAddress",
23242
+ kind: "data"
23243
+ },
23244
+ {
23245
+ name: "interest_rate_config",
23246
+ type: "vesu::interest_rate_model::InterestRateConfig",
23247
+ kind: "data"
23248
+ }
23249
+ ]
23250
+ },
23251
+ {
23252
+ type: "event",
23253
+ name: "vesu::interest_rate_model::interest_rate_model_component::Event",
23254
+ kind: "enum",
23255
+ variants: [
23256
+ {
23257
+ name: "SetInterestRateConfig",
23258
+ type: "vesu::interest_rate_model::interest_rate_model_component::SetInterestRateConfig",
23259
+ kind: "nested"
23260
+ }
23261
+ ]
23262
+ },
23263
+ {
23264
+ type: "event",
23265
+ name: "vesu::pool::Pool::UpdateContext",
23266
+ kind: "struct",
23267
+ members: [
23268
+ {
23269
+ name: "collateral_asset",
23270
+ type: "core::starknet::contract_address::ContractAddress",
23271
+ kind: "key"
23272
+ },
23273
+ {
23274
+ name: "debt_asset",
23275
+ type: "core::starknet::contract_address::ContractAddress",
23276
+ kind: "key"
23277
+ },
23278
+ {
23279
+ name: "collateral_asset_config",
23280
+ type: "vesu::data_model::AssetConfig",
23281
+ kind: "data"
23282
+ },
23283
+ {
23284
+ name: "debt_asset_config",
23285
+ type: "vesu::data_model::AssetConfig",
23286
+ kind: "data"
23287
+ },
23288
+ {
23289
+ name: "collateral_asset_price",
23290
+ type: "vesu::data_model::AssetPrice",
23291
+ kind: "data"
23292
+ },
23293
+ {
23294
+ name: "debt_asset_price",
23295
+ type: "vesu::data_model::AssetPrice",
23296
+ kind: "data"
23297
+ }
23298
+ ]
23299
+ },
23300
+ {
23301
+ type: "event",
23302
+ name: "vesu::pool::Pool::ModifyPosition",
23303
+ kind: "struct",
23304
+ members: [
23305
+ {
23306
+ name: "collateral_asset",
23307
+ type: "core::starknet::contract_address::ContractAddress",
23308
+ kind: "key"
23309
+ },
23310
+ {
23311
+ name: "debt_asset",
23312
+ type: "core::starknet::contract_address::ContractAddress",
23313
+ kind: "key"
23314
+ },
23315
+ {
23316
+ name: "user",
23317
+ type: "core::starknet::contract_address::ContractAddress",
23318
+ kind: "key"
23319
+ },
23320
+ {
23321
+ name: "collateral_delta",
23322
+ type: "alexandria_math::i257::i257",
23323
+ kind: "data"
23324
+ },
23325
+ {
23326
+ name: "collateral_shares_delta",
23327
+ type: "alexandria_math::i257::i257",
23328
+ kind: "data"
23329
+ },
23330
+ {
23331
+ name: "debt_delta",
23332
+ type: "alexandria_math::i257::i257",
23333
+ kind: "data"
23334
+ },
23335
+ {
23336
+ name: "nominal_debt_delta",
23337
+ type: "alexandria_math::i257::i257",
23338
+ kind: "data"
23339
+ }
23340
+ ]
23341
+ },
23342
+ {
23343
+ type: "event",
23344
+ name: "vesu::pool::Pool::LiquidatePosition",
23345
+ kind: "struct",
23346
+ members: [
23347
+ {
23348
+ name: "collateral_asset",
23349
+ type: "core::starknet::contract_address::ContractAddress",
23350
+ kind: "key"
23351
+ },
23352
+ {
23353
+ name: "debt_asset",
23354
+ type: "core::starknet::contract_address::ContractAddress",
23355
+ kind: "key"
23356
+ },
23357
+ {
23358
+ name: "user",
23359
+ type: "core::starknet::contract_address::ContractAddress",
23360
+ kind: "key"
23361
+ },
23362
+ {
23363
+ name: "liquidator",
23364
+ type: "core::starknet::contract_address::ContractAddress",
23365
+ kind: "key"
23366
+ },
23367
+ {
23368
+ name: "collateral_delta",
23369
+ type: "alexandria_math::i257::i257",
23370
+ kind: "data"
23371
+ },
23372
+ {
23373
+ name: "collateral_shares_delta",
23374
+ type: "alexandria_math::i257::i257",
23375
+ kind: "data"
23376
+ },
23377
+ {
23378
+ name: "debt_delta",
23379
+ type: "alexandria_math::i257::i257",
23380
+ kind: "data"
23381
+ },
23382
+ {
23383
+ name: "nominal_debt_delta",
23384
+ type: "alexandria_math::i257::i257",
23385
+ kind: "data"
23386
+ },
23387
+ {
23388
+ name: "bad_debt",
23389
+ type: "core::integer::u256",
23390
+ kind: "data"
23391
+ }
23392
+ ]
23393
+ },
23394
+ {
23395
+ type: "event",
23396
+ name: "vesu::pool::Pool::Flashloan",
23397
+ kind: "struct",
23398
+ members: [
23399
+ {
23400
+ name: "sender",
23401
+ type: "core::starknet::contract_address::ContractAddress",
23402
+ kind: "key"
23403
+ },
23404
+ {
23405
+ name: "receiver",
23406
+ type: "core::starknet::contract_address::ContractAddress",
23407
+ kind: "key"
23408
+ },
23409
+ {
23410
+ name: "asset",
23411
+ type: "core::starknet::contract_address::ContractAddress",
23412
+ kind: "key"
23413
+ },
23414
+ {
23415
+ name: "amount",
23416
+ type: "core::integer::u256",
23417
+ kind: "data"
23418
+ }
23419
+ ]
23420
+ },
23421
+ {
23422
+ type: "event",
23423
+ name: "vesu::pool::Pool::ModifyDelegation",
23424
+ kind: "struct",
23425
+ members: [
23426
+ {
23427
+ name: "delegator",
23428
+ type: "core::starknet::contract_address::ContractAddress",
23429
+ kind: "key"
23430
+ },
23431
+ {
23432
+ name: "delegatee",
23433
+ type: "core::starknet::contract_address::ContractAddress",
23434
+ kind: "key"
23435
+ },
23436
+ {
23437
+ name: "delegation",
23438
+ type: "core::bool",
23439
+ kind: "data"
23440
+ }
23441
+ ]
23442
+ },
23443
+ {
23444
+ type: "event",
23445
+ name: "vesu::pool::Pool::Donate",
23446
+ kind: "struct",
23447
+ members: [
23448
+ {
23449
+ name: "asset",
23450
+ type: "core::starknet::contract_address::ContractAddress",
23451
+ kind: "key"
23452
+ },
23453
+ {
23454
+ name: "amount",
23455
+ type: "core::integer::u256",
23456
+ kind: "data"
23457
+ }
23458
+ ]
23459
+ },
23460
+ {
23461
+ type: "event",
23462
+ name: "vesu::pool::Pool::SetAssetConfig",
23463
+ kind: "struct",
23464
+ members: [
23465
+ {
23466
+ name: "asset",
23467
+ type: "core::starknet::contract_address::ContractAddress",
23468
+ kind: "key"
23469
+ },
23470
+ {
23471
+ name: "asset_config",
23472
+ type: "vesu::data_model::AssetConfig",
23473
+ kind: "data"
23474
+ }
23475
+ ]
23476
+ },
23477
+ {
23478
+ type: "event",
23479
+ name: "vesu::pool::Pool::SetOracle",
23480
+ kind: "struct",
23481
+ members: [
23482
+ {
23483
+ name: "oracle",
23484
+ type: "core::starknet::contract_address::ContractAddress",
23485
+ kind: "data"
23486
+ }
23487
+ ]
23488
+ },
23489
+ {
23490
+ type: "event",
23491
+ name: "vesu::pool::Pool::SetPairConfig",
23492
+ kind: "struct",
23493
+ members: [
23494
+ {
23495
+ name: "collateral_asset",
23496
+ type: "core::starknet::contract_address::ContractAddress",
23497
+ kind: "key"
23498
+ },
23499
+ {
23500
+ name: "debt_asset",
23501
+ type: "core::starknet::contract_address::ContractAddress",
23502
+ kind: "key"
23503
+ },
23504
+ {
23505
+ name: "pair_config",
23506
+ type: "vesu::data_model::PairConfig",
23507
+ kind: "data"
23508
+ }
23509
+ ]
23510
+ },
23511
+ {
23512
+ type: "event",
23513
+ name: "vesu::pool::Pool::ClaimFees",
23514
+ kind: "struct",
23515
+ members: [
23516
+ {
23517
+ name: "asset",
23518
+ type: "core::starknet::contract_address::ContractAddress",
23519
+ kind: "key"
23520
+ },
23521
+ {
23522
+ name: "recipient",
23523
+ type: "core::starknet::contract_address::ContractAddress",
23524
+ kind: "data"
23525
+ },
23526
+ {
23527
+ name: "fee_shares",
23528
+ type: "core::integer::u256",
23529
+ kind: "data"
23530
+ },
23531
+ {
23532
+ name: "fee_amount",
23533
+ type: "core::integer::u256",
23534
+ kind: "data"
23535
+ }
23536
+ ]
23537
+ },
23538
+ {
23539
+ type: "event",
23540
+ name: "vesu::pool::Pool::SetFeeRecipient",
23541
+ kind: "struct",
23542
+ members: [
23543
+ {
23544
+ name: "fee_recipient",
23545
+ type: "core::starknet::contract_address::ContractAddress",
23546
+ kind: "key"
23547
+ }
23548
+ ]
23549
+ },
23550
+ {
23551
+ type: "event",
23552
+ name: "vesu::pool::Pool::SetPausingAgent",
23553
+ kind: "struct",
23554
+ members: [
23555
+ {
23556
+ name: "agent",
23557
+ type: "core::starknet::contract_address::ContractAddress",
23558
+ kind: "key"
23559
+ }
23560
+ ]
23561
+ },
23562
+ {
23563
+ type: "event",
23564
+ name: "vesu::pool::Pool::SetCurator",
23565
+ kind: "struct",
23566
+ members: [
23567
+ {
23568
+ name: "curator",
23569
+ type: "core::starknet::contract_address::ContractAddress",
23570
+ kind: "key"
23571
+ }
23572
+ ]
23573
+ },
23574
+ {
23575
+ type: "event",
23576
+ name: "vesu::pool::Pool::NominateCurator",
23577
+ kind: "struct",
23578
+ members: [
23579
+ {
23580
+ name: "pending_curator",
23581
+ type: "core::starknet::contract_address::ContractAddress",
23582
+ kind: "key"
23583
+ }
23584
+ ]
23585
+ },
23586
+ {
23587
+ type: "event",
23588
+ name: "vesu::pool::Pool::ContractPaused",
23589
+ kind: "struct",
23590
+ members: [
23591
+ {
23592
+ name: "account",
23593
+ type: "core::starknet::contract_address::ContractAddress",
23594
+ kind: "data"
23595
+ }
23596
+ ]
23597
+ },
23598
+ {
23599
+ type: "event",
23600
+ name: "vesu::pool::Pool::ContractUnpaused",
23601
+ kind: "struct",
23602
+ members: [
23603
+ {
23604
+ name: "account",
23605
+ type: "core::starknet::contract_address::ContractAddress",
23606
+ kind: "data"
23607
+ }
23608
+ ]
23609
+ },
23610
+ {
23611
+ type: "event",
23612
+ name: "vesu::pool::Pool::ContractUpgraded",
23613
+ kind: "struct",
23614
+ members: [
23615
+ {
23616
+ name: "new_implementation",
23617
+ type: "core::starknet::class_hash::ClassHash",
23618
+ kind: "data"
23619
+ }
23620
+ ]
23621
+ },
23622
+ {
23623
+ type: "event",
23624
+ name: "vesu::pool::Pool::Event",
23625
+ kind: "enum",
23626
+ variants: [
23627
+ {
23628
+ name: "OwnableEvent",
23629
+ type: "openzeppelin_access::ownable::ownable::OwnableComponent::Event",
23630
+ kind: "flat"
23631
+ },
23632
+ {
23633
+ name: "InterestRateModelEvents",
23634
+ type: "vesu::interest_rate_model::interest_rate_model_component::Event",
23635
+ kind: "nested"
23636
+ },
23637
+ {
23638
+ name: "UpdateContext",
23639
+ type: "vesu::pool::Pool::UpdateContext",
23640
+ kind: "nested"
23641
+ },
23642
+ {
23643
+ name: "ModifyPosition",
23644
+ type: "vesu::pool::Pool::ModifyPosition",
23645
+ kind: "nested"
23646
+ },
23647
+ {
23648
+ name: "LiquidatePosition",
23649
+ type: "vesu::pool::Pool::LiquidatePosition",
23650
+ kind: "nested"
23651
+ },
23652
+ {
23653
+ name: "Flashloan",
23654
+ type: "vesu::pool::Pool::Flashloan",
23655
+ kind: "nested"
23656
+ },
23657
+ {
23658
+ name: "ModifyDelegation",
23659
+ type: "vesu::pool::Pool::ModifyDelegation",
23660
+ kind: "nested"
23661
+ },
23662
+ {
23663
+ name: "Donate",
23664
+ type: "vesu::pool::Pool::Donate",
23665
+ kind: "nested"
23666
+ },
23667
+ {
23668
+ name: "SetAssetConfig",
23669
+ type: "vesu::pool::Pool::SetAssetConfig",
23670
+ kind: "nested"
23671
+ },
23672
+ {
23673
+ name: "SetOracle",
23674
+ type: "vesu::pool::Pool::SetOracle",
23675
+ kind: "nested"
23676
+ },
23677
+ {
23678
+ name: "SetPairConfig",
23679
+ type: "vesu::pool::Pool::SetPairConfig",
23680
+ kind: "nested"
23681
+ },
23682
+ {
23683
+ name: "ClaimFees",
23684
+ type: "vesu::pool::Pool::ClaimFees",
23685
+ kind: "nested"
23686
+ },
23687
+ {
23688
+ name: "SetFeeRecipient",
23689
+ type: "vesu::pool::Pool::SetFeeRecipient",
23690
+ kind: "nested"
23691
+ },
23692
+ {
23693
+ name: "SetPausingAgent",
23694
+ type: "vesu::pool::Pool::SetPausingAgent",
23695
+ kind: "nested"
23696
+ },
23697
+ {
23698
+ name: "SetCurator",
23699
+ type: "vesu::pool::Pool::SetCurator",
23700
+ kind: "nested"
23701
+ },
23702
+ {
23703
+ name: "NominateCurator",
23704
+ type: "vesu::pool::Pool::NominateCurator",
23705
+ kind: "nested"
23706
+ },
23707
+ {
23708
+ name: "ContractPaused",
23709
+ type: "vesu::pool::Pool::ContractPaused",
23710
+ kind: "nested"
23711
+ },
23712
+ {
23713
+ name: "ContractUnpaused",
23714
+ type: "vesu::pool::Pool::ContractUnpaused",
23715
+ kind: "nested"
23716
+ },
23717
+ {
23718
+ name: "ContractUpgraded",
23719
+ type: "vesu::pool::Pool::ContractUpgraded",
23720
+ kind: "nested"
23721
+ }
23722
+ ]
23723
+ }
23724
+ ];
23725
+
23726
+ // src/strategies/universal-adapters/vesu-adapter.ts
23727
+ var VesuAmountType = /* @__PURE__ */ ((VesuAmountType2) => {
23728
+ VesuAmountType2[VesuAmountType2["Delta"] = 0] = "Delta";
23729
+ VesuAmountType2[VesuAmountType2["Target"] = 1] = "Target";
23730
+ return VesuAmountType2;
23731
+ })(VesuAmountType || {});
23732
+ var VesuAmountDenomination = /* @__PURE__ */ ((VesuAmountDenomination2) => {
23733
+ VesuAmountDenomination2[VesuAmountDenomination2["Native"] = 0] = "Native";
23734
+ VesuAmountDenomination2[VesuAmountDenomination2["Assets"] = 1] = "Assets";
23735
+ return VesuAmountDenomination2;
23736
+ })(VesuAmountDenomination || {});
23737
+ function getVesuMultiplyParams(isIncrease, params) {
23738
+ if (isIncrease) {
23739
+ const _params2 = params;
23740
+ return {
23741
+ action: new CairoCustomEnum2({ IncreaseLever: {
23742
+ pool_id: _params2.pool_id.toBigInt(),
23743
+ collateral_asset: _params2.collateral_asset.toBigInt(),
23744
+ debt_asset: _params2.debt_asset.toBigInt(),
23745
+ user: _params2.user.toBigInt(),
23746
+ add_margin: BigInt(_params2.add_margin.toWei()),
23747
+ margin_swap: _params2.margin_swap.map((swap) => ({
23748
+ route: swap.route.map((route) => ({
23749
+ pool_key: {
23750
+ token0: route.pool_key.token0.toBigInt(),
23751
+ token1: route.pool_key.token1.toBigInt(),
23752
+ fee: route.pool_key.fee,
23753
+ tick_spacing: route.pool_key.tick_spacing,
23754
+ extension: BigInt(num8.hexToDecimalString(route.pool_key.extension))
23755
+ },
23756
+ sqrt_ratio_limit: uint2567.bnToUint256(route.sqrt_ratio_limit.toWei()),
23757
+ skip_ahead: BigInt(100)
23758
+ })),
23759
+ token_amount: {
23760
+ token: swap.token_amount.token.toBigInt(),
23761
+ amount: swap.token_amount.amount.toI129()
23762
+ }
23763
+ })),
23764
+ margin_swap_limit_amount: BigInt(_params2.margin_swap_limit_amount.toWei()),
23765
+ lever_swap: _params2.lever_swap.map((swap) => ({
23766
+ route: swap.route.map((route) => ({
23767
+ pool_key: {
23768
+ token0: route.pool_key.token0.toBigInt(),
23769
+ token1: route.pool_key.token1.toBigInt(),
23770
+ fee: route.pool_key.fee,
23771
+ tick_spacing: route.pool_key.tick_spacing,
23772
+ extension: BigInt(num8.hexToDecimalString(route.pool_key.extension))
23773
+ },
23774
+ sqrt_ratio_limit: uint2567.bnToUint256(route.sqrt_ratio_limit.toWei()),
23775
+ skip_ahead: BigInt(100)
23776
+ })),
23777
+ token_amount: {
23778
+ token: swap.token_amount.token.toBigInt(),
23779
+ amount: swap.token_amount.amount.toI129()
23780
+ }
23781
+ })),
23782
+ lever_swap_limit_amount: BigInt(_params2.lever_swap_limit_amount.toWei())
23783
+ } })
23784
+ };
23785
+ }
23786
+ const _params = params;
23787
+ return {
23788
+ action: new CairoCustomEnum2({ DecreaseLever: {
23789
+ pool_id: _params.pool_id.toBigInt(),
23790
+ collateral_asset: _params.collateral_asset.toBigInt(),
23791
+ debt_asset: _params.debt_asset.toBigInt(),
23792
+ user: _params.user.toBigInt(),
23793
+ sub_margin: BigInt(_params.sub_margin.toWei()),
23794
+ recipient: _params.recipient.toBigInt(),
23795
+ lever_swap: _params.lever_swap.map((swap) => ({
23796
+ route: swap.route.map((route) => ({
23797
+ pool_key: {
23798
+ token0: route.pool_key.token0.toBigInt(),
23799
+ token1: route.pool_key.token1.toBigInt(),
23800
+ fee: route.pool_key.fee,
23801
+ tick_spacing: route.pool_key.tick_spacing,
23802
+ extension: ContractAddr.from(route.pool_key.extension).toBigInt()
23803
+ },
23804
+ sqrt_ratio_limit: uint2567.bnToUint256(route.sqrt_ratio_limit.toWei()),
23805
+ skip_ahead: BigInt(route.skip_ahead.toWei())
23806
+ })),
23807
+ token_amount: {
23808
+ token: swap.token_amount.token.toBigInt(),
23809
+ amount: swap.token_amount.amount.toI129()
23810
+ }
23811
+ })),
23812
+ lever_swap_limit_amount: BigInt(_params.lever_swap_limit_amount.toWei()),
23813
+ lever_swap_weights: _params.lever_swap_weights.map((weight) => BigInt(weight.toWei())),
23814
+ withdraw_swap: _params.withdraw_swap.map((swap) => ({
23815
+ route: swap.route.map((route) => ({
23816
+ pool_key: {
23817
+ token0: route.pool_key.token0.toBigInt(),
23818
+ token1: route.pool_key.token1.toBigInt(),
23819
+ fee: route.pool_key.fee,
23820
+ tick_spacing: route.pool_key.tick_spacing,
23821
+ extension: ContractAddr.from(route.pool_key.extension).toBigInt()
23822
+ },
23823
+ sqrt_ratio_limit: uint2567.bnToUint256(route.sqrt_ratio_limit.toWei()),
23824
+ skip_ahead: BigInt(route.skip_ahead.toWei())
23825
+ })),
23826
+ token_amount: {
23827
+ token: swap.token_amount.token.toBigInt(),
23828
+ amount: swap.token_amount.amount.toI129()
23829
+ }
23830
+ })),
23831
+ withdraw_swap_limit_amount: BigInt(_params.withdraw_swap_limit_amount.toWei()),
23832
+ withdraw_swap_weights: _params.withdraw_swap_weights.map((weight) => BigInt(weight.toWei())),
23833
+ close_position: _params.close_position
23834
+ } })
23835
+ };
23836
+ }
23837
+ var VesuPools = {
23838
+ Genesis: ContractAddr.from("0x4dc4f0ca6ea4961e4c8373265bfd5317678f4fe374d76f3fd7135f57763bf28"),
23839
+ Re7xSTRK: ContractAddr.from("0x052fb52363939c3aa848f8f4ac28f0a51379f8d1b971d8444de25fbd77d8f161"),
23840
+ Re7xBTC: ContractAddr.from("0x3a8416bf20d036df5b1cf3447630a2e1cb04685f6b0c3a70ed7fb1473548ecf")
23841
+ };
23842
+ function getVesuSingletonAddress(vesuPool) {
23843
+ if (vesuPool.eq(VesuPools.Genesis) || vesuPool.eq(VesuPools.Re7xSTRK)) {
23844
+ return { addr: VESU_SINGLETON, isV2: false };
23845
+ }
23846
+ return { addr: vesuPool, isV2: true };
23847
+ }
23848
+ var VesuAdapter = class _VesuAdapter extends BaseAdapter {
23849
+ constructor(config) {
23850
+ super();
23851
+ this.VESU_MULTIPLY = ContractAddr.from("0x027fef272d0a9a3844767c851a64b36fe4f0115141d81134baade95d2b27b781");
23852
+ this.getModifyPosition = () => {
23853
+ const positionData = [0n];
23854
+ const packedArguments = [
23855
+ toBigInt(this.config.poolId.toString()),
23856
+ // pool id
23857
+ toBigInt(this.config.collateral.address.toString()),
23858
+ // collateral
23859
+ toBigInt(this.config.debt.address.toString()),
23860
+ // debt
23861
+ toBigInt(this.config.vaultAllocator.toString()),
23862
+ // vault allocator
23863
+ toBigInt(positionData.length),
23864
+ ...positionData
23865
+ ];
23866
+ const output = this.constructSimpleLeafData({
23867
+ id: this.config.id,
23868
+ target: getVesuSingletonAddress(this.config.poolId).addr,
23869
+ method: "modify_position",
23870
+ packedArguments
23871
+ });
23872
+ return { leaf: output, callConstructor: this.getModifyPositionCall.bind(this) };
23873
+ };
23874
+ this.getModifyPositionCall = (params) => {
23875
+ const _collateral = {
23876
+ amount_type: this.formatAmountTypeEnum(params.collateralAmount.amount_type),
23877
+ denomination: this.formatAmountDenominationEnum(params.collateralAmount.denomination),
23878
+ value: {
23879
+ abs: uint2567.bnToUint256(params.collateralAmount.value.abs.toWei()),
23880
+ is_negative: params.collateralAmount.value.abs.isZero() ? false : params.collateralAmount.value.is_negative
23881
+ }
23882
+ };
23883
+ logger.verbose(`VesuAdapter::ConstructingModify::Collateral::${JSON.stringify(_collateral)}`);
23884
+ const _debt = {
23885
+ amount_type: this.formatAmountTypeEnum(params.debtAmount.amount_type),
23886
+ denomination: this.formatAmountDenominationEnum(params.debtAmount.denomination),
23887
+ value: {
23888
+ abs: uint2567.bnToUint256(params.debtAmount.value.abs.toWei()),
23889
+ is_negative: params.debtAmount.value.abs.isZero() ? false : params.debtAmount.value.is_negative
23890
+ }
23891
+ };
23892
+ logger.verbose(`VesuAdapter::ConstructingModify::Debt::${JSON.stringify(_debt)}`);
23893
+ const { contract, isV2 } = this.getVesuSingletonContract(getMainnetConfig(), this.config.poolId);
23894
+ const call = contract.populate("modify_position", {
23895
+ params: isV2 ? {
23896
+ collateral_asset: this.config.collateral.address.toBigInt(),
23897
+ debt_asset: this.config.debt.address.toBigInt(),
23898
+ user: this.config.vaultAllocator.toBigInt(),
23899
+ collateral: _collateral,
23900
+ debt: _debt
23901
+ } : {
23902
+ pool_id: this.config.poolId.toBigInt(),
23903
+ collateral_asset: this.config.collateral.address.toBigInt(),
23904
+ debt_asset: this.config.debt.address.toBigInt(),
23905
+ user: this.config.vaultAllocator.toBigInt(),
23906
+ collateral: _collateral,
23907
+ debt: _debt,
23908
+ data: [0]
23909
+ }
23910
+ });
23911
+ return {
23912
+ sanitizer: SIMPLE_SANITIZER,
23913
+ call: {
23914
+ contractAddress: ContractAddr.from(contract.address),
23915
+ selector: hash3.getSelectorFromName("modify_position"),
23916
+ calldata: [
23917
+ ...call.calldata
23918
+ ]
23919
+ }
23920
+ };
23921
+ };
23922
+ this.getMultiplyAdapter = () => {
23923
+ const packedArguments = [
23924
+ toBigInt(this.config.poolId.toString()),
23925
+ // pool id
23926
+ toBigInt(this.config.collateral.address.toString()),
23927
+ // collateral
23928
+ toBigInt(this.config.debt.address.toString()),
23929
+ // debt
23930
+ toBigInt(this.config.vaultAllocator.toString())
23931
+ // vault allocator
23932
+ ];
23933
+ const output = this.constructSimpleLeafData({
23934
+ id: this.config.id,
23935
+ target: this.VESU_MULTIPLY,
23936
+ method: "modify_lever",
23937
+ packedArguments
23938
+ }, SIMPLE_SANITIZER_V2);
23939
+ return { leaf: output, callConstructor: this.getMultiplyCall.bind(this) };
23940
+ };
23941
+ this.getMultiplyCall = (params) => {
23942
+ const isIncrease = params.isIncrease;
23943
+ const multiplyParams = isIncrease ? params.increaseParams : params.decreaseParams;
23944
+ if (!multiplyParams) {
23945
+ throw new Error("Multiply params are not provided");
23946
+ }
23947
+ const multiplyContract = new Contract8({ abi: vesu_multiple_abi_default, address: this.VESU_MULTIPLY.toString(), providerOrAccount: new RpcProvider4({ nodeUrl: "" }) });
23948
+ const call = multiplyContract.populate("modify_lever", {
23949
+ modify_lever_params: getVesuMultiplyParams(isIncrease, {
23950
+ ...multiplyParams,
23951
+ user: this.config.vaultAllocator,
23952
+ pool_id: this.config.poolId,
23953
+ collateral_asset: this.config.collateral.address,
23954
+ debt_asset: this.config.debt.address,
23955
+ recipient: this.config.vaultAllocator
23956
+ })
23957
+ });
23958
+ return {
23959
+ sanitizer: SIMPLE_SANITIZER_V2,
23960
+ call: {
23961
+ contractAddress: this.VESU_MULTIPLY,
23962
+ selector: hash3.getSelectorFromName("modify_lever"),
23963
+ calldata: [
22045
23964
  ...call.calldata
22046
23965
  ]
22047
23966
  }
@@ -22050,14 +23969,12 @@ var VesuAdapter = class _VesuAdapter extends BaseAdapter {
22050
23969
  this.getVesuModifyDelegationAdapter = (id) => {
22051
23970
  return () => {
22052
23971
  const packedArguments = [
22053
- toBigInt(this.config.poolId.toString()),
22054
- // pool id
22055
23972
  toBigInt(this.VESU_MULTIPLY.toString())
22056
23973
  // vault allocator
22057
23974
  ];
22058
23975
  const output = this.constructSimpleLeafData({
22059
23976
  id,
22060
- target: this.VESU_SINGLETON,
23977
+ target: getVesuSingletonAddress(this.config.poolId).addr,
22061
23978
  method: "modify_delegation",
22062
23979
  packedArguments
22063
23980
  }, SIMPLE_SANITIZER_V2);
@@ -22065,8 +23982,12 @@ var VesuAdapter = class _VesuAdapter extends BaseAdapter {
22065
23982
  };
22066
23983
  };
22067
23984
  this.getVesuModifyDelegationCall = (params) => {
22068
- const singletonContract = new Contract8({ abi: vesu_singleton_abi_default, address: this.VESU_SINGLETON.toString(), providerOrAccount: new RpcProvider4({ nodeUrl: "" }) });
22069
- const call = singletonContract.populate("modify_delegation", {
23985
+ const VESU_SINGLETON2 = getVesuSingletonAddress(this.config.poolId).addr;
23986
+ const { contract, isV2 } = this.getVesuSingletonContract(getMainnetConfig(), this.config.poolId);
23987
+ const call = contract.populate("modify_delegation", isV2 ? {
23988
+ delegatee: this.VESU_MULTIPLY.toBigInt(),
23989
+ delegation: params.delegation
23990
+ } : {
22070
23991
  pool_id: this.config.poolId.toBigInt(),
22071
23992
  delegatee: this.VESU_MULTIPLY.toBigInt(),
22072
23993
  delegation: params.delegation
@@ -22074,7 +23995,7 @@ var VesuAdapter = class _VesuAdapter extends BaseAdapter {
22074
23995
  return {
22075
23996
  sanitizer: SIMPLE_SANITIZER_V2,
22076
23997
  call: {
22077
- contractAddress: this.VESU_SINGLETON,
23998
+ contractAddress: VESU_SINGLETON2,
22078
23999
  selector: hash3.getSelectorFromName("modify_delegation"),
22079
24000
  calldata: [
22080
24001
  ...call.calldata
@@ -22156,8 +24077,13 @@ var VesuAdapter = class _VesuAdapter extends BaseAdapter {
22156
24077
  }
22157
24078
  throw new Error(`Unknown VesuAmountDenomination: ${denomination}`);
22158
24079
  }
22159
- getVesuSingletonContract(config) {
22160
- return new Contract8({ abi: vesu_singleton_abi_default, address: this.VESU_SINGLETON.address, providerOrAccount: config.provider });
24080
+ getVesuSingletonContract(config, poolId) {
24081
+ const { addr: VESU_SINGLETON2, isV2 } = getVesuSingletonAddress(poolId);
24082
+ const ABI = isV2 ? vesu_pool_v2_abi_default : vesu_singleton_abi_default;
24083
+ return {
24084
+ contract: new Contract8({ abi: ABI, address: VESU_SINGLETON2.address, providerOrAccount: config.provider }),
24085
+ isV2
24086
+ };
22161
24087
  }
22162
24088
  async getLTVConfig(config) {
22163
24089
  const CACHE_KEY = "ltv_config";
@@ -22165,8 +24091,16 @@ var VesuAdapter = class _VesuAdapter extends BaseAdapter {
22165
24091
  if (cacheData) {
22166
24092
  return cacheData;
22167
24093
  }
22168
- const output = await this.getVesuSingletonContract(config).call("ltv_config", [this.config.poolId.address, this.config.collateral.address.address, this.config.debt.address.address]);
22169
- this.setCache(CACHE_KEY, Number(output.max_ltv) / 1e18, 3e5);
24094
+ const { contract, isV2 } = await this.getVesuSingletonContract(config, this.config.poolId);
24095
+ let ltv = 0;
24096
+ if (isV2) {
24097
+ const output = await contract.call("pair_config", [this.config.collateral.address.address, this.config.debt.address.address]);
24098
+ ltv = Number(output.max_ltv) / 1e18;
24099
+ } else {
24100
+ const output = await contract.call("ltv_config", [this.config.poolId.address, this.config.collateral.address.address, this.config.debt.address.address]);
24101
+ ltv = Number(output.max_ltv) / 1e18;
24102
+ }
24103
+ this.setCache(CACHE_KEY, ltv, 3e5);
22170
24104
  return this.getCache(CACHE_KEY);
22171
24105
  }
22172
24106
  async getPositions(config) {
@@ -22178,14 +24112,17 @@ var VesuAdapter = class _VesuAdapter extends BaseAdapter {
22178
24112
  if (cacheData) {
22179
24113
  return cacheData;
22180
24114
  }
22181
- const output = await this.getVesuSingletonContract(config).call("position_unsafe", [
22182
- this.config.poolId.address,
24115
+ const { contract, isV2 } = this.getVesuSingletonContract(config, this.config.poolId);
24116
+ const output = await contract.call(isV2 ? "position" : "position_unsafe", [
24117
+ ...isV2 ? [] : [this.config.poolId.address],
24118
+ // exclude pool id in v2
22183
24119
  this.config.collateral.address.address,
22184
24120
  this.config.debt.address.address,
22185
24121
  this.config.vaultAllocator.address
22186
24122
  ]);
22187
24123
  const token1Price = await this.pricer.getPrice(this.config.collateral.symbol);
22188
24124
  const token2Price = await this.pricer.getPrice(this.config.debt.symbol);
24125
+ logger.verbose(`VesuAdapter::getPositions token1Price: ${token1Price.price}, token2Price: ${token2Price.price}`);
22189
24126
  const collateralAmount = Web3Number.fromWei(output["1"].toString(), this.config.collateral.decimals);
22190
24127
  const debtAmount = Web3Number.fromWei(output["2"].toString(), this.config.debt.decimals);
22191
24128
  const value = [{
@@ -22211,8 +24148,10 @@ var VesuAdapter = class _VesuAdapter extends BaseAdapter {
22211
24148
  if (cacheData) {
22212
24149
  return cacheData;
22213
24150
  }
22214
- const output = await this.getVesuSingletonContract(config).call("check_collateralization_unsafe", [
22215
- this.config.poolId.address,
24151
+ const { contract, isV2 } = this.getVesuSingletonContract(config, this.config.poolId);
24152
+ const output = await contract.call(isV2 ? "check_collateralization" : "check_collateralization_unsafe", [
24153
+ ...isV2 ? [] : [this.config.poolId.address],
24154
+ // exclude pool id in v2
22216
24155
  this.config.collateral.address.address,
22217
24156
  this.config.debt.address.address,
22218
24157
  this.config.vaultAllocator.address
@@ -22272,7 +24211,7 @@ var VesuAdapter = class _VesuAdapter extends BaseAdapter {
22272
24211
  );
22273
24212
  pools = data.data;
22274
24213
  for (const pool of vesu_pools_default.data) {
22275
- const found = pools.find((d) => d.id === pool.id);
24214
+ const found = pools.find((d) => ContractAddr.from(d.id).eqString(pool.id));
22276
24215
  if (!found) {
22277
24216
  logger.verbose(`VesuRebalance: pools: ${JSON.stringify(pools)}`);
22278
24217
  logger.verbose(
@@ -24662,12 +26601,12 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
24662
26601
  const rewardAPYs = [];
24663
26602
  for (const [index, pool] of pools.entries()) {
24664
26603
  const vesuAdapter = vesuAdapters[index];
24665
- const collateralAsset = pool.assets.find((a) => a.symbol === vesuAdapter.config.collateral.symbol)?.stats;
24666
- const debtAsset = pool.assets.find((a) => a.symbol === vesuAdapter.config.debt.symbol)?.stats;
26604
+ const collateralAsset = pool.assets.find((a) => a.symbol.toLowerCase() === vesuAdapter.config.collateral.symbol.toLowerCase())?.stats;
26605
+ const debtAsset = pool.assets.find((a) => a.symbol.toLowerCase() === vesuAdapter.config.debt.symbol.toLowerCase())?.stats;
24667
26606
  const supplyApy = Number(collateralAsset.supplyApy.value || 0) / 1e18;
24668
26607
  const lstAPY = Number(collateralAsset.lstApr?.value || 0) / 1e18;
24669
26608
  baseAPYs.push(...[supplyApy + lstAPY, Number(debtAsset.borrowApr.value) / 1e18]);
24670
- rewardAPYs.push(...[Number(collateralAsset.defiSpringSupplyApr.value || "0") / 1e18, 0]);
26609
+ rewardAPYs.push(...[Number(collateralAsset.defiSpringSupplyApr?.value || "0") / 1e18, 0]);
24671
26610
  }
24672
26611
  logger.verbose(`${this.metadata.name}::netAPY: baseAPYs: ${JSON.stringify(baseAPYs)}`);
24673
26612
  logger.verbose(`${this.metadata.name}::netAPY: rewardAPYs: ${JSON.stringify(rewardAPYs)}`);
@@ -24737,6 +26676,7 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
24737
26676
  const underlying = this.asset();
24738
26677
  let vesuAum = Web3Number.fromWei("0", underlying.decimals);
24739
26678
  let tokenUnderlyingPrice = await this.pricer.getPrice(this.asset().symbol);
26679
+ logger.verbose(`${this.getTag()} tokenUnderlyingPrice: ${tokenUnderlyingPrice.price}`);
24740
26680
  if (legAUM[0].token.address.eq(underlying.address)) {
24741
26681
  vesuAum = vesuAum.plus(legAUM[0].amount);
24742
26682
  } else {
@@ -24837,7 +26777,7 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
24837
26777
  amount: unusedBalance.amount,
24838
26778
  usdValue: unusedBalance.usdValue,
24839
26779
  token: this.asset(),
24840
- remarks: "Unused Balance"
26780
+ remarks: "Unused Balance (may not include recent deposits)"
24841
26781
  }];
24842
26782
  }
24843
26783
  getSetManagerCall(strategist, root = this.getMerkleRoot()) {
@@ -25175,8 +27115,8 @@ function getLooperSettings(token1Symbol, token2Symbol, vaultSettings, pool1, poo
25175
27115
  vaultSettings.leafAdapters.push(commonAdapter.getFlashloanAdapter.bind(commonAdapter));
25176
27116
  vaultSettings.leafAdapters.push(vesuAdapterUSDCETH.getModifyPosition.bind(vesuAdapterUSDCETH));
25177
27117
  vaultSettings.leafAdapters.push(vesuAdapterETHUSDC.getModifyPosition.bind(vesuAdapterETHUSDC));
25178
- vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(USDCToken.address, vesuAdapterUSDCETH.VESU_SINGLETON, "approve_token1" /* APPROVE_TOKEN1 */).bind(commonAdapter));
25179
- vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(ETHToken.address, vesuAdapterETHUSDC.VESU_SINGLETON, "approve_token2" /* APPROVE_TOKEN2 */).bind(commonAdapter));
27118
+ vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(USDCToken.address, VESU_SINGLETON, "approve_token1" /* APPROVE_TOKEN1 */).bind(commonAdapter));
27119
+ vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(ETHToken.address, VESU_SINGLETON, "approve_token2" /* APPROVE_TOKEN2 */).bind(commonAdapter));
25180
27120
  vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(USDCToken.address, vaultSettings.vaultAddress, "approve_bring_liquidity" /* APPROVE_BRING_LIQUIDITY */).bind(commonAdapter));
25181
27121
  vaultSettings.leafAdapters.push(commonAdapter.getBringLiquidityAdapter("bring_liquidity" /* BRING_LIQUIDITY */).bind(commonAdapter));
25182
27122
  vaultSettings.leafAdapters.push(vesuAdapterUSDCETH.getDefispringRewardsAdapter("defispring_rewards" /* DEFISPRING_REWARDS */).bind(vesuAdapterUSDCETH));
@@ -25480,7 +27420,7 @@ var UniversalStrategies = [
25480
27420
  // src/strategies/universal-lst-muliplier-strategy.tsx
25481
27421
  import { Contract as Contract10, uint256 as uint2569 } from "starknet";
25482
27422
  import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
25483
- var UniversalLstMultiplierStrategy = class extends UniversalStrategy {
27423
+ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy extends UniversalStrategy {
25484
27424
  constructor(config, pricer, metadata) {
25485
27425
  super(config, pricer, metadata);
25486
27426
  this.quoteAmountToFetchPrice = new Web3Number(1, 18);
@@ -25492,8 +27432,15 @@ var UniversalLstMultiplierStrategy = class extends UniversalStrategy {
25492
27432
  this.quoteAmountToFetchPrice = new Web3Number(0.01, this.asset().decimals);
25493
27433
  }
25494
27434
  }
27435
+ asset() {
27436
+ const vesuAdapter1 = this.getAdapter("vesu_leg1_adapter" /* VESU_LEG1 */);
27437
+ return vesuAdapter1.config.collateral;
27438
+ }
27439
+ getTag() {
27440
+ return `${_UniversalLstMultiplierStrategy.name}:${this.metadata.name}`;
27441
+ }
25495
27442
  // only one leg is used
25496
- // todo support lending assets of underlying as well
27443
+ // todo support lending assets of underlying as well (like if xSTRK looping is not viable, simply supply STRK)
25497
27444
  getVesuAdapters() {
25498
27445
  const vesuAdapter1 = this.getAdapter("vesu_leg1_adapter" /* VESU_LEG1 */);
25499
27446
  vesuAdapter1.pricer = this.pricer;
@@ -25502,9 +27449,13 @@ var UniversalLstMultiplierStrategy = class extends UniversalStrategy {
25502
27449
  }
25503
27450
  // not applicable for this strategy
25504
27451
  // No rewards on collateral or borrowing of LST assets
25505
- // protected async getRewardsAUM(prevAum: Web3Number): Promise<Web3Number> {
25506
- // return Web3Number.fromWei("0", this.asset().decimals);
25507
- // }
27452
+ async getRewardsAUM(prevAum) {
27453
+ const lstToken = this.asset();
27454
+ if (lstToken.symbol === "xSTRK") {
27455
+ return super.getRewardsAUM(prevAum);
27456
+ }
27457
+ return Web3Number.fromWei("0", lstToken.decimals);
27458
+ }
25508
27459
  async getLSTDexPrice() {
25509
27460
  const ekuboQuoter = new EkuboQuoter(this.config);
25510
27461
  const lstTokenInfo = this.asset();
@@ -25527,6 +27478,7 @@ var UniversalLstMultiplierStrategy = class extends UniversalStrategy {
25527
27478
  async getVesuMultiplyCall(params) {
25528
27479
  const [vesuAdapter1] = this.getVesuAdapters();
25529
27480
  const legLTV = await vesuAdapter1.getLTVConfig(this.config);
27481
+ logger.verbose(`${this.getTag()}::getVesuMultiplyCall legLTV: ${legLTV}`);
25530
27482
  const existingPositions = await vesuAdapter1.getPositions(this.config);
25531
27483
  const collateralisation = await vesuAdapter1.getCollateralization(this.config);
25532
27484
  const existingCollateralInfo = existingPositions[0];
@@ -25540,8 +27492,11 @@ var UniversalLstMultiplierStrategy = class extends UniversalStrategy {
25540
27492
  const addedCollateral = params.leg1DepositAmount.multipliedBy(params.isDeposit ? 1 : -1);
25541
27493
  logger.verbose(`${this.getTag()}::getVesuMultiplyCall addedCollateral: ${addedCollateral}`);
25542
27494
  const numeratorPart1 = existingCollateralInfo.amount.plus(addedCollateral).multipliedBy(collateralPrice).multipliedBy(legLTV);
27495
+ logger.verbose(`${this.getTag()}::getVesuMultiplyCall numeratorPart1: ${numeratorPart1}`);
25543
27496
  const numeratorPart2 = existingDebtInfo.amount.multipliedBy(debtPrice).multipliedBy(this.metadata.additionalInfo.targetHealthFactor);
27497
+ logger.verbose(`${this.getTag()}::getVesuMultiplyCall numeratorPart2: ${numeratorPart2}`);
25544
27498
  const denominatorPart = this.metadata.additionalInfo.targetHealthFactor - legLTV / dexPrice;
27499
+ logger.verbose(`${this.getTag()}::getVesuMultiplyCall denominatorPart: ${denominatorPart}`);
25545
27500
  const x_debt_usd = numeratorPart1.minus(numeratorPart2).dividedBy(denominatorPart);
25546
27501
  logger.verbose(`${this.getTag()}::getVesuMultiplyCall x_debt_usd: ${x_debt_usd}`);
25547
27502
  logger.debug(`${this.getTag()}::getVesuMultiplyCall numeratorPart1: ${numeratorPart1}, numeratorPart2: ${numeratorPart2}, denominatorPart: ${denominatorPart}`);
@@ -25577,10 +27532,15 @@ var UniversalLstMultiplierStrategy = class extends UniversalStrategy {
25577
27532
  * @param params marginAmount is in LST, debtAmount is in underlying
25578
27533
  */
25579
27534
  async getModifyLeverCall(params) {
27535
+ logger.verbose(`${this.getTag()}::getModifyLeverCall marginAmount: ${params.marginAmount}, debtAmount: ${params.debtAmount}, lstDexPriceInUnderlying: ${params.lstDexPriceInUnderlying}, isIncrease: ${params.isIncrease}`);
25580
27536
  assert(!params.marginAmount.isZero() || !params.debtAmount.isZero(), "Deposit/debt must be non-0");
25581
27537
  const [vesuAdapter1] = this.getVesuAdapters();
25582
27538
  const lstTokenInfo = this.asset();
25583
27539
  const lstUnderlyingTokenInfo = vesuAdapter1.config.debt;
27540
+ const maxAmounts = lstTokenInfo.symbol == "xSTRK" ? 5e5 : 0.5;
27541
+ if (params.marginAmount.greaterThan(maxAmounts)) {
27542
+ throw new Error(`Margin amount is greater than max amount: ${params.marginAmount.toNumber()} > ${maxAmounts}`);
27543
+ }
25584
27544
  const proofsIDs = [];
25585
27545
  const manageCalls = [];
25586
27546
  if (params.marginAmount.greaterThan(0)) {
@@ -25594,9 +27554,9 @@ var UniversalLstMultiplierStrategy = class extends UniversalStrategy {
25594
27554
  manageCalls.push(manageCall1);
25595
27555
  }
25596
27556
  const lstDexPriceInUnderlying = params.lstDexPriceInUnderlying;
27557
+ const lstTrueExchangeRate = await this.getLSTExchangeRate();
25597
27558
  const ekuboQuoter = new EkuboQuoter(this.config);
25598
- const marginSwap = [];
25599
- const MAX_SLIPPAGE = 0.01;
27559
+ const MAX_SLIPPAGE = 2e-3;
25600
27560
  const fromToken = params.isIncrease ? lstUnderlyingTokenInfo : lstTokenInfo;
25601
27561
  const toToken = params.isIncrease ? lstTokenInfo : lstUnderlyingTokenInfo;
25602
27562
  const leverSwapQuote = await ekuboQuoter.getQuote(
@@ -25605,10 +27565,22 @@ var UniversalLstMultiplierStrategy = class extends UniversalStrategy {
25605
27565
  params.debtAmount
25606
27566
  // negative for exact amount out
25607
27567
  );
25608
- assert(leverSwapQuote.price_impact < MAX_SLIPPAGE, "getIncreaseLeverCall: Price impact is too high [Debt swap]");
27568
+ logger.verbose(`${this.getTag()}::getModifyLeverCall leverSwapQuote: ${JSON.stringify(leverSwapQuote)}`);
27569
+ assert(leverSwapQuote.price_impact < 0.01, "getIncreaseLeverCall: Price impact is too high [Debt swap]");
25609
27570
  const leverSwap = ekuboQuoter.getVesuMultiplyQuote(leverSwapQuote, fromToken, toToken);
25610
- const minExpectedDebt = params.debtAmount.dividedBy(lstDexPriceInUnderlying).multipliedBy(1 - MAX_SLIPPAGE);
25611
- const maxUsedCollateral = params.debtAmount.abs().dividedBy(lstDexPriceInUnderlying).multipliedBy(1 + MAX_SLIPPAGE);
27571
+ logger.verbose(`${this.getTag()}::getModifyLeverCall leverSwap: ${JSON.stringify(leverSwap)}`);
27572
+ let minLSTReceived = params.debtAmount.dividedBy(lstDexPriceInUnderlying).multipliedBy(1 - MAX_SLIPPAGE);
27573
+ const minLSTReceivedAsPerTruePrice = params.debtAmount.dividedBy(lstTrueExchangeRate);
27574
+ if (minLSTReceived < minLSTReceivedAsPerTruePrice) {
27575
+ minLSTReceived = minLSTReceivedAsPerTruePrice;
27576
+ }
27577
+ logger.verbose(`${this.getTag()}::getModifyLeverCall minLSTReceivedAsPerTruePrice: ${minLSTReceivedAsPerTruePrice}, minLSTReceived: ${minLSTReceived}`);
27578
+ let maxUsedCollateral = params.debtAmount.abs().dividedBy(lstDexPriceInUnderlying).multipliedBy(1 + MAX_SLIPPAGE);
27579
+ const maxUsedCollateralInLST = params.debtAmount.abs().dividedBy(lstTrueExchangeRate).multipliedBy(1.005);
27580
+ logger.verbose(`${this.getTag()}::getModifyLeverCall maxUsedCollateralInLST: ${maxUsedCollateralInLST}, maxUsedCollateral: ${maxUsedCollateral}`);
27581
+ if (maxUsedCollateralInLST > maxUsedCollateral) {
27582
+ maxUsedCollateral = maxUsedCollateralInLST;
27583
+ }
25612
27584
  const STEP2_ID = "switch_delegation_on" /* SWITCH_DELEGATION_ON */;
25613
27585
  const manage2Info = this.getProofs(STEP2_ID);
25614
27586
  const manageCall2 = manage2Info.callConstructor({
@@ -25620,10 +27592,10 @@ var UniversalLstMultiplierStrategy = class extends UniversalStrategy {
25620
27592
  isIncrease: true,
25621
27593
  increaseParams: {
25622
27594
  add_margin: params.marginAmount,
25623
- margin_swap: marginSwap,
27595
+ margin_swap: [],
25624
27596
  margin_swap_limit_amount: Web3Number.fromWei(0, this.asset().decimals),
25625
27597
  lever_swap: leverSwap,
25626
- lever_swap_limit_amount: minExpectedDebt
27598
+ lever_swap_limit_amount: minLSTReceived
25627
27599
  }
25628
27600
  } : {
25629
27601
  isIncrease: false,
@@ -25778,7 +27750,7 @@ var hyperxWBTC = {
25778
27750
  manager: ContractAddr.from("0x75866db44c81e6986f06035206ee9c7d15833ddb22d6a22c016cfb5c866a491"),
25779
27751
  vaultAllocator: ContractAddr.from("0x57b5c1bb457b5e840a2714ae53ada87d77be2f3fd33a59b4fe709ef20c020c1"),
25780
27752
  redeemRequestNFT: ContractAddr.from("0x7a5dc288325456f05e70e9616e16bc02ffbe448f4b89f80b47c0970b989c7c"),
25781
- aumOracle: ContractAddr.from(""),
27753
+ aumOracle: ContractAddr.from("0x258f8a0ca0d21f542e48ad89d00e92dc4d9db4999084f50ef9c22dfb1e83023"),
25782
27754
  leafAdapters: [],
25783
27755
  adapters: [],
25784
27756
  targetHealthFactor: 1.1,
@@ -25789,7 +27761,7 @@ var hyperxtBTC = {
25789
27761
  manager: ContractAddr.from("0xc4cc3e08029a0ae076f5fdfca70575abb78d23c5cd1c49a957f7e697885401"),
25790
27762
  vaultAllocator: ContractAddr.from("0x50bbd4fe69f841ecb13b2619fe50ebfa4e8944671b5d0ebf7868fd80c61b31e"),
25791
27763
  redeemRequestNFT: ContractAddr.from("0xeac9032f02057779816e38a6cb9185d12d86b3aacc9949b96b36de359c1e3"),
25792
- aumOracle: ContractAddr.from(""),
27764
+ aumOracle: ContractAddr.from("0x7e0d05cb7ba3f7db77a36c21c21583b5a524c2e685c08c24b3554911fb4a039"),
25793
27765
  leafAdapters: [],
25794
27766
  adapters: [],
25795
27767
  targetHealthFactor: 1.1,
@@ -25800,7 +27772,7 @@ var hyperxsBTC = {
25800
27772
  manager: ContractAddr.from("0xc9ac023090625b0be3f6532ca353f086746f9c09f939dbc1b2613f09e5f821"),
25801
27773
  vaultAllocator: ContractAddr.from("0x60c2d856936b975459a5b4eb28b8672d91f757bd76cebb6241f8d670185dc01"),
25802
27774
  redeemRequestNFT: ContractAddr.from("0x429e8ee8bc7ecd1ade72630d350a2e0f10f9a2507c45f188ba17fe8f2ab4cf3"),
25803
- aumOracle: ContractAddr.from(""),
27775
+ aumOracle: ContractAddr.from("0x149298ade3e79ec6cbdac6cfad289c57504eaf54e590939136ed1ceca60c345"),
25804
27776
  leafAdapters: [],
25805
27777
  adapters: [],
25806
27778
  targetHealthFactor: 1.1,
@@ -25835,7 +27807,7 @@ function getStrategySettings(lstSymbol, underlyingSymbol, addresses, isPreview =
25835
27807
  launchBlock: 0,
25836
27808
  type: "Other",
25837
27809
  depositTokens: [Global.getDefaultTokens().find((token) => token.symbol === lstSymbol)],
25838
- additionalInfo: getLooperSettings2(lstSymbol, underlyingSymbol, addresses, VesuPools.Re7xSTRK),
27810
+ additionalInfo: getLooperSettings2(lstSymbol, underlyingSymbol, addresses, lstSymbol === "xSTRK" ? VesuPools.Re7xSTRK : VesuPools.Re7xBTC),
25839
27811
  risk: {
25840
27812
  riskFactor: _riskFactor4,
25841
27813
  netRisk: _riskFactor4.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _riskFactor4.reduce((acc, curr) => acc + curr.weight, 0),
@@ -25851,10 +27823,10 @@ function getStrategySettings(lstSymbol, underlyingSymbol, addresses, isPreview =
25851
27823
  }
25852
27824
  var HyperLSTStrategies = [
25853
27825
  getStrategySettings("xSTRK", "STRK", hyperxSTRK, false),
25854
- getStrategySettings("xWBTC", "WBTC", hyperxWBTC, true),
25855
- getStrategySettings("xtBTC", "tBTC", hyperxtBTC, true),
25856
- getStrategySettings("xsBTC", "solvBTC", hyperxsBTC, true),
25857
- getStrategySettings("xLBTC", "LBTC", hyperxLBTC, true)
27826
+ getStrategySettings("xWBTC", "WBTC", hyperxWBTC, false),
27827
+ getStrategySettings("xtBTC", "tBTC", hyperxtBTC, false),
27828
+ getStrategySettings("xsBTC", "solvBTC", hyperxsBTC, false),
27829
+ getStrategySettings("xLBTC", "LBTC", hyperxLBTC, false)
25858
27830
  ];
25859
27831
  export {
25860
27832
  AUMTypes,
@@ -25902,5 +27874,6 @@ export {
25902
27874
  getNoRiskTags,
25903
27875
  getRiskColor,
25904
27876
  getRiskExplaination,
27877
+ getVesuSingletonAddress,
25905
27878
  highlightTextWithLinks
25906
27879
  };