Hello guys,
Not sure if this is the right place to ask but I don't know where else to ask..
I'm desperately looking for Uniswap factory address as I want to create a notification on each new LP and test it out. I found out that I need to have this address, but I was able only to find a Router and the factory address for Base is not mentioned anywhere (only on ETH).
So I tried to use web3.js and get the factory address somehow, unfortunately no luck.
const Web3 = require('web3').default;
const web3 = new Web3('https://mainnet.base.org');
const abi = require('./uniswapV2RouterABI.json').abi;
const router = '0x198EF79F1F515F02dFE9e3115eD9fC07183f02fC'; // Uniswap Router address
const routerContract = new web3.eth.Contract(abi, router);
async function getFactoryAddress() {
try {
let factoryAddress = await routerContract.methods.factory().call();
console.log(factoryAddress);
} catch (error) {
console.error("Error fetching factory address:", error);
}
}
getFactoryAddress();
More information can be found here in the ether stack post here.
https://unpkg.com/@uniswap/v2-periphery@1.1.0-beta.0/build/IUniswapV2Router02.json – uniswapV2RouterABI.json