@1delta/margin-fetcher 0.0.35 → 0.0.37

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 (89) hide show
  1. package/dist/abis/morpho/lens.d.ts +38 -15
  2. package/dist/abis/morpho/lens.d.ts.map +1 -1
  3. package/dist/abis/morpho/lens.js +30 -20
  4. package/dist/flash-liquidity/assets.d.ts +2 -2
  5. package/dist/flash-liquidity/assets.d.ts.map +1 -1
  6. package/dist/flash-liquidity/assets.js +2 -2
  7. package/dist/flash-liquidity/fetchLiquidity.d.ts.map +1 -1
  8. package/dist/flash-liquidity/fetchLiquidity.js +2 -2
  9. package/dist/lending/aave-v2-type/misc.d.ts +3 -9
  10. package/dist/lending/aave-v2-type/misc.d.ts.map +1 -1
  11. package/dist/lending/addresses/contracts.d.ts +0 -1
  12. package/dist/lending/addresses/contracts.d.ts.map +1 -1
  13. package/dist/lending/addresses/contracts.js +0 -17
  14. package/dist/lending/fetchLender.d.ts.map +1 -1
  15. package/dist/lending/fetchLender.js +24 -5
  16. package/dist/lending/fetchLenderAll.d.ts.map +1 -1
  17. package/dist/lending/fetchLenderAll.js +15 -3
  18. package/dist/lending/meta/index.js +1 -1
  19. package/dist/lending/morpho/chainsConfigs.d.ts +21 -0
  20. package/dist/lending/morpho/chainsConfigs.d.ts.map +1 -0
  21. package/dist/lending/morpho/chainsConfigs.js +234 -0
  22. package/dist/lending/morpho/constants/markets.d.ts +4 -0
  23. package/dist/lending/morpho/constants/markets.d.ts.map +1 -0
  24. package/dist/lending/morpho/constants/markets.js +63 -0
  25. package/dist/lending/morpho/convertPublic.d.ts.map +1 -1
  26. package/dist/lending/morpho/convertPublic.js +2 -13
  27. package/dist/lending/morpho/getMarketsFromChain.d.ts +8 -0
  28. package/dist/lending/morpho/getMarketsFromChain.d.ts.map +1 -0
  29. package/dist/lending/morpho/getMarketsFromChain.js +318 -0
  30. package/dist/lending/morpho/publicCallBuild.d.ts +5 -0
  31. package/dist/lending/morpho/publicCallBuild.d.ts.map +1 -1
  32. package/dist/lending/morpho/publicCallBuild.js +16 -0
  33. package/dist/lending/morpho/utils/evmParser.d.ts +22 -0
  34. package/dist/lending/morpho/utils/evmParser.d.ts.map +1 -0
  35. package/dist/lending/morpho/utils/evmParser.js +103 -0
  36. package/dist/lending/morpho/utils/mathLib.d.ts +125 -0
  37. package/dist/lending/morpho/utils/mathLib.d.ts.map +1 -0
  38. package/dist/lending/morpho/utils/mathLib.js +334 -0
  39. package/dist/lending/morpho/utils/parsers.d.ts +10 -0
  40. package/dist/lending/morpho/utils/parsers.d.ts.map +1 -0
  41. package/dist/lending/morpho/utils/parsers.js +37 -0
  42. package/dist/lending/user-data/abis.d.ts +37 -14
  43. package/dist/lending/user-data/abis.d.ts.map +1 -1
  44. package/dist/lending/user-data/morpho/userCallBuild.d.ts +3 -0
  45. package/dist/lending/user-data/morpho/userCallBuild.d.ts.map +1 -1
  46. package/dist/lending/user-data/morpho/userCallBuild.js +9 -8
  47. package/dist/lending-pairs/computeLendingPairs.d.ts.map +1 -1
  48. package/dist/lending-pairs/computeLendingPairs.js +11 -7
  49. package/dist/prices/main-prices/fetchOracleData.d.ts +0 -2
  50. package/dist/prices/main-prices/fetchOracleData.d.ts.map +1 -1
  51. package/dist/prices/main-prices/fetchOracleData.js +6 -24
  52. package/dist/utils/constants.d.ts +0 -23
  53. package/dist/utils/constants.d.ts.map +1 -1
  54. package/dist/utils/constants.js +4 -23
  55. package/dist/utils/index.d.ts +0 -1
  56. package/dist/utils/index.d.ts.map +1 -1
  57. package/dist/utils/index.js +2 -10
  58. package/dist/utils/parsing.d.ts +2 -0
  59. package/dist/utils/parsing.d.ts.map +1 -1
  60. package/dist/utils/parsing.js +20 -0
  61. package/dist/yields/index.d.ts.map +1 -1
  62. package/dist/yields/index.js +17 -1
  63. package/package.json +2 -2
  64. package/src/abis/morpho/lens.ts +40 -30
  65. package/src/flash-liquidity/assets.ts +3 -2
  66. package/src/flash-liquidity/fetchLiquidity.ts +3 -2
  67. package/src/lending/addresses/contracts.ts +0 -20
  68. package/src/lending/fetchLender.ts +29 -4
  69. package/src/lending/fetchLenderAll.ts +32 -12
  70. package/src/lending/meta/index.ts +1 -1
  71. package/src/lending/morpho/chainsConfigs.ts +268 -0
  72. package/src/lending/morpho/constants/markets.ts +64 -0
  73. package/src/lending/morpho/convertPublic.ts +2 -14
  74. package/src/lending/morpho/getMarketsFromChain.ts +402 -0
  75. package/src/lending/morpho/publicCallBuild.ts +17 -0
  76. package/src/lending/morpho/utils/evmParser.ts +122 -0
  77. package/src/lending/morpho/utils/mathLib.ts +434 -0
  78. package/src/lending/morpho/utils/parsers.ts +53 -0
  79. package/src/lending/user-data/morpho/userCallBuild.ts +9 -8
  80. package/src/lending-pairs/computeLendingPairs.ts +15 -10
  81. package/src/prices/main-prices/fetchOracleData.ts +10 -36
  82. package/src/utils/constants.ts +43 -61
  83. package/src/utils/index.ts +3 -10
  84. package/src/utils/parsing.ts +32 -0
  85. package/src/yields/index.ts +18 -0
  86. package/test/flashLiquidity.test.ts +27 -20
  87. package/test/lenderData.test.ts +7 -4
  88. package/test/mainPrices.test.ts +3 -10
  89. package/test/mbChain.test.ts +44 -0
@@ -1,7 +1,7 @@
1
1
  import { initializeChainData, initializeLenderData } from '@1delta/data-sdk'
2
2
 
3
3
  const baseUrl =
4
- 'https://raw.githubusercontent.com/1delta-DAO/lender-metadata/multi-fetch'
4
+ 'https://raw.githubusercontent.com/1delta-DAO/lender-metadata/main'
5
5
  const aavePools = baseUrl + '/config/aave-pools.json'
6
6
  const aaveOracles = baseUrl + '/data/aave-oracles.json'
7
7
  const morphoOracles = baseUrl + '/data/morpho-oracles.json'
@@ -0,0 +1,268 @@
1
+ import { Address } from 'viem'
2
+ import { Chain } from '@1delta/chain-registry'
3
+
4
+ type MorphoContractName =
5
+ | 'Morpho'
6
+ | 'MetaMorphoFactory'
7
+ | 'MetaMorphoV1_1Factory'
8
+
9
+ type OptionalContracts = 'MetaMorphoFactory'
10
+ type RequiredContracts = Exclude<MorphoContractName, OptionalContracts>
11
+ type DeploymentDetails = { address: Address; fromBlock: bigint }
12
+ export type Deployments = {
13
+ [chainId: string]: {
14
+ [name in RequiredContracts]-?: DeploymentDetails
15
+ } & {
16
+ [name in OptionalContracts]?: DeploymentDetails
17
+ }
18
+ }
19
+
20
+ export const DEPLOYMENTS: Deployments = {
21
+ [Chain.ETHEREUM_MAINNET]: {
22
+ Morpho: {
23
+ address: '0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb',
24
+ fromBlock: 18883124n,
25
+ },
26
+ MetaMorphoFactory: {
27
+ address: '0xA9c3D3a366466Fa809d1Ae982Fb2c46E5fC41101',
28
+ fromBlock: 18925584n,
29
+ },
30
+ MetaMorphoV1_1Factory: {
31
+ address: '0x1897A8997241C1cD4bD0698647e4EB7213535c24',
32
+ fromBlock: 21439510n,
33
+ },
34
+ },
35
+ [Chain.BASE]: {
36
+ Morpho: {
37
+ address: '0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb',
38
+ fromBlock: 13977148n,
39
+ },
40
+ MetaMorphoFactory: {
41
+ address: '0xA9c3D3a366466Fa809d1Ae982Fb2c46E5fC41101',
42
+ fromBlock: 13978134n,
43
+ },
44
+ MetaMorphoV1_1Factory: {
45
+ address: '0xFf62A7c278C62eD665133147129245053Bbf5918',
46
+ fromBlock: 23928808n,
47
+ },
48
+ },
49
+ [Chain.INK]: {
50
+ Morpho: {
51
+ address: '0x857f3EefE8cbda3Bc49367C996cd664A880d3042',
52
+ fromBlock: 4078776n,
53
+ },
54
+ MetaMorphoV1_1Factory: {
55
+ address: '0xd3f39505d0c48AFED3549D625982FdC38Ea9904b',
56
+ fromBlock: 4078830n,
57
+ },
58
+ },
59
+ [Chain.ARBITRUM_ONE]: {
60
+ Morpho: {
61
+ address: '0x6c247b1F6182318877311737BaC0844bAa518F5e',
62
+ fromBlock: 296446593n,
63
+ },
64
+ MetaMorphoV1_1Factory: {
65
+ address: '0x878988f5f561081deEa117717052164ea1Ef0c82',
66
+ fromBlock: 296447195n,
67
+ },
68
+ },
69
+ [Chain.OP_MAINNET]: {
70
+ Morpho: {
71
+ address: '0xce95AfbB8EA029495c66020883F87aaE8864AF92',
72
+ fromBlock: 130770075n,
73
+ },
74
+ MetaMorphoV1_1Factory: {
75
+ address: '0x3Bb6A6A0Bc85b367EFE0A5bAc81c5E52C892839a',
76
+ fromBlock: 130770189n,
77
+ },
78
+ },
79
+ [Chain.POLYGON_MAINNET]: {
80
+ Morpho: {
81
+ address: '0x1bF0c2541F820E775182832f06c0B7Fc27A25f67',
82
+ fromBlock: 66931042n,
83
+ },
84
+ MetaMorphoV1_1Factory: {
85
+ address: '0xa9c87daB340631C34BB738625C70499e29ddDC98',
86
+ fromBlock: 66931118n,
87
+ },
88
+ },
89
+ [Chain.WORLD_CHAIN]: {
90
+ Morpho: {
91
+ address: '0xE741BC7c34758b4caE05062794E8Ae24978AF432',
92
+ fromBlock: 9025669n,
93
+ },
94
+ MetaMorphoV1_1Factory: {
95
+ address: '0x4DBB3a642a2146d5413750Cca3647086D9ba5F12',
96
+ fromBlock: 9025733n,
97
+ },
98
+ },
99
+ [Chain.SCROLL]: {
100
+ Morpho: {
101
+ address: '0x2d012EdbAdc37eDc2BC62791B666f9193FDF5a55',
102
+ fromBlock: 12842868n,
103
+ },
104
+ MetaMorphoV1_1Factory: {
105
+ address: '0x56b65742ade55015e6480959808229Ad6dbc9295',
106
+ fromBlock: 12842903n,
107
+ },
108
+ },
109
+ [Chain.FRAXTAL]: {
110
+ Morpho: {
111
+ address: '0xa6030627d724bA78a59aCf43Be7550b4C5a0653b',
112
+ fromBlock: 15317931n,
113
+ },
114
+ MetaMorphoV1_1Factory: {
115
+ address: '0x27D4Af0AC9E7FDfA6D0853236f249CC27AE79488',
116
+ fromBlock: 15318007n,
117
+ },
118
+ },
119
+ [Chain.UNICHAIN]: {
120
+ Morpho: {
121
+ address: '0x8f5ae9CddB9f68de460C77730b018Ae7E04a140A',
122
+ fromBlock: 9139027n,
123
+ },
124
+ MetaMorphoV1_1Factory: {
125
+ address: '0xe9EdE3929F43a7062a007C3e8652e4ACa610Bdc0',
126
+ fromBlock: 9316789n,
127
+ },
128
+ },
129
+ [Chain.CORN]: {
130
+ Morpho: {
131
+ address: '0xc2B1E031540e3F3271C5F3819F0cC7479a8DdD90',
132
+ fromBlock: 251401n,
133
+ },
134
+ MetaMorphoV1_1Factory: {
135
+ address: '0xe430821595602eA5DD0cD350f86987437c7362fA',
136
+ fromBlock: 253027n,
137
+ },
138
+ },
139
+ [Chain.MODE]: {
140
+ Morpho: {
141
+ address: '0xd85cE6BD68487E0AaFb0858FDE1Cd18c76840564',
142
+ fromBlock: 19983370n,
143
+ },
144
+ MetaMorphoV1_1Factory: {
145
+ address: '0xae5b0884bfff430493D6C844B9fd052Af7d79278',
146
+ fromBlock: 19983443n,
147
+ },
148
+ },
149
+ [Chain.HEMI_NETWORK]: {
150
+ Morpho: {
151
+ address: '0xa4Ca2c2e25b97DA19879201bA49422bc6f181f42',
152
+ fromBlock: 1188872n,
153
+ },
154
+ MetaMorphoV1_1Factory: {
155
+ address: '0x8e52179BeB18E882040b01632440d8Ca0f01da82',
156
+ fromBlock: 1188885n,
157
+ },
158
+ },
159
+ [Chain.SONIC_MAINNET]: {
160
+ Morpho: {
161
+ address: '0xd6c916eB7542D0Ad3f18AEd0FCBD50C582cfa95f',
162
+ fromBlock: 9100931n,
163
+ },
164
+ MetaMorphoV1_1Factory: {
165
+ address: '0x0cE9e3512CB4df8ae7e265e62Fb9258dc14f12e8',
166
+ fromBlock: 9101319n,
167
+ },
168
+ },
169
+ [Chain.PLUME_MAINNET]: {
170
+ Morpho: {
171
+ address: '0x42b18785CE0Aed7BF7Ca43a39471ED4C0A3e0bB5',
172
+ fromBlock: 765994n,
173
+ },
174
+ MetaMorphoV1_1Factory: {
175
+ address: '0x2525D453D9BA13921D5aB5D8c12F9202b0e19456',
176
+ fromBlock: 766078n,
177
+ },
178
+ },
179
+ [Chain.LISK]: {
180
+ Morpho: {
181
+ address: '0x00cD58DEEbd7A2F1C55dAec715faF8aed5b27BF8',
182
+ fromBlock: 15731231n,
183
+ },
184
+ MetaMorphoV1_1Factory: {
185
+ address: '0x01dD876130690469F685a65C2B295A90a81BaD91',
186
+ fromBlock: 15731333n,
187
+ },
188
+ },
189
+ [Chain.SONEIUM]: {
190
+ Morpho: {
191
+ address: '0xE75Fc5eA6e74B824954349Ca351eb4e671ADA53a',
192
+ fromBlock: 6440817n,
193
+ },
194
+ MetaMorphoV1_1Factory: {
195
+ address: '0x7026b436f294e560b3C26E731f5cac5992cA2B33',
196
+ fromBlock: 6440899n,
197
+ },
198
+ },
199
+ [Chain.FLAME]: {
200
+ Morpho: {
201
+ address: '0x63971484590b054b6Abc4FEe9F31BC6F68CfeC04',
202
+ fromBlock: 5991116n,
203
+ },
204
+ MetaMorphoV1_1Factory: {
205
+ address: '0xf2BD176D3A89f6E9f6D0c7F17C4Ae6A3515007a8',
206
+ fromBlock: 5991236n,
207
+ },
208
+ },
209
+ [Chain.BASECAMP]: {
210
+ Morpho: {
211
+ address: '0xc7CAd9B1377Eb8103397Cb07Cb5c4f03eb2eBEa8',
212
+ fromBlock: 4804080n,
213
+ },
214
+ MetaMorphoV1_1Factory: {
215
+ address: '0xa8CD521d42b716821D7ddD2Ca6a237087aA5b487',
216
+ fromBlock: 4804270n,
217
+ },
218
+ },
219
+ [Chain.HYPEREVM]: {
220
+ Morpho: {
221
+ address: '0x68e37dE8d93d3496ae143F2E900490f6280C57cD',
222
+ fromBlock: 1988429n,
223
+ },
224
+ MetaMorphoV1_1Factory: {
225
+ address: '0xec051b19d654C48c357dC974376DeB6272f24e53',
226
+ fromBlock: 1988677n,
227
+ },
228
+ },
229
+ [Chain.KATANA]: {
230
+ Morpho: {
231
+ address: '0xD50F2DffFd62f94Ee4AEd9ca05C61d0753268aBc',
232
+ fromBlock: 2741069n,
233
+ },
234
+ MetaMorphoV1_1Factory: {
235
+ address: '0x1c8De6889acee12257899BFeAa2b7e534de32E16',
236
+ fromBlock: 2741420n,
237
+ },
238
+ },
239
+ [Chain.TAC_MAINNET]: {
240
+ Morpho: {
241
+ address: '0x918B9F2E4B44E20c6423105BB6cCEB71473aD35c',
242
+ fromBlock: 853025n,
243
+ },
244
+ MetaMorphoV1_1Factory: {
245
+ address: '0xcDA78f4979d17Ec93052A84A12001fe0088AD734',
246
+ fromBlock: 978654n,
247
+ },
248
+ },
249
+ }
250
+
251
+ export function getContractDeploymentInfo(
252
+ chainId: number,
253
+ name: OptionalContracts,
254
+ ): DeploymentDetails | undefined
255
+ export function getContractDeploymentInfo(
256
+ chainId: number,
257
+ name: RequiredContracts,
258
+ ): DeploymentDetails
259
+ export function getContractDeploymentInfo(
260
+ chainId: number | undefined,
261
+ name: MorphoContractName,
262
+ ): DeploymentDetails | undefined
263
+ export function getContractDeploymentInfo(
264
+ chainId: number | undefined,
265
+ name: MorphoContractName,
266
+ ) {
267
+ return chainId !== undefined ? DEPLOYMENTS[chainId][name] : undefined
268
+ }
@@ -0,0 +1,64 @@
1
+ import { Chain } from '@1delta/chain-registry'
2
+
3
+ export const MORPHO_MARKETS: { [chain: string]: string[] } = {
4
+ [Chain.HYPEREVM]: [
5
+ '0xf9f0473b23ebeb82c83078f0f0f77f27ac534c9fb227cb4366e6057b6163ffbf',
6
+ '0xb5b215bd2771f5ed73125bf6a02e7b743fadc423dfbb095ad59df047c50d3e81',
7
+ '0x64e7db7f042812d4335947a7cdf6af1093d29478aff5f1ccd93cc67f8aadfddc',
8
+ '0xc0a3063a0a7755b7d58642e9a6d3be1c05bc974665ef7d3b158784348d4e17c5',
9
+ '0x78f6b57d825ef01a5dc496ad1f426a6375c685047d07a30cd07ac5107ffc7976',
10
+ '0xd2e8f6fd195556222d7a0314d4fb93fdf84ae920faaebba6dbcf584ac865e1f5',
11
+ '0xd5c5b5db889eb5d4f4026b9704cddffbc1356732a37c2b543330c10756ae7a18',
12
+ '0xfdece686f16877984325c7a1c192e0f18862bae3829d000a1a62b5bc2b31d4ef',
13
+ '0x076689a210adf3fdaa54e8ed452615ed641ba0d985f95e1376c3df3017d62878',
14
+ '0x0bb2900086fe38fa9633c664e1f955eb8dcf66a81174967e83dee867e083a105',
15
+ '0x0ecf5be1fadf4bec3f79ce196f02a327b507b34d230c0f033f4970b1b510119c',
16
+ '0x15f505f8dda26a523f7490ad0322f3ed4f325a54fd50832bc65e4bd75e3dca54',
17
+ '0x19bbcc95b876740c0765ed1e4bac1979c4aea1b4bfbfee0e61dc1fe76a6887dc',
18
+ '0x19e47d37453628ebf0fd18766ce6fee1b08ea46752a5da83ca0bfecb270d07e8',
19
+ '0x1c6b87ae1b97071ef444eedcba9f5a92cfe974edbbcaa1946644fc7ab0e283af',
20
+ '0x1da89208e6cb5173e97a83461853b8400de4f7c37542cf010a10579a5f7ca451',
21
+ '0x216bd19960f140177a4a3fb9cf258edcbadb1f5d54740fc944503bff4a00e65e',
22
+ '0x2acd218c67daa94dd2f92e81f477ffc9f8507319f0f2d698eae5ed631ae14039',
23
+ '0x2b62c4153d81d5b5a233d1d2b7ef899d3fca4076d458e215ff3a00176b415b0d',
24
+ '0x31aaa663d718e83ea15326ec110c4bcf5e123585d0b6c4d0ad61a50c4aa65b1e',
25
+ '0x33c935bb0699b737d9cbd4274b5936a9004eee03ccfa70e266ff7c1513fd4808',
26
+ '0x5031ac4543f8232df889e5eb24389f8cf9520366f21dc62240017cb3bc6ecc59',
27
+ '0x53bf81793c2cc384c19a3bc9b032467e179a390a9225cd9542742ac10f539cc2',
28
+ '0x5ecb7a25d51c870ec57f810c880e3e20743e56d0524575b7b8934a778aaec1af',
29
+ '0x5ef35fe4418a6bcfcc70fe32efce30074f22e9a782f81d432c1e537ddbda11e2',
30
+ '0x65f2a559764859a559d8c39604cf665942bab7d10dfaa1b82e914c9d351038d4',
31
+ '0x7268244d330f1462f77ded7a14e2f868893e86e76e8b8eaa869405d588aff6ce',
32
+ '0x83bab0d612f592d0f145b2ec82fd730144dfb3d72c8fc838b27555558e49c496',
33
+ '0x8eb8cfe3b1ac8f653608ae09fb099263fa2fe25d4a59305c309937292c2aeee9',
34
+ '0x964e7d1db11bdf32262c71274c297dcdb4710d73acb814f04fdca8b0c7cdf028',
35
+ '0x9e28003bb5c29c1df3552e99b04d656fadf1aedaf81256637dcc51d91cf6c639',
36
+ '0xa24d04c3aff60d49b3475f0084334546cbf66182e788b6bf173e6f9990b2c816',
37
+ '0xa62327642e110efd38ba2d153867a8625c8dc40832e1d211ba4f4151c3de9050',
38
+ '0xa7fe39c692f0192fb2f281a6cc16c8b2e1c8f9b9f2bc418e0c0c1e9374bf4b04',
39
+ '0xb142d65d7c624def0a9f4b49115b83f400a86bd2904d4f3339ec4441e28483ea',
40
+ '0xb5b575e402c7c19def8661069c39464c8bf3297b638e64d841b09a4eb2807de5',
41
+ '0xbc15a1782163f4be46c23ac61f5da50fed96ad40293f86a5ce0501ce4a246b32',
42
+ '0xc5526286d537c890fdd879d17d80c4a22dc7196c1e1fff0dd6c853692a759c62',
43
+ '0xc59a3f8a3918d89ebef44ee1dcda435719f543cfd3f37ead7e74852ea5931581',
44
+ '0xd173e9d80aeacac486b46a9a849ecb386cec260cc7dd5be0db3505a0f9f93fb5',
45
+ '0xdb2cf3ad3ef91c9bb673bf35744e7141bc2950b27a75c8d11b0ead9f6742d927',
46
+ '0xe0ede98b4425285a9c93d51f8ba27d9a09bc0033874e4a883d3f29d41f9f2e4a',
47
+ '0xe41ace68f2de7be8e47185b51ddc23d4a58aac4ce9f8cc5f9384fe26f2104ec8',
48
+ '0xebeabb17bd69d4b8ed6929a821d69478b564f4cc604d0995944c9da8b5cb3f04',
49
+ '0xed00791e29eb08c9bc0d8b389fe1f00084699baf2a785ba2a42e915706b17b82',
50
+ '0xf25db2433ae650155eae04ebd8b3795d19bfcb318d22926a8a5e746e8028e0a8',
51
+ ],
52
+ [Chain.OP_MAINNET]: [
53
+ '0x173b66359f0741b1c7f1963075cd271c739b6dc73b658e108a54ce6febeb279b',
54
+ '0x67840b3ace736fe47ab919ad003e0330da50536f61f9fcb96af80d0f37a57070',
55
+ '0xc7ae57c1998c67a4c21804df606db1309b68a518ba5acc8b1dc3ffcb1b26b071',
56
+ ],
57
+ [Chain.SONEIUM]: [
58
+ '0xc35eda4e57363a5679949be05c65b81c2c274bfcd21173344d99726147236614',
59
+ '0x80a26251892573c16d88f2aabd447bc46d918daa035e1bbaedc9ca315bfb3275',
60
+ '0x87f0a5e65f1cfb879d2d5e7300691332ba227f3babe8fbd4bd2cbca862d8ae5e',
61
+ '0xebaf3dc6fa2fb3f78d18c87adcc37c06fe64874c5b2d69619ef7696088780df9',
62
+ '0x5869019d7ec9f92db2e90c0156b542cda7c0a679c626eac842aa5117a0483d4a',
63
+ ],
64
+ }
@@ -1,4 +1,3 @@
1
- import { formatUnits } from 'viem'
2
1
  import {
3
2
  MorphoGeneralPublicResponse,
4
3
  RewardsMap,
@@ -7,18 +6,7 @@ import {
7
6
  import { apyToApr } from '../user-data/utils'
8
7
  import { AdditionalYields } from '../../types'
9
8
  import { GenericTokenList } from '../types'
10
-
11
- function parseLtv(ltv: number | string) {
12
- let str = 0
13
- try {
14
- str = Number(formatUnits(BigInt(ltv), 18))
15
- } catch (e) {}
16
- return str
17
- }
18
-
19
- function formatNr(n: string, d: number) {
20
- return Number(formatUnits(BigInt(n ?? 0), d))
21
- }
9
+ import { formatNr, parseLtv } from './utils/parsers'
22
10
 
23
11
  export function convertMarketsToMorphoResponse(
24
12
  response: GetMarketsResponse,
@@ -112,7 +100,7 @@ export function convertMarketsToMorphoResponse(
112
100
  ),
113
101
  totalDebtStable: 0,
114
102
  totalDebt: 0,
115
- totalLiquidity: 0,
103
+ totalLiquidity: formatNr(state.collateralAssets, collateralAsset.decimals),
116
104
  totalLiquidityUSD: Number(state.collateralAssetsUsd),
117
105
  totalDepositsUSD: Number(state.collateralAssetsUsd),
118
106
  totalDebtStableUSD: 0,