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