|
1 | 1 | import { request } from "graphql-request"; |
2 | | -import { BaseAdapterChainConfig, FetchOptions, FetchV2, SimpleAdapter } from "../../adapters/types"; |
| 2 | +import { FetchOptions, FetchV2, SimpleAdapter } from "../../adapters/types"; |
3 | 3 | import { CHAIN } from "../../helpers/chains"; |
4 | 4 | import { METRIC } from "../../helpers/metrics"; |
5 | | -import { getConfig } from "../../helpers/cache"; |
6 | 5 |
|
7 | | -const MorphoBlues = { |
| 6 | +interface MorphoBlueConfig { |
| 7 | + chainId?: number; |
| 8 | + blue: string; |
| 9 | + start: string; |
| 10 | + fromBlock?: number; |
| 11 | +} |
| 12 | + |
| 13 | +const MorphoBlues: Record<string, MorphoBlueConfig> = { |
8 | 14 | [CHAIN.ETHEREUM]: { |
9 | 15 | chainId: 1, |
10 | 16 | blue: "0xbbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb", |
11 | 17 | start: "2024-01-02", |
12 | 18 | }, |
13 | | - // [CHAIN.BASE]: { |
14 | | - // chainId: 8453, |
15 | | - // blue: "0xbbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb", |
16 | | - // start: "2024-05-03", |
17 | | - // }, |
18 | | - // [CHAIN.POLYGON]: { |
19 | | - // chainId: 137, |
20 | | - // blue: "0x1bF0c2541F820E775182832f06c0B7Fc27A25f67", |
21 | | - // start: "2025-01-20", |
22 | | - // }, |
23 | | - // [CHAIN.UNICHAIN]: { |
24 | | - // chainId: 130, |
25 | | - // blue: "0x8f5ae9cddb9f68de460c77730b018ae7e04a140a", |
26 | | - // start: "2025-02-18", |
27 | | - // }, |
28 | | - // [CHAIN.KATANA]: { |
29 | | - // chainId: 747474, |
30 | | - // blue: "0xD50F2DffFd62f94Ee4AEd9ca05C61d0753268aBc", |
31 | | - // start: "2025-07-01", |
32 | | - // }, |
33 | | - // [CHAIN.ARBITRUM]: { |
34 | | - // chainId: 42161, |
35 | | - // blue: "0x6c247b1F6182318877311737BaC0844bAa518F5e", |
36 | | - // start: "2025-01-18", |
37 | | - // }, |
38 | | - // [CHAIN.FRAXTAL]: { |
39 | | - // fromBlock: 15317931, |
40 | | - // blue: "0xa6030627d724bA78a59aCf43Be7550b4C5a0653b", |
41 | | - // start: "2025-01-22", |
42 | | - // }, |
43 | | - // [CHAIN.INK]: { |
44 | | - // fromBlock: 4078776, |
45 | | - // blue: "0x857f3EefE8cbda3Bc49367C996cd664A880d3042", |
46 | | - // start: "2025-01-25", |
47 | | - // }, |
48 | | - // [CHAIN.OPTIMISM]: { |
49 | | - // fromBlock: 130770075, |
50 | | - // blue: "0xce95AfbB8EA029495c66020883F87aaE8864AF92", |
51 | | - // start: "2025-01-18", |
52 | | - // }, |
53 | | - // [CHAIN.SCROLL]: { |
54 | | - // fromBlock: 12842868, |
55 | | - // blue: "0x2d012EdbAdc37eDc2BC62791B666f9193FDF5a55", |
56 | | - // start: "2025-01-22", |
57 | | - // }, |
58 | | - // [CHAIN.WC]: { |
59 | | - // fromBlock: 12842868, |
60 | | - // blue: "0xE741BC7c34758b4caE05062794E8Ae24978AF432", |
61 | | - // start: "2025-01-22", |
62 | | - // }, |
63 | | - // [CHAIN.MODE]: { |
64 | | - // fromBlock: 19983370, |
65 | | - // blue: "0xd85cE6BD68487E0AaFb0858FDE1Cd18c76840564", |
66 | | - // start: "2025-02-22", |
67 | | - // }, |
68 | | - // [CHAIN.CORN]: { |
69 | | - // fromBlock: 251401, |
70 | | - // blue: "0xc2B1E031540e3F3271C5F3819F0cC7479a8DdD90", |
71 | | - // start: "2025-02-22", |
72 | | - // }, |
73 | | - // [CHAIN.HEMI]: { |
74 | | - // fromBlock: 1188872, |
75 | | - // blue: "0xa4Ca2c2e25b97DA19879201bA49422bc6f181f42", |
76 | | - // start: "2025-02-22", |
77 | | - // }, |
78 | | - // [CHAIN.SONIC]: { |
79 | | - // fromBlock: 9100931, |
80 | | - // blue: "0xd6c916eB7542D0Ad3f18AEd0FCBD50C582cfa95f", |
81 | | - // start: "2025-02-22", |
82 | | - // }, |
83 | | - // [CHAIN.HYPERLIQUID]: { |
84 | | - // fromBlock: 1988429, |
85 | | - // blue: "0x68e37dE8d93d3496ae143F2E900490f6280C57cD", |
86 | | - // start: "2025-04-04", |
87 | | - // }, |
88 | | - // [CHAIN.SONEIUM]: { |
89 | | - // fromBlock: 6440817, |
90 | | - // blue: "0xE75Fc5eA6e74B824954349Ca351eb4e671ADA53a", |
91 | | - // start: "2025-05-01", |
92 | | - // }, |
93 | | - // [CHAIN.TAC]: { |
94 | | - // fromBlock: 853025, |
95 | | - // blue: "0x918B9F2E4B44E20c6423105BB6cCEB71473aD35c", |
96 | | - // start: "2025-06-25", |
97 | | - // }, |
98 | | - // [CHAIN.ZIRCUIT]: { |
99 | | - // fromBlock: 14640172, |
100 | | - // blue: "0xA902A365Fe10B4a94339B5A2Dc64F60c1486a5c8", |
101 | | - // start: "2025-06-07", |
102 | | - // }, |
| 19 | + [CHAIN.BASE]: { |
| 20 | + chainId: 8453, |
| 21 | + blue: "0xbbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb", |
| 22 | + start: "2024-05-03", |
| 23 | + }, |
| 24 | + [CHAIN.POLYGON]: { |
| 25 | + chainId: 137, |
| 26 | + blue: "0x1bF0c2541F820E775182832f06c0B7Fc27A25f67", |
| 27 | + start: "2025-01-20", |
| 28 | + }, |
| 29 | + [CHAIN.UNICHAIN]: { |
| 30 | + chainId: 130, |
| 31 | + blue: "0x8f5ae9cddb9f68de460c77730b018ae7e04a140a", |
| 32 | + start: "2025-02-18", |
| 33 | + }, |
| 34 | + [CHAIN.KATANA]: { |
| 35 | + chainId: 747474, |
| 36 | + blue: "0xD50F2DffFd62f94Ee4AEd9ca05C61d0753268aBc", |
| 37 | + start: "2025-07-01", |
| 38 | + }, |
| 39 | + [CHAIN.ARBITRUM]: { |
| 40 | + chainId: 42161, |
| 41 | + blue: "0x6c247b1F6182318877311737BaC0844bAa518F5e", |
| 42 | + start: "2025-01-18", |
| 43 | + }, |
| 44 | + [CHAIN.FRAXTAL]: { |
| 45 | + fromBlock: 15317931, |
| 46 | + blue: "0xa6030627d724bA78a59aCf43Be7550b4C5a0653b", |
| 47 | + start: "2025-01-22", |
| 48 | + }, |
| 49 | + [CHAIN.INK]: { |
| 50 | + fromBlock: 4078776, |
| 51 | + blue: "0x857f3EefE8cbda3Bc49367C996cd664A880d3042", |
| 52 | + start: "2025-01-25", |
| 53 | + }, |
| 54 | + [CHAIN.OPTIMISM]: { |
| 55 | + fromBlock: 130770075, |
| 56 | + blue: "0xce95AfbB8EA029495c66020883F87aaE8864AF92", |
| 57 | + start: "2025-01-18", |
| 58 | + }, |
| 59 | + [CHAIN.SCROLL]: { |
| 60 | + fromBlock: 12842868, |
| 61 | + blue: "0x2d012EdbAdc37eDc2BC62791B666f9193FDF5a55", |
| 62 | + start: "2025-01-22", |
| 63 | + }, |
| 64 | + [CHAIN.WC]: { |
| 65 | + fromBlock: 12842868, |
| 66 | + blue: "0xE741BC7c34758b4caE05062794E8Ae24978AF432", |
| 67 | + start: "2025-01-22", |
| 68 | + }, |
| 69 | + [CHAIN.MODE]: { |
| 70 | + fromBlock: 19983370, |
| 71 | + blue: "0xd85cE6BD68487E0AaFb0858FDE1Cd18c76840564", |
| 72 | + start: "2025-02-22", |
| 73 | + }, |
| 74 | + [CHAIN.CORN]: { |
| 75 | + fromBlock: 251401, |
| 76 | + blue: "0xc2B1E031540e3F3271C5F3819F0cC7479a8DdD90", |
| 77 | + start: "2025-02-22", |
| 78 | + }, |
| 79 | + [CHAIN.HEMI]: { |
| 80 | + fromBlock: 1188872, |
| 81 | + blue: "0xa4Ca2c2e25b97DA19879201bA49422bc6f181f42", |
| 82 | + start: "2025-02-22", |
| 83 | + }, |
| 84 | + [CHAIN.SONIC]: { |
| 85 | + fromBlock: 9100931, |
| 86 | + blue: "0xd6c916eB7542D0Ad3f18AEd0FCBD50C582cfa95f", |
| 87 | + start: "2025-02-22", |
| 88 | + }, |
| 89 | + [CHAIN.HYPERLIQUID]: { |
| 90 | + fromBlock: 1988429, |
| 91 | + blue: "0x68e37dE8d93d3496ae143F2E900490f6280C57cD", |
| 92 | + start: "2025-04-04", |
| 93 | + }, |
| 94 | + [CHAIN.SONEIUM]: { |
| 95 | + fromBlock: 6440817, |
| 96 | + blue: "0xE75Fc5eA6e74B824954349Ca351eb4e671ADA53a", |
| 97 | + start: "2025-05-01", |
| 98 | + }, |
| 99 | + [CHAIN.TAC]: { |
| 100 | + fromBlock: 853025, |
| 101 | + blue: "0x918B9F2E4B44E20c6423105BB6cCEB71473aD35c", |
| 102 | + start: "2025-06-25", |
| 103 | + }, |
| 104 | + [CHAIN.ZIRCUIT]: { |
| 105 | + fromBlock: 14640172, |
| 106 | + blue: "0xA902A365Fe10B4a94339B5A2Dc64F60c1486a5c8", |
| 107 | + start: "2025-06-07", |
| 108 | + }, |
103 | 109 | }; |
104 | 110 |
|
105 | 111 | const info = { |
@@ -241,7 +247,7 @@ const fetchEvents = async ( |
241 | 247 | let markets: Array<MorphoMarket> = [] |
242 | 248 | if (MorphoBlues[options.chain].chainId) { |
243 | 249 | markets = await fetchMarketsFromSubgraph( |
244 | | - MorphoBlues[options.chain].chainId, |
| 250 | + Number(MorphoBlues[options.chain].chainId), |
245 | 251 | BLUE_API_ENDPOINT |
246 | 252 | ); |
247 | 253 | } else if (MorphoBlues[options.chain].fromBlock) { |
@@ -319,7 +325,7 @@ const adapter: SimpleAdapter = { |
319 | 325 | }; |
320 | 326 |
|
321 | 327 | for (const [chain, blueConfig] of Object.entries(MorphoBlues)) { |
322 | | - (adapter.adapter as BaseAdapterChainConfig)[chain] = { |
| 328 | + (adapter.adapter as any)[chain] = { |
323 | 329 | fetch, |
324 | 330 | start: blueConfig.start, |
325 | 331 | } |
|
0 commit comments