Last active
April 10, 2022 00:42
-
-
Save j2abro/9e640b0026ec69646f90e6f49558c7dd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import IUniswapV2Factory from "@uniswap/v2-core/build/IUniswapV2Factory.json" assert {type: "json"}; | |
import { ethers } from 'ethers'; | |
const provider = new ethers.providers.InfuraProvider("homestead", INFURA_KEY); | |
const UniswapV2FactoryAddress = '0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f'; | |
(async () => { | |
const factory = new ethers.Contract( UniswapV2FactoryAddress , IUniswapV2Factory.abi , provider ) | |
let numPairs = await factory.allPairsLength(); | |
console.log('Number of Uniswap V2 Trading Pairs:', numPairs.toString()); | |
}) (); | |
//Prints --> Number of Uniswap V2 Trading Pairs: 69636 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment