I wanna get UniswapV2Router02 deployed on Fantom network.
UniswapRouter = await ethers.getContractAt(
"UniswapV2Router02",
"0xf491e7b69e4244ad4002bc14e878a34207e38c29"
);
But I get the following error.
HardhatError: HH700: Artifact for contract "UniswapV2Router02" not found.
Please help me!
Best Answer
ethers.getContractAt is not ether js native method. Instead it is the variant of hardhat-ethers.
You should use ether.js method.
First go to, fantom scan and take the contract abi and save it in router02.json file.
Then require it to the main file with
That is it. You will get contract instance there and you can function as you like.
If you have any doubts regarding .env file. Look at this answer of mine, I explained it clearly here.
Comment if you don't understand anything.