@defisaver/positions-sdk 0.0.32 → 0.0.34

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 (86) hide show
  1. package/README.md +63 -63
  2. package/cjs/config/contracts.d.ts +908 -41
  3. package/cjs/config/contracts.js +171 -44
  4. package/cjs/contracts.js +4 -10
  5. package/cjs/curveUsd/index.js +1 -1
  6. package/cjs/helpers/curveUsdHelpers/index.d.ts +2 -1
  7. package/cjs/helpers/curveUsdHelpers/index.js +25 -17
  8. package/cjs/markets/morphoBlue/index.d.ts +2 -0
  9. package/cjs/markets/morphoBlue/index.js +17 -1
  10. package/cjs/moneymarket/moneymarketCommonService.js +1 -1
  11. package/cjs/morphoBlue/index.js +6 -3
  12. package/cjs/services/utils.d.ts +4 -0
  13. package/cjs/services/utils.js +13 -1
  14. package/cjs/types/contracts/generated/CrvUSDView.d.ts +30 -4
  15. package/cjs/types/curveUsd.d.ts +6 -0
  16. package/cjs/types/morphoBlue.d.ts +2 -1
  17. package/cjs/types/morphoBlue.js +1 -0
  18. package/esm/config/contracts.d.ts +908 -41
  19. package/esm/config/contracts.js +171 -44
  20. package/esm/contracts.js +4 -10
  21. package/esm/curveUsd/index.js +1 -1
  22. package/esm/helpers/curveUsdHelpers/index.d.ts +2 -1
  23. package/esm/helpers/curveUsdHelpers/index.js +26 -18
  24. package/esm/markets/morphoBlue/index.d.ts +2 -0
  25. package/esm/markets/morphoBlue/index.js +15 -0
  26. package/esm/moneymarket/moneymarketCommonService.js +1 -1
  27. package/esm/morphoBlue/index.js +6 -3
  28. package/esm/services/utils.d.ts +4 -0
  29. package/esm/services/utils.js +11 -0
  30. package/esm/types/contracts/generated/CrvUSDView.d.ts +30 -4
  31. package/esm/types/curveUsd.d.ts +6 -0
  32. package/esm/types/morphoBlue.d.ts +2 -1
  33. package/esm/types/morphoBlue.js +1 -0
  34. package/package.json +40 -40
  35. package/src/aaveV2/index.ts +226 -226
  36. package/src/aaveV3/index.ts +561 -561
  37. package/src/assets/index.ts +60 -60
  38. package/src/chickenBonds/index.ts +123 -123
  39. package/src/compoundV2/index.ts +219 -219
  40. package/src/compoundV3/index.ts +275 -275
  41. package/src/config/contracts.js +817 -690
  42. package/src/constants/index.ts +5 -5
  43. package/src/contracts.ts +124 -130
  44. package/src/curveUsd/index.ts +228 -228
  45. package/src/exchange/index.ts +17 -17
  46. package/src/helpers/aaveHelpers/index.ts +134 -134
  47. package/src/helpers/chickenBondsHelpers/index.ts +23 -23
  48. package/src/helpers/compoundHelpers/index.ts +181 -181
  49. package/src/helpers/curveUsdHelpers/index.ts +40 -32
  50. package/src/helpers/index.ts +6 -6
  51. package/src/helpers/makerHelpers/index.ts +94 -94
  52. package/src/helpers/morphoBlueHelpers/index.ts +46 -46
  53. package/src/helpers/sparkHelpers/index.ts +106 -106
  54. package/src/index.ts +42 -42
  55. package/src/liquity/index.ts +116 -116
  56. package/src/maker/index.ts +101 -101
  57. package/src/markets/aave/index.ts +80 -80
  58. package/src/markets/aave/marketAssets.ts +24 -24
  59. package/src/markets/compound/index.ts +141 -141
  60. package/src/markets/compound/marketsAssets.ts +48 -48
  61. package/src/markets/curveUsd/index.ts +69 -69
  62. package/src/markets/index.ts +4 -4
  63. package/src/markets/morphoBlue/index.ts +36 -20
  64. package/src/markets/spark/index.ts +29 -29
  65. package/src/markets/spark/marketAssets.ts +10 -10
  66. package/src/moneymarket/moneymarketCommonService.ts +75 -75
  67. package/src/morphoAaveV2/index.ts +255 -255
  68. package/src/morphoAaveV3/index.ts +619 -619
  69. package/src/morphoBlue/index.ts +170 -165
  70. package/src/multicall/index.ts +22 -22
  71. package/src/services/dsrService.ts +15 -15
  72. package/src/services/priceService.ts +21 -21
  73. package/src/services/utils.ts +48 -35
  74. package/src/spark/index.ts +422 -422
  75. package/src/staking/staking.ts +167 -167
  76. package/src/types/aave.ts +256 -256
  77. package/src/types/chickenBonds.ts +45 -45
  78. package/src/types/common.ts +83 -83
  79. package/src/types/compound.ts +128 -128
  80. package/src/types/contracts/generated/CrvUSDView.ts +43 -8
  81. package/src/types/curveUsd.ts +118 -112
  82. package/src/types/index.ts +7 -7
  83. package/src/types/liquity.ts +30 -30
  84. package/src/types/maker.ts +50 -50
  85. package/src/types/morphoBlue.ts +80 -79
  86. package/src/types/spark.ts +106 -106
@@ -9,35 +9,86 @@ module.exports = {
9
9
  "address": "0x8095fFFC3cDdE58C4F537D39f9795A40a103e633",
10
10
  "createdBlock": 17870436,
11
11
  "oldVersions": {
12
- "16483408": "0x9ECB0645b357fDD7B92789B91595160862Bd45d0",
13
- "16690564": "0xf4B715BB788cC4071061bd67dC8B56681460A2fF"
12
+ "16483408": {
13
+ "abi": [{ "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address", "name": "_user", "type": "address" }, { "internalType": "address[]", "name": "_tokens", "type": "address[]" }], "name": "getTokenBalances", "outputs": [{ "components": [{ "internalType": "address", "name": "token", "type": "address" }, { "internalType": "uint256", "name": "balance", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsStable", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsVariable", "type": "uint256" }, { "internalType": "uint256", "name": "stableBorrowRate", "type": "uint256" }, { "internalType": "bool", "name": "enabledAsCollateral", "type": "bool" }], "internalType": "struct AaveV3View.UserToken[]", "name": "userTokens", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }],
14
+ "address": "0x9ECB0645b357fDD7B92789B91595160862Bd45d0"
15
+ },
16
+ "16690564": {
17
+ "abi": [{ "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address", "name": "_user", "type": "address" }, { "internalType": "address[]", "name": "_tokens", "type": "address[]" }], "name": "getTokenBalances", "outputs": [{ "components": [{ "internalType": "address", "name": "token", "type": "address" }, { "internalType": "uint256", "name": "balance", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsStable", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsVariable", "type": "uint256" }, { "internalType": "uint256", "name": "stableBorrowRate", "type": "uint256" }, { "internalType": "bool", "name": "enabledAsCollateral", "type": "bool" }], "internalType": "struct AaveV3View.UserToken[]", "name": "userTokens", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }],
18
+ "address": "0xf4B715BB788cC4071061bd67dC8B56681460A2fF"
19
+ }
14
20
  }
15
21
  },
16
22
  "10": {
17
23
  "address": "0xB6aF2C91E3eBB250615aaa33Bb955f7a7f21AD17",
18
24
  "createdBlock": 107950604,
19
25
  "oldVersions": {
20
- "6723401": "0xc3A1859A5B0Ffe9ccF1f70f6F3AaB8e8EF8E6366",
21
- "6926482": "0x2cB32d185a6211b07bCaaEE79D2FD8566e5711a9",
22
- "8908372": "0x9629685De9Cc4adaC27F7F1733E046A9549D23F5",
23
- "13445522": "0x2136949bb2Aa4056A7505Fa0895DD797d4C7c683",
24
- "18286606": "0xf924f1E8cdB6AFC02d115fb9C6f80275B2E63cc9",
25
- "23450199": "0xcd5380201fdc29Bc417C8aFB926Df60aacc0C0F4",
26
- "76015698": "0xC20fA40Dd4f0D3f7431Eb4B6bc0614F36932F6Dc",
27
- "106560861": "0x05f8Ba4Db7F7C65a61881297D86Aea3c83C26304"
26
+ "6723401": {
27
+ "abi": [{ "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address", "name": "_user", "type": "address" }, { "internalType": "address[]", "name": "_tokens", "type": "address[]" }], "name": "getTokenBalances", "outputs": [{ "components": [{ "internalType": "address", "name": "token", "type": "address" }, { "internalType": "uint256", "name": "balance", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsStable", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsVariable", "type": "uint256" }, { "internalType": "uint256", "name": "stableBorrowRate", "type": "uint256" }, { "internalType": "bool", "name": "enabledAsCollateral", "type": "bool" }], "internalType": "struct AaveV3View.UserToken[]", "name": "userTokens", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }],
28
+ "address": "0xc3A1859A5B0Ffe9ccF1f70f6F3AaB8e8EF8E6366"
29
+ },
30
+ "6926482": {
31
+ "abi": [{ "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address", "name": "_user", "type": "address" }, { "internalType": "address[]", "name": "_tokens", "type": "address[]" }], "name": "getTokenBalances", "outputs": [{ "components": [{ "internalType": "address", "name": "token", "type": "address" }, { "internalType": "uint256", "name": "balance", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsStable", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsVariable", "type": "uint256" }, { "internalType": "uint256", "name": "stableBorrowRate", "type": "uint256" }, { "internalType": "bool", "name": "enabledAsCollateral", "type": "bool" }], "internalType": "struct AaveV3View.UserToken[]", "name": "userTokens", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }],
32
+ "address": "0x2cB32d185a6211b07bCaaEE79D2FD8566e5711a9"
33
+ },
34
+ "8908372": {
35
+ "abi": [{ "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address", "name": "_user", "type": "address" }, { "internalType": "address[]", "name": "_tokens", "type": "address[]" }], "name": "getTokenBalances", "outputs": [{ "components": [{ "internalType": "address", "name": "token", "type": "address" }, { "internalType": "uint256", "name": "balance", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsStable", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsVariable", "type": "uint256" }, { "internalType": "uint256", "name": "stableBorrowRate", "type": "uint256" }, { "internalType": "bool", "name": "enabledAsCollateral", "type": "bool" }], "internalType": "struct AaveV3View.UserToken[]", "name": "userTokens", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }],
36
+ "address": "0x9629685De9Cc4adaC27F7F1733E046A9549D23F5"
37
+ },
38
+ "13445522": {
39
+ "abi": [{ "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address", "name": "_user", "type": "address" }, { "internalType": "address[]", "name": "_tokens", "type": "address[]" }], "name": "getTokenBalances", "outputs": [{ "components": [{ "internalType": "address", "name": "token", "type": "address" }, { "internalType": "uint256", "name": "balance", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsStable", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsVariable", "type": "uint256" }, { "internalType": "uint256", "name": "stableBorrowRate", "type": "uint256" }, { "internalType": "bool", "name": "enabledAsCollateral", "type": "bool" }], "internalType": "struct AaveV3View.UserToken[]", "name": "userTokens", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }],
40
+ "address": "0x2136949bb2Aa4056A7505Fa0895DD797d4C7c683"
41
+ },
42
+ "18286606": {
43
+ "abi": [{ "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address", "name": "_user", "type": "address" }, { "internalType": "address[]", "name": "_tokens", "type": "address[]" }], "name": "getTokenBalances", "outputs": [{ "components": [{ "internalType": "address", "name": "token", "type": "address" }, { "internalType": "uint256", "name": "balance", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsStable", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsVariable", "type": "uint256" }, { "internalType": "uint256", "name": "stableBorrowRate", "type": "uint256" }, { "internalType": "bool", "name": "enabledAsCollateral", "type": "bool" }], "internalType": "struct AaveV3View.UserToken[]", "name": "userTokens", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }],
44
+ "address": "0xf924f1E8cdB6AFC02d115fb9C6f80275B2E63cc9"
45
+ },
46
+ "23450199": {
47
+ "abi": [{ "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address", "name": "_user", "type": "address" }, { "internalType": "address[]", "name": "_tokens", "type": "address[]" }], "name": "getTokenBalances", "outputs": [{ "components": [{ "internalType": "address", "name": "token", "type": "address" }, { "internalType": "uint256", "name": "balance", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsStable", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsVariable", "type": "uint256" }, { "internalType": "uint256", "name": "stableBorrowRate", "type": "uint256" }, { "internalType": "bool", "name": "enabledAsCollateral", "type": "bool" }], "internalType": "struct AaveV3View.UserToken[]", "name": "userTokens", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }],
48
+ "address": "0xcd5380201fdc29Bc417C8aFB926Df60aacc0C0F4"
49
+ },
50
+ "76015698": {
51
+ "abi": [{ "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address", "name": "_user", "type": "address" }, { "internalType": "address[]", "name": "_tokens", "type": "address[]" }], "name": "getTokenBalances", "outputs": [{ "components": [{ "internalType": "address", "name": "token", "type": "address" }, { "internalType": "uint256", "name": "balance", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsStable", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsVariable", "type": "uint256" }, { "internalType": "uint256", "name": "stableBorrowRate", "type": "uint256" }, { "internalType": "bool", "name": "enabledAsCollateral", "type": "bool" }], "internalType": "struct AaveV3View.UserToken[]", "name": "userTokens", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }],
52
+ "address": "0xC20fA40Dd4f0D3f7431Eb4B6bc0614F36932F6Dc"
53
+ },
54
+ "106560861": {
55
+ "abi": [{ "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address", "name": "_user", "type": "address" }, { "internalType": "address[]", "name": "_tokens", "type": "address[]" }], "name": "getTokenBalances", "outputs": [{ "components": [{ "internalType": "address", "name": "token", "type": "address" }, { "internalType": "uint256", "name": "balance", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsStable", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsVariable", "type": "uint256" }, { "internalType": "uint256", "name": "stableBorrowRate", "type": "uint256" }, { "internalType": "bool", "name": "enabledAsCollateral", "type": "bool" }], "internalType": "struct AaveV3View.UserToken[]", "name": "userTokens", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }],
56
+ "address": "0x05f8Ba4Db7F7C65a61881297D86Aea3c83C26304"
57
+ },
28
58
  }
29
59
  },
30
60
  "42161": {
31
61
  "address": "0x2596e41933136E87C04b56f632CEcA2cdCCC2Cc6",
32
62
  "createdBlock": 119382184,
33
63
  "oldVersions": {
34
- "12855842": "0xfCCB21cAd40ADeB097533E027f335b87c5d6CA21",
35
- "16400389": "0x710f01037018Daad969B8FeFe69b4823Ef788bc6",
36
- "18522551": "0x8C589b04a4C1f8F280f0133395451F6c2BE02450",
37
- "19702666": "0x48D32ee631ebCe01f2cd8F99B94911D5A059E9dA",
38
- "24918146": "0x8EF42fF40e9a9dD3E1ae81e7947D4E89e6d9f968",
39
- "63484252": "0xA74a85407D5A940542915458616aC3cf3f404E3b",
40
- "108724549": "0x401E66549DF354a21B3CC95e3F548Df6854d6DEE"
64
+ "12855842": {
65
+ "abi": [{ "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address", "name": "_user", "type": "address" }, { "internalType": "address[]", "name": "_tokens", "type": "address[]" }], "name": "getTokenBalances", "outputs": [{ "components": [{ "internalType": "address", "name": "token", "type": "address" }, { "internalType": "uint256", "name": "balance", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsStable", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsVariable", "type": "uint256" }, { "internalType": "uint256", "name": "stableBorrowRate", "type": "uint256" }, { "internalType": "bool", "name": "enabledAsCollateral", "type": "bool" }], "internalType": "struct AaveV3View.UserToken[]", "name": "userTokens", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }],
66
+ "address": "0xfCCB21cAd40ADeB097533E027f335b87c5d6CA21"
67
+ },
68
+ "16400389": {
69
+ "abi": [{ "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address", "name": "_user", "type": "address" }, { "internalType": "address[]", "name": "_tokens", "type": "address[]" }], "name": "getTokenBalances", "outputs": [{ "components": [{ "internalType": "address", "name": "token", "type": "address" }, { "internalType": "uint256", "name": "balance", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsStable", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsVariable", "type": "uint256" }, { "internalType": "uint256", "name": "stableBorrowRate", "type": "uint256" }, { "internalType": "bool", "name": "enabledAsCollateral", "type": "bool" }], "internalType": "struct AaveV3View.UserToken[]", "name": "userTokens", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }],
70
+ "address": "0x710f01037018Daad969B8FeFe69b4823Ef788bc6"
71
+ },
72
+ "18522551": {
73
+ "abi": [{ "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address", "name": "_user", "type": "address" }, { "internalType": "address[]", "name": "_tokens", "type": "address[]" }], "name": "getTokenBalances", "outputs": [{ "components": [{ "internalType": "address", "name": "token", "type": "address" }, { "internalType": "uint256", "name": "balance", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsStable", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsVariable", "type": "uint256" }, { "internalType": "uint256", "name": "stableBorrowRate", "type": "uint256" }, { "internalType": "bool", "name": "enabledAsCollateral", "type": "bool" }], "internalType": "struct AaveV3View.UserToken[]", "name": "userTokens", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }],
74
+ "address": "0x8C589b04a4C1f8F280f0133395451F6c2BE02450"
75
+ },
76
+ "19702666": {
77
+ "abi": [{ "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address", "name": "_user", "type": "address" }, { "internalType": "address[]", "name": "_tokens", "type": "address[]" }], "name": "getTokenBalances", "outputs": [{ "components": [{ "internalType": "address", "name": "token", "type": "address" }, { "internalType": "uint256", "name": "balance", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsStable", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsVariable", "type": "uint256" }, { "internalType": "uint256", "name": "stableBorrowRate", "type": "uint256" }, { "internalType": "bool", "name": "enabledAsCollateral", "type": "bool" }], "internalType": "struct AaveV3View.UserToken[]", "name": "userTokens", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }],
78
+ "address": "0x48D32ee631ebCe01f2cd8F99B94911D5A059E9dA"
79
+ },
80
+ "24918146": {
81
+ "abi": [{ "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address", "name": "_user", "type": "address" }, { "internalType": "address[]", "name": "_tokens", "type": "address[]" }], "name": "getTokenBalances", "outputs": [{ "components": [{ "internalType": "address", "name": "token", "type": "address" }, { "internalType": "uint256", "name": "balance", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsStable", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsVariable", "type": "uint256" }, { "internalType": "uint256", "name": "stableBorrowRate", "type": "uint256" }, { "internalType": "bool", "name": "enabledAsCollateral", "type": "bool" }], "internalType": "struct AaveV3View.UserToken[]", "name": "userTokens", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }],
82
+ "address": "0x8EF42fF40e9a9dD3E1ae81e7947D4E89e6d9f968"
83
+ },
84
+ "63484252": {
85
+ "abi": [{ "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address", "name": "_user", "type": "address" }, { "internalType": "address[]", "name": "_tokens", "type": "address[]" }], "name": "getTokenBalances", "outputs": [{ "components": [{ "internalType": "address", "name": "token", "type": "address" }, { "internalType": "uint256", "name": "balance", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsStable", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsVariable", "type": "uint256" }, { "internalType": "uint256", "name": "stableBorrowRate", "type": "uint256" }, { "internalType": "bool", "name": "enabledAsCollateral", "type": "bool" }], "internalType": "struct AaveV3View.UserToken[]", "name": "userTokens", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }],
86
+ "address": "0xA74a85407D5A940542915458616aC3cf3f404E3b"
87
+ },
88
+ "108724549": {
89
+ "abi": [{ "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address", "name": "_user", "type": "address" }, { "internalType": "address[]", "name": "_tokens", "type": "address[]" }], "name": "getTokenBalances", "outputs": [{ "components": [{ "internalType": "address", "name": "token", "type": "address" }, { "internalType": "uint256", "name": "balance", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsStable", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsVariable", "type": "uint256" }, { "internalType": "uint256", "name": "stableBorrowRate", "type": "uint256" }, { "internalType": "bool", "name": "enabledAsCollateral", "type": "bool" }], "internalType": "struct AaveV3View.UserToken[]", "name": "userTokens", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }],
90
+ "address": "0x401E66549DF354a21B3CC95e3F548Df6854d6DEE"
91
+ },
41
92
  }
42
93
  },
43
94
  "8453": {
@@ -225,7 +276,10 @@ module.exports = {
225
276
  "address": "0xf522b1588688b9887623b9C666175684d284D363",
226
277
  "createdBlock": 15581957,
227
278
  "oldVersions": {
228
- "15520449": "0x5e07E953dac1d7c19091c3b493579ba7283572a4"
279
+ "15520449": {
280
+ "abi": [{ "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address", "name": "_user", "type": "address" }], "name": "getLoanData", "outputs": [{ "components": [{ "internalType": "address", "name": "user", "type": "address" }, { "internalType": "address[]", "name": "collAddr", "type": "address[]" }, { "internalType": "uint256[]", "name": "collAmounts", "type": "uint256[]" }, { "internalType": "uint256", "name": "depositAmount", "type": "uint256" }, { "internalType": "uint256", "name": "depositValue", "type": "uint256" }, { "internalType": "uint256", "name": "borrowAmount", "type": "uint256" }, { "internalType": "uint256", "name": "borrowValue", "type": "uint256" }, { "internalType": "uint256", "name": "collValue", "type": "uint256" }], "internalType": "struct CompV3View.LoanData", "name": "data", "type": "tuple" }], "stateMutability": "view", "type": "function" }],
281
+ "address": "0x5e07E953dac1d7c19091c3b493579ba7283572a4",
282
+ }
229
283
  }
230
284
  },
231
285
  "8453": {
@@ -286,14 +340,34 @@ module.exports = {
286
340
  "address": "0xEDf1087544a01596b70Da746F861B878F245B08f",
287
341
  "createdBlock": 15484097,
288
342
  "oldVersions": {
289
- "11374778": "0xbC18860D3212e97D488cCDa2e37ff4ab8593D31d",
290
- "11375123": "0xE66d12b13224C0cD490CaC2FF7746e258Bc8E60c",
291
- "11375721": "0x682868AdbcFC9fECC3506B0A182E7E5D683F83BC",
292
- "11377499": "0x7ce5B82B44fa3037A1dE3F01133bfC3b945635a1",
293
- "11420152": "0x8F07659525e78fd73Bf86f8E97AEa41bd54dEb54",
294
- "11637629": "0xd0C9ADDABbA270493A6503e74E62794435c8F1D3",
295
- "12317383": "0x21F46013a19Ee99191a04C62C9c88B1F50E00bb2",
296
- "15484097": "0xEDf1087544a01596b70Da746F861B878F245B08f"
343
+ "11374778": {
344
+ "abi": [{ "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address", "name": "_user", "type": "address" }, { "internalType": "address[]", "name": "_tokens", "type": "address[]" }], "name": "getTokenBalances", "outputs": [{ "components": [{ "internalType": "address", "name": "token", "type": "address" }, { "internalType": "uint256", "name": "balance", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsStable", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsVariable", "type": "uint256" }, { "internalType": "bool", "name": "enabledAsCollateral", "type": "bool" }], "internalType": "struct AaveLoanInfoV2.UserToken[]", "name": "userTokens", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }],
345
+ "address": "0xbC18860D3212e97D488cCDa2e37ff4ab8593D31d"
346
+ },
347
+ "11375123": {
348
+ "abi": [{ "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address", "name": "_user", "type": "address" }, { "internalType": "address[]", "name": "_tokens", "type": "address[]" }], "name": "getTokenBalances", "outputs": [{ "components": [{ "internalType": "address", "name": "token", "type": "address" }, { "internalType": "uint256", "name": "balance", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsStable", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsVariable", "type": "uint256" }, { "internalType": "bool", "name": "enabledAsCollateral", "type": "bool" }], "internalType": "struct AaveLoanInfoV2.UserToken[]", "name": "userTokens", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }],
349
+ "address": "0xE66d12b13224C0cD490CaC2FF7746e258Bc8E60c"
350
+ },
351
+ "11377499": {
352
+ "abi": [{ "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address", "name": "_user", "type": "address" }, { "internalType": "address[]", "name": "_tokens", "type": "address[]" }], "name": "getTokenBalances", "outputs": [{ "components": [{ "internalType": "address", "name": "token", "type": "address" }, { "internalType": "uint256", "name": "balance", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsStable", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsVariable", "type": "uint256" }, { "internalType": "bool", "name": "enabledAsCollateral", "type": "bool" }], "internalType": "struct AaveLoanInfoV2.UserToken[]", "name": "userTokens", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }],
353
+ "address": "0x7ce5B82B44fa3037A1dE3F01133bfC3b945635a1"
354
+ },
355
+ "11420152": {
356
+ "abi": [{ "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address", "name": "_user", "type": "address" }, { "internalType": "address[]", "name": "_tokens", "type": "address[]" }], "name": "getTokenBalances", "outputs": [{ "components": [{ "internalType": "address", "name": "token", "type": "address" }, { "internalType": "uint256", "name": "balance", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsStable", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsVariable", "type": "uint256" }, { "internalType": "bool", "name": "enabledAsCollateral", "type": "bool" }], "internalType": "struct AaveLoanInfoV2.UserToken[]", "name": "userTokens", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }],
357
+ "address": "0x8F07659525e78fd73Bf86f8E97AEa41bd54dEb54"
358
+ },
359
+ "11637629": {
360
+ "abi": [{ "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address", "name": "_user", "type": "address" }, { "internalType": "address[]", "name": "_tokens", "type": "address[]" }], "name": "getTokenBalances", "outputs": [{ "components": [{ "internalType": "address", "name": "token", "type": "address" }, { "internalType": "uint256", "name": "balance", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsStable", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsVariable", "type": "uint256" }, { "internalType": "uint256", "name": "stableBorrowRate", "type": "uint256" }, { "internalType": "bool", "name": "enabledAsCollateral", "type": "bool" }], "internalType": "struct AaveLoanInfoV2.UserToken[]", "name": "userTokens", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }],
361
+ "address": "0xd0C9ADDABbA270493A6503e74E62794435c8F1D3"
362
+ },
363
+ "12317383": {
364
+ "abi": [{ "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address", "name": "_user", "type": "address" }, { "internalType": "address[]", "name": "_tokens", "type": "address[]" }], "name": "getTokenBalances", "outputs": [{ "components": [{ "internalType": "address", "name": "token", "type": "address" }, { "internalType": "uint256", "name": "balance", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsStable", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsVariable", "type": "uint256" }, { "internalType": "uint256", "name": "stableBorrowRate", "type": "uint256" }, { "internalType": "bool", "name": "enabledAsCollateral", "type": "bool" }], "internalType": "struct AaveLoanInfoV2.UserToken[]", "name": "userTokens", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }],
365
+ "address": "0x21F46013a19Ee99191a04C62C9c88B1F50E00bb2"
366
+ },
367
+ "15484097": {
368
+ "abi": [{ "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address", "name": "_user", "type": "address" }, { "internalType": "address[]", "name": "_tokens", "type": "address[]" }], "name": "getTokenBalances", "outputs": [{ "components": [{ "internalType": "address", "name": "token", "type": "address" }, { "internalType": "uint256", "name": "balance", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsStable", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsVariable", "type": "uint256" }, { "internalType": "uint256", "name": "stableBorrowRate", "type": "uint256" }, { "internalType": "bool", "name": "enabledAsCollateral", "type": "bool" }], "internalType": "struct AaveLoanInfoV2.UserToken[]", "name": "userTokens", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }],
369
+ "address": "0xEDf1087544a01596b70Da746F861B878F245B08f"
370
+ },
297
371
  }
298
372
  },
299
373
  }
@@ -329,14 +403,38 @@ module.exports = {
329
403
  "address": "0xb25b98d3ca2dde635829870f852472bdd0b01b7e",
330
404
  "createdBlock": 17819315,
331
405
  "oldVersions": {
332
- "10024350": "0x576501AbD98ce5472b03B7AB4F5980941DB7Ef37",
333
- "10027063": "0x5F0679505134b1a146aD614bD2766A67df584D6b",
334
- "10052917": "0xEc8cd4B51BCA40D6342d5b880D6Dc0AA4317D506",
335
- "10411281": "0x781FDB68cE5EE5Cd7470bbFEec0F98c24eA18c93",
336
- "10684038": "0xB1F40B5109bba75C27a302C4E5d2afc30d5D1F30",
337
- "12503103": "0x8b7b8a0Ec22d4b2dBfB103947D8cD11e80E1CE22",
338
- "13416222": "0x19c76C1EdECd4551Fa8e49D1f96598dCDFF7A65F",
339
- "15442192": "0x4D81E17ce35A81b70b2E5eD4a0592e1C2C01219d"
406
+ "10024350": {
407
+ "abi": [],
408
+ "address": "0x576501AbD98ce5472b03B7AB4F5980941DB7Ef37",
409
+ },
410
+ "10027063": {
411
+ "abi": [{ "inputs": [{ "internalType": "address", "name": "_user", "type": "address" }, { "internalType": "address[]", "name": "_cTokens", "type": "address[]" }], "name": "getTokenBalances", "outputs": [{ "internalType": "uint256[]", "name": "balances", "type": "uint256[]" }, { "internalType": "uint256[]", "name": "borrows", "type": "uint256[]" }], "stateMutability": "view", "type": "function" }],
412
+ "address": "0x5F0679505134b1a146aD614bD2766A67df584D6b",
413
+ },
414
+ "10052917": {
415
+ "abi": [{ "inputs": [{ "internalType": "address", "name": "_user", "type": "address" }, { "internalType": "address[]", "name": "_cTokens", "type": "address[]" }], "name": "getTokenBalances", "outputs": [{ "internalType": "uint256[]", "name": "balances", "type": "uint256[]" }, { "internalType": "uint256[]", "name": "borrows", "type": "uint256[]" }], "stateMutability": "view", "type": "function" }],
416
+ "address": "0xEc8cd4B51BCA40D6342d5b880D6Dc0AA4317D506",
417
+ },
418
+ "10411281": {
419
+ "abi": [{ "inputs": [{ "internalType": "address", "name": "_user", "type": "address" }, { "internalType": "address[]", "name": "_cTokens", "type": "address[]" }], "name": "getTokenBalances", "outputs": [{ "internalType": "uint256[]", "name": "balances", "type": "uint256[]" }, { "internalType": "uint256[]", "name": "borrows", "type": "uint256[]" }], "stateMutability": "view", "type": "function" }],
420
+ "address": "0x781FDB68cE5EE5Cd7470bbFEec0F98c24eA18c93",
421
+ },
422
+ "10684038": {
423
+ "abi": [{ "inputs": [{ "internalType": "address", "name": "_user", "type": "address" }, { "internalType": "address[]", "name": "_cTokens", "type": "address[]" }], "name": "getTokenBalances", "outputs": [{ "internalType": "uint256[]", "name": "balances", "type": "uint256[]" }, { "internalType": "uint256[]", "name": "borrows", "type": "uint256[]" }], "stateMutability": "view", "type": "function" }],
424
+ "address": "0xB1F40B5109bba75C27a302C4E5d2afc30d5D1F30",
425
+ },
426
+ "12503103": {
427
+ "abi": [{ "inputs": [{ "internalType": "address", "name": "_user", "type": "address" }, { "internalType": "address[]", "name": "_cTokens", "type": "address[]" }], "name": "getTokenBalances", "outputs": [{ "internalType": "uint256[]", "name": "balances", "type": "uint256[]" }, { "internalType": "uint256[]", "name": "borrows", "type": "uint256[]" }], "stateMutability": "view", "type": "function" }],
428
+ "address": "0x8b7b8a0Ec22d4b2dBfB103947D8cD11e80E1CE22",
429
+ },
430
+ "13416222": {
431
+ "abi": [{ "inputs": [{ "internalType": "address", "name": "_user", "type": "address" }, { "internalType": "address[]", "name": "_cTokens", "type": "address[]" }], "name": "getTokenBalances", "outputs": [{ "internalType": "uint256[]", "name": "balances", "type": "uint256[]" }, { "internalType": "uint256[]", "name": "borrows", "type": "uint256[]" }], "stateMutability": "view", "type": "function" }],
432
+ "address": "0x19c76C1EdECd4551Fa8e49D1f96598dCDFF7A65F",
433
+ },
434
+ "15442192": {
435
+ "abi": [{ "inputs": [{ "internalType": "address", "name": "_user", "type": "address" }, { "internalType": "address[]", "name": "_cTokens", "type": "address[]" }], "name": "getTokenBalances", "outputs": [{ "internalType": "uint256[]", "name": "balances", "type": "uint256[]" }, { "internalType": "uint256[]", "name": "borrows", "type": "uint256[]" }], "stateMutability": "view", "type": "function" }],
436
+ "address": "0x4D81E17ce35A81b70b2E5eD4a0592e1C2C01219d",
437
+ },
340
438
  }
341
439
  }
342
440
  }
@@ -398,7 +496,10 @@ module.exports = {
398
496
  "address": "0x3667d1DB1f47F2c3a2f2411895d3476cc515b687",
399
497
  "createdBlock": 16741545,
400
498
  "oldVersions": {
401
- "16586304": "0x6518a138Da4ecE07cC6263FB2e7c4Ae773360302"
499
+ "16586304": {
500
+ "abi": [{ "inputs": [{ "internalType": "address", "name": "_usr", "type": "address" }], "name": "getUserInfo", "outputs": [{ "components": [{ "internalType": "uint256", "name": "userHealthFactor", "type": "uint256" }, { "internalType": "uint256", "name": "morphoClaimed", "type": "uint256" }, { "components": [{ "internalType": "address", "name": "market", "type": "address" }, { "internalType": "address", "name": "underlying", "type": "address" }, { "internalType": "uint256", "name": "userSupplyRate", "type": "uint256" }, { "internalType": "uint256", "name": "userBorrowRate", "type": "uint256" }, { "internalType": "uint256", "name": "supplyBalanceInP2P", "type": "uint256" }, { "internalType": "uint256", "name": "supplyBalanceOnPool", "type": "uint256" }, { "internalType": "uint256", "name": "borrowBalanceInP2P", "type": "uint256" }, { "internalType": "uint256", "name": "borrowBalanceOnPool", "type": "uint256" }], "internalType": "struct MorphoAaveV2View.UserBalance[]", "name": "userBalances", "type": "tuple[]" }], "internalType": "struct MorphoAaveV2View.UserInfo", "name": "userInfo", "type": "tuple" }], "stateMutability": "view", "type": "function" }],
501
+ "address": "0x6518a138Da4ecE07cC6263FB2e7c4Ae773360302",
502
+ }
402
503
  }
403
504
  }
404
505
  }
@@ -410,7 +511,10 @@ module.exports = {
410
511
  "address": "0xB3B13838F6F57CE76b94f0744Ab0B045B780836e",
411
512
  "createdBlock": 17870357,
412
513
  "oldVersions": {
413
- "17734126": "0x29d01EF37514912ab874D51fEc76c8f5d4d6712e"
514
+ "17734126": {
515
+ "abi": [{ "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address", "name": "_user", "type": "address" }, { "internalType": "address[]", "name": "_tokens", "type": "address[]" }], "name": "getTokenBalances", "outputs": [{ "components": [{ "internalType": "address", "name": "token", "type": "address" }, { "internalType": "uint256", "name": "balance", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsStable", "type": "uint256" }, { "internalType": "uint256", "name": "borrowsVariable", "type": "uint256" }, { "internalType": "uint256", "name": "stableBorrowRate", "type": "uint256" }, { "internalType": "bool", "name": "enabledAsCollateral", "type": "bool" }], "internalType": "struct SparkView.UserToken[]", "name": "userTokens", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }],
516
+ "address": "0x29d01EF37514912ab874D51fEc76c8f5d4d6712e",
517
+ }
414
518
  }
415
519
  }
416
520
  }
@@ -528,13 +632,24 @@ module.exports = {
528
632
  }
529
633
  },
530
634
  "crvUSDView": {
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" }],
635
+ "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" }],
532
636
  "networks": {
533
637
  "1": {
534
- "address": "0x512460CF2Bb80823C135F5DC04D2a1fF258FAA1e",
535
- "createdBlock": 17683243,
638
+ "address": "0x4BbCf0e587853aAEdFC3E60f74C10E07D8deA701",
639
+ "createdBlock": 18823384,
536
640
  "oldVersions": {
537
- "17657253": "0xa81430a4eC71466264b9ee50403F8d63E8c72B95"
641
+ "17657253": {
642
+ "address": "0xa81430a4eC71466264b9ee50403F8d63E8c72B95",
643
+ "abi": [{ "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" }],
644
+ },
645
+ "17683243": {
646
+ "address": "0x512460CF2Bb80823C135F5DC04D2a1fF258FAA1e",
647
+ "abi": [{ "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" }],
648
+ },
649
+ "18419795": {
650
+ "address": "0x4df1281f9d2303be453e0085881702a4b1358692",
651
+ "abi": [{ "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" }],
652
+ },
538
653
  }
539
654
  }
540
655
  }
@@ -554,9 +669,18 @@ module.exports = {
554
669
  "address": "0xb760e60Dff6263E8Ab31B04ee5Cc010beA47e2Df",
555
670
  "createdBlock": 17017214,
556
671
  "oldVersions": {
557
- "12549073": "0xFCDd12C6317adbd033B93486d176f99441344A0f",
558
- "12567960": "0x0bE59e4804d957026a0E31B5d0BEA0fbaE262ba7",
559
- "12638758": "0x30EFEF27A6919d927E4c684E373198F671c686Dc",
672
+ "12549073": {
673
+ "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" }],
674
+ "address": "0xFCDd12C6317adbd033B93486d176f99441344A0f"
675
+ },
676
+ "12567960": {
677
+ "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" }],
678
+ "address": "0x0bE59e4804d957026a0E31B5d0BEA0fbaE262ba7"
679
+ },
680
+ "12638758": {
681
+ "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" }],
682
+ "address": "0x30EFEF27A6919d927E4c684E373198F671c686Dc"
683
+ },
560
684
  "12746821": {
561
685
  "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
686
  "address": "0xD1913B977737c9505B8EcFEDB8121546096d3393"
@@ -604,7 +728,10 @@ module.exports = {
604
728
  "address": "0x922C795aE0be55Aaeb3FF51813B76AFc78e97C7c",
605
729
  "createdBlock": 14410792,
606
730
  "oldVersions": {
607
- "14384301": "0x119a9B532FEe9Ce4a07F86f7053e635dD4E166F9"
731
+ "14384301": {
732
+ "abi": [{ "inputs": [{ "internalType": "contract IManager", "name": "_manager", "type": "address" }, { "internalType": "uint256", "name": "_cdpId", "type": "uint256" }, { "internalType": "bytes32", "name": "_ilk", "type": "bytes32" }], "name": "getCdpInfo", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }, { "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }],
733
+ "address": "0x119a9B532FEe9Ce4a07F86f7053e635dD4E166F9"
734
+ }
608
735
  }
609
736
  }
610
737
  }
package/cjs/contracts.js CHANGED
@@ -15,12 +15,9 @@ const getConfigContractAddress = (name, network, block) => {
15
15
  }
16
16
  const oldVersions = (networkData === null || networkData === void 0 ? void 0 : networkData.oldVersions) || {};
17
17
  // Versions are ordered from oldest to the newest
18
- for (const [createdBlock, addressOrObject] of Object.entries(oldVersions).reverse()) {
18
+ for (const [createdBlock, oldVersionObject] of Object.entries(oldVersions).reverse()) {
19
19
  if (block >= Number(createdBlock)) {
20
- if (typeof addressOrObject !== 'string') {
21
- return addressOrObject.address;
22
- }
23
- return addressOrObject;
20
+ return oldVersionObject.address;
24
21
  }
25
22
  }
26
23
  }
@@ -36,12 +33,9 @@ const getConfigContractAbi = (name, network, block) => {
36
33
  }
37
34
  const oldVersions = (networkData === null || networkData === void 0 ? void 0 : networkData.oldVersions) || {};
38
35
  // Versions are ordered from oldest to the newest
39
- for (const [createdBlock, addressOrObject] of Object.entries(oldVersions).reverse()) {
36
+ for (const [createdBlock, oldVersionObject] of Object.entries(oldVersions).reverse()) {
40
37
  if (block >= Number(createdBlock)) {
41
- if (typeof addressOrObject !== 'string') {
42
- return addressOrObject.abi;
43
- }
44
- return latestAbi;
38
+ return oldVersionObject.abi;
45
39
  }
46
40
  }
47
41
  }
@@ -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,
190
+ loanExists: data.loanExists, usedAssets, network: common_1.NetworkNumber.Eth, selectedMarket, numOfBands: data.N,
191
191
  })), { userBands });
192
192
  });
193
193
  exports.getCurveUsdUserData = getCurveUsdUserData;
@@ -1,8 +1,9 @@
1
1
  import { CrvUSDAggregatedPositionData, CrvUSDMarketData, CrvUSDUsedAssets } from '../../types';
2
2
  import { NetworkNumber } from '../../types/common';
3
- export declare const getCrvUsdAggregatedData: ({ loanExists, usedAssets, network, selectedMarket, ...rest }: {
3
+ export declare const getCrvUsdAggregatedData: ({ loanExists, usedAssets, network, selectedMarket, numOfBands, ...rest }: {
4
4
  loanExists: boolean;
5
5
  usedAssets: CrvUSDUsedAssets;
6
6
  network: NetworkNumber;
7
7
  selectedMarket: CrvUSDMarketData;
8
+ numOfBands: number | string;
8
9
  }) => CrvUSDAggregatedPositionData;
@@ -17,26 +17,34 @@ 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");
20
21
  const getCrvUsdAggregatedData = (_a) => {
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)
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)
29
32
  .times(100)
30
33
  .toString()
31
34
  : '0';
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
- };
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;
41
49
  };
42
50
  exports.getCrvUsdAggregatedData = getCrvUsdAggregatedData;
@@ -1,6 +1,8 @@
1
1
  import { MorphoBlueMarketData } from '../../types';
2
2
  import { NetworkNumber } from '../../types/common';
3
3
  export declare const MORPHO_BLUE_WSTETH_ETH: (networkId?: NetworkNumber) => MorphoBlueMarketData;
4
+ export declare const MORPHO_BLUE_WSTETH_USDC: (networkId?: NetworkNumber) => MorphoBlueMarketData;
4
5
  export declare const MorphoBlueMarkets: (networkId: NetworkNumber) => {
5
6
  readonly morphobluewstetheth: MorphoBlueMarketData;
7
+ readonly morphobluewstethusdc: MorphoBlueMarketData;
6
8
  };