@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
@@ -8,35 +8,86 @@ module.exports = {
8
8
  "address": "0x8095fFFC3cDdE58C4F537D39f9795A40a103e633",
9
9
  "createdBlock": 17870436,
10
10
  "oldVersions": {
11
- "16483408": "0x9ECB0645b357fDD7B92789B91595160862Bd45d0",
12
- "16690564": "0xf4B715BB788cC4071061bd67dC8B56681460A2fF"
11
+ "16483408": {
12
+ "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" }],
13
+ "address": "0x9ECB0645b357fDD7B92789B91595160862Bd45d0"
14
+ },
15
+ "16690564": {
16
+ "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" }],
17
+ "address": "0xf4B715BB788cC4071061bd67dC8B56681460A2fF"
18
+ }
13
19
  }
14
20
  },
15
21
  "10": {
16
22
  "address": "0xB6aF2C91E3eBB250615aaa33Bb955f7a7f21AD17",
17
23
  "createdBlock": 107950604,
18
24
  "oldVersions": {
19
- "6723401": "0xc3A1859A5B0Ffe9ccF1f70f6F3AaB8e8EF8E6366",
20
- "6926482": "0x2cB32d185a6211b07bCaaEE79D2FD8566e5711a9",
21
- "8908372": "0x9629685De9Cc4adaC27F7F1733E046A9549D23F5",
22
- "13445522": "0x2136949bb2Aa4056A7505Fa0895DD797d4C7c683",
23
- "18286606": "0xf924f1E8cdB6AFC02d115fb9C6f80275B2E63cc9",
24
- "23450199": "0xcd5380201fdc29Bc417C8aFB926Df60aacc0C0F4",
25
- "76015698": "0xC20fA40Dd4f0D3f7431Eb4B6bc0614F36932F6Dc",
26
- "106560861": "0x05f8Ba4Db7F7C65a61881297D86Aea3c83C26304"
25
+ "6723401": {
26
+ "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" }],
27
+ "address": "0xc3A1859A5B0Ffe9ccF1f70f6F3AaB8e8EF8E6366"
28
+ },
29
+ "6926482": {
30
+ "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" }],
31
+ "address": "0x2cB32d185a6211b07bCaaEE79D2FD8566e5711a9"
32
+ },
33
+ "8908372": {
34
+ "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" }],
35
+ "address": "0x9629685De9Cc4adaC27F7F1733E046A9549D23F5"
36
+ },
37
+ "13445522": {
38
+ "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" }],
39
+ "address": "0x2136949bb2Aa4056A7505Fa0895DD797d4C7c683"
40
+ },
41
+ "18286606": {
42
+ "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" }],
43
+ "address": "0xf924f1E8cdB6AFC02d115fb9C6f80275B2E63cc9"
44
+ },
45
+ "23450199": {
46
+ "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" }],
47
+ "address": "0xcd5380201fdc29Bc417C8aFB926Df60aacc0C0F4"
48
+ },
49
+ "76015698": {
50
+ "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" }],
51
+ "address": "0xC20fA40Dd4f0D3f7431Eb4B6bc0614F36932F6Dc"
52
+ },
53
+ "106560861": {
54
+ "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" }],
55
+ "address": "0x05f8Ba4Db7F7C65a61881297D86Aea3c83C26304"
56
+ },
27
57
  }
28
58
  },
29
59
  "42161": {
30
60
  "address": "0x2596e41933136E87C04b56f632CEcA2cdCCC2Cc6",
31
61
  "createdBlock": 119382184,
32
62
  "oldVersions": {
33
- "12855842": "0xfCCB21cAd40ADeB097533E027f335b87c5d6CA21",
34
- "16400389": "0x710f01037018Daad969B8FeFe69b4823Ef788bc6",
35
- "18522551": "0x8C589b04a4C1f8F280f0133395451F6c2BE02450",
36
- "19702666": "0x48D32ee631ebCe01f2cd8F99B94911D5A059E9dA",
37
- "24918146": "0x8EF42fF40e9a9dD3E1ae81e7947D4E89e6d9f968",
38
- "63484252": "0xA74a85407D5A940542915458616aC3cf3f404E3b",
39
- "108724549": "0x401E66549DF354a21B3CC95e3F548Df6854d6DEE"
63
+ "12855842": {
64
+ "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" }],
65
+ "address": "0xfCCB21cAd40ADeB097533E027f335b87c5d6CA21"
66
+ },
67
+ "16400389": {
68
+ "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" }],
69
+ "address": "0x710f01037018Daad969B8FeFe69b4823Ef788bc6"
70
+ },
71
+ "18522551": {
72
+ "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" }],
73
+ "address": "0x8C589b04a4C1f8F280f0133395451F6c2BE02450"
74
+ },
75
+ "19702666": {
76
+ "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" }],
77
+ "address": "0x48D32ee631ebCe01f2cd8F99B94911D5A059E9dA"
78
+ },
79
+ "24918146": {
80
+ "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" }],
81
+ "address": "0x8EF42fF40e9a9dD3E1ae81e7947D4E89e6d9f968"
82
+ },
83
+ "63484252": {
84
+ "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" }],
85
+ "address": "0xA74a85407D5A940542915458616aC3cf3f404E3b"
86
+ },
87
+ "108724549": {
88
+ "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" }],
89
+ "address": "0x401E66549DF354a21B3CC95e3F548Df6854d6DEE"
90
+ },
40
91
  }
41
92
  },
42
93
  "8453": {
@@ -224,7 +275,10 @@ module.exports = {
224
275
  "address": "0xf522b1588688b9887623b9C666175684d284D363",
225
276
  "createdBlock": 15581957,
226
277
  "oldVersions": {
227
- "15520449": "0x5e07E953dac1d7c19091c3b493579ba7283572a4"
278
+ "15520449": {
279
+ "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" }],
280
+ "address": "0x5e07E953dac1d7c19091c3b493579ba7283572a4",
281
+ }
228
282
  }
229
283
  },
230
284
  "8453": {
@@ -285,14 +339,34 @@ module.exports = {
285
339
  "address": "0xEDf1087544a01596b70Da746F861B878F245B08f",
286
340
  "createdBlock": 15484097,
287
341
  "oldVersions": {
288
- "11374778": "0xbC18860D3212e97D488cCDa2e37ff4ab8593D31d",
289
- "11375123": "0xE66d12b13224C0cD490CaC2FF7746e258Bc8E60c",
290
- "11375721": "0x682868AdbcFC9fECC3506B0A182E7E5D683F83BC",
291
- "11377499": "0x7ce5B82B44fa3037A1dE3F01133bfC3b945635a1",
292
- "11420152": "0x8F07659525e78fd73Bf86f8E97AEa41bd54dEb54",
293
- "11637629": "0xd0C9ADDABbA270493A6503e74E62794435c8F1D3",
294
- "12317383": "0x21F46013a19Ee99191a04C62C9c88B1F50E00bb2",
295
- "15484097": "0xEDf1087544a01596b70Da746F861B878F245B08f"
342
+ "11374778": {
343
+ "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" }],
344
+ "address": "0xbC18860D3212e97D488cCDa2e37ff4ab8593D31d"
345
+ },
346
+ "11375123": {
347
+ "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" }],
348
+ "address": "0xE66d12b13224C0cD490CaC2FF7746e258Bc8E60c"
349
+ },
350
+ "11377499": {
351
+ "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" }],
352
+ "address": "0x7ce5B82B44fa3037A1dE3F01133bfC3b945635a1"
353
+ },
354
+ "11420152": {
355
+ "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" }],
356
+ "address": "0x8F07659525e78fd73Bf86f8E97AEa41bd54dEb54"
357
+ },
358
+ "11637629": {
359
+ "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" }],
360
+ "address": "0xd0C9ADDABbA270493A6503e74E62794435c8F1D3"
361
+ },
362
+ "12317383": {
363
+ "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" }],
364
+ "address": "0x21F46013a19Ee99191a04C62C9c88B1F50E00bb2"
365
+ },
366
+ "15484097": {
367
+ "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" }],
368
+ "address": "0xEDf1087544a01596b70Da746F861B878F245B08f"
369
+ },
296
370
  }
297
371
  },
298
372
  }
@@ -328,14 +402,38 @@ module.exports = {
328
402
  "address": "0xb25b98d3ca2dde635829870f852472bdd0b01b7e",
329
403
  "createdBlock": 17819315,
330
404
  "oldVersions": {
331
- "10024350": "0x576501AbD98ce5472b03B7AB4F5980941DB7Ef37",
332
- "10027063": "0x5F0679505134b1a146aD614bD2766A67df584D6b",
333
- "10052917": "0xEc8cd4B51BCA40D6342d5b880D6Dc0AA4317D506",
334
- "10411281": "0x781FDB68cE5EE5Cd7470bbFEec0F98c24eA18c93",
335
- "10684038": "0xB1F40B5109bba75C27a302C4E5d2afc30d5D1F30",
336
- "12503103": "0x8b7b8a0Ec22d4b2dBfB103947D8cD11e80E1CE22",
337
- "13416222": "0x19c76C1EdECd4551Fa8e49D1f96598dCDFF7A65F",
338
- "15442192": "0x4D81E17ce35A81b70b2E5eD4a0592e1C2C01219d"
405
+ "10024350": {
406
+ "abi": [],
407
+ "address": "0x576501AbD98ce5472b03B7AB4F5980941DB7Ef37",
408
+ },
409
+ "10027063": {
410
+ "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" }],
411
+ "address": "0x5F0679505134b1a146aD614bD2766A67df584D6b",
412
+ },
413
+ "10052917": {
414
+ "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" }],
415
+ "address": "0xEc8cd4B51BCA40D6342d5b880D6Dc0AA4317D506",
416
+ },
417
+ "10411281": {
418
+ "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" }],
419
+ "address": "0x781FDB68cE5EE5Cd7470bbFEec0F98c24eA18c93",
420
+ },
421
+ "10684038": {
422
+ "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" }],
423
+ "address": "0xB1F40B5109bba75C27a302C4E5d2afc30d5D1F30",
424
+ },
425
+ "12503103": {
426
+ "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" }],
427
+ "address": "0x8b7b8a0Ec22d4b2dBfB103947D8cD11e80E1CE22",
428
+ },
429
+ "13416222": {
430
+ "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" }],
431
+ "address": "0x19c76C1EdECd4551Fa8e49D1f96598dCDFF7A65F",
432
+ },
433
+ "15442192": {
434
+ "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" }],
435
+ "address": "0x4D81E17ce35A81b70b2E5eD4a0592e1C2C01219d",
436
+ },
339
437
  }
340
438
  }
341
439
  }
@@ -397,7 +495,10 @@ module.exports = {
397
495
  "address": "0x3667d1DB1f47F2c3a2f2411895d3476cc515b687",
398
496
  "createdBlock": 16741545,
399
497
  "oldVersions": {
400
- "16586304": "0x6518a138Da4ecE07cC6263FB2e7c4Ae773360302"
498
+ "16586304": {
499
+ "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" }],
500
+ "address": "0x6518a138Da4ecE07cC6263FB2e7c4Ae773360302",
501
+ }
401
502
  }
402
503
  }
403
504
  }
@@ -409,7 +510,10 @@ module.exports = {
409
510
  "address": "0xB3B13838F6F57CE76b94f0744Ab0B045B780836e",
410
511
  "createdBlock": 17870357,
411
512
  "oldVersions": {
412
- "17734126": "0x29d01EF37514912ab874D51fEc76c8f5d4d6712e"
513
+ "17734126": {
514
+ "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" }],
515
+ "address": "0x29d01EF37514912ab874D51fEc76c8f5d4d6712e",
516
+ }
413
517
  }
414
518
  }
415
519
  }
@@ -527,13 +631,24 @@ module.exports = {
527
631
  }
528
632
  },
529
633
  "crvUSDView": {
530
- "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" }],
634
+ "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
635
  "networks": {
532
636
  "1": {
533
- "address": "0x512460CF2Bb80823C135F5DC04D2a1fF258FAA1e",
534
- "createdBlock": 17683243,
637
+ "address": "0x4BbCf0e587853aAEdFC3E60f74C10E07D8deA701",
638
+ "createdBlock": 18823384,
535
639
  "oldVersions": {
536
- "17657253": "0xa81430a4eC71466264b9ee50403F8d63E8c72B95"
640
+ "17657253": {
641
+ "address": "0xa81430a4eC71466264b9ee50403F8d63E8c72B95",
642
+ "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" }],
643
+ },
644
+ "17683243": {
645
+ "address": "0x512460CF2Bb80823C135F5DC04D2a1fF258FAA1e",
646
+ "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" }],
647
+ },
648
+ "18419795": {
649
+ "address": "0x4df1281f9d2303be453e0085881702a4b1358692",
650
+ "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" }],
651
+ },
537
652
  }
538
653
  }
539
654
  }
@@ -553,9 +668,18 @@ module.exports = {
553
668
  "address": "0xb760e60Dff6263E8Ab31B04ee5Cc010beA47e2Df",
554
669
  "createdBlock": 17017214,
555
670
  "oldVersions": {
556
- "12549073": "0xFCDd12C6317adbd033B93486d176f99441344A0f",
557
- "12567960": "0x0bE59e4804d957026a0E31B5d0BEA0fbaE262ba7",
558
- "12638758": "0x30EFEF27A6919d927E4c684E373198F671c686Dc",
671
+ "12549073": {
672
+ "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" }],
673
+ "address": "0xFCDd12C6317adbd033B93486d176f99441344A0f"
674
+ },
675
+ "12567960": {
676
+ "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" }],
677
+ "address": "0x0bE59e4804d957026a0E31B5d0BEA0fbaE262ba7"
678
+ },
679
+ "12638758": {
680
+ "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" }],
681
+ "address": "0x30EFEF27A6919d927E4c684E373198F671c686Dc"
682
+ },
559
683
  "12746821": {
560
684
  "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" }],
561
685
  "address": "0xD1913B977737c9505B8EcFEDB8121546096d3393"
@@ -603,7 +727,10 @@ module.exports = {
603
727
  "address": "0x922C795aE0be55Aaeb3FF51813B76AFc78e97C7c",
604
728
  "createdBlock": 14410792,
605
729
  "oldVersions": {
606
- "14384301": "0x119a9B532FEe9Ce4a07F86f7053e635dD4E166F9"
730
+ "14384301": {
731
+ "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" }],
732
+ "address": "0x119a9B532FEe9Ce4a07F86f7053e635dD4E166F9"
733
+ }
607
734
  }
608
735
  }
609
736
  }
package/esm/contracts.js CHANGED
@@ -9,12 +9,9 @@ export const getConfigContractAddress = (name, network, block) => {
9
9
  }
10
10
  const oldVersions = (networkData === null || networkData === void 0 ? void 0 : networkData.oldVersions) || {};
11
11
  // Versions are ordered from oldest to the newest
12
- for (const [createdBlock, addressOrObject] of Object.entries(oldVersions).reverse()) {
12
+ for (const [createdBlock, oldVersionObject] of Object.entries(oldVersions).reverse()) {
13
13
  if (block >= Number(createdBlock)) {
14
- if (typeof addressOrObject !== 'string') {
15
- return addressOrObject.address;
16
- }
17
- return addressOrObject;
14
+ return oldVersionObject.address;
18
15
  }
19
16
  }
20
17
  }
@@ -29,12 +26,9 @@ export const getConfigContractAbi = (name, network, block) => {
29
26
  }
30
27
  const oldVersions = (networkData === null || networkData === void 0 ? void 0 : networkData.oldVersions) || {};
31
28
  // Versions are ordered from oldest to the newest
32
- for (const [createdBlock, addressOrObject] of Object.entries(oldVersions).reverse()) {
29
+ for (const [createdBlock, oldVersionObject] of Object.entries(oldVersions).reverse()) {
33
30
  if (block >= Number(createdBlock)) {
34
- if (typeof addressOrObject !== 'string') {
35
- return addressOrObject.abi;
36
- }
37
- return latestAbi;
31
+ return oldVersionObject.abi;
38
32
  }
39
33
  }
40
34
  }
@@ -179,7 +179,7 @@ export const getCurveUsdUserData = (web3, network, address, selectedMarket, acti
179
179
  priceHigh,
180
180
  priceLow, liquidationDiscount: assetAmountInEth(data.liquidationDiscount), numOfBands: data.N, usedAssets,
181
181
  status }), getCrvUsdAggregatedData({
182
- loanExists: data.loanExists, usedAssets, network: NetworkNumber.Eth, selectedMarket,
182
+ loanExists: data.loanExists, usedAssets, network: NetworkNumber.Eth, selectedMarket, numOfBands: data.N,
183
183
  })), { userBands });
184
184
  });
185
185
  export const getCurveUsdFullPositionData = (web3, network, address, selectedMarket) => __awaiter(void 0, void 0, void 0, function* () {
@@ -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;
@@ -10,26 +10,34 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import Dec from 'decimal.js';
13
- import { getAssetsTotal } from '../../moneymarket';
13
+ import { calcLeverageLiqPrice, getAssetsTotal, isLeveragedPos } from '../../moneymarket';
14
+ import { mapRange } from '../../services/utils';
14
15
  export const getCrvUsdAggregatedData = (_a) => {
15
- var { loanExists, usedAssets, network, selectedMarket } = _a, rest = __rest(_a, ["loanExists", "usedAssets", "network", "selectedMarket"]);
16
- const _supplied = getAssetsTotal(usedAssets, ({ isSupplied }) => isSupplied, ({ supplied }) => supplied); // this is wrong if we are in soft-liquidations
17
- const _borrowed = getAssetsTotal(usedAssets, ({ isBorrowed }) => isBorrowed, ({ borrowed }) => borrowed);
18
- const _suppliedUsd = getAssetsTotal(usedAssets, ({ isSupplied }) => isSupplied, ({ suppliedUsd }) => suppliedUsd);
19
- const _borrowedUsd = getAssetsTotal(usedAssets, ({ isBorrowed }) => isBorrowed, ({ borrowedUsd }) => borrowedUsd);
20
- const ratio = loanExists
21
- ? new Dec(_suppliedUsd)
22
- .dividedBy(_borrowedUsd)
16
+ var _b;
17
+ var { loanExists, usedAssets, network, selectedMarket, numOfBands } = _a, rest = __rest(_a, ["loanExists", "usedAssets", "network", "selectedMarket", "numOfBands"]);
18
+ const payload = {};
19
+ payload.supplied = getAssetsTotal(usedAssets, ({ isSupplied }) => isSupplied, ({ supplied }) => supplied); // this is wrong if we are in soft-liquidations
20
+ payload.borrowed = getAssetsTotal(usedAssets, ({ isBorrowed }) => isBorrowed, ({ borrowed }) => borrowed);
21
+ payload.suppliedUsd = getAssetsTotal(usedAssets, ({ isSupplied }) => isSupplied, ({ suppliedUsd }) => suppliedUsd);
22
+ payload.borrowedUsd = getAssetsTotal(usedAssets, ({ isBorrowed }) => isBorrowed, ({ borrowedUsd }) => borrowedUsd);
23
+ payload.ratio = loanExists
24
+ ? new Dec(payload.suppliedUsd)
25
+ .dividedBy(payload.borrowedUsd)
23
26
  .times(100)
24
27
  .toString()
25
28
  : '0';
26
- // we don't have borrowLimitUsd here
27
- return {
28
- ratio,
29
- supplied: _supplied,
30
- suppliedUsd: _suppliedUsd,
31
- borrowedUsd: _borrowedUsd,
32
- borrowed: _borrowed,
33
- safetyRatio: ratio,
34
- };
29
+ // this is all approximation
30
+ payload.minAllowedRatio = mapRange(numOfBands, 4, 50, 115, 140); // collateral ratio
31
+ payload.collFactor = new Dec(1).div(payload.minAllowedRatio).mul(100).toString(); // collateral factor = 1 / collateral ratio
32
+ // only take in consideration collAsset
33
+ payload.borrowLimitUsd = ((_b = usedAssets === null || usedAssets === void 0 ? void 0 : usedAssets[selectedMarket.collAsset]) === null || _b === void 0 ? void 0 : _b.isSupplied)
34
+ ? new Dec(usedAssets[selectedMarket.collAsset].suppliedUsd).mul(payload.collFactor).toString()
35
+ : '0';
36
+ const { leveragedType, leveragedAsset } = isLeveragedPos(usedAssets);
37
+ payload.leveragedType = leveragedType;
38
+ if (leveragedType !== '') {
39
+ payload.leveragedAsset = leveragedAsset;
40
+ payload.liquidationPrice = calcLeverageLiqPrice(leveragedType, usedAssets[selectedMarket.collAsset].price, payload.borrowedUsd, payload.borrowLimitUsd);
41
+ }
42
+ return payload;
35
43
  };
@@ -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
  };