-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfig.ts
More file actions
190 lines (177 loc) · 5.29 KB
/
config.ts
File metadata and controls
190 lines (177 loc) · 5.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
src/config/base-config.ts// Base Network Configuration and Protocol Definitions
// Comprehensive configuration for Base ecosystem DeFi protocols
export interface BaseNetworkConfig {
chainId: number;
name: string;
rpcUrl: string;
wsUrl: string;
blockExplorer: string;
nativeCurrency: {
name: string;
symbol: string;
decimals: number;
};
}
export interface ProtocolConfig {
name: string;
address: string;
abi?: any[];
category: 'DEX' | 'Lending' | 'Yield' | 'Bridge' | 'Derivatives';
tvlEndpoint?: string;
subgraphUrl?: string;
isActive: boolean;
launchDate: string;
}
// Base Network Configuration
export const BASE_CONFIG: BaseNetworkConfig = {
chainId: 8453,
name: 'Base',
rpcUrl: 'https://mainnet.base.org',
wsUrl: 'wss://mainnet.base.org',
blockExplorer: 'https://basescan.org',
nativeCurrency: {
name: 'Ethereum',
symbol: 'ETH',
decimals: 18
}
};
// DEX Protocol Configurations
export const DEX_PROTOCOLS: Record<string, ProtocolConfig> = {
uniswapV3: {
name: 'Uniswap V3',
address: '0x2626664c2603336E57B271c5C0b26F421741e481',
category: 'DEX',
tvlEndpoint: 'https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3-base',
subgraphUrl: 'https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3-base',
isActive: true,
launchDate: '2023-08-09'
},
aerodrome: {
name: 'Aerodrome Finance',
address: '0xcF77a3Ba9A5CA399B7c97c74d54e5b1Beb874E43',
category: 'DEX',
tvlEndpoint: 'https://api.aerodrome.finance/api/v1/pairs',
isActive: true,
launchDate: '2023-08-28'
},
baseswap: {
name: 'BaseSwap',
address: '0x327Df1E6de05895d2ab08513aaDD9313Fe505d86',
category: 'DEX',
tvlEndpoint: 'https://api.baseswap.fi/api/v1/summary',
isActive: true,
launchDate: '2023-08-10'
}
};
// Lending Protocol Configurations
export const LENDING_PROTOCOLS: Record<string, ProtocolConfig> = {
aaveV3: {
name: 'Aave V3',
address: '0xA238Dd80C259a72e81d7e4664a9801593F98d1c5',
category: 'Lending',
tvlEndpoint: 'https://aave-api-v2.aave.com/data/markets-data',
subgraphUrl: 'https://api.thegraph.com/subgraphs/name/aave/protocol-v3-base',
isActive: true,
launchDate: '2023-09-07'
},
compoundV3: {
name: 'Compound V3',
address: '0x9c4ec768c28520B50860ea7a15bd7213a9fF58bf',
category: 'Lending',
tvlEndpoint: 'https://api.compound.finance/api/v2/ctoken',
isActive: true,
launchDate: '2023-08-23'
},
moonwell: {
name: 'Moonwell',
address: '0xfBb21d0380beE3312B33c4353c8936a0F13EF26C',
category: 'Lending',
tvlEndpoint: 'https://api.moonwell.fi/base/governance/proposals',
isActive: true,
launchDate: '2023-10-12'
}
};
// Yield Farming Protocol Configurations
export const YIELD_PROTOCOLS: Record<string, ProtocolConfig> = {
beefy: {
name: 'Beefy Finance',
address: '0x0000000000000000000000000000000000000000',
category: 'Yield',
tvlEndpoint: 'https://api.beefy.finance/vaults/base',
isActive: true,
launchDate: '2023-08-15'
},
yearn: {
name: 'Yearn Finance',
address: '0x0000000000000000000000000000000000000000',
category: 'Yield',
tvlEndpoint: 'https://api.yearn.finance/v1/chains/8453/vaults/all',
isActive: true,
launchDate: '2023-09-20'
}
};
// Bridge Protocol Configurations
export const BRIDGE_PROTOCOLS: Record<string, ProtocolConfig> = {
baseBridge: {
name: 'Base Bridge',
address: '0x4200000000000000000000000000000000000010',
category: 'Bridge',
tvlEndpoint: 'https://api.base.org/api/v1/bridge/stats',
isActive: true,
launchDate: '2023-07-13'
}
};
// Utility Functions
export const getAllProtocols = (): Record<string, ProtocolConfig> => {
return {
...DEX_PROTOCOLS,
...LENDING_PROTOCOLS,
...YIELD_PROTOCOLS,
...BRIDGE_PROTOCOLS
};
};
export const getProtocolsByCategory = (category: ProtocolConfig['category']): Record<string, ProtocolConfig> => {
const allProtocols = getAllProtocols();
return Object.entries(allProtocols)
.filter(([_, protocol]) => protocol.category === category)
.reduce((acc, [key, protocol]) => {
acc[key] = protocol;
return acc;
}, {} as Record<string, ProtocolConfig>);
};
export const getActiveProtocols = (): Record<string, ProtocolConfig> => {
const allProtocols = getAllProtocols();
return Object.entries(allProtocols)
.filter(([_, protocol]) => protocol.isActive)
.reduce((acc, [key, protocol]) => {
acc[key] = protocol;
return acc;
}, {} as Record<string, ProtocolConfig>);
};
export const getProtocolByAddress = (address: string): ProtocolConfig | undefined => {
const allProtocols = getAllProtocols();
return Object.values(allProtocols).find(protocol =>
protocol.address.toLowerCase() === address.toLowerCase()
);
};
// API Configuration
export const API_CONFIG = {
endpoints: {
defiLlama: 'https://api.llama.fi',
coinGecko: 'https://api.coingecko.com/api/v3',
theGraph: 'https://api.thegraph.com/subgraphs/name',
alchemy: 'https://base-mainnet.g.alchemy.com/v2'
},
refreshIntervals: {
tvl: 30000, // 30 seconds
prices: 10000, // 10 seconds
yields: 60000, // 1 minute
transactions: 5000 // 5 seconds
}
};
// Export default configuration
export default {
network: BASE_CONFIG,
protocols: getAllProtocols(),
api: API_CONFIG
};