The most obvious way to get the address for a pair is to call getPair on the factory. If the pair exists, this function will return its address, else
- The "canonical" way to determine whether or not a pair exists.
- Requires an on-chain lookup.
|The factory address|
token0must be strictly less than
token1by sort order.
- Can be computed offline.
- Requires the ability to perform
This example makes use of the Uniswap SDK. In reality, the SDK computes pair addresses behind the scenes, obviating the need to compute them manually like this.