@strkfarm/sdk 1.1.17 → 1.1.20

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