Constants
V2 SDK constants including factory addresses and init code hash.
Import
import {
FACTORY_ADDRESS,
FACTORY_ADDRESS_MAP,
INIT_CODE_HASH,
MINIMUM_LIQUIDITY,
} from '@uniswap/v2-sdk-next'Factory Addresses
FACTORY_ADDRESS
The default V2 factory address (Ethereum mainnet).
const FACTORY_ADDRESS = '0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f'Deprecated: Use
FACTORY_ADDRESS_MAPinstead.
FACTORY_ADDRESS_MAP
Factory addresses by chain ID.
import { FACTORY_ADDRESS_MAP } from '@uniswap/v2-sdk-next'
import { ChainId } from '@uniswap/sdk-core-next'
const mainnetFactory = FACTORY_ADDRESS_MAP[ChainId.MAINNET]
// '0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f'
const baseFactory = FACTORY_ADDRESS_MAP[ChainId.BASE]
// '0x8909dc15e40173ff4699343b6eb8132c65e18ec6'Init Code Hash
INIT_CODE_HASH
The keccak256 hash of the pair bytecode, used for computing pair addresses.
const INIT_CODE_HASH = '0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f'Used in CREATE2 address computation:
import { computePairAddress } from '@uniswap/v2-sdk-next'
const pairAddress = computePairAddress({
factoryAddress: FACTORY_ADDRESS,
tokenA,
tokenB,
})
// Uses INIT_CODE_HASH internallyLiquidity Constants
MINIMUM_LIQUIDITY
The minimum liquidity locked in every pair (burned on first mint).
const MINIMUM_LIQUIDITY = 1000nWhen a pair is first created, 1000 units of liquidity are permanently locked to prevent division by zero attacks.
Supported Chains
V2 is deployed on:
| Chain | Factory Address |
|---|---|
| Ethereum | 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f |
| Optimism | 0x0c3c1c532F1e39EdF36BE9Fe0bE1410313E074Bf |
| Arbitrum | 0xf1D7CC64Fb4452F05c498126312eBE29f30Fbcf9 |
| Polygon | 0x9e5A52f57b3038F1B8EeE45F28b3C1967e22799C |
| Base | 0x8909dc15e40173ff4699343b6eb8132c65e18ec6 |
| BNB Chain | 0x8909Dc15e40173Ff4699343b6eB8132c65e18eC6 |
| Avalanche | 0x9e5A52f57b3038F1B8EeE45F28b3C1967e22799C |
| Blast | 0x5C346464d33F90bABaf70dB6388507CC889C1070 |
| Celo | 0x79a530c8e2fA8748B7B40dd3629C0520c2cCf03f |