0
# Chains and Addresses
1
2
Comprehensive blockchain network support with pre-configured contract addresses for Uniswap protocols across multiple chains including Ethereum, Polygon, Arbitrum, Optimism, and more.
3
4
## Capabilities
5
6
### Chain Identification
7
8
Enumeration of supported blockchain networks with their respective chain IDs.
9
10
```typescript { .api }
11
/**
12
* Supported blockchain chain IDs
13
*/
14
enum ChainId {
15
MAINNET = 1,
16
GOERLI = 5,
17
SEPOLIA = 11155111,
18
OPTIMISM = 10,
19
OPTIMISM_GOERLI = 420,
20
OPTIMISM_SEPOLIA = 11155420,
21
ARBITRUM_ONE = 42161,
22
ARBITRUM_GOERLI = 421613,
23
ARBITRUM_SEPOLIA = 421614,
24
POLYGON = 137,
25
POLYGON_MUMBAI = 80001,
26
CELO = 42220,
27
CELO_ALFAJORES = 44787,
28
GNOSIS = 100,
29
MOONBEAM = 1284,
30
BNB = 56,
31
AVALANCHE = 43114,
32
BASE_GOERLI = 84531,
33
BASE_SEPOLIA = 84532,
34
BASE = 8453,
35
ZORA = 7777777,
36
ZORA_SEPOLIA = 999999999,
37
ROOTSTOCK = 30,
38
BLAST = 81457,
39
ZKSYNC = 324,
40
WORLDCHAIN = 480,
41
UNICHAIN_SEPOLIA = 1301,
42
UNICHAIN = 130,
43
MONAD_TESTNET = 10143,
44
SONEIUM = 1868,
45
}
46
47
/**
48
* Array of all supported chain IDs
49
*/
50
const SUPPORTED_CHAINS: readonly ChainId[];
51
52
/**
53
* Type representing any supported chain ID
54
*/
55
type SupportedChainsType = (typeof SUPPORTED_CHAINS)[number];
56
```
57
58
### Native Currency Names
59
60
Names of native currencies for different blockchain networks.
61
62
```typescript { .api }
63
/**
64
* Native currency names matching CLI input format
65
*/
66
enum NativeCurrencyName {
67
ETHER = 'ETH',
68
MATIC = 'MATIC',
69
CELO = 'CELO',
70
GNOSIS = 'XDAI',
71
MOONBEAM = 'GLMR',
72
BNB = 'BNB',
73
AVAX = 'AVAX',
74
ROOTSTOCK = 'RBTC',
75
}
76
```
77
78
### Contract Address Management
79
80
Pre-configured contract addresses for Uniswap protocols across all supported chains.
81
82
```typescript { .api }
83
/**
84
* Mapping of chain IDs to contract addresses
85
*/
86
type AddressMap = { [chainId: number]: string };
87
88
/**
89
* Interface defining all contract addresses for a chain
90
*/
91
type ChainAddresses = {
92
v3CoreFactoryAddress: string;
93
multicallAddress: string;
94
quoterAddress: string;
95
v3MigratorAddress?: string;
96
nonfungiblePositionManagerAddress?: string;
97
tickLensAddress?: string;
98
swapRouter02Address?: string;
99
mixedRouteQuoterV1Address?: string;
100
mixedRouteQuoterV2Address?: string;
101
// v4 addresses
102
v4PoolManagerAddress?: string;
103
v4PositionManagerAddress?: string;
104
v4StateView?: string;
105
v4QuoterAddress?: string;
106
};
107
108
/**
109
* Master mapping of all contract addresses by chain
110
*/
111
const CHAIN_TO_ADDRESSES_MAP: Record<SupportedChainsType, ChainAddresses>;
112
```
113
114
### UNI Token Addresses
115
116
UNI governance token addresses across supported networks.
117
118
```typescript { .api }
119
/**
120
* UNI token contract addresses by chain ID
121
*/
122
const UNI_ADDRESSES: AddressMap;
123
124
/**
125
* NFT airdrop claim contract address
126
*/
127
const UNISWAP_NFT_AIRDROP_CLAIM_ADDRESS: string;
128
```
129
130
### Uniswap V2 Addresses
131
132
Contract addresses for Uniswap V2 protocol.
133
134
```typescript { .api }
135
/**
136
* @deprecated use V2_FACTORY_ADDRESSES instead
137
*/
138
const V2_FACTORY_ADDRESS: string;
139
140
/**
141
* V2 factory contract addresses by chain ID
142
*/
143
const V2_FACTORY_ADDRESSES: AddressMap;
144
145
/**
146
* @deprecated use V2_ROUTER_ADDRESSES instead
147
*/
148
const V2_ROUTER_ADDRESS: string;
149
150
/**
151
* V2 router contract addresses by chain ID
152
*/
153
const V2_ROUTER_ADDRESSES: AddressMap;
154
```
155
156
### Uniswap V3 Addresses
157
158
Contract addresses for Uniswap V3 protocol.
159
160
```typescript { .api }
161
/**
162
* V3 core factory contract addresses by chain ID
163
*/
164
const V3_CORE_FACTORY_ADDRESSES: AddressMap;
165
166
/**
167
* V3 migrator contract addresses by chain ID
168
*/
169
const V3_MIGRATOR_ADDRESSES: AddressMap;
170
171
/**
172
* Quoter contract addresses by chain ID
173
*/
174
const QUOTER_ADDRESSES: AddressMap;
175
176
/**
177
* Nonfungible position manager contract addresses by chain ID
178
*/
179
const NONFUNGIBLE_POSITION_MANAGER_ADDRESSES: AddressMap;
180
181
/**
182
* Tick lens contract addresses by chain ID
183
*/
184
const TICK_LENS_ADDRESSES: AddressMap;
185
186
/**
187
* Mixed route quoter V1 contract addresses by chain ID
188
*/
189
const MIXED_ROUTE_QUOTER_V1_ADDRESSES: AddressMap;
190
```
191
192
### Infrastructure Addresses
193
194
Addresses for governance, multicall, and other infrastructure contracts.
195
196
```typescript { .api }
197
/**
198
* Multicall contract addresses by chain ID
199
*/
200
const MULTICALL_ADDRESSES: AddressMap;
201
202
/**
203
* V0 governance contract addresses
204
*/
205
const GOVERNANCE_ALPHA_V0_ADDRESSES: AddressMap;
206
207
/**
208
* V1 governance contract addresses
209
*/
210
const GOVERNANCE_ALPHA_V1_ADDRESSES: AddressMap;
211
212
/**
213
* Current Bravo governance contract addresses
214
*/
215
const GOVERNANCE_BRAVO_ADDRESSES: AddressMap;
216
217
/**
218
* Timelock contract addresses
219
*/
220
const TIMELOCK_ADDRESSES: AddressMap;
221
222
/**
223
* Merkle distributor contract addresses
224
*/
225
const MERKLE_DISTRIBUTOR_ADDRESS: AddressMap;
226
227
/**
228
* Argent wallet detector contract addresses
229
*/
230
const ARGENT_WALLET_DETECTOR_ADDRESS: AddressMap;
231
232
/**
233
* ENS registrar contract addresses
234
*/
235
const ENS_REGISTRAR_ADDRESSES: AddressMap;
236
237
/**
238
* SOCKS controller contract addresses
239
*/
240
const SOCKS_CONTROLLER_ADDRESSES: AddressMap;
241
```
242
243
### Dynamic Address Resolution
244
245
Functions for retrieving addresses dynamically based on chain ID.
246
247
```typescript { .api }
248
/**
249
* Returns swap router 02 address for the given chain ID
250
* @param chainId - The chain ID to get the address for
251
* @returns The swap router 02 address, or empty string if not supported
252
*/
253
function SWAP_ROUTER_02_ADDRESSES(chainId: number): string;
254
```
255
256
**Usage Examples:**
257
258
```typescript
259
import { ChainId, V3_CORE_FACTORY_ADDRESSES, SWAP_ROUTER_02_ADDRESSES } from "@uniswap/sdk-core";
260
261
// Get V3 factory address for Ethereum mainnet
262
const factoryAddress = V3_CORE_FACTORY_ADDRESSES[ChainId.MAINNET];
263
console.log(factoryAddress); // "0x1F98431c8aD98523631AE4a59f267346ea31F984"
264
265
// Get swap router address dynamically
266
const routerAddress = SWAP_ROUTER_02_ADDRESSES(ChainId.POLYGON);
267
console.log(routerAddress); // Returns router address for Polygon
268
269
// Check if chain is supported
270
if (SUPPORTED_CHAINS.includes(ChainId.ARBITRUM_ONE)) {
271
console.log("Arbitrum One is supported");
272
}
273
```
274
275
### Address Map Construction
276
277
Utility function for creating address maps with the same address across multiple networks.
278
279
```typescript { .api }
280
/**
281
* Creates an address map with the same address across default networks and additional networks
282
* @param address - The contract address to use
283
* @param additionalNetworks - Additional chain IDs to include
284
* @returns Address map with the address across specified networks
285
*/
286
function constructSameAddressMap(
287
address: string,
288
additionalNetworks?: ChainId[]
289
): AddressMap;
290
```