@defisaver/positions-sdk 0.0.27 → 0.0.29

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.
Files changed (80) hide show
  1. package/README.md +63 -63
  2. package/cjs/config/contracts.d.ts +18 -9
  3. package/cjs/config/contracts.js +8 -7
  4. package/cjs/contracts.d.ts +1 -1
  5. package/cjs/contracts.js +27 -4
  6. package/cjs/curveUsd/index.js +1 -1
  7. package/cjs/helpers/curveUsdHelpers/index.d.ts +1 -2
  8. package/cjs/helpers/curveUsdHelpers/index.js +17 -25
  9. package/cjs/markets/aave/marketAssets.d.ts +1 -1
  10. package/cjs/markets/aave/marketAssets.js +1 -1
  11. package/cjs/moneymarket/moneymarketCommonService.js +1 -1
  12. package/cjs/services/utils.d.ts +0 -4
  13. package/cjs/services/utils.js +1 -13
  14. package/cjs/types/contracts/generated/CrvUSDView.d.ts +4 -30
  15. package/cjs/types/curveUsd.d.ts +0 -6
  16. package/esm/config/contracts.d.ts +18 -9
  17. package/esm/config/contracts.js +8 -7
  18. package/esm/contracts.d.ts +1 -1
  19. package/esm/contracts.js +27 -4
  20. package/esm/curveUsd/index.js +1 -1
  21. package/esm/helpers/curveUsdHelpers/index.d.ts +1 -2
  22. package/esm/helpers/curveUsdHelpers/index.js +18 -26
  23. package/esm/markets/aave/marketAssets.d.ts +1 -1
  24. package/esm/markets/aave/marketAssets.js +1 -1
  25. package/esm/moneymarket/moneymarketCommonService.js +1 -1
  26. package/esm/services/utils.d.ts +0 -4
  27. package/esm/services/utils.js +0 -11
  28. package/esm/types/contracts/generated/CrvUSDView.d.ts +4 -30
  29. package/esm/types/curveUsd.d.ts +0 -6
  30. package/package.json +40 -40
  31. package/src/aaveV2/index.ts +226 -226
  32. package/src/aaveV3/index.ts +561 -561
  33. package/src/assets/index.ts +60 -60
  34. package/src/chickenBonds/index.ts +123 -123
  35. package/src/compoundV2/index.ts +219 -219
  36. package/src/compoundV3/index.ts +275 -275
  37. package/src/config/contracts.js +676 -675
  38. package/src/constants/index.ts +3 -3
  39. package/src/contracts.ts +126 -100
  40. package/src/curveUsd/index.ts +228 -228
  41. package/src/exchange/index.ts +17 -17
  42. package/src/helpers/aaveHelpers/index.ts +134 -134
  43. package/src/helpers/chickenBondsHelpers/index.ts +23 -23
  44. package/src/helpers/compoundHelpers/index.ts +181 -181
  45. package/src/helpers/curveUsdHelpers/index.ts +32 -40
  46. package/src/helpers/index.ts +5 -5
  47. package/src/helpers/makerHelpers/index.ts +94 -94
  48. package/src/helpers/sparkHelpers/index.ts +106 -106
  49. package/src/index.ts +40 -40
  50. package/src/liquity/index.ts +116 -116
  51. package/src/maker/index.ts +101 -101
  52. package/src/markets/aave/index.ts +80 -80
  53. package/src/markets/aave/marketAssets.ts +32 -32
  54. package/src/markets/compound/index.ts +141 -141
  55. package/src/markets/compound/marketsAssets.ts +46 -46
  56. package/src/markets/curveUsd/index.ts +69 -69
  57. package/src/markets/index.ts +3 -3
  58. package/src/markets/spark/index.ts +29 -29
  59. package/src/markets/spark/marketAssets.ts +9 -9
  60. package/src/moneymarket/moneymarketCommonService.ts +75 -75
  61. package/src/morpho/markets.ts +39 -39
  62. package/src/morphoAaveV2/index.ts +255 -255
  63. package/src/morphoAaveV3/index.ts +619 -619
  64. package/src/multicall/index.ts +22 -22
  65. package/src/services/dsrService.ts +15 -15
  66. package/src/services/priceService.ts +21 -21
  67. package/src/services/utils.ts +35 -48
  68. package/src/spark/index.ts +422 -422
  69. package/src/staking/staking.ts +167 -167
  70. package/src/types/aave.ts +256 -256
  71. package/src/types/chickenBonds.ts +45 -45
  72. package/src/types/common.ts +83 -83
  73. package/src/types/compound.ts +128 -128
  74. package/src/types/contracts/generated/CrvUSDView.ts +8 -43
  75. package/src/types/curveUsd.ts +112 -118
  76. package/src/types/index.ts +6 -6
  77. package/src/types/liquity.ts +30 -30
  78. package/src/types/maker.ts +50 -50
  79. package/src/types/spark.ts +106 -106
  80. package/yarn-error.log +0 -64
package/README.md CHANGED
@@ -1,63 +1,63 @@
1
- # DeFi Saver Positions SDK
2
-
3
- Supported protocols:
4
- - [Maker](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/maker)
5
- - [Spark](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/spark)
6
- - [CrvUSD](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/curveUsd)
7
- - [Aave V2](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/aaveV2)
8
- - [Aave V3](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/aaveV3)
9
- - [Morpho Aave V2](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/morphoAaveV2)
10
- - [Morpho Aave V3](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/morphoAaveV3)
11
- - [Compound V2](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/compoundV2)
12
- - [Compound V3](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/compoundV3)
13
- - [Liquity](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/liquity)
14
- - [Chicken Bonds](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/chickenBonds)
15
-
16
- ## Setup
17
- Supported Node version is v10.
18
-
19
- - run `npm install` (first time)
20
- - run `npm run build`
21
-
22
- `build` command will generate contracts and build ejs and esm folders
23
-
24
- ## How to use
25
- [All available imports](https://github.com/defisaver/defisaver-positions-sdk/blob/main/src/index.ts)
26
-
27
- This is a Compound V3 example, and every other protocol is similar
28
- ```js
29
- import Web3 from 'web3';
30
- import { compoundV3 } from '@defisaver/positions-sdk';
31
-
32
-
33
- // every protocol has market data and user data getters
34
- const {
35
- getCompoundV3MarketsData,
36
- getCompoundV3AccountData,
37
- } = compoundV3;
38
-
39
- const provider = 'Your RPC provider';
40
- const web3 = new Web3(provider);
41
-
42
- const user = '0x123...';
43
-
44
- const { assetsData } = await getCompoundV3MarketsData(
45
- web3, // rpc for the network you are using (note: can be tenderly or any other testnet rpc)
46
- 1, // network
47
- selectedMarket, // market object like in /src/markets/compound/index.ts
48
- web3, // this must be mainnet rpc - used for getting prices onchain and calculating apys
49
- );
50
-
51
- const userData = await getCompoundV3AccountData(
52
- web3,
53
- 1, // network
54
- userAddress, // EOA or DSProxy
55
- '', // proxy address of the user, or just empty string if checking for EOA
56
- {
57
- selectedMarket, // market object as in /src/markets/compound/index.ts
58
- assetsData,
59
- }
60
- );
61
- ```
62
-
63
- More examples found [here](https://github.com/defisaver/defisaver-positions-sdk/tree/main/tests)
1
+ # DeFi Saver Positions SDK
2
+
3
+ Supported protocols:
4
+ - [Maker](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/maker)
5
+ - [Spark](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/spark)
6
+ - [CrvUSD](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/curveUsd)
7
+ - [Aave V2](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/aaveV2)
8
+ - [Aave V3](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/aaveV3)
9
+ - [Morpho Aave V2](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/morphoAaveV2)
10
+ - [Morpho Aave V3](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/morphoAaveV3)
11
+ - [Compound V2](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/compoundV2)
12
+ - [Compound V3](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/compoundV3)
13
+ - [Liquity](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/liquity)
14
+ - [Chicken Bonds](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/chickenBonds)
15
+
16
+ ## Setup
17
+ Supported Node version is v10.
18
+
19
+ - run `npm install` (first time)
20
+ - run `npm run build`
21
+
22
+ `build` command will generate contracts and build ejs and esm folders
23
+
24
+ ## How to use
25
+ [All available imports](https://github.com/defisaver/defisaver-positions-sdk/blob/main/src/index.ts)
26
+
27
+ This is a Compound V3 example, and every other protocol is similar
28
+ ```js
29
+ import Web3 from 'web3';
30
+ import { compoundV3 } from '@defisaver/positions-sdk';
31
+
32
+
33
+ // every protocol has market data and user data getters
34
+ const {
35
+ getCompoundV3MarketsData,
36
+ getCompoundV3AccountData,
37
+ } = compoundV3;
38
+
39
+ const provider = 'Your RPC provider';
40
+ const web3 = new Web3(provider);
41
+
42
+ const user = '0x123...';
43
+
44
+ const { assetsData } = await getCompoundV3MarketsData(
45
+ web3, // rpc for the network you are using (note: can be tenderly or any other testnet rpc)
46
+ 1, // network
47
+ selectedMarket, // market object like in /src/markets/compound/index.ts
48
+ web3, // this must be mainnet rpc - used for getting prices onchain and calculating apys
49
+ );
50
+
51
+ const userData = await getCompoundV3AccountData(
52
+ web3,
53
+ 1, // network
54
+ userAddress, // EOA or DSProxy
55
+ '', // proxy address of the user, or just empty string if checking for EOA
56
+ {
57
+ selectedMarket, // market object as in /src/markets/compound/index.ts
58
+ assetsData,
59
+ }
60
+ );
61
+ ```
62
+
63
+ More examples found [here](https://github.com/defisaver/defisaver-positions-sdk/tree/main/tests)
@@ -2913,12 +2913,6 @@ export namespace crvUSDsfrxETHAmm {
2913
2913
  }
2914
2914
  export namespace crvUSDView {
2915
2915
  let abi_50: ({
2916
- inputs: never[];
2917
- name: string;
2918
- type: string;
2919
- outputs?: undefined;
2920
- stateMutability?: undefined;
2921
- } | {
2922
2916
  inputs: {
2923
2917
  internalType: string;
2924
2918
  name: string;
@@ -2969,8 +2963,6 @@ export namespace crvUSDView {
2969
2963
  createdBlock: number;
2970
2964
  oldVersions: {
2971
2965
  "17657253": string;
2972
- "17683243": string;
2973
- "18419795": string;
2974
2966
  };
2975
2967
  };
2976
2968
  };
@@ -3045,7 +3037,24 @@ export namespace LiquityView {
3045
3037
  "12549073": string;
3046
3038
  "12567960": string;
3047
3039
  "12638758": string;
3048
- "12746821": string;
3040
+ "12746821": {
3041
+ abi: {
3042
+ inputs: {
3043
+ internalType: string;
3044
+ name: string;
3045
+ type: string;
3046
+ }[];
3047
+ name: string;
3048
+ outputs: {
3049
+ internalType: string;
3050
+ name: string;
3051
+ type: string;
3052
+ }[];
3053
+ stateMutability: string;
3054
+ type: string;
3055
+ }[];
3056
+ address: string;
3057
+ };
3049
3058
  };
3050
3059
  };
3051
3060
  };
@@ -528,15 +528,13 @@ module.exports = {
528
528
  }
529
529
  },
530
530
  "crvUSDView": {
531
- "abi": [{ "inputs": [], "name": "CurveUsdInvalidController", "type": "error" }, { "inputs": [], "name": "WBTC_HEALTH_ZAP", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "WBTC_MARKET", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "market", "type": "address" }, { "internalType": "uint256", "name": "collateral", "type": "uint256" }, { "internalType": "uint256", "name": "debt", "type": "uint256" }, { "internalType": "uint256", "name": "N", "type": "uint256" }], "name": "createLoanData", "outputs": [{ "components": [{ "internalType": "int256", "name": "health", "type": "int256" }, { "internalType": "uint256", "name": "minColl", "type": "uint256" }, { "internalType": "uint256", "name": "maxBorrow", "type": "uint256" }, { "components": [{ "internalType": "int256", "name": "id", "type": "int256" }, { "internalType": "uint256", "name": "lowPrice", "type": "uint256" }, { "internalType": "uint256", "name": "highPrice", "type": "uint256" }, { "internalType": "uint256", "name": "collAmount", "type": "uint256" }, { "internalType": "uint256", "name": "debtAmount", "type": "uint256" }], "internalType": "struct CurveUsdView.Band[]", "name": "bands", "type": "tuple[]" }], "internalType": "struct CurveUsdView.CreateLoanData", "name": "", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "market", "type": "address" }, { "internalType": "int256", "name": "n", "type": "int256" }], "name": "getBandData", "outputs": [{ "components": [{ "internalType": "int256", "name": "id", "type": "int256" }, { "internalType": "uint256", "name": "lowPrice", "type": "uint256" }, { "internalType": "uint256", "name": "highPrice", "type": "uint256" }, { "internalType": "uint256", "name": "collAmount", "type": "uint256" }, { "internalType": "uint256", "name": "debtAmount", "type": "uint256" }], "internalType": "struct CurveUsdView.Band", "name": "", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "market", "type": "address" }, { "internalType": "int256", "name": "from", "type": "int256" }, { "internalType": "int256", "name": "to", "type": "int256" }], "name": "getBandsData", "outputs": [{ "components": [{ "internalType": "int256", "name": "id", "type": "int256" }, { "internalType": "uint256", "name": "lowPrice", "type": "uint256" }, { "internalType": "uint256", "name": "highPrice", "type": "uint256" }, { "internalType": "uint256", "name": "collAmount", "type": "uint256" }, { "internalType": "uint256", "name": "debtAmount", "type": "uint256" }], "internalType": "struct CurveUsdView.Band[]", "name": "", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "market", "type": "address" }, { "internalType": "uint256", "name": "collateral", "type": "uint256" }, { "internalType": "uint256", "name": "debt", "type": "uint256" }, { "internalType": "uint256", "name": "N", "type": "uint256" }], "name": "getBandsDataForPosition", "outputs": [{ "components": [{ "internalType": "int256", "name": "id", "type": "int256" }, { "internalType": "uint256", "name": "lowPrice", "type": "uint256" }, { "internalType": "uint256", "name": "highPrice", "type": "uint256" }, { "internalType": "uint256", "name": "collAmount", "type": "uint256" }, { "internalType": "uint256", "name": "debtAmount", "type": "uint256" }], "internalType": "struct CurveUsdView.Band[]", "name": "bands", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_controllerAddress", "type": "address" }, { "internalType": "address", "name": "_user", "type": "address" }], "name": "getCollAmountsFromAMM", "outputs": [{ "internalType": "uint256", "name": "crvUsdAmount", "type": "uint256" }, { "internalType": "uint256", "name": "collAmount", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_user", "type": "address" }, { "internalType": "address", "name": "_controllerAddr", "type": "address" }], "name": "getCollateralRatio", "outputs": [{ "internalType": "uint256", "name": "collRatio", "type": "uint256" }, { "internalType": "bool", "name": "isInSoftLiquidation", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "market", "type": "address" }], "name": "globalData", "outputs": [{ "components": [{ "internalType": "address", "name": "collateral", "type": "address" }, { "internalType": "uint256", "name": "decimals", "type": "uint256" }, { "internalType": "int256", "name": "activeBand", "type": "int256" }, { "internalType": "uint256", "name": "A", "type": "uint256" }, { "internalType": "uint256", "name": "totalDebt", "type": "uint256" }, { "internalType": "uint256", "name": "ammPrice", "type": "uint256" }, { "internalType": "uint256", "name": "basePrice", "type": "uint256" }, { "internalType": "uint256", "name": "oraclePrice", "type": "uint256" }, { "internalType": "uint256", "name": "minted", "type": "uint256" }, { "internalType": "uint256", "name": "redeemed", "type": "uint256" }, { "internalType": "uint256", "name": "monetaryPolicyRate", "type": "uint256" }, { "internalType": "uint256", "name": "ammRate", "type": "uint256" }, { "internalType": "int256", "name": "minBand", "type": "int256" }, { "internalType": "int256", "name": "maxBand", "type": "int256" }], "internalType": "struct CurveUsdView.GlobalData", "name": "", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "market", "type": "address" }, { "internalType": "address", "name": "user", "type": "address" }, { "internalType": "int256", "name": "collChange", "type": "int256" }, { "internalType": "int256", "name": "debtChange", "type": "int256" }, { "internalType": "bool", "name": "isFull", "type": "bool" }, { "internalType": "uint256", "name": "numBands", "type": "uint256" }], "name": "healthCalculator", "outputs": [{ "internalType": "int256", "name": "health", "type": "int256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_controllerAddr", "type": "address" }], "name": "isControllerValid", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "market", "type": "address" }, { "internalType": "uint256", "name": "collateral", "type": "uint256" }, { "internalType": "uint256", "name": "N", "type": "uint256" }], "name": "maxBorrow", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "market", "type": "address" }, { "internalType": "uint256", "name": "debt", "type": "uint256" }, { "internalType": "uint256", "name": "N", "type": "uint256" }], "name": "minCollateral", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "market", "type": "address" }, { "internalType": "address", "name": "user", "type": "address" }], "name": "userData", "outputs": [{ "components": [{ "internalType": "bool", "name": "loanExists", "type": "bool" }, { "internalType": "uint256", "name": "collateralPrice", "type": "uint256" }, { "internalType": "uint256", "name": "marketCollateralAmount", "type": "uint256" }, { "internalType": "uint256", "name": "curveUsdCollateralAmount", "type": "uint256" }, { "internalType": "uint256", "name": "debtAmount", "type": "uint256" }, { "internalType": "uint256", "name": "N", "type": "uint256" }, { "internalType": "uint256", "name": "priceLow", "type": "uint256" }, { "internalType": "uint256", "name": "priceHigh", "type": "uint256" }, { "internalType": "uint256", "name": "liquidationDiscount", "type": "uint256" }, { "internalType": "int256", "name": "health", "type": "int256" }, { "internalType": "int256[2]", "name": "bandRange", "type": "int256[2]" }, { "internalType": "uint256[][2]", "name": "usersBands", "type": "uint256[][2]" }, { "internalType": "uint256", "name": "collRatio", "type": "uint256" }, { "internalType": "bool", "name": "isInSoftLiquidation", "type": "bool" }], "internalType": "struct CurveUsdView.UserData", "name": "", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_controllerAddress", "type": "address" }, { "internalType": "address", "name": "_user", "type": "address" }], "name": "userMaxWithdraw", "outputs": [{ "internalType": "uint256", "name": "maxWithdraw", "type": "uint256" }], "stateMutability": "view", "type": "function" }],
531
+ "abi": [{ "inputs": [{ "internalType": "address", "name": "market", "type": "address" }, { "internalType": "uint256", "name": "collateral", "type": "uint256" }, { "internalType": "uint256", "name": "debt", "type": "uint256" }, { "internalType": "uint256", "name": "N", "type": "uint256" }], "name": "createLoanData", "outputs": [{ "components": [{ "internalType": "int256", "name": "health", "type": "int256" }, { "internalType": "uint256", "name": "minColl", "type": "uint256" }, { "internalType": "uint256", "name": "maxBorrow", "type": "uint256" }, { "components": [{ "internalType": "int256", "name": "id", "type": "int256" }, { "internalType": "uint256", "name": "lowPrice", "type": "uint256" }, { "internalType": "uint256", "name": "highPrice", "type": "uint256" }, { "internalType": "uint256", "name": "collAmount", "type": "uint256" }, { "internalType": "uint256", "name": "debtAmount", "type": "uint256" }], "internalType": "struct CurveUsdView.Band[]", "name": "bands", "type": "tuple[]" }], "internalType": "struct CurveUsdView.CreateLoanData", "name": "", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "market", "type": "address" }, { "internalType": "int256", "name": "n", "type": "int256" }], "name": "getBandData", "outputs": [{ "components": [{ "internalType": "int256", "name": "id", "type": "int256" }, { "internalType": "uint256", "name": "lowPrice", "type": "uint256" }, { "internalType": "uint256", "name": "highPrice", "type": "uint256" }, { "internalType": "uint256", "name": "collAmount", "type": "uint256" }, { "internalType": "uint256", "name": "debtAmount", "type": "uint256" }], "internalType": "struct CurveUsdView.Band", "name": "", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "market", "type": "address" }, { "internalType": "uint256", "name": "collateral", "type": "uint256" }, { "internalType": "uint256", "name": "debt", "type": "uint256" }, { "internalType": "uint256", "name": "N", "type": "uint256" }], "name": "getBandsData", "outputs": [{ "components": [{ "internalType": "int256", "name": "id", "type": "int256" }, { "internalType": "uint256", "name": "lowPrice", "type": "uint256" }, { "internalType": "uint256", "name": "highPrice", "type": "uint256" }, { "internalType": "uint256", "name": "collAmount", "type": "uint256" }, { "internalType": "uint256", "name": "debtAmount", "type": "uint256" }], "internalType": "struct CurveUsdView.Band[]", "name": "bands", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "market", "type": "address" }, { "internalType": "int256", "name": "from", "type": "int256" }, { "internalType": "int256", "name": "to", "type": "int256" }], "name": "getBandsData", "outputs": [{ "components": [{ "internalType": "int256", "name": "id", "type": "int256" }, { "internalType": "uint256", "name": "lowPrice", "type": "uint256" }, { "internalType": "uint256", "name": "highPrice", "type": "uint256" }, { "internalType": "uint256", "name": "collAmount", "type": "uint256" }, { "internalType": "uint256", "name": "debtAmount", "type": "uint256" }], "internalType": "struct CurveUsdView.Band[]", "name": "", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "market", "type": "address" }], "name": "globalData", "outputs": [{ "components": [{ "internalType": "address", "name": "collateral", "type": "address" }, { "internalType": "uint256", "name": "decimals", "type": "uint256" }, { "internalType": "int256", "name": "activeBand", "type": "int256" }, { "internalType": "uint256", "name": "A", "type": "uint256" }, { "internalType": "uint256", "name": "totalDebt", "type": "uint256" }, { "internalType": "uint256", "name": "ammPrice", "type": "uint256" }, { "internalType": "uint256", "name": "basePrice", "type": "uint256" }, { "internalType": "uint256", "name": "oraclePrice", "type": "uint256" }, { "internalType": "uint256", "name": "minted", "type": "uint256" }, { "internalType": "uint256", "name": "redeemed", "type": "uint256" }, { "internalType": "uint256", "name": "monetaryPolicyRate", "type": "uint256" }, { "internalType": "uint256", "name": "ammRate", "type": "uint256" }, { "internalType": "int256", "name": "minBand", "type": "int256" }, { "internalType": "int256", "name": "maxBand", "type": "int256" }], "internalType": "struct CurveUsdView.GlobalData", "name": "", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "market", "type": "address" }, { "internalType": "address", "name": "user", "type": "address" }, { "internalType": "int256", "name": "collChange", "type": "int256" }, { "internalType": "int256", "name": "debtChange", "type": "int256" }, { "internalType": "bool", "name": "isFull", "type": "bool" }, { "internalType": "uint256", "name": "numBands", "type": "uint256" }], "name": "healthCalculator", "outputs": [{ "internalType": "int256", "name": "", "type": "int256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "market", "type": "address" }, { "internalType": "uint256", "name": "collateral", "type": "uint256" }, { "internalType": "uint256", "name": "N", "type": "uint256" }], "name": "maxBorrow", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "market", "type": "address" }, { "internalType": "uint256", "name": "debt", "type": "uint256" }, { "internalType": "uint256", "name": "N", "type": "uint256" }], "name": "minCollateral", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "market", "type": "address" }, { "internalType": "address", "name": "user", "type": "address" }], "name": "userData", "outputs": [{ "components": [{ "internalType": "bool", "name": "loanExists", "type": "bool" }, { "internalType": "uint256", "name": "collateralPrice", "type": "uint256" }, { "internalType": "uint256", "name": "marketCollateralAmount", "type": "uint256" }, { "internalType": "uint256", "name": "curveUsdCollateralAmount", "type": "uint256" }, { "internalType": "uint256", "name": "debtAmount", "type": "uint256" }, { "internalType": "uint256", "name": "N", "type": "uint256" }, { "internalType": "uint256", "name": "priceLow", "type": "uint256" }, { "internalType": "uint256", "name": "priceHigh", "type": "uint256" }, { "internalType": "uint256", "name": "liquidationDiscount", "type": "uint256" }, { "internalType": "int256", "name": "health", "type": "int256" }, { "internalType": "int256[2]", "name": "bandRange", "type": "int256[2]" }, { "internalType": "uint256[][2]", "name": "usersBands", "type": "uint256[][2]" }], "internalType": "struct CurveUsdView.UserData", "name": "", "type": "tuple" }], "stateMutability": "view", "type": "function" }],
532
532
  "networks": {
533
533
  "1": {
534
- "address": "0x4BbCf0e587853aAEdFC3E60f74C10E07D8deA701",
535
- "createdBlock": 18823384,
534
+ "address": "0x512460CF2Bb80823C135F5DC04D2a1fF258FAA1e",
535
+ "createdBlock": 17683243,
536
536
  "oldVersions": {
537
- "17657253": "0xa81430a4eC71466264b9ee50403F8d63E8c72B95",
538
- "17683243": "0x512460CF2Bb80823C135F5DC04D2a1fF258FAA1e",
539
- "18419795": "0x4df1281f9d2303be453e0085881702a4b1358692",
537
+ "17657253": "0xa81430a4eC71466264b9ee50403F8d63E8c72B95"
540
538
  }
541
539
  }
542
540
  }
@@ -559,7 +557,10 @@ module.exports = {
559
557
  "12549073": "0xFCDd12C6317adbd033B93486d176f99441344A0f",
560
558
  "12567960": "0x0bE59e4804d957026a0E31B5d0BEA0fbaE262ba7",
561
559
  "12638758": "0x30EFEF27A6919d927E4c684E373198F671c686Dc",
562
- "12746821": "0xD1913B977737c9505B8EcFEDB8121546096d3393"
560
+ "12746821": {
561
+ "abi": [{ "inputs": [{ "internalType": "address", "name": "_troveOwner", "type": "address" }], "name": "getTroveInfo", "outputs": [{ "internalType": "uint256", "name": "troveStatus", "type": "uint256" }, { "internalType": "uint256", "name": "collAmount", "type": "uint256" }, { "internalType": "uint256", "name": "debtAmount", "type": "uint256" }, { "internalType": "uint256", "name": "collPrice", "type": "uint256" }, { "internalType": "uint256", "name": "TCRatio", "type": "uint256" }, { "internalType": "bool", "name": "recoveryMode", "type": "bool" }], "stateMutability": "view", "type": "function" }],
562
+ "address": "0xD1913B977737c9505B8EcFEDB8121546096d3393"
563
+ },
563
564
  }
564
565
  }
565
566
  }
@@ -5,7 +5,7 @@ import * as ContractTypes from './types/contracts/generated';
5
5
  import { Blockish, NetworkNumber } from './types/common';
6
6
  export type ConfigKey = keyof typeof configRaw;
7
7
  export declare const getConfigContractAddress: (name: ConfigKey, network: NetworkNumber, block?: Blockish) => string;
8
- export declare const getConfigContractAbi: (name: ConfigKey) => any[];
8
+ export declare const getConfigContractAbi: (name: ConfigKey, network?: NetworkNumber, block?: Blockish) => any[];
9
9
  export declare const getErc20Contract: (address: string, web3: Web3) => import("web3-eth-contract").Contract;
10
10
  export declare const createContractWrapper: (web3: Web3, network: NetworkNumber, name: ConfigKey, _address?: string, block?: Blockish) => BaseContract;
11
11
  export declare const UniMulticallContract: (web3: Web3, network: NetworkNumber, block?: Blockish) => ContractTypes.UniMulticall;
package/cjs/contracts.js CHANGED
@@ -14,20 +14,43 @@ const getConfigContractAddress = (name, network, block) => {
14
14
  return latestAddress;
15
15
  }
16
16
  const oldVersions = (networkData === null || networkData === void 0 ? void 0 : networkData.oldVersions) || {};
17
- for (const [createdBlock, address] of Object.entries(oldVersions).reverse()) {
17
+ // Versions are ordered from oldest to the newest
18
+ for (const [createdBlock, addressOrObject] of Object.entries(oldVersions).reverse()) {
18
19
  if (block >= Number(createdBlock)) {
19
- return address;
20
+ if (typeof addressOrObject !== 'string') {
21
+ return addressOrObject.address;
22
+ }
23
+ return addressOrObject;
20
24
  }
21
25
  }
22
26
  }
23
27
  return latestAddress;
24
28
  };
25
29
  exports.getConfigContractAddress = getConfigContractAddress;
26
- const getConfigContractAbi = (name) => contractConfig[name].abi;
30
+ const getConfigContractAbi = (name, network, block) => {
31
+ const networkData = network ? contractConfig[name].networks[network] : null;
32
+ const latestAbi = contractConfig[name].abi;
33
+ if (block && block !== 'latest' && networkData) {
34
+ if (block >= ((networkData === null || networkData === void 0 ? void 0 : networkData.createdBlock) || 0)) {
35
+ return latestAbi;
36
+ }
37
+ const oldVersions = (networkData === null || networkData === void 0 ? void 0 : networkData.oldVersions) || {};
38
+ // Versions are ordered from oldest to the newest
39
+ for (const [createdBlock, addressOrObject] of Object.entries(oldVersions).reverse()) {
40
+ if (block >= Number(createdBlock)) {
41
+ if (typeof addressOrObject !== 'string') {
42
+ return addressOrObject.abi;
43
+ }
44
+ return latestAbi;
45
+ }
46
+ }
47
+ }
48
+ return latestAbi;
49
+ };
27
50
  exports.getConfigContractAbi = getConfigContractAbi;
28
51
  const createContractFromConfigFunc = (name, _address) => (web3, network, block) => {
29
52
  const address = _address || (0, exports.getConfigContractAddress)(name, network, block);
30
- return new web3.eth.Contract(contractConfig[name].abi, address);
53
+ return new web3.eth.Contract((0, exports.getConfigContractAbi)(name, network, block), address);
31
54
  };
32
55
  const getErc20Contract = (address, web3) => (new web3.eth.Contract((0, exports.getConfigContractAbi)('Erc20'), address));
33
56
  exports.getErc20Contract = getErc20Contract;
@@ -187,7 +187,7 @@ const getCurveUsdUserData = (web3, network, address, selectedMarket, activeBand)
187
187
  priceHigh,
188
188
  priceLow, liquidationDiscount: (0, tokens_1.assetAmountInEth)(data.liquidationDiscount), numOfBands: data.N, usedAssets,
189
189
  status }), (0, curveUsdHelpers_1.getCrvUsdAggregatedData)({
190
- loanExists: data.loanExists, usedAssets, network: common_1.NetworkNumber.Eth, selectedMarket, numOfBands: data.N,
190
+ loanExists: data.loanExists, usedAssets, network: common_1.NetworkNumber.Eth, selectedMarket,
191
191
  })), { userBands });
192
192
  });
193
193
  exports.getCurveUsdUserData = getCurveUsdUserData;
@@ -1,9 +1,8 @@
1
1
  import { CrvUSDAggregatedPositionData, CrvUSDMarketData, CrvUSDUsedAssets } from '../../types';
2
2
  import { NetworkNumber } from '../../types/common';
3
- export declare const getCrvUsdAggregatedData: ({ loanExists, usedAssets, network, selectedMarket, numOfBands, ...rest }: {
3
+ export declare const getCrvUsdAggregatedData: ({ loanExists, usedAssets, network, selectedMarket, ...rest }: {
4
4
  loanExists: boolean;
5
5
  usedAssets: CrvUSDUsedAssets;
6
6
  network: NetworkNumber;
7
7
  selectedMarket: CrvUSDMarketData;
8
- numOfBands: number | string;
9
8
  }) => CrvUSDAggregatedPositionData;
@@ -17,34 +17,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.getCrvUsdAggregatedData = void 0;
18
18
  const decimal_js_1 = __importDefault(require("decimal.js"));
19
19
  const moneymarket_1 = require("../../moneymarket");
20
- const utils_1 = require("../../services/utils");
21
20
  const getCrvUsdAggregatedData = (_a) => {
22
- var _b;
23
- var { loanExists, usedAssets, network, selectedMarket, numOfBands } = _a, rest = __rest(_a, ["loanExists", "usedAssets", "network", "selectedMarket", "numOfBands"]);
24
- const payload = {};
25
- payload.supplied = (0, moneymarket_1.getAssetsTotal)(usedAssets, ({ isSupplied }) => isSupplied, ({ supplied }) => supplied); // this is wrong if we are in soft-liquidations
26
- payload.borrowed = (0, moneymarket_1.getAssetsTotal)(usedAssets, ({ isBorrowed }) => isBorrowed, ({ borrowed }) => borrowed);
27
- payload.suppliedUsd = (0, moneymarket_1.getAssetsTotal)(usedAssets, ({ isSupplied }) => isSupplied, ({ suppliedUsd }) => suppliedUsd);
28
- payload.borrowedUsd = (0, moneymarket_1.getAssetsTotal)(usedAssets, ({ isBorrowed }) => isBorrowed, ({ borrowedUsd }) => borrowedUsd);
29
- payload.ratio = loanExists
30
- ? new decimal_js_1.default(payload.suppliedUsd)
31
- .dividedBy(payload.borrowedUsd)
21
+ var { loanExists, usedAssets, network, selectedMarket } = _a, rest = __rest(_a, ["loanExists", "usedAssets", "network", "selectedMarket"]);
22
+ const _supplied = (0, moneymarket_1.getAssetsTotal)(usedAssets, ({ isSupplied }) => isSupplied, ({ supplied }) => supplied); // this is wrong if we are in soft-liquidations
23
+ const _borrowed = (0, moneymarket_1.getAssetsTotal)(usedAssets, ({ isBorrowed }) => isBorrowed, ({ borrowed }) => borrowed);
24
+ const _suppliedUsd = (0, moneymarket_1.getAssetsTotal)(usedAssets, ({ isSupplied }) => isSupplied, ({ suppliedUsd }) => suppliedUsd);
25
+ const _borrowedUsd = (0, moneymarket_1.getAssetsTotal)(usedAssets, ({ isBorrowed }) => isBorrowed, ({ borrowedUsd }) => borrowedUsd);
26
+ const ratio = loanExists
27
+ ? new decimal_js_1.default(_suppliedUsd)
28
+ .dividedBy(_borrowedUsd)
32
29
  .times(100)
33
30
  .toString()
34
31
  : '0';
35
- // this is all approximation
36
- payload.minAllowedRatio = (0, utils_1.mapRange)(numOfBands, 4, 50, 115, 140); // collateral ratio
37
- payload.collFactor = new decimal_js_1.default(1).div(payload.minAllowedRatio).mul(100).toString(); // collateral factor = 1 / collateral ratio
38
- // only take in consideration collAsset
39
- payload.borrowLimitUsd = ((_b = usedAssets === null || usedAssets === void 0 ? void 0 : usedAssets[selectedMarket.collAsset]) === null || _b === void 0 ? void 0 : _b.isSupplied)
40
- ? new decimal_js_1.default(usedAssets[selectedMarket.collAsset].suppliedUsd).mul(payload.collFactor).toString()
41
- : '0';
42
- const { leveragedType, leveragedAsset } = (0, moneymarket_1.isLeveragedPos)(usedAssets);
43
- payload.leveragedType = leveragedType;
44
- if (leveragedType !== '') {
45
- payload.leveragedAsset = leveragedAsset;
46
- payload.liquidationPrice = (0, moneymarket_1.calcLeverageLiqPrice)(leveragedType, usedAssets[selectedMarket.collAsset].price, payload.borrowedUsd, payload.borrowLimitUsd);
47
- }
48
- return payload;
32
+ // we don't have borrowLimitUsd here
33
+ return {
34
+ ratio,
35
+ supplied: _supplied,
36
+ suppliedUsd: _suppliedUsd,
37
+ borrowedUsd: _borrowedUsd,
38
+ borrowed: _borrowed,
39
+ safetyRatio: ratio,
40
+ };
49
41
  };
50
42
  exports.getCrvUsdAggregatedData = getCrvUsdAggregatedData;
@@ -5,5 +5,5 @@ export declare const aaveV3AssetsDefaultMarket: {
5
5
  readonly 1: readonly ["WBTC", "ETH", "wstETH", "USDC", "DAI", "LINK", "AAVE", "cbETH", "USDT", "rETH", "LUSD", "UNI", "MKR", "SNX", "BAL", "LDO", "CRV", "ENS", "1INCH", "GHO", "FRAX", "RPL", "sDAI"];
6
6
  readonly 10: readonly ["DAI", "USDC.e", "USDT", "SUSD", "AAVE", "LINK", "WBTC", "ETH", "OP", "wstETH", "LUSD", "MAI", "rETH"];
7
7
  readonly 42161: readonly ["ETH", "DAI", "EURS", "USDC", "USDT", "AAVE", "LINK", "WBTC", "wstETH", "MAI", "rETH", "LUSD", "USDC.e", "FRAX", "ARB"];
8
- readonly 8453: readonly ["ETH", "USDbC", "cbETH"];
8
+ readonly 8453: readonly ["ETH", "USDbC", "cbETH", "wstETH"];
9
9
  };
@@ -26,6 +26,6 @@ exports.aaveV3AssetsDefaultMarket = {
26
26
  'ETH', 'DAI', 'EURS', 'USDC', 'USDT', 'AAVE', 'LINK', 'WBTC', 'wstETH', 'MAI', 'rETH', 'LUSD', 'USDC.e', 'FRAX', 'ARB',
27
27
  ],
28
28
  [common_1.NetworkNumber.Base]: [
29
- 'ETH', 'USDbC', 'cbETH',
29
+ 'ETH', 'USDbC', 'cbETH', 'wstETH',
30
30
  ],
31
31
  };
@@ -27,7 +27,7 @@ const calcLeverageLiqPrice = (leverageType, assetPrice, borrowedUsd, borrowLimit
27
27
  exports.calcLeverageLiqPrice = calcLeverageLiqPrice;
28
28
  const calculateBorrowingAssetLimit = (assetBorrowedUsd, borrowLimitUsd) => new decimal_js_1.default(assetBorrowedUsd).div(borrowLimitUsd).times(100).toString();
29
29
  exports.calculateBorrowingAssetLimit = calculateBorrowingAssetLimit;
30
- exports.STABLE_ASSETS = ['DAI', 'USDC', 'USDT', 'TUSD', 'USDP', 'GUSD', 'BUSD', 'SUSD', 'FRAX', 'LUSD', 'USDC.e', 'GHO', 'sDAI', 'crvUSD'];
30
+ exports.STABLE_ASSETS = ['DAI', 'USDC', 'USDT', 'TUSD', 'USDP', 'GUSD', 'BUSD', 'SUSD', 'FRAX', 'LUSD', 'USDC.e', 'GHO', 'sDAI'];
31
31
  const isLeveragedPos = (usedAssets, dustLimit = 5) => {
32
32
  let borrowUnstable = 0;
33
33
  let supplyStable = 0;
@@ -14,7 +14,3 @@ export declare const handleWbtcLegacy: (asset: string) => string;
14
14
  export declare const wethToEthByAddress: (maybeWethAddr: string, chainId?: NetworkNumber) => string;
15
15
  export declare const ethToWethByAddress: (maybeEthAddr: string, chainId?: NetworkNumber) => string;
16
16
  export declare const bytesToString: (hex: string) => string;
17
- /**
18
- * Map an input value from one range (minInput, maxInput) to a value in another range (minOutput, maxOutput)
19
- */
20
- export declare const mapRange: (input: number | string, minInput: number | string, maxInput: number | string, minOutput: number | string, maxOutput: number | string) => number;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.mapRange = exports.bytesToString = exports.ethToWethByAddress = exports.wethToEthByAddress = exports.handleWbtcLegacy = exports.getEthAmountForDecimals = exports.compareAddresses = exports.isAddress = exports.ADDRESS_REGEX = exports.getAbiItem = exports.wstEthToStEth = exports.stEthToWstEth = exports.wethToEth = exports.ethToWeth = exports.addToObjectIf = exports.isLayer2Network = void 0;
6
+ exports.bytesToString = exports.ethToWethByAddress = exports.wethToEthByAddress = exports.handleWbtcLegacy = exports.getEthAmountForDecimals = exports.compareAddresses = exports.isAddress = exports.ADDRESS_REGEX = exports.getAbiItem = exports.wstEthToStEth = exports.stEthToWstEth = exports.wethToEth = exports.ethToWeth = exports.addToObjectIf = exports.isLayer2Network = void 0;
7
7
  const decimal_js_1 = __importDefault(require("decimal.js"));
8
8
  const tokens_1 = require("@defisaver/tokens");
9
9
  const common_1 = require("../types/common");
@@ -39,15 +39,3 @@ const bytesToString = (hex) => Buffer.from(hex.replace(/^0x/, ''), 'hex')
39
39
  // eslint-disable-next-line no-control-regex
40
40
  .replace(/\x00/g, '');
41
41
  exports.bytesToString = bytesToString;
42
- /**
43
- * Map an input value from one range (minInput, maxInput) to a value in another range (minOutput, maxOutput)
44
- */
45
- const mapRange = (input, minInput, maxInput, minOutput, maxOutput) => {
46
- // slope = 1.0 * (output_end - output_start) / (input_end - input_start)
47
- const inputDiff = new decimal_js_1.default(maxInput).minus(minInput);
48
- const outputDiff = new decimal_js_1.default(maxOutput).minus(minOutput);
49
- const slope = new decimal_js_1.default(outputDiff).div(inputDiff);
50
- // output = output_start + slope * (input - input_start)
51
- return new decimal_js_1.default(minOutput).plus(new decimal_js_1.default(slope).mul(new decimal_js_1.default(input).minus(minInput))).toDP(2).toNumber();
52
- };
53
- exports.mapRange = mapRange;
@@ -138,9 +138,7 @@ export declare namespace CurveUsdView {
138
138
  [
139
139
  number | string | BN[],
140
140
  number | string | BN[]
141
- ],
142
- number | string | BN,
143
- boolean
141
+ ]
144
142
  ] | {
145
143
  loanExists: boolean;
146
144
  collateralPrice: number | string | BN;
@@ -154,8 +152,6 @@ export declare namespace CurveUsdView {
154
152
  health: number | string | BN;
155
153
  bandRange: [number | string | BN, number | string | BN];
156
154
  usersBands: [number | string | BN[], number | string | BN[]];
157
- collRatio: number | string | BN;
158
- isInSoftLiquidation: boolean;
159
155
  };
160
156
  type UserDataStructOutputArray = [
161
157
  boolean,
@@ -175,9 +171,7 @@ export declare namespace CurveUsdView {
175
171
  [
176
172
  string[],
177
173
  string[]
178
- ],
179
- string,
180
- boolean
174
+ ]
181
175
  ];
182
176
  type UserDataStructOutputStruct = {
183
177
  loanExists: boolean;
@@ -192,8 +186,6 @@ export declare namespace CurveUsdView {
192
186
  health: string;
193
187
  bandRange: [string, string];
194
188
  usersBands: [string[], string[]];
195
- collRatio: string;
196
- isInSoftLiquidation: boolean;
197
189
  };
198
190
  type UserDataStructOutput = UserDataStructOutputArray & UserDataStructOutputStruct;
199
191
  }
@@ -201,33 +193,15 @@ export interface CrvUSDView extends BaseContract {
201
193
  constructor(jsonInterface: any[], address?: string, options?: ContractOptions): CrvUSDView;
202
194
  clone(): CrvUSDView;
203
195
  methods: {
204
- WBTC_HEALTH_ZAP(): NonPayableTransactionObject<string>;
205
- WBTC_MARKET(): NonPayableTransactionObject<string>;
206
196
  createLoanData(market: string, collateral: number | string | BN, debt: number | string | BN, N: number | string | BN): NonPayableTransactionObject<CurveUsdView.CreateLoanDataStructOutput>;
207
197
  getBandData(market: string, n: number | string | BN): NonPayableTransactionObject<CurveUsdView.BandStructOutput>;
208
- getBandsData(market: string, from: number | string | BN, to: number | string | BN): NonPayableTransactionObject<CurveUsdView.BandStructOutput[]>;
209
- getBandsDataForPosition(market: string, collateral: number | string | BN, debt: number | string | BN, N: number | string | BN): NonPayableTransactionObject<CurveUsdView.BandStructOutput[]>;
210
- getCollAmountsFromAMM(_controllerAddress: string, _user: string): NonPayableTransactionObject<[
211
- string,
212
- string
213
- ] & {
214
- crvUsdAmount: string;
215
- collAmount: string;
216
- }>;
217
- getCollateralRatio(_user: string, _controllerAddr: string): NonPayableTransactionObject<[
218
- string,
219
- boolean
220
- ] & {
221
- collRatio: string;
222
- isInSoftLiquidation: boolean;
223
- }>;
198
+ "getBandsData(address,uint256,uint256,uint256)"(market: string, collateral: number | string | BN, debt: number | string | BN, N: number | string | BN): NonPayableTransactionObject<CurveUsdView.BandStructOutput[]>;
199
+ "getBandsData(address,int256,int256)"(market: string, from: number | string | BN, to: number | string | BN): NonPayableTransactionObject<CurveUsdView.BandStructOutput[]>;
224
200
  globalData(market: string): NonPayableTransactionObject<CurveUsdView.GlobalDataStructOutput>;
225
201
  healthCalculator(market: string, user: string, collChange: number | string | BN, debtChange: number | string | BN, isFull: boolean, numBands: number | string | BN): NonPayableTransactionObject<string>;
226
- isControllerValid(_controllerAddr: string): NonPayableTransactionObject<boolean>;
227
202
  maxBorrow(market: string, collateral: number | string | BN, N: number | string | BN): NonPayableTransactionObject<string>;
228
203
  minCollateral(market: string, debt: number | string | BN, N: number | string | BN): NonPayableTransactionObject<string>;
229
204
  userData(market: string, user: string): NonPayableTransactionObject<CurveUsdView.UserDataStructOutput>;
230
- userMaxWithdraw(_controllerAddress: string, _user: string): NonPayableTransactionObject<string>;
231
205
  };
232
206
  events: {
233
207
  allEvents(options?: EventOptions, cb?: Callback<EventLog>): EventEmitter;
@@ -67,12 +67,6 @@ export interface CrvUSDAggregatedPositionData {
67
67
  borrowedUsd: string;
68
68
  borrowed: string;
69
69
  safetyRatio: string;
70
- borrowLimitUsd: string;
71
- minAllowedRatio: number;
72
- collFactor: string;
73
- leveragedType: string;
74
- leveragedAsset?: string;
75
- liquidationPrice?: string;
76
70
  }
77
71
  export interface CrvUSDUsedAsset {
78
72
  isSupplied: boolean;
@@ -2913,12 +2913,6 @@ export namespace crvUSDsfrxETHAmm {
2913
2913
  }
2914
2914
  export namespace crvUSDView {
2915
2915
  let abi_50: ({
2916
- inputs: never[];
2917
- name: string;
2918
- type: string;
2919
- outputs?: undefined;
2920
- stateMutability?: undefined;
2921
- } | {
2922
2916
  inputs: {
2923
2917
  internalType: string;
2924
2918
  name: string;
@@ -2969,8 +2963,6 @@ export namespace crvUSDView {
2969
2963
  createdBlock: number;
2970
2964
  oldVersions: {
2971
2965
  "17657253": string;
2972
- "17683243": string;
2973
- "18419795": string;
2974
2966
  };
2975
2967
  };
2976
2968
  };
@@ -3045,7 +3037,24 @@ export namespace LiquityView {
3045
3037
  "12549073": string;
3046
3038
  "12567960": string;
3047
3039
  "12638758": string;
3048
- "12746821": string;
3040
+ "12746821": {
3041
+ abi: {
3042
+ inputs: {
3043
+ internalType: string;
3044
+ name: string;
3045
+ type: string;
3046
+ }[];
3047
+ name: string;
3048
+ outputs: {
3049
+ internalType: string;
3050
+ name: string;
3051
+ type: string;
3052
+ }[];
3053
+ stateMutability: string;
3054
+ type: string;
3055
+ }[];
3056
+ address: string;
3057
+ };
3049
3058
  };
3050
3059
  };
3051
3060
  };