Hello,
When I call following getPair under uniswapFactory contract I created via ethers.Contract it doesn´t return any pair address.
const UniswapV2Factory = require("./build/contracts/IUniswapV2Factory.json");
uniswapFactory = new ethers.Contract(
'0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f', // uniswap v2 factory address in Etherscan mainnet
UniswapV2Factory.abi, wallet
);
const pairAddress = await uniswapFactory.getPair(wethAddress, otherAddress);
const pair = new Contract(pairAddress, UniswapV2Pair.abi, wallet);
console.log("yeah2!");
Strange thing is if I removed await
keywork it returns Promise { }.
However, if I run await uniswapFactory.getPair(wethAddress, otherAddress);
directly under Truffle console it resolves the pair address correctly.
Any suggestions would be greatly appreciated as it´s been bugging me also for a very long time.
Thank you