Is it possible on the hardhat local mainnet fork to call other contracts originally on the mainnet ?
1 Answer
Yes, it is. The hardhat allows to fork mainnet from a specified block (or a latest one) and thus to interact with all the contracts with their state at that very block. All you need to provide is the provider that supports archive nodes for the mainnet (Infura or Alchemy will do). Here you can find all the relevant info about it.
-
Thanks, I was reading that but I'm not sure where it mentions it. Is it in the impersonator section?– AFDSCommented Jul 13, 2021 at 3:42
-
"You can start an instance of Hardhat Network that forks mainnet. This means that it will simulate having the same state as mainnet, but it will work as a local development network. That way you can interact with deployed protocols and test complex interactions locally." Commented Jul 13, 2021 at 10:11
-
Link only answers are discouraged. Can you include an example or main ideas? Just leave the link for the details.– Ismael ♦Commented Aug 18, 2021 at 14:45